diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs index 42b6b970..50664c22 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs @@ -418,20 +418,23 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public virtual List GetEdiWms() { var sql = - "select * from (\n" + - "select\n" + - "ISNULL(a.PN,b.PN) PN,\n" + - "ISNULL(a.LU,b.LU) LU,A.BillTime,\n" + - "B.EDITime,\n" + - "ISNULL(A.qty,0) ShippingQty,\n" + - "ISNULL(b.qty,0) EdiQty ,\n" + - "case when ISNULL(A.qty,0) >ISNULL(b.qty,0) then '发运比EDI多'\n" + - "when ISNULL(A.qty,0) ='2023-09-25 00:00:00' group by PN,CustomerPartCodeNoSpace,LU) a full join\n" + - "(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_BBAC_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" + - "WHERE isnull(A.qty,0)<>isnull(B.qty,0) ) temp order by EDITime,BillTime\n"; +"select * from (\n" + +"select\n" + +"ISNULL(a.PN,b.PN) PN,\n" + +"ISNULL(a.LU,b.LU) LU,A.BillTime,\n" + +"B.EDITime,\n" + +"ISNULL(A.qty,0) ShippingQty,\n" + +"ISNULL(b.qty,0) EdiQty ,\n" + +"case\n" + +"when ISNULL(A.qty,0) >ISNULL(b.qty,0) and ISNULL(b.qty,0)=0 then 'WMS有发货EDI无订单'\n" + +"when ISNULL(B.qty,0)=0 and ISNULL(A.qty,0)<0 then 'WMS有发货EDI无订单'\n" + +"when ISNULL(A.qty,0) >ISNULL(b.qty,0) and ISNULL(b.qty,0)>0 then 'WMS有发货多余EDI订单'\n" + +"when ISNULL(A.qty,0) ='2023-09-25 00:00:00' group by PN,CustomerPartCodeNoSpace,LU) a full join\n" + +"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_BBAC_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" + +"WHERE isnull(A.qty,0)<>isnull(B.qty,0)) temp WHERE STATE!='WMS有发货多余EDI订单' order by EDITime,BillTime\n"; var entities = DbConnection.Query(sql, null, null, false, 1200, null).ToList(); foreach(var itm in entities) { @@ -448,20 +451,23 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public virtual List GetHBPOEdiWms() { var sql = - "select * from (\n" + - "select\n" + - "ISNULL(a.PN,b.PN) PN,\n" + - "ISNULL(a.LU,b.LU) LU,A.BillTime,\n" + - "B.EDITime,\n" + - "ISNULL(A.qty,0) ShippingQty,\n" + - "ISNULL(b.qty,0) EdiQty ,\n" + - "case when ISNULL(A.qty,0) >ISNULL(b.qty,0) then '发运比EDI多'\n" + - "when ISNULL(A.qty,0) ='2023-09-25 00:00:00' group by PN,CustomerPartCodeNoSpace,LU) a full join\n" + - "(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_HBPO_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" + - "WHERE isnull(A.qty,0)<>isnull(B.qty,0) ) temp order by EDITime,BillTime\n"; + "select * from (\n" + +"select\n" + +"ISNULL(a.PN,b.PN) PN,\n" + +"ISNULL(a.LU,b.LU) LU,A.BillTime,\n" + +"B.EDITime,\n" + +"ISNULL(A.qty,0) ShippingQty,\n" + +"ISNULL(b.qty,0) EdiQty ,\n" + +"case\n" + +"when ISNULL(A.qty,0) >ISNULL(b.qty,0) and ISNULL(b.qty,0)=0 then 'WMS有发货EDI无订单'\n" + +"when ISNULL(B.qty,0)=0 and ISNULL(A.qty,0)<0 then 'WMS有发货EDI无订单'\n" + +"when ISNULL(A.qty,0) >ISNULL(b.qty,0) and ISNULL(b.qty,0)>0 then 'WMS有发货多余EDI订单'\n" + +"when ISNULL(A.qty,0) ='2023-09-25 00:00:00' group by PN,CustomerPartCodeNoSpace,LU) a full join\n" + +"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_HBPO_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" + +"WHERE isnull(A.qty,0)<>isnull(B.qty,0)) temp WHERE STATE!='WMS有发货多余EDI订单' order by EDITime,BillTime\n"; var entities = DbConnection.Query(sql, null, null, false, 1200, null).ToList(); foreach (var itm in entities) {