From 93843591cc5f41b8e8c7480f1eb57ac1d114898c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=92=E6=9E=97=E6=9D=B0?= <1205395967@qq.com> Date: Fri, 23 Sep 2022 17:59:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=8B=A8=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ICSWareHouseLotInfoService.cs | 69 +++++++++---------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs index e593499..594ac4e 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs @@ -899,8 +899,27 @@ namespace ICSSoft.DataProject List NewBarCodeList = new List(); 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)) {