Hi
I am using below piece of code to calculate on hand for an item. Generally it works fine, however for the items that are used in the WHS processes the value returned is wrong. Basically inventOnHand.availPhysical() method fails, i have added the code form std Ax , for the "AvailPhysical method looks like it not returning correct values. Does anyone encountered it before?
public InventQtyAvailPhysical A_onHand()
{
InventDim inventDim;
InventOnHand inventOnhand;
InventDimParm InventDimParm;
;
InventDimParm.initFromInventDim(inventDim);
inventOnhand = inventOnhand::newParameters(this.ItemId, inventDim, InventDimParm);
return inventOnhand.availPhysical();
}
STD AX code:
/// <summary>
/// Gets the the quantity available for physical reservation.
/// </summary>
/// <returns>
/// The quantity in the inventory unit.
/// </returns>
public InventQtyAvailPhysical availPhysical()
{
// Don't do math for this quantity, instead use the value in InventSum
// because it's the correct number for WHS Items
if (itemUsesWHS)
{
this.setInventSum();
this.setAvailability();
return inventSum.AvailPhysical;
}
else
{
return (this.physicalInvent() - this.reservPhysical());
}
}
Thanks
P
*This post is locked for comments
Hi,
We have encountered the same issue. The main thing is considering Physical On Hand form's attidute in Warehouse Management module as reference.
I'm not a developer, so I can't provide you the code but, we develop our codes to show On-hand based on WhsInventReserve table.
I hope that information helps.
Hello Pradeep,
The below code will works for you. It returns Available physical items from Warehouse.
static void Job3(Args _args)
{
InventOnhand inventOnhand;
InventDim inventDim;
InventDimParm inventDimParm;
ItemId itemId;
InventQty availQty;
;
itemId = 'PN-VC841A';
inventDim.InventSiteId = 'ENPRO'; //site
inventDim.InventLocationId = 'IT-KHB'; //WHS
inventDimParm.initFromInventDim(inventDim);
inventOnhand = InventOnhand::newParameters(itemId, inventDim, inventDimParm);
availQty = inventOnhand.availPhysical();
info(strFmt("%1", availQty));
}
Regards,
Faqru
I did every piece of bit..This issue happens only for item with WHS enabled as described by Pradeep..For rest items the code works fine.
Hello Pradeep,
I am encountering the same issue. Can you help me with the piece of code what you did in order to resolve this issue?
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156