|
|
@ -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); |
|
|
|
|
|
|
|