陈季伟 2 years ago
parent
commit
256f442990
  1. 69
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

69
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

@ -899,8 +899,27 @@ namespace ICSSoft.DataProject
List<string> NewBarCodeList = new List<string>();
try
{
///分批前添加日志
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
//检验是否分批
string sql = @"SELECT b.LotEnable,b.PrintEnable FROM ICSInventoryLot a
LEFT JOIN ICSInventory b ON a.InvCode=b.InvCode AND a.WorkPoint=b.WorkPoint
where a.LotNo='{0}' and a.WorkPoint='{1}'
";
sql = string.Format(sql, LotNo, WorkPoint);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count == 0)
{
throw new Exception(language.GetNameByCode("WMSAPIInfo369"));
}
else
{
LotEnable = dt.Rows[0]["LotEnable"].ToString();
PrintEnable = dt.Rows[0]["PrintEnable"].ToString();
}
if (!LotEnable.Equals("False"))
{
///分批前添加日志
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
@ -911,8 +930,8 @@ namespace ICSSoft.DataProject
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,
SELECT NEWID(),'{3}','{7}','{8}',a.LotNo ,a.InvCode ,
c.WarehouseCode,c.LocationCode,'','',c.Quantity+{6},
'','0','{4}','31','0','',
'','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,''
@ -922,30 +941,12 @@ 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, LotNo, WorkPoint, User, Identification, TransType, BusinessCode);
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransType, BusinessCode, Quantity, TransCode, TransSequence);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
}
//检验是否分批
sql = @"SELECT b.LotEnable,b.PrintEnable FROM ICSInventoryLot a
LEFT JOIN ICSInventory b ON a.InvCode=b.InvCode AND a.WorkPoint=b.WorkPoint
where a.LotNo='{0}' and a.WorkPoint='{1}'
";
sql = string.Format(sql, LotNo, WorkPoint);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count == 0)
{
throw new Exception(language.GetNameByCode("WMSAPIInfo369"));
}
else
{
LotEnable = dt.Rows[0]["LotEnable"].ToString();
PrintEnable = dt.Rows[0]["PrintEnable"].ToString();
}
if (!LotEnable.Equals("False"))
{
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
}
#region 获取分批后的条码(lotstr)
sql = @"SELECT TOP 1 LotNO FROM ICSInventoryLot WHERE EATTRIBUTE1='{0}' AND WorkPoint='{1}'
ORDER BY CAST(SUBSTRING(LotNO, (LEN(LotNO)-CHARINDEX('-',REVERSE(LotNO))+1)+1,CHARINDEX('-',REVERSE(LotNO))-1) AS INT) DESC";
@ -1035,28 +1036,22 @@ namespace ICSSoft.DataProject
RETURN
END
IF EXISTS(SELECT id FROM ICSWareHouseLotInfo WHERE WarehouseCode='{9}' AND LocationCode='{10}' AND WorkPoint='{1}' AND LotNo = '{0}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo355")) + @"',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,MergeID)
SELECT NEWID(),'{3}','','',a.LotNo ,a.InvCode ,
c.WarehouseCode,c.LocationCode,'{9}','{10}',{6},
SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode ,
c.WarehouseCode,c.LocationCode,'','',c.Quantity,
'','0','{7}','32','0','',
'','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,'','{11}'
SYSDATETIME() ,a.WorkPoint ,'','{9}'
FROM ICSInventoryLot a
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, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, WarehouseCode, LocationCode, MergeID);
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, MergeID);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{

Loading…
Cancel
Save