The below code will used to Receive the transfer order with batch number registration through code
public void processTransferOrder()
{
this.registerInventory("100001");
this.postTransferOrderReceive("10001",systemdateget());
}
public void postTransferOrderReceive(InventTransferOrderId _transferId, TransDate _postingDate)
{
InventTransferTable inventTransferTable;
InventTransferParmTable inventTransferParmTable;
InventTransferUpdReceive inventTransferUpdReceive;
inventTransferTable = InventTransferTable::find(_transferId,true);
if(inventTransferTable.TransferId)
{
inventTransferParmTable.initParmDefault();
inventTransferParmTable.ParmId = RunBaseMultiParm::getSysParmId();
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.UpdateType = InventTransferUpdateType::Receive;
inventTransferParmTable.PrintTransferReceipt = NoYes::No;
inventTransferParmTable.ReceiveUpdateQty = InventTransferReceiveUpdateQty::Registered;
inventTransferParmTable.EditLines = NoYes::Yes;
inventTransferParmTable.ExplodeLines = NoYes::Yes;
inventTransferParmTable.TransDate = _postingDate;
inventTransferUpdReceive = InventTransferUpdReceive::newParmBuffer(inventTransferParmTable);
inventTransferUpdReceive.run();
}
}
public void postTransferOrderReceive(InventTransferOrderId _transferId)
{
InventTransWMS_Register inventTransWMS_register;
TmpInventTransWMS tmpInventTransWMS;
InventTrans inventTranslocal;
InventDim inventDimlocal;
InventTransIdReceive inventTransIdReceive;
while select inventTransferLine
where inventTransferLine.TransferId == _transferId
{
inventTranslocal = InventTrans::findTransId(InventTransferLine.InventTransIdReceive, true);
inventDimlocal = inventTranslocal.inventDim();
if(arrivalDataTmp.InventBatchId)
{
inventDimlocal.inventBatchId = arrivalDataTmp.inventBatchId;
inventDimlocal = InventDim::findOrCreate(inventDimlocal);
inventTranslocal.inventDimId = inventDimlocal.inventDimId;
}
inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
tmpInventTransWMS.clear();
tmpInventTransWMS.initFromInventTrans(inventTranslocal);
tmpInventTransWMS.ItemId = inventTranslocal.ItemId;
tmpInventTransWMS.InventQty = arrivalDataTmp.qty;
if(tmpInventTransWMS.validateWrite())
{
tmpInventTransWMS.insert();
inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS
, inventTranslocal
, inventDimlocal);
inventTransWMS_register.updateInvent(inventTranslocal);
}
}
public void processTransferOrder()
{
this.registerInventory("100001");
this.postTransferOrderReceive("10001",systemdateget());
}
public void postTransferOrderReceive(InventTransferOrderId _transferId, TransDate _postingDate)
{
InventTransferTable inventTransferTable;
InventTransferParmTable inventTransferParmTable;
InventTransferUpdReceive inventTransferUpdReceive;
inventTransferTable = InventTransferTable::find(_transferId,true);
if(inventTransferTable.TransferId)
{
inventTransferParmTable.initParmDefault();
inventTransferParmTable.ParmId = RunBaseMultiParm::getSysParmId();
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.UpdateType = InventTransferUpdateType::Receive;
inventTransferParmTable.PrintTransferReceipt = NoYes::No;
inventTransferParmTable.ReceiveUpdateQty = InventTransferReceiveUpdateQty::Registered;
inventTransferParmTable.EditLines = NoYes::Yes;
inventTransferParmTable.ExplodeLines = NoYes::Yes;
inventTransferParmTable.TransDate = _postingDate;
inventTransferUpdReceive = InventTransferUpdReceive::newParmBuffer(inventTransferParmTable);
inventTransferUpdReceive.run();
}
}
public void postTransferOrderReceive(InventTransferOrderId _transferId)
{
InventTransWMS_Register inventTransWMS_register;
TmpInventTransWMS tmpInventTransWMS;
InventTrans inventTranslocal;
InventDim inventDimlocal;
InventTransIdReceive inventTransIdReceive;
while select inventTransferLine
where inventTransferLine.TransferId == _transferId
{
inventTranslocal = InventTrans::findTransId(InventTransferLine.InventTransIdReceive, true);
inventDimlocal = inventTranslocal.inventDim();
if(arrivalDataTmp.InventBatchId)
{
inventDimlocal.inventBatchId = arrivalDataTmp.inventBatchId;
inventDimlocal = InventDim::findOrCreate(inventDimlocal);
inventTranslocal.inventDimId = inventDimlocal.inventDimId;
}
inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
tmpInventTransWMS.clear();
tmpInventTransWMS.initFromInventTrans(inventTranslocal);
tmpInventTransWMS.ItemId = inventTranslocal.ItemId;
tmpInventTransWMS.InventQty = arrivalDataTmp.qty;
if(tmpInventTransWMS.validateWrite())
{
tmpInventTransWMS.insert();
inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS
, inventTranslocal
, inventDimlocal);
inventTransWMS_register.updateInvent(inventTranslocal);
}
}
Thank you very much! I look for this solution for long time. Your post resolved my problem. Excellent!
ReplyDelete