Posts Tagged ‘InventOnHand’

What the difference between InventOnHand and InventDimOnHand classes and in what cases they must be used?

Axapta InventOnHand class is wrapper for InventSum table. Unique index for InventSum table is ItemId + InventDimId. In other word, this class is used to get on hand for item with specific dimension. For example, if you require getting on-hand qty for “Bottle” items that have “green” color, “standard” size and are stored in “22” warehouse, “1” Aisle, “4” Shelf then you use InventOnHand class.

But, if you require getting on-hand qty for warehouse location then InventOnHand class couldn’t help us. Because one location could contains different items. Or if you require get on-hand qty for pallet. In these cases InventDimOnHand class must be used. This class is used when you require on-hand qty for specific inventDim. InventDimOnHand сlass consists of InventDimOnHandMember classes. Each InventDimOnHandMember class contains information about Item, Dimensions and Qty.

Example: “Get location on-hand”

static void rmsOnHandQty(Args _args)
{
WMSLocation wmsLocation;
InventDim inventDimLocal;
InventDimParm inventDimParmCriteria;
InventDimOnHand inventDimOnHand;
InventDimOnHandIterator inventDimOnHandIterator;
InventDimOnHandMember inventDimOnHandMember;
Qty qty;
;

select firstonly wmsLocation;

inventDimLocal.InventLocationId = wmsLocation.inventLocationId;
inventDimLocal.wMSLocationId = wmsLocation.wMSLocationId;
inventDimLocal = InventDim::findOrCreate(inventDimLocal);

inventDimParmCriteria.wmsLocationIdFlag = NoYes::Yes;
inventDimParmCriteria.InventLocationIdFlag = NoYes::Yes;

inventDimOnHand = InventDimOnHand::newPhysicalArrived('', inventDimLocal, inventDimParmCriteria, inventDimOnHandLevel::Item, null);
inventDimOnHandIterator = inventDimOnHand.onHandIterator();
while (inventDimOnHandIterator.more())
{
inventDimOnHandMember = inventDimOnHandIterator.value();
qty += inventDimOnHandMember.parmInventQty();
inventDimOnHandIterator.next();
}

info(strfmt("%1 location has %2 items", wmsLocation.wMSLocationId, num2str(qty,2,2,1,1)));
}

Advertorial
Facebook page
Google Translate