Hi everyone,
I am working on a customization for Production orders where we need to reserve raw materials by License Plate (LP) and then generate the corresponding WHS work for the reserved quantity.
I am currently using the standard reservation engine with InventUpd_Reservation to reserve against a specific LP. The reservation is created correctly (e.g., 8 units reserved physically on a specific License Plate).
However, when I release the production order to the warehouse, the WHS work that gets created is not for the reserved quantity (8 units), but instead for the remaining unreserved quantity (e.g., 3 units).
It seems that the WHS work creation logic ignores the reservation created via InventUpd_Reservation and only generates work for the quantity that is still “unreserved” from a WHS perspective.
Is there any way to make WHS work generation respect the reservation performed by InventUpd_Reservation?
Here's the code:
{
ProdBOM prodBOMAux;
WHSInventTable whsInventTable;
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
InventSum inventSum;
InventDim inventDim, inventDimAux;
InventMovement inventMovement;
InventUpd_Reservation reservation;
real remainQty;
boolean reserveSuccess = false;
Set licensePlatesChecked = new Set(Types::String);
WHSWorkTable whsWork;
join whsInventTable
where whsInventTable.ItemId == prodBOMAux.ItemId
join inventDim
where inventDim.inventDimId == prodBOMAux.InventDimId
&& prodBOMAux.ProdId == prodTable.ProdId
{
while (remainQty > 0)
{
reserveSuccess = false;
order by LicensePlateId asc
where inventSum.ItemId == prodBOMAux.ItemId
&& inventSum.InventLocationId == inventDim.InventLocationId
&& inventSum.InventSiteId == inventDim.InventSiteId
&& inventSum.AvailPhysical > 0
&& inventSum.LicensePlateId != ''
{
if (licensePlatesChecked.in(inventSum.LicensePlateId))
{
continue;
}
inventDimAux.clear();
inventDimAux.data(inventDim);
inventDimAux.LicensePlateId = inventSum.LicensePlateId;
inventDimAux.wMSLocationId = inventSum.wMSLocationId;
inventDimAux.inventBatchId = inventSum.inventBatchId;
inventDimParm.initFromInventDim(inventDimAux);
InventAvailabilityByUnit inventAvailabilityByUnit = InventAvailabilityProvider::findByItemSumDim(inventSum.inventTable(), inventSum, inventDimAux);
InventQty availQtyreserve = inventAvailabilityByUnit.parmInventAvailability().availReservation();
if(availQtyreserve >= prodBOMAux.BOMQty)
{
reservation = InventUpd_Reservation::newParameters(inventmovement,
inventDim,
inventDimParm,
InventDimFixedClass::inventDimParm2InventDimFixed(inventDimParm),
-prodBOMAux.BOMQty,
false);
reservation.updateNow();
reserveSuccess = true;
break;
}
else
{
licensePlatesChecked.add(inventSum.LicensePlateId);
}
}
{
warning(strFmt('No se encontró matrícula con cantidad suficiente para el artículo %1. Cantidad requerida: %2. Piezas pendientes: %3', prodBOMAux.ItemId, prodBOMAux.BOMQty, remainQty));
break;
}
}
}
}
Thanks!


Report
All responses (
Answers (