@ -7400,7 +7400,8 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
LEFT JOIN ICSWarehouse wh ON a . WHCode = wh . WarehouseCode AND a . WorkPoint = wh . WorkPoint
LEFT JOIN ICSInventoryBatchEnable invBat ON a . INVCode = invBat . InvCode AND a . WHCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint
WHERE a . MTDOCCode = ' { JsonData . TransCode } '
AND a . WorkPoint = ' { JsonData . WorkPoint } ' ";
AND a . WorkPoint = ' { JsonData . WorkPoint } '
AND a . MTDOCType = '1' ";
#endregion
DataTable table = DBHelper . SQlReturnData ( sql , cmd ) ;
@ -7683,6 +7684,29 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
StringBuilder sql = new StringBuilder ( ) ;
foreach ( var item in JsonData )
{
string doc = $@"SELECT ExtensionID,INVCode,MTDOCType FROM ICSMTDOC a WHERE a.MTDOCCode= '{item.TransCode}' AND a.Sequence= '{item.TransSequence}' AND a.WorkPoint= '{item.WorkPoint}'" ;
DataTable dataTable = DBHelper . SQlReturnData ( doc , cmd ) ;
string afterInvCode = String . Empty ;
string afterExtensionID = String . Empty ;
string beforInvCode = String . Empty ;
string beforExtensionID = String . Empty ;
if ( dataTable ! = null & & dataTable . Rows . Count > 0 )
{
if ( dataTable . Rows [ 0 ] [ "MTDOCType" ] . ToString ( ) = = "1" )
{
beforInvCode = dataTable . Rows [ 0 ] [ "INVCode" ] . ToString ( ) ;
beforExtensionID = dataTable . Rows [ 0 ] [ "ExtensionID" ] . ToString ( ) ;
afterInvCode = dataTable . Rows [ 1 ] [ "INVCode" ] . ToString ( ) ;
afterExtensionID = dataTable . Rows [ 1 ] [ "ExtensionID" ] . ToString ( ) ;
}
else
{
beforInvCode = dataTable . Rows [ 1 ] [ "INVCode" ] . ToString ( ) ;
beforExtensionID = dataTable . Rows [ 1 ] [ "ExtensionID" ] . ToString ( ) ;
afterInvCode = dataTable . Rows [ 0 ] [ "INVCode" ] . ToString ( ) ;
afterExtensionID = dataTable . Rows [ 0 ] [ "ExtensionID" ] . ToString ( ) ;
}
}
foreach ( var data in item . DetailModels )
{
//修改源头单据
@ -7692,23 +7716,23 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
if ( TransType = = "13" )
{
//形态转换
sql . Append ( $ @ "UPDATE ICSWareHouseLotInfo SET InvCode='{item.A fterInvCode}' WHERE LotNo='{data.LotNo}' AND WorkPoint='{item.WorkPoint}' AND InvCode='{item.B eforInvCode}' AND WarehouseCode='{item.WHCode}';
UPDATE ICSWareHouseLotInfoLog SET InvCode = ' ' WHERE LotNo = ' { data . LotNo } ' AND WorkPoint = ' { item . WorkPoint } ' AND InvCode = ' { item . B eforInvCode} ' ;
UPDATE ICSInventoryLot SET InvCode = ' { item . A fterInvCode} ' WHERE LotNo = ' { data . LotNo } ' AND InvCode = ' { item . B eforInvCode} ' AND WorkPoint = ' { item . WorkPoint } ' AND ExtensionID = ' { item . B eforExtensionID} ' ; ");
sql . Append ( $ @ "UPDATE ICSWareHouseLotInfo SET InvCode='{a fterInvCode}' WHERE LotNo='{data.LotNo}' AND WorkPoint='{item.WorkPoint}' AND InvCode='{b eforInvCode}' AND WarehouseCode='{item.WHCode}';
UPDATE ICSWareHouseLotInfoLog SET InvCode = ' ' WHERE LotNo = ' { data . LotNo } ' AND WorkPoint = ' { item . WorkPoint } ' AND InvCode = ' { b eforInvCode} ' ;
UPDATE ICSInventoryLot SET InvCode = ' { a fterInvCode} ' WHERE LotNo = ' { data . LotNo } ' AND InvCode = ' { b eforInvCode} ' AND WorkPoint = ' { item . WorkPoint } ' AND ExtensionID = ' { b eforExtensionID} ' ; ");
sql . Append ( $ @ "INSERT INTO [dbo].[ICSWareHouseLotInfoLog] ([ID], [Identification], [TransCode], [TransSequence], [LotNo], [InvCode], [FromWarehouseCode], [FromLocationCode], [ToWarehouseCode], [ToLocationCode], [Quantity], [Memo], [Lock], [TransType], [BusinessCode], [ERPUpload], [ERPID], [ERPDetailID], [ERPCode], [ERPSequence], [LogID], [MergeID], [MUSER], [MUSERName], [MTIME], [WorkPoint], [EATTRIBUTE1], [EATTRIBUTE2], [EATTRIBUTE3])
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { item . B eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 5 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { item . B eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { b eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 5 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { b eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
sql . Append ( $ @ "INSERT INTO [dbo].[ICSWareHouseLotInfoLog] ([ID], [Identification], [TransCode], [TransSequence], [LotNo], [InvCode], [FromWarehouseCode], [FromLocationCode], [ToWarehouseCode], [ToLocationCode], [Quantity], [Memo], [Lock], [TransType], [BusinessCode], [ERPUpload], [ERPID], [ERPDetailID], [ERPCode], [ERPSequence], [LogID], [MergeID], [MUSER], [MUSERName], [MTIME], [WorkPoint], [EATTRIBUTE1], [EATTRIBUTE2], [EATTRIBUTE3])
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { item . A fterInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 6 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { item . B eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { a fterInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 6 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { b eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
}
else if ( TransType = = "12" )
{
sql . Append ( $@"UPDATE ICSInventoryLot SET ExtensionID='{item.AfterExtensionID}' WHERE LotNo='{data.LotNo}' AND InvCode='{item.BeforInvCode}' AND WorkPoint='{item.WorkPoint}' AND ExtensionID='{item.B eforExtensionID}';" ) ;
sql . Append ( $@"UPDATE ICSInventoryLot SET ExtensionID='{afterExtensionID}' WHERE LotNo='{data.LotNo}' AND InvCode='{beforInvCode}' AND WorkPoint='{item.WorkPoint}' AND ExtensionID='{b eforExtensionID}';" ) ;
sql . Append ( $ @ "INSERT INTO [dbo].[ICSWareHouseLotInfoLog] ([ID], [Identification], [TransCode], [TransSequence], [LotNo], [InvCode], [FromWarehouseCode], [FromLocationCode], [ToWarehouseCode], [ToLocationCode], [Quantity], [Memo], [Lock], [TransType], [BusinessCode], [ERPUpload], [ERPID], [ERPDetailID], [ERPCode], [ERPSequence], [LogID], [MergeID], [MUSER], [MUSERName], [MTIME], [WorkPoint], [EATTRIBUTE1], [EATTRIBUTE2], [EATTRIBUTE3])
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { item . B eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 5 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { item . B eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { b eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 5 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { b eforExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
sql . Append ( $ @ "INSERT INTO [dbo].[ICSWareHouseLotInfoLog] ([ID], [Identification], [TransCode], [TransSequence], [LotNo], [InvCode], [FromWarehouseCode], [FromLocationCode], [ToWarehouseCode], [ToLocationCode], [Quantity], [Memo], [Lock], [TransType], [BusinessCode], [ERPUpload], [ERPID], [ERPDetailID], [ERPCode], [ERPSequence], [LogID], [MergeID], [MUSER], [MUSERName], [MTIME], [WorkPoint], [EATTRIBUTE1], [EATTRIBUTE2], [EATTRIBUTE3])
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { item . B eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 6 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { item . A fterExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
SELECT NEWID ( ) , NEWID ( ) , ' { item . TransCode } ' , ' { item . TransSequence } ' , ' { data . LotNo } ' , ' { b eforInvCode} ' , { item . WHCode } , NULL , NULL , NULL , { data . Quantity } , NULL , '0' , N ' 1 0 ' , N ' 3 6 ' , '0' , NULL , NULL , NULL , NULL , NULL , NULL , f . F_Account , f . F_RealName , SYSDATETIME ( ) , ' { item . WorkPoint } ' , NULL , NULL , ' { a fterExtensionID} ' FROM Sys_SRM_User f WHERE f . F_Account = ' { item . User } ' ; ");
}
else