|
|
@ -2890,24 +2890,15 @@ namespace ICSSoft.DataProject |
|
|
|
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}' |
|
|
@ -3722,5 +3713,97 @@ namespace ICSSoft.DataProject |
|
|
|
throw new Exception(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 料架单据绑定
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="LotNo"></param>
|
|
|
|
/// <param name="ContainerCode"></param>
|
|
|
|
/// <param name="User"></param>
|
|
|
|
/// <param name="WorkPoint"></param>
|
|
|
|
/// <param name="cmd"></param>
|
|
|
|
/// <param name="language"></param>
|
|
|
|
public static void ContainerTransCodeBind(List<string> tranCodes, string containerCode, string User, SqlCommand cmd, Dictionary<string, string> language) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' )
|
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{1}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
|
|
|
|
IF NOT EXISTS(SELECT ID FROM ICSContainer WHERE ContainerCode='{0}' ) |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo473"), "", "{0}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
SELECT top 1 Desks FROM ICSMOApply WHERE ApplyCode='{2}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, containerCode, User, tranCodes.FirstOrDefault()); |
|
|
|
|
|
|
|
var table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (table.Rows.Count<=0) |
|
|
|
{ |
|
|
|
throw new Exception("单据对应的工位不存在,操作失败"); |
|
|
|
} |
|
|
|
foreach (string tranCode in tranCodes) |
|
|
|
{ |
|
|
|
string sqlCheck = @"IF NOT EXISTS(select ID from ICSWareHouseLotInfoLog where TransType='15' AND TransCode='{0}')
|
|
|
|
BEGIN |
|
|
|
RAISERROR('" + language.GetNameByCode("WMSAPIInfo478") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
IF NOT EXISTS( SELECT ID FROM ICSMOApply WHERE ApplyCode='{0}' AND Desks='{1}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('"+language.GetNameByCode("WMSAPIInfo477") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
IF EXISTS(select ID from ICSContainerReceiptsNumber where ContainerCode='{2}' AND TransCode='{0}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}","{2}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
INSERT INTO ICSContainerReceiptsNumber SELECT NEWID(),'{0}','{2}',F_Account,F_RealName,GETDATE(),NULL,NULL,NULL,NULL,NULL FROM Sys_SRM_User WHERE F_Account='{3}' ";
|
|
|
|
sqlCheck= string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(),containerCode, User); |
|
|
|
if (!DBHelper.ExecuteNonQuery(sqlCheck, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception("单据新增失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
throw ex; |
|
|
|
} |
|
|
|
} |
|
|
|
/// <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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |