Browse Source

更败大众备件对应DTO字段

FoShanPG
44673626 3 years ago
parent
commit
8e892a8a5c
  1. 124
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

124
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -155,7 +155,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var sql1 = "SELECT\n" +
" A.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" A.PurchaseOrderNo,\n" +
" A.PurchaseOrderNo Kanban,\n" +
" A.SpareDate WmsDate \n" +
"FROM\n" +
" Set_WMSSparePart A\n" +
@ -200,7 +200,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var sql2 = "SELECT\n" +
" A.WMSDeliveryNote WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" A.PurchaseOrderNo,\n" +
" A.PurchaseOrderNo Kanban,\n" +
" A.SpareDate WmsDate \n" +
"FROM\n" +
" Set_WMSSparePart A\n" +
@ -212,6 +212,120 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//结算表中订单日期也要合并
var sql10 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT CONVERT\n" +
" ( VARCHAR ( 100 ), a.SpareDate, 23 ) AS AcceptanceDate,\n" +
" PurchaseOrderNo KanbanNumber,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_SparePart a\n" +
" LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" a.Extend != 'is90' \n" +
" AND a.PurchaseOrderNo != 'NoOrder' \n" +
" AND a.Version = '{0}' \n" +
" ) t1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" PurchaseOrderNo KanbanNumber,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_SparePart a \n" +
" WHERE\n" +
" a.Extend != 'is90' \n" +
" AND a.PurchaseOrderNo != 'NoOrder' \n" +
" AND a.Version = '{0}' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" HAVING\n" +
" COUNT ( * ) > 1 \n" +
" ) t2 ON t1.KanbanNumber = t2.KanbanNumber \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"WHERE\n" +
" t2.KanbanNumber IS NULL";
var list11 = DbConnection.Query<CompareExtend1>(string.Format(sql10, version));
var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT CONVERT\n" +
" ( VARCHAR ( 100 ), a.SpareDate, 23 ) AS AcceptanceDate,\n" +
" PurchaseOrderNo KanbanNumber,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_SparePart a\n" +
" LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" a.Extend != 'is90' \n" +
" AND a.PurchaseOrderNo != 'NoOrder' \n" +
" AND a.Version = '{0}' \n" +
" ) t1\n" +
" INNER JOIN (\n" +
" SELECT\n" +
" PurchaseOrderNo KanbanNumber,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_SparePart a \n" +
" WHERE\n" +
" a.Extend != 'is90' \n" +
" AND a.PurchaseOrderNo != 'NoOrder' \n" +
" AND a.Version = '{0}' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode \n" +
" HAVING\n" +
" COUNT ( * ) > 1 \n" +
" ) t2 ON t1.KanbanNumber = t2.KanbanNumber \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"ORDER BY\n" +
" t1.KanbanNumber,\n" +
" t1.MaterialCode";
var list12 = DbConnection.Query<CompareExtend1>(string.Format(sql11, version));
List<CompareExtend1> _lscopy = new List<CompareExtend1>();
foreach (var itm in list11)
{
var first = _lscopy.FirstOrDefault(p => p.KanbanNumber == itm.KanbanNumber && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
first.AcceptanceDate += "," + itm.AcceptanceDate;
}
else
{
_lscopy.Add(itm);
}
}
foreach (var itm in list12)
{
_lscopy.Add(itm);
}
List<CompareExtend> _ls = new List<CompareExtend>();
foreach (var itm in listCompare.ToList())
{
@ -257,6 +371,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
itm1. = itm.WmsDate;
}
var itmcopy = _lscopy.FirstOrDefault(p => p.KanbanNumber == itm1. && p.MaterialCode == itm1.SAP编码);
if (itmcopy != null)
{
itm1. = itmcopy.AcceptanceDate;
}
}

Loading…
Cancel
Save