|
|
@ -2878,23 +2878,33 @@ namespace ICSSoft.DataProject |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{3}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
IF NOT EXISTS(SELECT ID FROM ICSInventoryLot WHERE LotNO='{0}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo038"), "{0}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
IF NOT EXISTS(SELECT ID FROM ICSContainer WHERE ContainerCode='{1}' AND WorkPoint='{2}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo473"), "{2}", "{1}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
IF NOT EXISTS (SELECT * FROM ICSContainerLot WHERE ContainerID= |
|
|
|
(SELECT ID FROM ICSContainer WHERE ContainerCode='{1}' AND WorkPoint='{2}')) |
|
|
|
(SELECT ID FROM ICSContainer WHERE ContainerCode='{1}' AND WorkPoint='{2}') AND LotNo='{0}') |
|
|
|
BEGIN |
|
|
|
update ICSContainer set LocationCode='{4}',EATTRIBUTE1='已绑定' where ContainerCode='{1}' AND WorkPoint='{2}' |
|
|
|
-- update ICSContainer set EATTRIBUTE1='已绑定' where ContainerCode='{1}' AND WorkPoint='{2}' |
|
|
|
INSERT INTO ICSContainerLot |
|
|
|
(ID,ContainerID,LotNo,MUSER,MUSERName,WorkPoint,MTIME,EATTRIBUTE1) |
|
|
|
SELECT NEWID(),ID,'{0}','{3}' |
|
|
|
,(SELECT F_RealName FROM Sys_SRM_User WHERE F_Account='{3}' AND F_Location='{2}'),'{2}',GETDATE(),'{4}' FROM ICSContainer |
|
|
|
,(SELECT F_RealName FROM Sys_SRM_User WHERE F_Account='{3}' AND F_Location='{2}'),'{2}',GETDATE(),'' FROM ICSContainer |
|
|
|
WHERE ContainerCode='{1}' AND WorkPoint='{2}' |
|
|
|
END |
|
|
|
ELSE |
|
|
|
BEGIN |
|
|
|
update ICSContainer set LocationCode='{4}',EATTRIBUTE1='已绑定' where ContainerCode='{1}' AND WorkPoint='{2}' |
|
|
|
UPDATE ICSContainerLot SET LotNo='{0}' WHERE ContainerID= |
|
|
|
(SELECT ID FROM ICSContainer WHERE ContainerCode='{1}' AND WorkPoint='{2}') |
|
|
|
END |
|
|
|
-- ELSE |
|
|
|
-- BEGIN |
|
|
|
-- update ICSContainer set LocationCode='{4}',EATTRIBUTE1='已绑定' where ContainerCode='{1}' AND WorkPoint='{2}' |
|
|
|
-- UPDATE ICSContainerLot SET LotNo='{0}' WHERE ContainerID= |
|
|
|
-- (SELECT ID FROM ICSContainer WHERE ContainerCode='{1}' AND WorkPoint='{2}') |
|
|
|
-- END |
|
|
|
";
|
|
|
|
sql = string.Format(sql, LotNo, ContainerCode, WorkPoint, User, LocationCode); |
|
|
|
|
|
|
@ -3244,5 +3254,33 @@ namespace ICSSoft.DataProject |
|
|
|
throw new Exception(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 根据条码获取仓库和区域信息
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="LotNo"></param>
|
|
|
|
/// <param name="cmd"></param>
|
|
|
|
public static DataTable GetWHCodeArea(string LotNo,SqlCommand cmd) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
string check = $@"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
|
|
|
|
INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint |
|
|
|
WHERE A.LotNo='{LotNo}' |
|
|
|
UNION ALL |
|
|
|
SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A |
|
|
|
INNER JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint |
|
|
|
WHERE A.LotNo='{LotNo}'";
|
|
|
|
var table = DBHelper.SQlReturnData(check, cmd); |
|
|
|
return table; |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |