/// create/Update marking between purhcase order and transfer order /// </summary> /// <param name = "_inventTransId">receipt InventTrans PO</param> /// <param name = "_refInventTransId">Issue InventTrans TO</param> /// <param name = "_qtyToMark">qty</param> public void updateMarking(InventTransId _inventTransId, InventTransId _refInventTransId, Qty _qtyToMark = 0) { Qty qtyToMark; try { TmpInventTransMark tmpInventTransMark; InventTransId issueInventTransId = _inventTransId; InventTransId receiptInventTransId = _refInventTransId; InventTransOriginId receiptInventTransOriginId = InventTransOrigin::findByInventTransId(receiptInventTransId).RecId; InventTrans receiptInventTrans = InventTrans::findByInventTransOrigin(receiptInventTransOriginId); InventTransOriginId issueInventTransOriginId = InventTransOrigin::findByInventTransId(issueInventTransId).RecId; InventTrans issueInventTrans = InventTrans::findByInventTransOrigin(issueInventTransOriginId); InventTransMarkCollection collection = TmpInventTransMark::markingCollection( InventTransOrigin::find(receiptInventTransOriginId), receiptInventTrans.inventDim(), receiptInventTrans.Qty); collection.insertCollectionToTmpTable(tmpInventTransMark); select firstonly tmpInventTransMark where tmpInventTransMark.InventTransOrigin == issueInventTrans.InventTransOrigin && tmpInventTransMark.InventDimId == issueInventTrans.InventDimId; if (tmpInventTransMark.RecId != 0) { qtyToMark = issueInventTrans.Qty; tmpInventTransMark.QtyMarkNow = qtyToMark; tmpInventTransMark.QtyRemain -= tmpInventTransMark.QtyMarkNow; Map mapUpdated = new Map(Types::Int64, Types::Record); mapUpdated.insert(tmpInventTransMark.RecId, tmpInventTransMark); TmpInventTransMark::updateTmpMark( receiptInventTransOriginId, receiptInventTrans.inventDim(), -qtyToMark, mapUpdated.pack()); } } catch (Exception::Error) { throw error(strFmt("FailMarkInventtransaction", _refInventTransId)); } }
This blog is contains coding reference related to Microsoft AX 2012 and D365 finance and operations and Power platform
Tuesday, December 13, 2022
D365FO: Inventory marking between purchase order and transfer order
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment