Hi! Use the following code to get On-hand values for specific item + dimensions (warehouse, configuration, size and color) per warehouse, location, pallet, batch.
Set required ItemId and inventDim (inventDim should contain warehouse, configuration, size and color values).
static void availPhysical(Args _args)
{
InventSum inventSum;
InventSumDelta inventSumDelta;
InventDim sumInventDim;
ItemId itemId = 'ItemId_Here';
InventDim inventDim = InventDim::find('ItemInventDim_Here');
WMSLocation wmsLocation;
createdTransactionId ttsId;
;
while select sum(AvailPhysical)
from inventSum
where (inventSum.ItemId == itemId) &&
(!inventSum.Closed) && (!inventSum.ClosedQty) &&
(inventSum.AvailPhysical != 0)
join sumInventDim
group by InventLocationId, wMSLocationId, wMSPalletId, InventBatchId
where (sumInventDim.InventDimId == inventSum.InventDimId) &&
(sumInventDim.InventLocationId == inventDim.InventLocationId) &&
(sumInventDim.configId == inventDim.configId) &&
(sumInventDim.InventSizeId == inventDim.InventSizeId) &&
(sumInventDim.InventColorId == inventDim.InventColorId)
exists join wmsLocation
where (wmsLocation.InventLocationId == sumInventDim.InventLocationId) &&
(wmsLocation.wMSLocationId == sumInventDim.wMSLocationId) &&
((wmsLocation.locationType == WMSLocationType::Buffer) ||
(wmsLocation.locationType == WMSLocationType::Pick))
{
//do something
//sumInventDim.InventLocationId,
//sumInventDim.wMSLocationId,
//sumInventDim.wMSPalletId,
//sumInventDim.InventBatchId,
//inventSum.AvailPhysical,
}
if (appl.inventUpdateOnhandGlobal().inventUpdateOnhand().mustAddInventSumDeltaOnhand(itemId))
{
ttsId = appl.inventUpdateOnhandGlobal().inventUpdateOnhand().ttsId();
while select sum(AvailPhysical)
from inventSumDelta
where (inventSumDelta.ItemId == itemId) &&
(inventSumDelta.TTSId == ttsId) &&
(inventSumDelta.IsAggregated == NoYes::No) &&
(inventSumDelta.AvailPhysical != 0)
join sumInventDim
group by InventLocationId, wMSLocationId, wMSPalletId, InventBatchId
where (sumInventDim.InventDimId == inventSumDelta.InventDimId) &&
(sumInventDim.InventLocationId == inventDim.InventLocationId) &&
(sumInventDim.configId == inventDim.configId) &&
(sumInventDim.InventSizeId == inventDim.InventSizeId) &&
(sumInventDim.InventColorId == inventDim.InventColorId)
exists join wmsLocation
where (wmsLocation.InventLocationId == sumInventDim.InventLocationId) &&
(wmsLocation.wMSLocationId == sumInventDim.wMSLocationId) &&
((wmsLocation.locationType == WMSLocationType::Buffer) ||
(wmsLocation.locationType == WMSLocationType::Pick))
{
//do something
//sumInventDim.InventLocationId,
//sumInventDim.wMSLocationId,
//sumInventDim.wMSPalletId,
//sumInventDim.InventBatchId,
//inventSumDelta.AvailPhysical,
}
}
}