InventQty reservedPhysicalReceiptQty;calculateOrders:
// Insert after process receipts // Process receipts - physical reserved this.vkProcessReceiptsReservedPhysical( _salesTmpATP, itemId, atpEndDate, supplyStartDate, atpDateForPastSupply, _inventTransId, _inventDimCriteria, _inventDimParm);Basically it is almost copy of processReceipts method with small changes highlighted with comments
protected void vkProcessReceiptsReservedPhysical( SalesTmpATP _salesTmpATP, ItemId _itemId, date _atpEndDate, date _supplyStartDate, date _atpDateForPastSupply, InventTransId _inventTransId, InventDim _inventDimCriteria, InventDimParm _inventDimParm) { InventTrans inventTrans; InventTransOrigin inventTransOrigin; InventTransOriginTransfer inventTransOriginTransfer; InventTrans inventTransTransfer; InventDim inventDimTransfer; InventDim inventDim; // Calculate receipts - don't include transfers if a corresponding counterpart issue transaction exist with same grouping inventory dimensions. // Notice quarantine orders and wms orders are not linked together by the table inventTransOriginTransfer - instead the receipt and issue inventTrans have same inventTransOrigin. while select forceplaceholders DateExpected, sum (Qty) from inventTrans group by DateExpected where inventTrans.ItemId == _itemId && inventTrans.Qty >0 // receipt && inventTrans.DateExpected <= _atpEndDate && (inventTrans.DateExpected >= _supplyStartDate && (inventTrans.StatusReceipt == StatusReceipt::Arrived || inventTrans.StatusReceipt == StatusReceipt::Ordered)) && inventTrans.StatusIssue == StatusIssue::None // to enable StatusItem index join TableId from inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin && inventTransOrigin.InventTransId != _inventTransId outer join TableId from inventTransOriginTransfer where inventTransOriginTransfer.ReceiptInventTransOrigin == inventTransOrigin.RecId #inventDimExistsJoin(inventTrans.inventDimId, inventDim, _inventDimCriteria, _inventDimParm) // notexists -> exists exists join inventTransTransfer where inventTransTransfer.ItemId == _itemId && inventTransTransfer.StatusReceipt == StatusReceipt::None && inventTransTransfer.StatusIssue == StatusIssue::ReservPhysical // == StatusIssue::ReservPhysical instead of range && ( inventTransTransfer.InventTransOrigin == inventTrans.InventTransOrigin || inventTransTransfer.InventTransOrigin == inventTransOriginTransfer.IssueInventTransOrigin) #inventDimExistsJoin(inventTransTransfer.inventDimId,inventDimTransfer,_inventDimCriteria,_inventDimParm) { reservedPhysicalReceiptQty += inventTrans.Qty; this.updateSalesTmpATPWithReceipt( _salesTmpATP, inventTrans, _atpDateForPastSupply); } }currentOnHand:
return InventSum::findSumQty(_itemId, _inventDimCriteria, _inventDimParm).PhysicalInvent;
return InventSum::findSumQty(_itemId, _inventDimCriteria, _inventDimParm).PhysicalInvent - reservedPhysicalReceiptQty;
If you found value in what I share, I've set up a Buy Me a Coffee page as a way to show your support.
Buy Me a CoffeeNo comments. Be the first one to comment on this post.
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics 365 FO.
Authors are allowed to set their own "buy me a coffee" link.
Join us.