This job helps to find the Item On-hand by using the Select statement. It loops through the Inventsum and groups by Inventory dimension. You can add/remove the dimension of the InventDim table.
void exportItemOnHand()
{
InventTable invTable;
InventSum inventSum;
InventDim inventDim, inventDim1;
InventDimParm invDimParm;
Qty availPhysical;
TextBuffer tb;
;
tb = new TextBuffer();
tb.appendText("Company,Item number,Site,Warehouse,Location,Configuration,Size,On-hand\n");
select invTable where invTable.ItemId == "011029";
while select inventSum
join inventDim
group by InventSiteid, InventLocationId, WMSLocationId, ConfigId, InventSizeId
where inventSum.InventDimId == inventDim.inventDimId
&& inventSum.Closed == NoYes::No
&& invTable.ItemId == inventSum.ItemId
{
inventDim1.InventSiteId = inventDim.InventSiteId;
inventDim1.InventLocationId = inventDim.InventLocationId;
inventDim1.wMSLocationId = inventDim.wMSLocationId;
inventDim1.configId = inventDim.configId;
inventDim1.InventSizeId = inventDim.InventSizeId;
inventDim1 = InventDim::findOrCreate(inventDim1);
invDimParm.initFromInventDim(InventDim::find(inventDim1.inventDimId));
availPhysical = InventSum::findSum(invTable.ItemId, inventDim1, invDimParm).availPhysical();
tb.appendText(strfmt("%1,%2,%3,%4,%5,%6,%7,%8\n", strupr(curext()), invTable.ItemId, inventDim1.InventSiteId, inventDim1.InventLocationId,
inventDim1.wMSLocationId, inventDim1.configId, inventDim1.InventSizeId, availPhysical));
}
tb.toFile("D:\sample.txt");
}
Regards,
K. Arunsubrmaniam
void exportItemOnHand()
{
InventTable invTable;
InventSum inventSum;
InventDim inventDim, inventDim1;
InventDimParm invDimParm;
Qty availPhysical;
TextBuffer tb;
;
tb = new TextBuffer();
tb.appendText("Company,Item number,Site,Warehouse,Location,Configuration,Size,On-hand\n");
select invTable where invTable.ItemId == "011029";
while select inventSum
join inventDim
group by InventSiteid, InventLocationId, WMSLocationId, ConfigId, InventSizeId
where inventSum.InventDimId == inventDim.inventDimId
&& inventSum.Closed == NoYes::No
&& invTable.ItemId == inventSum.ItemId
{
inventDim1.InventSiteId = inventDim.InventSiteId;
inventDim1.InventLocationId = inventDim.InventLocationId;
inventDim1.wMSLocationId = inventDim.wMSLocationId;
inventDim1.configId = inventDim.configId;
inventDim1.InventSizeId = inventDim.InventSizeId;
inventDim1 = InventDim::findOrCreate(inventDim1);
invDimParm.initFromInventDim(InventDim::find(inventDim1.inventDimId));
availPhysical = InventSum::findSum(invTable.ItemId, inventDim1, invDimParm).availPhysical();
tb.appendText(strfmt("%1,%2,%3,%4,%5,%6,%7,%8\n", strupr(curext()), invTable.ItemId, inventDim1.InventSiteId, inventDim1.InventLocationId,
inventDim1.wMSLocationId, inventDim1.configId, inventDim1.InventSizeId, availPhysical));
}
tb.toFile("D:\sample.txt");
}
Regards,
K. Arunsubrmaniam
No comments:
Post a Comment