Browse Source

更新版本

FoShanPG
Administrator 2 years ago
parent
commit
fea27ebdd5
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  2. 397
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  3. 6
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

@ -60,6 +60,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<ErrorBill> GetErrorBillList()
{
return DbConnection.Query<ErrorBill>("select [Id],[BillNum],[MaterialCode],[WmsBillNum],[MaterialDesc],[CustomerMaterialCode] from set_ErrorBill ").ToList();
}

397
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -161,214 +161,209 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<UnSettleDetailReport1> GetDiffReport1(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{
string str = " ";
if (!string.IsNullOrEmpty(begin))
{
str += string.Format(" and beginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
str += string.Format(" and beginTime<='{0}' ", end);
}
var sqlString =
"SELECT\n" +
"2 WMSState,\n" +
"temp1.WMSBillNum,\n" +
"temp1.UnSettleVersion\t\t ,\n" +
"temp1.CP5Time\t\t\t\t ,\n" +
"temp1.MaterialCode\t\t\t ,\n" +
"temp1.ChassisNumber\t\t\t ,\n" +
"temp1.KENNCode\t\t\t\t ,\n" +
"temp1.chassisNumber2\t\t ,\n" +
"temp1.KENNCode2\t\t\t\t ,\n" +
"temp1.QTY\t\t\t\t\t ,\n" +
"temp1.ParentSapMaterialCode\t ,\n" +
"temp1.FLAG\t\t\t\t\t ,\n" +
"temp1.UnSettleQty\t\t\t ,\n" +
"temp1.MaterialGroup\t\t\t ,\n" +
"temp1.MaterialDesc\t\t\t ,\n" +
"temp1.ParentMaterialDesc\t ,\n" +
"temp1.SapMaterialCode\t\t ,\n" +
"temp2.Price,\n" +
"ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT,\n" +
"Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT,\n" +
"temp1.DiffQty\n"+
"FROM\n" +
"(\n" +
"SELECT\n" +
"A.*,\n" +
"Isnull(F.Qty, 0) UnSettleQty,\n" +
"B.EstimateTypeDesc MaterialGroup,\n" +
"B.MaterialDesc MaterialDesc,\n" +
"d.MaterialDesc ParentMaterialDesc,\n" +
"B.MaterialCode SapMaterialCode,\n" +
"A.Qty-Isnull(F.Qty,\n" +
"0) DiffQty\n" +
"FROM\n" +
"(\n" +
"select\n" +
"\n" +
"MaterialCode,\n" +
"ChassisNumber,\n" +
"KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode2,\n" +
"flag,\n" +
"\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + ErpMaterialCode\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS ParentSapMaterialCode,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + WMSBillNum\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS WMSBillNum,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + CONVERT(VARCHAR(10),CP5Time,120)\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS CP5Time,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + UnSettleVersion\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS UnSettleVersion,\n" +
"sum(qty) qty\n" +
"from\n" +
"\n" +
"(\n" +
"SELECT\n" +
"WMSState,\n" +
"WMSBillNum,\n" +
"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" +
"QTY,\n" +
"ErpMaterialCode ,\n" +
"'' FLAG\n" +
"FROM\n" +
"Set_fis\n" +
"where\n" +
"1 = 1\n" +
"AND STATE = 0 {0}\n" +
"UNION ALL\n" +
"SELECT\n" +
"\n" +
"WMSState,\n" +
"WMSBillNum,\n" +
"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" +
"QTY,\n" +
"ErpMaterialCode ,\n" +
"'L' FLAG\n" +
"FROM\n" +
"Set_fis\n" +
"WHERE\n" +
"1 = 1\n" +
"AND STATE = 4 {0}\n" +
")\n" +
"tm1\n" +
"GROUP BY\n" +
"MaterialCode,\n" +
"KENNCode2,\n" +
"ChassisNumber2,\n" +
"KENNCode,\n" +
"ChassisNumber,\n" +
"FLAG\n" +
") A\n" +
"left join (\n" +
"select\n" +
"*\n" +
"from\n" +
"Set_Unsettle\n" +
"where\n" +
"version = '{1}') f\n" +
"on\n" +
"a.MaterialCode = f.MaterialCode\n" +
"and a.KENNCode2 = f.KENNCode\n" +
"and a.ChassisNumber2 = f.ChassisNumber\n" +
"LEFT JOIN Set_material B ON\n" +
"a.MaterialCode = b.CustomerPartCode\n" +
"LEFT JOIN (\n" +
"select\n" +
"max(Id) Id,\n" +
"MaterialCode,\n" +
"MaterialDesc\n" +
"from\n" +
"Set_material\n" +
"group by\n" +
"MaterialCode,\n" +
"MaterialDesc) d ON\n" +
"Substring(a.ParentSapMaterialCode,1,8) = d.MaterialCode\n" +
") temp1\n" +
"LEFT JOIN (\n" +
"SELECT\n" +
"Price,\n" +
"MaterialCode\n" +
"FROM\n" +
"Set_PriceList\n" +
"WHERE\n" +
"version = (\n" +
"SELECT\n" +
"Max(Version)\n" +
"FROM\n" +
"Set_PriceList ) ) temp2 ON\n" +
"temp1.SapMaterialCode = temp2.MaterialCode\n";
// string str = " ";
// if (!string.IsNullOrEmpty(begin))
// {
// str += string.Format(" and beginTime>='{0}' ", begin);
// }
// if (!string.IsNullOrEmpty(end))
// {
// str += string.Format(" and beginTime<='{0}' ", end);
// }
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
// var sqlString =
//"SELECT\n" +
//"2 WMSState,\n" +
//"temp1.WMSBillNum,\n" +
//"temp1.UnSettleVersion\t\t ,\n" +
//"temp1.CP5Time\t\t\t\t ,\n" +
//"temp1.MaterialCode\t\t\t ,\n" +
//"temp1.ChassisNumber\t\t\t ,\n" +
//"temp1.KENNCode\t\t\t\t ,\n" +
//"temp1.chassisNumber2\t\t ,\n" +
//"temp1.KENNCode2\t\t\t\t ,\n" +
//"temp1.QTY\t\t\t\t\t ,\n" +
//"temp1.ParentSapMaterialCode\t ,\n" +
//"temp1.FLAG\t\t\t\t\t ,\n" +
//"temp1.UnSettleQty\t\t\t ,\n" +
//"temp1.MaterialGroup\t\t\t ,\n" +
//"temp1.MaterialDesc\t\t\t ,\n" +
//"temp1.ParentMaterialDesc\t ,\n" +
//"temp1.SapMaterialCode\t\t ,\n" +
//"temp2.Price,\n" +
//"ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT,\n" +
//"Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT,\n" +
//"temp1.DiffQty\n"+
string _sql = string.Format(sqlString, str, version);
;
var _query = DbConnection.Query<UnSettleDetailReport1 > (_sql, null, null, true, 1200, null); ;
//"FROM\n" +
//"(\n" +
//"SELECT\n" +
//"A.*,\n" +
//"Isnull(F.Qty, 0) UnSettleQty,\n" +
//"B.EstimateTypeDesc MaterialGroup,\n" +
//"B.MaterialDesc MaterialDesc,\n" +
//"d.MaterialDesc ParentMaterialDesc,\n" +
//"B.MaterialCode SapMaterialCode,\n" +
//"A.Qty-Isnull(F.Qty,\n" +
//"0) DiffQty\n" +
//"FROM\n" +
//"(\n" +
//"select\n" +
//"\n" +
//"MaterialCode,\n" +
//"ChassisNumber,\n" +
//"KENNCode,\n" +
//"ChassisNumber2,\n" +
//"KENNCode2,\n" +
//"flag,\n" +
//"\n" +
//"STUFF((\n" +
//"SELECT\n" +
//"',' + ErpMaterialCode\n" +
//"FROM\n" +
//"Set_fis subTitle\n" +
//"WHERE\n" +
//"KENNCode = tm1.KENNCode2\n" +
//"and ChassisNumber2 = tm1.ChassisNumber2\n" +
//"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
//"1,\n" +
//"1,\n" +
//"'') AS ParentSapMaterialCode,\n" +
//"STUFF((\n" +
//"SELECT\n" +
//"',' + WMSBillNum\n" +
//"FROM\n" +
//"Set_fis subTitle\n" +
//"WHERE\n" +
//"KENNCode = tm1.KENNCode2\n" +
//"and ChassisNumber2 = tm1.ChassisNumber2\n" +
//"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
//"1,\n" +
//"1,\n" +
//"'') AS WMSBillNum,\n" +
//"STUFF((\n" +
//"SELECT\n" +
//"',' + CONVERT(VARCHAR(10),CP5Time,120)\n" +
//"FROM\n" +
//"Set_fis subTitle\n" +
//"WHERE\n" +
//"KENNCode = tm1.KENNCode2\n" +
//"and ChassisNumber2 = tm1.ChassisNumber2\n" +
//"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
//"1,\n" +
//"1,\n" +
//"'') AS CP5Time,\n" +
//"STUFF((\n" +
//"SELECT\n" +
//"',' + UnSettleVersion\n" +
//"FROM\n" +
//"Set_fis subTitle\n" +
//"WHERE\n" +
//"KENNCode = tm1.KENNCode2\n" +
//"and ChassisNumber2 = tm1.ChassisNumber2\n" +
//"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
//"1,\n" +
//"1,\n" +
//"'') AS UnSettleVersion,\n" +
//"sum(qty) qty\n" +
//"from\n" +
//"\n" +
//"(\n" +
//"SELECT\n" +
//"WMSState,\n" +
//"WMSBillNum,\n" +
//"UnSettleVersion,\n" +
//"BeginTime CP5Time,\n" +
//"ItemCode MaterialCode,\n" +
//"ChassisNumber,\n" +
//"OrderBillNum KENNCode,\n" +
//"ChassisNumber2,\n" +
//"KENNCode KENNCode2,\n" +
//"QTY,\n" +
//"ErpMaterialCode ,\n" +
//"'' FLAG\n" +
//"FROM\n" +
//"Set_fis\n" +
//"where\n" +
//"1 = 1\n" +
//"AND STATE = 0 {0}\n" +
//"UNION ALL\n" +
//"SELECT\n" +
//"\n" +
//"WMSState,\n" +
//"WMSBillNum,\n" +
//"UnSettleVersion,\n" +
//"BeginTime CP5Time,\n" +
//"ItemCode MaterialCode,\n" +
//"ChassisNumber,\n" +
//"OrderBillNum KENNCode,\n" +
//"ChassisNumber2,\n" +
//"KENNCode KENNCode2,\n" +
//"QTY,\n" +
//"ErpMaterialCode ,\n" +
//"'L' FLAG\n" +
//"FROM\n" +
//"Set_fis\n" +
//"WHERE\n" +
//"1 = 1\n" +
//"AND STATE = 4 {0}\n" +
//")\n" +
//"tm1\n" +
//"GROUP BY\n" +
//"MaterialCode,\n" +
//"KENNCode2,\n" +
//"ChassisNumber2,\n" +
//"KENNCode,\n" +
//"ChassisNumber,\n" +
//"FLAG\n" +
//") A\n" +
//"left join (\n" +
//"select\n" +
//"*\n" +
//"from\n" +
//"Set_Unsettle\n" +
//"where\n" +
//"version = '{1}') f\n" +
//"on\n" +
//"a.MaterialCode = f.MaterialCode\n" +
//"and a.KENNCode2 = f.KENNCode\n" +
//"and a.ChassisNumber2 = f.ChassisNumber\n" +
//"LEFT JOIN Set_material B ON\n" +
//"a.MaterialCode = b.CustomerPartCode\n" +
//"LEFT JOIN (\n" +
//"select\n" +
//"max(Id) Id,\n" +
//"MaterialCode,\n" +
//"MaterialDesc\n" +
//"from\n" +
//"Set_material\n" +
//"group by\n" +
//"MaterialCode,\n" +
//"MaterialDesc) d ON\n" +
//"Substring(a.ParentSapMaterialCode,1,8) = d.MaterialCode\n" +
//") temp1\n" +
//"LEFT JOIN (\n" +
//"SELECT\n" +
//"Price,\n" +
//"MaterialCode\n" +
//"FROM\n" +
//"Set_PriceList\n" +
//"WHERE\n" +
//"version = (\n" +
//"SELECT\n" +
//"Max(Version)\n" +
//"FROM\n" +
//"Set_PriceList ) ) temp2 ON\n" +
//"temp1.SapMaterialCode = temp2.MaterialCode\n";
string _sql= string.Format("exec [dbo].[p_SystemR3Diff] '{0}','{1}'",string.IsNullOrEmpty(end)?DateTime.Now.ToShortDateString():end
, version);
var _query = DbConnection.Query<UnSettleDetailReport1>(_sql, null, null, true, 1200,System.Data.CommandType.Text);
var _list = _query.ToList();
//_list= _list.Where(p => p.SapMaterialCode == sapCode).ToList();

6
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -60,16 +60,16 @@ namespace SettleAccount.Job.Services
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
var _checkList = _errorListRepository.ToList();
var _checkList = _erpdapperRepository.GetErrorBillList();
var query = from itm in _ls
var q = from itm in _ls
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_ls = query.ToList();
_ls = q.ToList();

Loading…
Cancel
Save