Hi ! I have a transfer order, and i need to make a receive of only some of the products. The code i have, marks the entire order as received.
If i only execute the last 2 lines of code "itur = InventTransferUpdReceive::newParmBuffer(itpt); itur.run(); ", then nothing gets marked as received. Here is the code:
private void receiveProducts(inventTransferId _transferId, Map mapQtyArtSFull)
{
InventTransferParmTable itpt;
InventTransferParmLine itpl;
InventTransferUpdReceive itur;
boolean transferHasPendingItems;//si aun faltan recibir otros productos, no completo el recibo
WMSJournalTrans wmsJournalTrans;
;
itpt.clear();
itpt.initParmDefault();
//add check to make sure this is only posted if it needs to be posted
itpt.ParmId = RunBaseMultiParm::getSysParmId();
itpt.TransferId = _transferId;
itpt.UpdateType = InventTransferUpdateType::Receive;
itpt.PrintTransferReceipt = NoYes::No;
itpt.ReceiveUpdateQty = InventTransferReceiveUpdateQty::All; //<--funciona con ALL, estaba registered
itpt.EditLines = NoYes::Yes;
itpt.ExplodeLines = NoYes::Yes;
//itpt.InventDimFixedReceiveList = 245; // See note below on how to compute this.
itpt.InventDimFixedReceiveList = 0; // See note below on how to compute this.
itpt.createLines(NoYes::Yes);
while select forUpdate itpl
where itpl.ParmId == itpt.ParmId
{
if (mapQtyArtSFull.exists(itpl.ItemId))
{
itpl.QtyReceiveNow = mapQtyArtSFull.lookup(itpl.ItemId);
}
else
{
itpl.QtyReceiveNow = 0;
}
itpl.update();
}
itur = InventTransferUpdReceive::newParmBuffer(itpt);
itur.run();
}
And this is the code that generates the order:
private InventTransferId inventJournalTransfer(Map mapQtyArtSFull, InventSiteId inventSiteId, InventLocationId inventLocationIdFrom, InventLocationId inventLocationIdTo, PackingSlipId packingList)
{
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
InventTable inventTable;
InventTransferParmLine inventTransferParmLine;
InventTransferParmTable inventTransferParmTable;
inventTransferUpdShip inventTransferUpdShip;
MapEnumerator mapEnumerator;
// Ctr_LogisticSeries ctr_LogisticSeries;
;
//Order headerInventTransferParmLine
inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = InventTransferTable::numberSeq().num();
inventTransferTable.InventLocationIdFrom = inventLocationIdFrom;
inventTransferTable.InventLocationIdTo = inventLocationIdTo;
inventTransferTable.PackingList = PackingList;
inventTransferTable.DlvModeId = CustVendTransportPointLine::defaultDeliveryMode(inventTransferTable.InventLocationIdFrom,'','','','',inventTransferTable.InventLocationIdTo);
inventTransferTable.InventLocationIdTransit = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventLocationIdTransit;
inventTransferTable.initFromAddress();
inventTransferTable.initToAddress();
inventTransferTable.ShipDate = SystemDateget();
inventTransferTable.ReceiveDate = SystemDateget();
if (inventTransferTable.validateWrite())
{
inventTransferTable.insert();
mapEnumerator = mapQtyArtSFull.getEnumerator();
while (mapEnumerator.moveNext())
{
select firstonly inventTable
where inventTable.itemId == mapEnumerator.currentKey();
//Order line
inventDim.clear();
inventDim.InventSiteId = inventSiteId;
inventDim.InventLocationId = inventLocationIdTo;
inventTransferLine.clear();
inventTransferLine.initValue();
inventTransferLine.ItemId = inventTable.ItemId;
inventTransferLine.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.QtyTransfer = mapEnumerator.currentValue();
//inventTransferLine.PackingList = packingList;
inventTransferLine.initFromInventTableModule(InventTableModule::find(inventTransferLine.ItemId,ModuleInventPurchSales::Invent));
inventTransferLine.QtyRemainReceive = inventTransferLine.QtyTransfer;
inventTransferLine.QtyRemainShip = inventTransferLine.QtyTransfer;
inventTransferLine.ShipDate = SystemDateget();
//inventTransferLine.ReceiveDate = str2Date(#ReceiveDate, 213);
inventTransferLine.ReceiveDate = SystemDateget();
inventTransferLine.initFromInventTransferTable(inventTransferTable, false);
inventTransferLine.LineNum = InventTransferLine::lastLineNum(inventTransferLine.TransferId) + 1.0;
if (inventTransferLine.validateWrite())
{
inventTransferLine.insert();
}
else
{
throw error("Order line");
}
}
}
else
throw error("Order header");
//
inventTransferParmTable.clear();
inventTransferParmTable.initParmDefault();
inventTransferParmTable.ParmId = RunBaseMultiParm::getSysParmId();
inventTransferParmTable.TransferId = inventTransferTable.TransferId;
inventTransferParmTable.UpdateType = InventTransferUpdateType::Shipment;
inventTransferParmTable.ShipUpdateQty = InventTransferShipUpdateQty::All;
//inventTransferParmTable.PickUpdateQty = InventTransferPickUpdateQty::AvailableQty;
inventTransferParmTable.EditLines = false;
this.createPickLines(inventTransferParmTable);
//inventTransferParmTable.ExecutedDateTime = systemDateGet()
inventTransferUpdShip = InventTransferUpdShip::newParmBuffer(inventTransferParmTable);
inventTransferUpdShip.run();
return inventTransferTable.TransferId;
}
I googles a lot, tried for days, dunno what else to try . Help please!!
Thanks,
Jorge
*This post is locked for comments