From 98afc0a4d9d93451407104cf4c66d7411c4c31e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E9=B9=8F?= Date: Tue, 10 Oct 2023 16:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=A1=E7=A0=81=E5=90=88=E5=B9=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8D=A1=E6=8E=A7=E6=89=B9=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ICSWareHouseLotInfoService.cs | 53 +++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs index 971861b..0a77fca 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs @@ -1464,23 +1464,46 @@ namespace ICSSoft.DataProject RAISERROR('" + language.GetNameByCode("WMSAPIInfo171") + @"',16,1); RETURN END - IF NOT EXISTS(SELECT a.LotNo FROM ICSInventoryLot a - INNER JOIN ICSExtension b ON a.ExtensionID=b.ID AND a.WorkPoint=b.WorkPoint - INNER JOIN (SELECT a.LotNo,b.BatchCode,a.WorkPoint from ICSInventoryLot a - INNER JOIN ICSExtension b on a.ExtensionID=b.ID AND a.WorkPoint=b.WorkPoint where a.LotNo='{3}' ) c ON b.BatchCode=c.BatchCode and a.WorkPoint=c.WorkPoint + IF EXISTS( + SELECT * FROM ICSWareHouseLotInfo a + INNER JOIN ICSInventoryLot c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint + INNER JOIN ICSInventory d on c.invcode=d.invcode and c.WorkPoint=d.WorkPoint + WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' and d.BatchEnable='1' + ) + BEGIN + IF NOT EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a + INNER JOIN ICSWareHouseLotInfo b ON b.LotNo='{3}' AND a.WarehouseCode=b.WarehouseCode AND a.WorkPoint=b.WorkPoint + INNER JOIN ICSInventoryLot c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint + INNER JOIN ICSInventoryLot d on b.LotNo=d.LotNo and b.WorkPoint=d.WorkPoint + INNER JOIN ICSExtension e on c.ExtensionID=e.ID and c.WorkPoint=e.WorkPoint + INNER JOIN ICSExtension f on d.ExtensionID=f.id and d.WorkPoint=f.WorkPoint + WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' and e.ID=f.ID) + BEGIN + RAISERROR('不同仓库/批次条码,不能合并',16,1); + RETURN + END + END + IF NOT EXISTS( + SELECT * FROM ICSWareHouseLotInfo a + INNER JOIN ICSInventoryLot c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint + INNER JOIN ICSInventory d on c.invcode=d.invcode and c.WorkPoint=d.WorkPoint + WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' and d.BatchEnable='1' + ) + BEGIN + IF NOT EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a + INNER JOIN ICSWareHouseLotInfo b ON b.LotNo='{3}' AND a.WarehouseCode=b.WarehouseCode AND a.WorkPoint=b.WorkPoint + INNER JOIN ICSInventoryLot c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint + INNER JOIN ICSInventoryLot d on b.LotNo=d.LotNo and b.WorkPoint=d.WorkPoint WHERE a.LotNo='{0}' AND a.WorkPoint='{1}') - BEGIN - RAISERROR('" + language.GetNameByCode("WMSAPIInfo199") + @"',16,1); - RETURN - END - IF NOT EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a - INNER JOIN ICSWareHouseLotInfo b ON b.LotNo='{3}' AND a.LocationCode=b.LocationCode AND a.WorkPoint=b.WorkPoint - WHERE a.LotNo='{0}' AND a.WorkPoint='{1}') - BEGIN - RAISERROR('" + language.GetNameByCode("WMSAPIInfo200") + @"',16,1); - RETURN - END + BEGIN + RAISERROR('不同仓库/批次条码,不能合并',16,1); + RETURN + END + END + UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)+'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}' + UPDATE ICSInventoryLot SET Amount=(ISNULL(Amount,0)+(select Amount from + ICSInventoryLot where LotNo='{3}' AND WorkPoint='{1}')) WHERE LotNo='{0}' AND WorkPoint='{1}' "; sql = string.Format(sql, LotNo, WorkPoint, Quantity, CurrentLotNo);