@ -1001,6 +1001,20 @@ namespace ICSSoft.DataProject
}
if ( ! LotEnable . Equals ( "False" ) )
{
///更新库存
sql = @ "UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)-'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'
IF EXISTS ( SELECT a . LotNo FROM ICSWareHouseLotInfo a WHERE a . LotNo = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' AND Quantity < 0 )
BEGIN
RAISERROR ( ' " + language.GetNameByCode(" WMSAPIInfo167 ") + @" ' , 1 6 , 1 ) ;
RETURN
END ";
sql = string . Format ( sql , LotNo , WorkPoint , Quantity ) ;
if ( ! DBHelper . ExecuteNonQuery ( sql , cmd ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo168" ) ) ; //"库存更新失败!");
}
///分批前添加日志
sql = @ "IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
@ -1067,7 +1081,7 @@ namespace ICSSoft.DataProject
}
#endregion
sql = @ "INSERT INTO ICSWareHouseLotInfo(ID,LotNO,WarehouseCode,LocationCode,InvCode,Quantity,InDate,LockQuantity,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
select NEWID ( ) , ' { 0 } ' , WarehouseCode , LocationCode , InvCode , '0 ', InDate , LockQuantity
select NEWID ( ) , ' { 0 } ' , WarehouseCode , LocationCode , InvCode , ' { 2 } ' , InDate , LockQuantity
, MUSER , MUSERName , GETDATE ( ) , ' { 3 } ',' '
from ICSWareHouseLotInfo
where LotNO = ' { 1 } ' AND WorkPoint = ' { 3 } ' ";
@ -1097,7 +1111,7 @@ namespace ICSSoft.DataProject
ERPDetailID , ERPCode , ERPSequence , MUSER , MUSERName ,
MTIME , WorkPoint , EATTRIBUTE1 , LogID )
SELECT NEWID ( ) , ' { 3 } ',' { 4 } ',' { 5 } ',' { 1 0 } ' , a . InvCode ,
c . WarehouseCode , c . LocationCode , ' ',' ',' { 6 } ' ,
c . WarehouseCode , c . LocationCode , ' { 1 1 } ',' { 1 2 } ',' { 6 } ' ,
' ',' 0 ',' { 7 } ',' { 8 } ',' 0 ',' ' ,
' ',' ',' ' , f . F_Account , f . F_RealName ,
SYSDATETIME ( ) , a . WorkPoint , ' ',' { 9 } '
@ -1106,7 +1120,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 , LotNo , WorkPoint , User , Identification , TransCode , TransSequence , Quantity , TransType , BusinessCode , MergeID , lotstr ) ;
sql = string . Format ( sql , LotNo , WorkPoint , User , Identification , TransCode , TransSequence , Quantity , TransType , BusinessCode , MergeID , lotstr , WarehouseCode , LocationCode ) ;
cmd . CommandText = sql ;
result = cmd . ExecuteNonQuery ( ) ;
if ( result < = 0 )
@ -1176,7 +1190,7 @@ namespace ICSSoft.DataProject
Memo , Lock , TransType , BusinessCode , ERPUpload , ERPID ,
ERPDetailID , ERPCode , ERPSequence , MUSER , MUSERName ,
MTIME , WorkPoint , EATTRIBUTE1 , MergeID )
SELECT NEWID ( ) , ' { 3 } ',' ',' ' , a . LotNo , a . InvCode ,
SELECT NEWID ( ) , ' { 3 } ',' { 4 } ',' { 5 } ' , a . LotNo , a . InvCode ,
c . WarehouseCode , c . LocationCode , ' { 9 } ',' { 1 0 } ' , { 6 } ,
' ',' 0 ',' { 7 } ',' { 8 } ',' 0 ',' ' ,
' ',' ',' ' , f . F_Account , f . F_RealName ,
@ -1192,6 +1206,21 @@ namespace ICSSoft.DataProject
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo166" ) ) ;
}
///更新库存
sql = @ "UPDATE ICSWareHouseLotInfo SET WareHouseCode='{2}',LocationCode='{3}' WHERE LotNo='{0}' AND WorkPoint='{1}'
IF EXISTS ( SELECT a . LotNo FROM ICSWareHouseLotInfo a WHERE a . LotNo = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' AND Quantity < 0 )
BEGIN
RAISERROR ( ' " + language.GetNameByCode(" WMSAPIInfo167 ") + @" ' , 1 6 , 1 ) ;
RETURN
END ";
sql = string . Format ( sql , LotNo , WorkPoint , WarehouseCode , LocationCode ) ;
if ( ! DBHelper . ExecuteNonQuery ( sql , cmd ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo168" ) ) ; //"库存更新失败!");
}
}
}