Browse Source

更新版本

FoShanPG
Administrator 2 years ago
parent
commit
fea27ebdd5
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  2. 407
      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() public virtual List<ErrorBill> GetErrorBillList()
{ {
return DbConnection.Query<ErrorBill>("select [Id],[BillNum],[MaterialCode],[WmsBillNum],[MaterialDesc],[CustomerMaterialCode] from set_ErrorBill ").ToList(); return DbConnection.Query<ErrorBill>("select [Id],[BillNum],[MaterialCode],[WmsBillNum],[MaterialDesc],[CustomerMaterialCode] from set_ErrorBill ").ToList();
} }

407
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) public virtual List<UnSettleDetailReport1> GetDiffReport1(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{ {
string str = " "; // string str = " ";
if (!string.IsNullOrEmpty(begin)) // if (!string.IsNullOrEmpty(begin))
{ // {
str += string.Format(" and beginTime>='{0}' ", begin); // str += string.Format(" and beginTime>='{0}' ", begin);
} // }
if (!string.IsNullOrEmpty(end)) // if (!string.IsNullOrEmpty(end))
{ // {
str += string.Format(" and beginTime<='{0}' ", end); // str += string.Format(" and beginTime<='{0}' ", end);
} // }
var sqlString = // var sqlString =
"SELECT\n" + //"SELECT\n" +
"2 WMSState,\n" + //"2 WMSState,\n" +
"temp1.WMSBillNum,\n" + //"temp1.WMSBillNum,\n" +
"temp1.UnSettleVersion\t\t ,\n" + //"temp1.UnSettleVersion\t\t ,\n" +
"temp1.CP5Time\t\t\t\t ,\n" + //"temp1.CP5Time\t\t\t\t ,\n" +
"temp1.MaterialCode\t\t\t ,\n" + //"temp1.MaterialCode\t\t\t ,\n" +
"temp1.ChassisNumber\t\t\t ,\n" + //"temp1.ChassisNumber\t\t\t ,\n" +
"temp1.KENNCode\t\t\t\t ,\n" + //"temp1.KENNCode\t\t\t\t ,\n" +
"temp1.chassisNumber2\t\t ,\n" + //"temp1.chassisNumber2\t\t ,\n" +
"temp1.KENNCode2\t\t\t\t ,\n" + //"temp1.KENNCode2\t\t\t\t ,\n" +
"temp1.QTY\t\t\t\t\t ,\n" + //"temp1.QTY\t\t\t\t\t ,\n" +
"temp1.ParentSapMaterialCode\t ,\n" + //"temp1.ParentSapMaterialCode\t ,\n" +
"temp1.FLAG\t\t\t\t\t ,\n" + //"temp1.FLAG\t\t\t\t\t ,\n" +
"temp1.UnSettleQty\t\t\t ,\n" + //"temp1.UnSettleQty\t\t\t ,\n" +
"temp1.MaterialGroup\t\t\t ,\n" + //"temp1.MaterialGroup\t\t\t ,\n" +
"temp1.MaterialDesc\t\t\t ,\n" + //"temp1.MaterialDesc\t\t\t ,\n" +
"temp1.ParentMaterialDesc\t ,\n" + //"temp1.ParentMaterialDesc\t ,\n" +
"temp1.SapMaterialCode\t\t ,\n" + //"temp1.SapMaterialCode\t\t ,\n" +
"temp2.Price,\n" + //"temp2.Price,\n" +
"ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT,\n" + //"ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT,\n" +
"Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT,\n" + //"Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT,\n" +
"temp1.DiffQty\n"+ //"temp1.DiffQty\n"+
"FROM\n" + //"FROM\n" +
"(\n" + //"(\n" +
"SELECT\n" + //"SELECT\n" +
"A.*,\n" + //"A.*,\n" +
"Isnull(F.Qty, 0) UnSettleQty,\n" + //"Isnull(F.Qty, 0) UnSettleQty,\n" +
"B.EstimateTypeDesc MaterialGroup,\n" + //"B.EstimateTypeDesc MaterialGroup,\n" +
"B.MaterialDesc MaterialDesc,\n" + //"B.MaterialDesc MaterialDesc,\n" +
"d.MaterialDesc ParentMaterialDesc,\n" + //"d.MaterialDesc ParentMaterialDesc,\n" +
"B.MaterialCode SapMaterialCode,\n" + //"B.MaterialCode SapMaterialCode,\n" +
"A.Qty-Isnull(F.Qty,\n" + //"A.Qty-Isnull(F.Qty,\n" +
"0) DiffQty\n" + //"0) DiffQty\n" +
"FROM\n" + //"FROM\n" +
"(\n" + //"(\n" +
"select\n" + //"select\n" +
"\n" + //"\n" +
"MaterialCode,\n" + //"MaterialCode,\n" +
"ChassisNumber,\n" + //"ChassisNumber,\n" +
"KENNCode,\n" + //"KENNCode,\n" +
"ChassisNumber2,\n" + //"ChassisNumber2,\n" +
"KENNCode2,\n" + //"KENNCode2,\n" +
"flag,\n" + //"flag,\n" +
"\n" + //"\n" +
"STUFF((\n" + //"STUFF((\n" +
"SELECT\n" + //"SELECT\n" +
"',' + ErpMaterialCode\n" + //"',' + ErpMaterialCode\n" +
"FROM\n" + //"FROM\n" +
"Set_fis subTitle\n" + //"Set_fis subTitle\n" +
"WHERE\n" + //"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" + //"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" + //"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" + //"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" + //"1,\n" +
"1,\n" + //"1,\n" +
"'') AS ParentSapMaterialCode,\n" + //"'') AS ParentSapMaterialCode,\n" +
"STUFF((\n" + //"STUFF((\n" +
"SELECT\n" + //"SELECT\n" +
"',' + WMSBillNum\n" + //"',' + WMSBillNum\n" +
"FROM\n" + //"FROM\n" +
"Set_fis subTitle\n" + //"Set_fis subTitle\n" +
"WHERE\n" + //"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" + //"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" + //"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" + //"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" + //"1,\n" +
"1,\n" + //"1,\n" +
"'') AS WMSBillNum,\n" + //"'') AS WMSBillNum,\n" +
"STUFF((\n" + //"STUFF((\n" +
"SELECT\n" + //"SELECT\n" +
"',' + CONVERT(VARCHAR(10),CP5Time,120)\n" + //"',' + CONVERT(VARCHAR(10),CP5Time,120)\n" +
"FROM\n" + //"FROM\n" +
"Set_fis subTitle\n" + //"Set_fis subTitle\n" +
"WHERE\n" + //"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" + //"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" + //"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" + //"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" + //"1,\n" +
"1,\n" + //"1,\n" +
"'') AS CP5Time,\n" + //"'') AS CP5Time,\n" +
"STUFF((\n" + //"STUFF((\n" +
"SELECT\n" + //"SELECT\n" +
"',' + UnSettleVersion\n" + //"',' + UnSettleVersion\n" +
"FROM\n" + //"FROM\n" +
"Set_fis subTitle\n" + //"Set_fis subTitle\n" +
"WHERE\n" + //"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" + //"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" + //"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" + //"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" + //"1,\n" +
"1,\n" + //"1,\n" +
"'') AS UnSettleVersion,\n" + //"'') AS UnSettleVersion,\n" +
"sum(qty) qty\n" + //"sum(qty) qty\n" +
"from\n" + //"from\n" +
"\n" + //"\n" +
"(\n" + //"(\n" +
"SELECT\n" + //"SELECT\n" +
"WMSState,\n" + //"WMSState,\n" +
"WMSBillNum,\n" + //"WMSBillNum,\n" +
"UnSettleVersion,\n" + //"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" + //"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" + //"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" + //"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" + //"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" + //"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" + //"KENNCode KENNCode2,\n" +
"QTY,\n" + //"QTY,\n" +
"ErpMaterialCode ,\n" + //"ErpMaterialCode ,\n" +
"'' FLAG\n" + //"'' FLAG\n" +
"FROM\n" + //"FROM\n" +
"Set_fis\n" + //"Set_fis\n" +
"where\n" + //"where\n" +
"1 = 1\n" + //"1 = 1\n" +
"AND STATE = 0 {0}\n" + //"AND STATE = 0 {0}\n" +
"UNION ALL\n" + //"UNION ALL\n" +
"SELECT\n" + //"SELECT\n" +
"\n" + //"\n" +
"WMSState,\n" + //"WMSState,\n" +
"WMSBillNum,\n" + //"WMSBillNum,\n" +
"UnSettleVersion,\n" + //"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" + //"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" + //"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" + //"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" + //"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" + //"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" + //"KENNCode KENNCode2,\n" +
"QTY,\n" + //"QTY,\n" +
"ErpMaterialCode ,\n" + //"ErpMaterialCode ,\n" +
"'L' FLAG\n" + //"'L' FLAG\n" +
"FROM\n" + //"FROM\n" +
"Set_fis\n" + //"Set_fis\n" +
"WHERE\n" + //"WHERE\n" +
"1 = 1\n" + //"1 = 1\n" +
"AND STATE = 4 {0}\n" + //"AND STATE = 4 {0}\n" +
")\n" + //")\n" +
"tm1\n" + //"tm1\n" +
"GROUP BY\n" + //"GROUP BY\n" +
"MaterialCode,\n" + //"MaterialCode,\n" +
"KENNCode2,\n" + //"KENNCode2,\n" +
"ChassisNumber2,\n" + //"ChassisNumber2,\n" +
"KENNCode,\n" + //"KENNCode,\n" +
"ChassisNumber,\n" + //"ChassisNumber,\n" +
"FLAG\n" + //"FLAG\n" +
") A\n" + //") A\n" +
"left join (\n" + //"left join (\n" +
"select\n" + //"select\n" +
"*\n" + //"*\n" +
"from\n" + //"from\n" +
"Set_Unsettle\n" + //"Set_Unsettle\n" +
"where\n" + //"where\n" +
"version = '{1}') f\n" + //"version = '{1}') f\n" +
"on\n" + //"on\n" +
"a.MaterialCode = f.MaterialCode\n" + //"a.MaterialCode = f.MaterialCode\n" +
"and a.KENNCode2 = f.KENNCode\n" + //"and a.KENNCode2 = f.KENNCode\n" +
"and a.ChassisNumber2 = f.ChassisNumber\n" + //"and a.ChassisNumber2 = f.ChassisNumber\n" +
"LEFT JOIN Set_material B ON\n" + //"LEFT JOIN Set_material B ON\n" +
"a.MaterialCode = b.CustomerPartCode\n" + //"a.MaterialCode = b.CustomerPartCode\n" +
"LEFT JOIN (\n" + //"LEFT JOIN (\n" +
"select\n" + //"select\n" +
"max(Id) Id,\n" + //"max(Id) Id,\n" +
"MaterialCode,\n" + //"MaterialCode,\n" +
"MaterialDesc\n" + //"MaterialDesc\n" +
"from\n" + //"from\n" +
"Set_material\n" + //"Set_material\n" +
"group by\n" + //"group by\n" +
"MaterialCode,\n" + //"MaterialCode,\n" +
"MaterialDesc) d ON\n" + //"MaterialDesc) d ON\n" +
"Substring(a.ParentSapMaterialCode,1,8) = d.MaterialCode\n" + //"Substring(a.ParentSapMaterialCode,1,8) = d.MaterialCode\n" +
") temp1\n" + //") temp1\n" +
"LEFT JOIN (\n" + //"LEFT JOIN (\n" +
"SELECT\n" + //"SELECT\n" +
"Price,\n" + //"Price,\n" +
"MaterialCode\n" + //"MaterialCode\n" +
"FROM\n" + //"FROM\n" +
"Set_PriceList\n" + //"Set_PriceList\n" +
"WHERE\n" + //"WHERE\n" +
"version = (\n" + //"version = (\n" +
"SELECT\n" + //"SELECT\n" +
"Max(Version)\n" + //"Max(Version)\n" +
"FROM\n" + //"FROM\n" +
"Set_PriceList ) ) temp2 ON\n" + //"Set_PriceList ) ) temp2 ON\n" +
"temp1.SapMaterialCode = temp2.MaterialCode\n"; //"temp1.SapMaterialCode = temp2.MaterialCode\n";
//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(); 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);
string _sql = string.Format(sqlString, str, version);
;
var _query = DbConnection.Query<UnSettleDetailReport1 > (_sql, null, null, true, 1200, null); ;
var _list = _query.ToList(); 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 _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 } 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 equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
where tm1 == null where tm1 == null
select itm; select itm;
_ls = query.ToList(); _ls = q.ToList();

Loading…
Cancel
Save