diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs index aa99671..ab7bb24 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs @@ -626,7 +626,7 @@ a.ExtensionID tableName = @"ICSCheck a "; - where = @" a.CheckCode='{0}' AND a.WorkPoint='{1}' "; + where = @" a.CheckCode='{0}' AND a.WorkPoint='{1}' and a.Status='1'"; } #endregion #region 一步调拨(合并发料) @@ -12023,7 +12023,7 @@ END"; RETURN END INSERT INTO ICSCheck (ID,CheckCode,SelectLevel,Status,Quantity,Amount,MUSER,MUSERName,MTIME,WorkPoint) - SELECT NEWID(),'{0}','{1}','2',SUM(a.Quantity),0,b.F_Account,b.F_RealName,GETDATE(),b.F_Location + SELECT NEWID(),'{0}','{1}','1',SUM(a.Quantity),0,b.F_Account,b.F_RealName,GETDATE(),b.F_Location FROM ICSWareHouseLotInfo a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' WHERE SUBSTRING(a.LocationCode,1,{4}) = '{1}' @@ -12152,7 +12152,7 @@ END"; BEGIN IF ('{5}'='初盘') BEGIN - UPDATE a SET PrimaryQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE() + UPDATE a SET PrimaryQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE(),EATTRIBUTE1='1' FROM ICSCheckDetail a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON a.CheckID=c.ID AND a.WorkPoint=c.WorkPoint @@ -12160,7 +12160,7 @@ END"; END ELSE IF ('{5}'='抽盘') BEGIN - UPDATE a SET CheckQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE() + UPDATE a SET CheckQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE(),EATTRIBUTE1='3' FROM ICSCheckDetail a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON a.CheckID=c.ID AND a.WorkPoint=c.WorkPoint @@ -12168,7 +12168,7 @@ END"; END ELSE BEGIN - UPDATE a SET ReplayQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE() + UPDATE a SET ReplayQuantity='{4}',MUSER=b.F_Account,MUSERName=b.F_RealName,MTIME=GETDATE(),EATTRIBUTE1='2' FROM ICSCheckDetail a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON a.CheckID=c.ID AND a.WorkPoint=c.WorkPoint @@ -12179,8 +12179,8 @@ END"; BEGIN IF ('{5}'='初盘') BEGIN - INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint) - SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','{4}','0','0','0','0','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint + INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1) + SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','{4}','0','0','0','0','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint,'1' FROM ICSWareHouseLotInfo a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON SUBSTRING(a.LocationCode,1,len(c.SelectLevel))=c.SelectLevel @@ -12188,8 +12188,8 @@ END"; END ELSE IF ('{5}'='抽盘') BEGIN - INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint) - SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','0','0','0','0','{4}','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint + INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1) + SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','0','0','0','0','{4}','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint,'3' FROM ICSWareHouseLotInfo a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON SUBSTRING(a.LocationCode,1,len(c.SelectLevel))=c.SelectLevel @@ -12197,8 +12197,8 @@ END"; END ELSE BEGIN - INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint) - SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','0','0','{4}','0','0','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint + INSERT INTO ICSCheckDetail (ID,CheckID,LotNo,Quantity,Amount,PrimaryQuantity,PrimaryAmount,ReplayQuantity,ReplayAmount,CheckQuantity,CheckAmount,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1) + SELECT NEWID(),c.ID,a.LotNo,a.Quantity,'0','0','0','{4}','0','0','0',b.F_Account,b.F_RealName,GETDATE(),a.WorkPoint,'2' FROM ICSWareHouseLotInfo a INNER JOIN Sys_SRM_User b ON b.F_Account='{2}' AND b.F_Location='{3}' LEFT JOIN ICSCheck c ON SUBSTRING(a.LocationCode,1,len(c.SelectLevel))=c.SelectLevel @@ -12212,6 +12212,15 @@ END"; throw new Exception(language.GetNameByCode("WMSAPIInfo033"));//"盘点扫描创建失败!"); } + ///更新库存 + sql = @"UPDATE ICSWareHouseLotInfo SET LockQuantity='{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'"; + sql = string.Format(sql, itemInfo.LotNo, item.WorkPoint, itemInfo.ActualQuantity); + + if (!DBHelper.ExecuteNonQuery(sql, cmd)) + { + throw new Exception(language.GetNameByCode("WMSAPIInfo168"));//"库存更新失败!"); + } + #region 更新ICSCheckDetail表 //string strSql = @"UPDATE ICSCheckDetail Set"; @@ -12232,10 +12241,10 @@ END"; #endregion #region 更新库存 - if (item.UpdateWHLI) - { - ICSWareHouseLotInfoService.WareHouseLotInfoUpdate(Identification, item.CheckCode, "", itemInfo.LotNo, itemInfo.ActualQuantity, item.User, item.WorkPoint, TransTypeEnum.Check.GetDescription(), item.CheckKind, cmd, language); - } + //if (item.UpdateWHLI) + //{ + // ICSWareHouseLotInfoService.WareHouseLotInfoUpdate(Identification, item.CheckCode, "", itemInfo.LotNo, itemInfo.ActualQuantity, item.User, item.WorkPoint, TransTypeEnum.Check.GetDescription(), item.CheckKind, cmd, language); + //} #endregion lots += "'" + itemInfo.LotNo + item.WorkPoint + "',"; } diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs index 5bb063c..2cd942d 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs @@ -2700,13 +2700,22 @@ namespace ICSSoft.DataProject throw new Exception(language.GetNameByCode("WMSAPIInfo166")); } ///更新库存 - sql = @"UPDATE ICSWareHouseLotInfo SET Quantity='{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'"; + sql = @"UPDATE ICSWareHouseLotInfo SET Quantity='{2}',LockQuantity=LockQuantity-{2} WHERE LotNo='{0}' AND WorkPoint='{1}'"; sql = string.Format(sql, LotNo, WorkPoint, Quantity); if (!DBHelper.ExecuteNonQuery(sql, cmd)) { throw new Exception(language.GetNameByCode("WMSAPIInfo168"));//"库存更新失败!"); } + + ///更新库存 + sql = @"UPDATE ICSCheck SET Status='2' WHERE CHeckCode='{0}' AND WorkPoint='{1}'"; + sql = string.Format(sql, TransCode, WorkPoint); + + if (!DBHelper.ExecuteNonQuery(sql, cmd)) + { + throw new Exception("盘点状态更新失败!");//"库存更新失败!"); + } ///添加日志 sql = @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode, FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,