Dynamics AX X++ job to fetch On Hand Item data on bases of Inventory dimensions
Static void onHandJob(Args _args)
{
InventOnhand inventOnhand;
InventDim InventDimLocal;
InventSum InventSumLocal;
ItemID itemId,ItemIdLocal;
InventDimParm inventDimParmLocal;
InventBatch inventBatchLocal;
itemid = wmsPickingList_OrderPickTmp.ItemId;
while select InventSumLocal
group by InventSumLocal.ItemId, InventDimLocal.inventBatchId,
InventDimLocal.wmsLocationId, InventDimLocal.LicensePlateId
where InventSumLocal.Closed == NoYes::No
&& InventSumLocal.ClosedQty == NoYes::No
&& InventSumLocal.ItemId == itemid
join InventDimLocal
where InventDimLocal.inventDimId == InventSumLocal.InventDimId
&& InventDimLocal.inventBatchId != ""
&& InventDimLocal.wmsLocationId !=""
{
inventBatchLocal = InventBatch::find(inventDimLocal.InventBatchId,itemid);
/* if (inventBatchLocal.pdsDispositionStatus() == PdsStatus::Available
&& (inventBatchLocal.PdsDispositionCode == "Approved"
|| inventBatchLocal.PdsDispositionCode == "Concess"))
{*/
inventDimParmLocal.initFromInventDim(InventDimLocal);
inventOnhand = InventOnHand::newParameters(itemid,InventDimLocal,inventDimParmLocal);
info(strfmt("%1",InventDimLocal.inventBatchId));
info(strfmt("%1",InventDimLocal.wmsLocationId));
info(strfmt("%1",InventDimLocal.LicensePlateId));
info(strfmt("%1",inventOnhand.physicalInvent()));
//}
}
}
{
InventOnhand inventOnhand;
InventDim InventDimLocal;
InventSum InventSumLocal;
ItemID itemId,ItemIdLocal;
InventDimParm inventDimParmLocal;
InventBatch inventBatchLocal;
itemid = wmsPickingList_OrderPickTmp.ItemId;
while select InventSumLocal
group by InventSumLocal.ItemId, InventDimLocal.inventBatchId,
InventDimLocal.wmsLocationId, InventDimLocal.LicensePlateId
where InventSumLocal.Closed == NoYes::No
&& InventSumLocal.ClosedQty == NoYes::No
&& InventSumLocal.ItemId == itemid
join InventDimLocal
where InventDimLocal.inventDimId == InventSumLocal.InventDimId
&& InventDimLocal.inventBatchId != ""
&& InventDimLocal.wmsLocationId !=""
{
inventBatchLocal = InventBatch::find(inventDimLocal.InventBatchId,itemid);
/* if (inventBatchLocal.pdsDispositionStatus() == PdsStatus::Available
&& (inventBatchLocal.PdsDispositionCode == "Approved"
|| inventBatchLocal.PdsDispositionCode == "Concess"))
{*/
inventDimParmLocal.initFromInventDim(InventDimLocal);
inventOnhand = InventOnHand::newParameters(itemid,InventDimLocal,inventDimParmLocal);
info(strfmt("%1",InventDimLocal.inventBatchId));
info(strfmt("%1",InventDimLocal.wmsLocationId));
info(strfmt("%1",InventDimLocal.LicensePlateId));
info(strfmt("%1",inventOnhand.physicalInvent()));
//}
}
}
Comments
Post a Comment