Monday, January 23, 2023

D365FO: Update inventory marking

if (updateMarking)
{
	InventDim inventDim = InventDim::find(currInventTransferLine.inventDimId);
	InventDimParm inventDimParm;
	inventDimParm.initFromInventDim(inventDim);

	InventTransOriginId receiptInventTransOriginId = InventTransOrigin::findByInventTransId(currInventTransferLine.InventTransId).RecId;

	InventTransOriginId issueInventTransOriginId = InventTransOrigin::findByInventTransId(currPurchLine.InventTransId).RecId;

	qty markedQty = InventTransOrigin::updateMarking(
						receiptInventTransOriginId,
						issueInventTransOriginId,
						-currInventTransferLine.QtyTransfer,
						'',
						SortOrder::Ascending,
						false,
						inventDim,
						inventDimParm);

	if (markedQty)
	{
		markedQty = InventTransOrigin::updateMarking(
						issueInventTransOriginId,
						receiptInventTransOriginId,
						currInventTransferLine.QtyTransfer,
						'',
						SortOrder::Ascending,
						false,
						inventDim,
						inventDimParm);
	}
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8