From c826bbcad3d8cca7e054462b31215cc30adea4ce Mon Sep 17 00:00:00 2001 From: lixh Date: Mon, 23 May 2022 11:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=89=B9=E6=AC=A1=E4=BB=8E?= =?UTF-8?q?=E7=89=A9=E6=96=99=E6=89=B9=E6=AC=A1=E4=B8=AD=E5=8F=96=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=8F=96=E7=89=A9=E6=96=99=E4=B8=8A?= =?UTF-8?q?=E9=9D=A2=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ICSSoft.DataProject/ICSSubmitService.cs | 128 +++++++++++------- 1 file changed, 76 insertions(+), 52 deletions(-) diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs index 5a5c328..5e5c9f3 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs @@ -76,7 +76,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, ISNULL(ext.ProjectCode, '') AS ProjectCode, a.ExtensionID, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode, + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, ISNULL(ext.Version, '') AS Version, ISNULL(ext.Brand, '') AS Brand, ISNULL(ext.cFree1, '') AS cFree1, @@ -250,7 +250,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, a.ExtensionID, ext.ProjectCode, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, ext.Version, ext.Brand, ext.cFree1, @@ -745,7 +745,7 @@ namespace ICSSoft.DataProject END " + sql + "AND Otin.InCode = '" + JsonData.TransCode + "'" + @"GROUP BY a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode, - wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, + wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER,a.MTIME"; columns = @"SUM(log.Quantity) AS Quantity, @@ -754,7 +754,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, a.LocationCode, loc.LocationName, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; tableName = @"ICSOtherIn Otin INNER JOIN ICSTransfer tra ON Otin.TransferDetailID=tra.TransferDetailID AND Otin.WorkPoint=tra.WorkPoint @@ -784,7 +784,7 @@ namespace ICSSoft.DataProject END " + sql + "AND sdn.SDNCode = '" + JsonData.TransCode + "'" + @"GROUP BY a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode, - wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, + wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER,a.MTIME"; columns = @"SUM(log.Quantity) AS Quantity, @@ -793,7 +793,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, a.LocationCode, loc.LocationName, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; tableName = @"ICSSDN sdn INNER JOIN ICSWareHouseLotInfoLog log ON sdn.SDNCode=log.TransCode AND sdn.Sequence=log.TransSequence AND sdn.WorkPoint=log.WorkPoint @@ -820,7 +820,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, a.LocationCode, loc.LocationName, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, ISNULL(split.SplitLotNo, a.LotNo+'-1') AS SplitLotNo,"; tableName = @"ICSWareHouseLotInfo a @@ -847,7 +847,7 @@ namespace ICSSoft.DataProject wh.WarehouseName AS WHName, a.LocationCode, loc.LocationName, - CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; + CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,"; tableName = @"ICSWareHouseLotInfo a INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint @@ -2012,7 +2012,7 @@ namespace ICSSoft.DataProject } } //校验退料数量是否超出领料数量 - sql = CheckOutsourcingIssueDoc(item.Type, item.id, item.WorkPoint, language); + sql = CheckOutsourcingIssueDoc(item.Type, Code, item.WorkPoint, language); DBHelper.ExecuteNonQuery(sql, cmd); codes += "'" + Code + item.WorkPoint + "',"; } @@ -2080,71 +2080,83 @@ namespace ICSSoft.DataProject } } - private static string CheckOutsourcingIssueDoc(string Type, string ID, string WorkPoint, Dictionary language) + private static string CheckOutsourcingIssueDoc(string Type, string Code, string WorkPoint, Dictionary language) { string sql = string.Empty; if (Type == "1") { sql = @"DECLARE @PickID VARCHAR(10) - SELECT @PickID=b.PickID + SELECT @PickID=b.PickID + FROM ICSOApplyNegDetail a + INNER JOIN ICSOOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint + INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint + WHERE c.Type='{2}' AND a.WorkPoint='{1}' + AND a.SourceDetailID IN (SELECT a.SourceDetailID FROM ICSOApplyNegDetail a - INNER JOIN ICSOOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint - WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}' - GROUP BY b.PickID - HAVING MAX(b.Quantity)