|
|
@ -56,13 +56,13 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
#region 正常入库
|
|
|
|
///添加库存(原条码退回,更新库存;新条码直接入库)
|
|
|
|
//stirng locationcode = "";
|
|
|
|
string sql = string.Empty; |
|
|
|
string locationcode = ""; |
|
|
|
|
|
|
|
|
|
|
|
if (BusinessCode != TransTypeEnum.SalesReturnBack.GetDescription<DBValue>()) |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(LogID)) |
|
|
@ -84,8 +84,8 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
locationcode = dt.Rows[0]["LocationCode"].ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
sql += @" IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
|
|
|
|
BEGIN |
|
|
@ -168,9 +168,156 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo166")); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 管控方式是"料品"时
|
|
|
|
|
|
|
|
ControlMode mode = ICSControlModeService.GetControlMode(); |
|
|
|
|
|
|
|
if (mode.itemCode.Equals("ControlMode02")) |
|
|
|
{ |
|
|
|
//查询是否存在料品管控的条码
|
|
|
|
string sqlStrNew = @"SELECT a.ID,
|
|
|
|
con.ContainerCode, |
|
|
|
con.ContainerName, |
|
|
|
a.LotNo, |
|
|
|
a.InvCode, |
|
|
|
inv.InvName, |
|
|
|
inv.InvStd, |
|
|
|
inv.InvUnit,-- {0} |
|
|
|
inv.AmountUnit, |
|
|
|
ext.ID AS ExtensionID, |
|
|
|
ext.ProjectCode, |
|
|
|
ext.Version, |
|
|
|
ext.BatchCode, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
|
ext.cFree2, |
|
|
|
ext.cFree3, |
|
|
|
ext.cFree4, |
|
|
|
ext.cFree5, |
|
|
|
ext.cFree6, |
|
|
|
ext.cFree7, |
|
|
|
ext.cFree8, |
|
|
|
ext.cFree9, |
|
|
|
ext.cFree10, |
|
|
|
a.MUSER AS [ USER ], |
|
|
|
a.MTIME AS [ MTime ] |
|
|
|
FROM |
|
|
|
ICSInventoryLot a |
|
|
|
LEFT JOIN ICSContainerLot conlot ON a.LotNo = conlot.LotNo AND a.WorkPoint = conlot.WorkPoint |
|
|
|
LEFT JOIN ICSContainer con ON conlot.ContainerID = con.ID AND conlot.WorkPoint = con.WorkPoint |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode = inv.InvCode AND a.WorkPoint = inv.WorkPoint |
|
|
|
INNER JOIN ICSExtension ext ON a.ExtensionID = ext.ID AND a.WorkPoint = ext.WorkPoint |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'";
|
|
|
|
sqlStrNew = string.Format(sqlStrNew, jointLotNo, WorkPoint); |
|
|
|
DataTable table = DBHelper.SQlReturnData(sqlStrNew, cmd); |
|
|
|
string json = JsonConvert.SerializeObject(table); |
|
|
|
List<LotNoMode> modelNew = JsonConvert.DeserializeObject<List<LotNoMode>>(json); |
|
|
|
|
|
|
|
//当不存在料品管控条码时,生成新条码
|
|
|
|
if (!(modelNew.Count > 0)) |
|
|
|
{ |
|
|
|
//获取旧条码的信息
|
|
|
|
string jsonStr = ICSControlModeService.QueryLotNo(LotNo, WorkPoint); |
|
|
|
List<LotNoMode> model = JsonConvert.DeserializeObject<List<LotNoMode>>(jsonStr); |
|
|
|
//在条码表中插入一条新数据,在条码表中插入一条新数据,并在库存表中添加新数据
|
|
|
|
LotNoMode lotNoMode = model[0]; |
|
|
|
CreateLotNo(jointLotNo, Quantity, "", "", WorkPoint, Identification, User, lotNoMode.InvCode, BusinessCode, lotNoMode.ProjectCode, lotNoMode.BatchCode, |
|
|
|
lotNoMode.Version, lotNoMode.Brand, lotNoMode.cFree1, lotNoMode.cFree2, lotNoMode.cFree3, lotNoMode.cFree4, lotNoMode.cFree5, lotNoMode.cFree6, lotNoMode.cFree7, |
|
|
|
lotNoMode.cFree8, lotNoMode.cFree9, lotNoMode.cFree10, cmd, language, LocationCode, LotNo); |
|
|
|
|
|
|
|
///添加日志
|
|
|
|
sql = @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
|
|
|
|
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, |
|
|
|
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, |
|
|
|
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, |
|
|
|
MTIME,WorkPoint,EATTRIBUTE1,LogID) |
|
|
|
SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode , |
|
|
|
'','',c.WarehouseCode,c.LocationCode,'{6}', |
|
|
|
'','0','{4}','{5}','0','', |
|
|
|
'','','',f.F_Account ,f.F_RealName , |
|
|
|
SYSDATETIME() ,a.WorkPoint ,'','{7}' |
|
|
|
FROM ICSInventoryLot a |
|
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint |
|
|
|
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, jointLotNo, WorkPoint, User, Identification, TransType, BusinessCode, Quantity, LogID); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo166")); |
|
|
|
} |
|
|
|
} |
|
|
|
//当存在料品管控条码时,直接将数量叠加
|
|
|
|
else |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
///更新目标条码库存
|
|
|
|
WareHouseLotInfoMerge(Identification, jointLotNo,LotNo, Quantity, User, WorkPoint, "5", |
|
|
|
TransTypeEnum.LOTMergeAfter.GetDescription<DBValue>(), cmd, language); |
|
|
|
//sql = @"
|
|
|
|
// IF NOT EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}')
|
|
|
|
// BEGIN
|
|
|
|
// RAISERROR('" + language.GetNameByCode("WMSAPIInfo171") + @"',16,1);
|
|
|
|
// RETURN
|
|
|
|
// END
|
|
|
|
// UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)+'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'
|
|
|
|
// ";
|
|
|
|
//sql = string.Format(sql, jointLotNo, WorkPoint, Quantity);
|
|
|
|
|
|
|
|
//if (!DBHelper.ExecuteNonQuery(sql, cmd))
|
|
|
|
//{
|
|
|
|
// throw new Exception(language.GetNameByCode("WMSAPIInfo169"));//"目标条码库存更新失败!");
|
|
|
|
//}
|
|
|
|
|
|
|
|
/// 添加日志
|
|
|
|
//sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
|
|
|
|
//BEGIN
|
|
|
|
// RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1);
|
|
|
|
// RETURN
|
|
|
|
//END
|
|
|
|
|
|
|
|
//INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
|
|
|
|
//FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
|
|
|
|
//Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
|
|
|
|
//ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
|
|
|
|
//MTIME,WorkPoint,EATTRIBUTE1)
|
|
|
|
//SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode ,
|
|
|
|
//'','',c.WarehouseCode,c.LocationCode,c.Quantity,
|
|
|
|
//'','0','{4}','{5}','0','',
|
|
|
|
//'','','',f.F_Account ,f.F_RealName ,
|
|
|
|
//SYSDATETIME() ,a.WorkPoint ,''
|
|
|
|
//FROM ICSInventoryLot a
|
|
|
|
//INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
|
|
//INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
|
|
|
|
//INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
|
|
|
|
//WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
|
|
|
|
//";
|
|
|
|
//sql = string.Format(sql, jointLotNo, WorkPoint, User, Identification, TransType, BusinessCode);
|
|
|
|
|
|
|
|
//if (!DBHelper.ExecuteNonQuery(sql, cmd))
|
|
|
|
//{
|
|
|
|
// throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
|
|
|
|
//}
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 生产入库,倒冲
|
|
|
|
|
|
|
|
#region 成品(生产)入库,倒冲
|
|
|
|
if (BusinessCode.Equals(TransTypeEnum.ManufactureReceiveDoc.GetDescription<DBValue>())) |
|
|
|
{ |
|
|
|
#region sql
|
|
|
@ -181,7 +328,7 @@ namespace ICSSoft.DataProject |
|
|
|
a.InvCode, |
|
|
|
b.InvName, |
|
|
|
b.InvStd, |
|
|
|
a.Quantity, |
|
|
|
a.Quantity/c.Quantity*{2} AS Quantity, |
|
|
|
a.Amount, |
|
|
|
a.Sequence AS TransSequence, |
|
|
|
a.IssueQuantity, |
|
|
@ -205,7 +352,7 @@ namespace ICSSoft.DataProject |
|
|
|
ext.cFree8, |
|
|
|
ext.cFree9, |
|
|
|
ext.cFree10 |
|
|
|
INTO #maintemp |
|
|
|
INTO #maintemp |
|
|
|
|
|
|
|
FROM |
|
|
|
ICSMOPick a |
|
|
@ -221,7 +368,7 @@ namespace ICSSoft.DataProject |
|
|
|
WHERE c.LotNo='{0}' AND c.WorkPoint='{1}' |
|
|
|
) temp ON c.MOCode=temp.MOCode AND a.WorkPoint=temp.WorkPoint AND c.Sequence=temp.Sequence |
|
|
|
WHERE a.SupplyType='1' |
|
|
|
GROUP BY c.MOCode,a.Quantity,a.InvCode,b.InvName,b.InvStd,a.WhCode,a.ExtensionID,a.WorkPoint,inv.BatchEnable,a.MODetailID,a.Amount,a.Sequence,a.IssueQuantity,inv.InvName,inv.InvCode,inv.InvUnit,inv.AmountUnit,c.Sequence, |
|
|
|
GROUP BY c.MOCode,a.Quantity,c.Quantity,a.InvCode,b.InvName,b.InvStd,a.WhCode,a.ExtensionID,a.WorkPoint,inv.BatchEnable,a.MODetailID,a.Amount,a.Sequence,a.IssueQuantity,inv.InvName,inv.InvCode,inv.InvUnit,inv.AmountUnit,c.Sequence, |
|
|
|
ext.ProjectCode,ext.BatchCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10; |
|
|
|
|
|
|
|
select * into #resulttemp from #maintemp |
|
|
@ -303,12 +450,16 @@ namespace ICSSoft.DataProject |
|
|
|
DROP table #resulttemp |
|
|
|
DROP table #barcodetemp";
|
|
|
|
#endregion
|
|
|
|
sql = String.Format(sql,LotNo,WorkPoint); |
|
|
|
sql = String.Format(sql,LotNo,WorkPoint, Quantity); |
|
|
|
DataTable table = DBHelper.SQlReturnData(sql,cmd); |
|
|
|
string json = JsonConvert.SerializeObject(table); |
|
|
|
List<DownItemModel> downItemModels = JsonConvert.DeserializeObject<List<DownItemModel>>(json); |
|
|
|
foreach (DownItemModel model in downItemModels) |
|
|
|
{ |
|
|
|
if (model != null && model.LotNo == null || "" == model.LotNo) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo201")); |
|
|
|
} |
|
|
|
WareHouseLotInfoDown(Identification,model.TransCode,model.Sequence + "~" + model.TransSequence,model.LotNo,model.Quantity,User,WorkPoint,"12",BusinessCode,cmd,language); |
|
|
|
//回写已领数量
|
|
|
|
sql = @"UPDATE ICSMOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity+") WHERE MODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'"; |
|
|
@ -332,7 +483,7 @@ namespace ICSSoft.DataProject |
|
|
|
a.InvCode, |
|
|
|
b.InvName, |
|
|
|
b.InvStd, |
|
|
|
a.Quantity, |
|
|
|
a.Quantity/c.Quantity*{2} AS Quantity, |
|
|
|
a.Amount, |
|
|
|
a.Sequence AS TransSequence, |
|
|
|
a.IssueQuantity, |
|
|
@ -372,7 +523,7 @@ namespace ICSSoft.DataProject |
|
|
|
WHERE c.LotNo='{0}' AND c.WorkPoint='{1}' |
|
|
|
) temp ON c.OOCode=temp.OOCode AND a.WorkPoint=temp.WorkPoint AND c.Sequence=temp.Sequence |
|
|
|
WHERE a.SupplyType='1' |
|
|
|
GROUP BY c.OOCode,a.Quantity,a.InvCode,b.InvName,b.InvStd,a.WhCode,a.ExtensionID,a.WorkPoint,inv.BatchEnable,a.OODetailID,a.Amount,a.Sequence,a.IssueQuantity,inv.InvName,inv.InvCode,inv.InvUnit,inv.AmountUnit,c.Sequence, |
|
|
|
GROUP BY c.OOCode,a.Quantity,c.Quantity,a.InvCode,b.InvName,b.InvStd,a.WhCode,a.ExtensionID,a.WorkPoint,inv.BatchEnable,a.OODetailID,a.Amount,a.Sequence,a.IssueQuantity,inv.InvName,inv.InvCode,inv.InvUnit,inv.AmountUnit,c.Sequence, |
|
|
|
ext.ProjectCode,ext.BatchCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10; |
|
|
|
|
|
|
|
select * into #resulttemp from #maintemp |
|
|
@ -454,12 +605,16 @@ namespace ICSSoft.DataProject |
|
|
|
DROP table #resulttemp |
|
|
|
DROP table #barcodetemp";
|
|
|
|
#endregion
|
|
|
|
sql = String.Format(sql, LotNo, WorkPoint); |
|
|
|
sql = String.Format(sql, LotNo, WorkPoint, Quantity); |
|
|
|
DataTable table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
string json = JsonConvert.SerializeObject(table); |
|
|
|
List<DownItemModel> downItemModels = JsonConvert.DeserializeObject<List<DownItemModel>>(json); |
|
|
|
foreach (DownItemModel model in downItemModels) |
|
|
|
{ |
|
|
|
if (model != null && model.LotNo == null || "" == model.LotNo) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo201")); |
|
|
|
} |
|
|
|
WareHouseLotInfoDown(Identification, model.TransCode, model.Sequence + "~" + model.TransSequence, model.LotNo, model.Quantity, User, WorkPoint, "12", BusinessCode, cmd, language); |
|
|
|
//回写已领数量
|
|
|
|
sql = @"UPDATE ICSOOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity+") WHERE OODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'"; |
|
|
@ -472,146 +627,7 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 管控方式是"料品"时
|
|
|
|
ControlMode mode = ICSControlModeService.GetControlMode(); |
|
|
|
|
|
|
|
if (mode.itemCode.Equals("ControlMode02")) |
|
|
|
{ |
|
|
|
//查询是否存在料品管控的条码
|
|
|
|
string sqlStrNew = @"SELECT a.ID,
|
|
|
|
con.ContainerCode, |
|
|
|
con.ContainerName, |
|
|
|
a.LotNo, |
|
|
|
a.InvCode, |
|
|
|
inv.InvName, |
|
|
|
inv.InvStd, |
|
|
|
inv.InvUnit,-- {0} |
|
|
|
inv.AmountUnit, |
|
|
|
ext.ID AS ExtensionID, |
|
|
|
ext.ProjectCode, |
|
|
|
ext.Version, |
|
|
|
ext.BatchCode, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
|
ext.cFree2, |
|
|
|
ext.cFree3, |
|
|
|
ext.cFree4, |
|
|
|
ext.cFree5, |
|
|
|
ext.cFree6, |
|
|
|
ext.cFree7, |
|
|
|
ext.cFree8, |
|
|
|
ext.cFree9, |
|
|
|
ext.cFree10, |
|
|
|
a.MUSER AS [ USER ], |
|
|
|
a.MTIME AS [ MTime ] |
|
|
|
FROM |
|
|
|
ICSInventoryLot a |
|
|
|
LEFT JOIN ICSContainerLot conlot ON a.LotNo = conlot.LotNo AND a.WorkPoint = conlot.WorkPoint |
|
|
|
LEFT JOIN ICSContainer con ON conlot.ContainerID = con.ID AND conlot.WorkPoint = con.WorkPoint |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode = inv.InvCode AND a.WorkPoint = inv.WorkPoint |
|
|
|
INNER JOIN ICSExtension ext ON a.ExtensionID = ext.ID AND a.WorkPoint = ext.WorkPoint |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'";
|
|
|
|
sqlStrNew = string.Format(sqlStrNew, jointLotNo, WorkPoint); |
|
|
|
DataTable table = DBHelper.SQlReturnData(sqlStrNew, cmd); |
|
|
|
string json = JsonConvert.SerializeObject(table); |
|
|
|
List<LotNoMode> modelNew = JsonConvert.DeserializeObject<List<LotNoMode>>(json); |
|
|
|
|
|
|
|
//当不存在料品管控条码时,生成新条码
|
|
|
|
if (!(modelNew.Count > 0)) |
|
|
|
{ |
|
|
|
//获取旧条码的信息
|
|
|
|
string jsonStr = ICSControlModeService.QueryLotNo(LotNo, WorkPoint); |
|
|
|
List<LotNoMode> model = JsonConvert.DeserializeObject<List<LotNoMode>>(jsonStr); |
|
|
|
//在条码表中插入一条新数据,在条码表中插入一条新数据,并在库存表中添加新数据
|
|
|
|
LotNoMode lotNoMode = model[0]; |
|
|
|
CreateLotNo(jointLotNo, Quantity, "", "", WorkPoint, Identification, User, lotNoMode.InvCode, BusinessCode, lotNoMode.ProjectCode,lotNoMode.BatchCode, |
|
|
|
lotNoMode.Version,lotNoMode.Brand,lotNoMode.cFree1, lotNoMode.cFree2, lotNoMode.cFree3, lotNoMode.cFree4, lotNoMode.cFree5, lotNoMode.cFree6, lotNoMode.cFree7, |
|
|
|
lotNoMode.cFree8, lotNoMode.cFree9, lotNoMode.cFree10,cmd,language,LocationCode); |
|
|
|
|
|
|
|
///添加日志
|
|
|
|
sql = @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
|
|
|
|
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, |
|
|
|
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, |
|
|
|
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, |
|
|
|
MTIME,WorkPoint,EATTRIBUTE1,LogID) |
|
|
|
SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode , |
|
|
|
'','',c.WarehouseCode,c.LocationCode,'{6}', |
|
|
|
'','0','{4}','{5}','0','', |
|
|
|
'','','',f.F_Account ,f.F_RealName , |
|
|
|
SYSDATETIME() ,a.WorkPoint ,'','{7}' |
|
|
|
FROM ICSInventoryLot a |
|
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint |
|
|
|
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, jointLotNo, WorkPoint, User, Identification, TransType, BusinessCode, Quantity, LogID); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo166")); |
|
|
|
} |
|
|
|
} |
|
|
|
//当存在料品管控条码时,直接将数量叠加
|
|
|
|
else |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
///更新目标条码库存
|
|
|
|
sql = @"
|
|
|
|
IF NOT EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + language.GetNameByCode("WMSAPIInfo171") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)+'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, jointLotNo, WorkPoint, Quantity); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo169"));//"目标条码库存更新失败!");
|
|
|
|
} |
|
|
|
|
|
|
|
///添加日志
|
|
|
|
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
|
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END |
|
|
|
|
|
|
|
INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode, |
|
|
|
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, |
|
|
|
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, |
|
|
|
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, |
|
|
|
MTIME,WorkPoint,EATTRIBUTE1) |
|
|
|
SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode , |
|
|
|
'','',c.WarehouseCode,c.LocationCode,c.Quantity, |
|
|
|
'','0','{4}','{5}','0','', |
|
|
|
'','','',f.F_Account ,f.F_RealName , |
|
|
|
SYSDATETIME() ,a.WorkPoint ,'' |
|
|
|
FROM ICSInventoryLot a |
|
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint |
|
|
|
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, jointLotNo, WorkPoint, User, Identification, TransType, BusinessCode); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo166")); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception) |
|
|
@ -1495,7 +1511,7 @@ namespace ICSSoft.DataProject |
|
|
|
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, |
|
|
|
MTIME,WorkPoint,EATTRIBUTE1) |
|
|
|
SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode , |
|
|
|
'','',c.WarehouseCode,c.LocationCode,c.Quantity, |
|
|
|
'','',c.WarehouseCode,c.LocationCode,'{6}', |
|
|
|
'','0','{4}','{5}','0','', |
|
|
|
'','','',f.F_Account ,f.F_RealName , |
|
|
|
SYSDATETIME() ,a.WorkPoint ,'' |
|
|
@ -1505,7 +1521,7 @@ namespace ICSSoft.DataProject |
|
|
|
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location |
|
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, CurrentLotNo, WorkPoint, User, Identification, TransType, BusinessCode); |
|
|
|
sql = string.Format(sql, CurrentLotNo, WorkPoint, User, Identification, TransType, BusinessCode,Quantity); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
@ -2199,6 +2215,7 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
log.Debug(ex.ToString()); |
|
|
|
log.Debug(TransType + Environment.NewLine + ERPupdate); |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -2239,7 +2256,7 @@ namespace ICSSoft.DataProject |
|
|
|
/// <param name="cmd"></param>
|
|
|
|
/// <param name="language"></param>
|
|
|
|
public static void CreateLotNo(string LotNo, string Quantity, string TransCode, string TransSequence, string WorkPoint, string Identification, string User, string InvCode, string BusinessCode, |
|
|
|
string ProjectCode, string BatchCode, string Version, string Brand, string cFree1, string cFree2, string cFree3, string cFree4, string cFree5,string cFree6, string cFree7, string cFree8, string cFree9, string cFree10, SqlCommand cmd, Dictionary<string, string> language,string LocationCode) |
|
|
|
string ProjectCode, string BatchCode, string Version, string Brand, string cFree1, string cFree2, string cFree3, string cFree4, string cFree5,string cFree6, string cFree7, string cFree8, string cFree9, string cFree10, SqlCommand cmd, Dictionary<string, string> language,string LocationCode,string OLDLotNo) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@ -2333,7 +2350,7 @@ namespace ICSSoft.DataProject |
|
|
|
LastPrintUser,LastPrintTime,MUSER,MUSERName,MTIME, |
|
|
|
WorkPoint,EATTRIBUTE1) |
|
|
|
SELECT TOP 1 NEWID(),'{0}','{8}',GETDATE(),'{6}', |
|
|
|
1,'0','{7}','16',null, |
|
|
|
'{1}','0','{7}','16',null, |
|
|
|
null,null,'{2}' ,f.F_RealName ,GETDATE(), |
|
|
|
'{4}' ,'' |
|
|
|
FROM Sys_SRM_User f |
|
|
@ -2354,13 +2371,14 @@ namespace ICSSoft.DataProject |
|
|
|
|
|
|
|
INSERT INTO ICSInventoryLotDetail(LotNo,TransCode,TransSequence,MUSER,MUSERName,MTIME, |
|
|
|
WorkPoint,EATTRIBUTE1) |
|
|
|
SELECT a.LotNo,'{0}','{1}',f.F_Account ,f.F_RealName,GETDATE(), |
|
|
|
SELECT '{4}',b.TransCode,b.TransSequence,f.F_Account ,f.F_RealName,GETDATE(), |
|
|
|
a.WorkPoint,'' |
|
|
|
FROM ICSInventoryLot a |
|
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location |
|
|
|
WHERE a.LotNo='{4}' AND a.WorkPoint='{3}' |
|
|
|
WHERE a.LotNo='{5}' AND a.WorkPoint='{3}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, TransCode, TransSequence, User, WorkPoint, LotNo); |
|
|
|
sql = string.Format(sql, TransCode, TransSequence, User, WorkPoint, LotNo, OLDLotNo); |
|
|
|
|
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|