Hi everyone,
I have to deploy a new functionality on AX. I need to do a reservation with X++ of a SalesTable selected record and select a specific pallet to do it. That its not important, the thing is i don't know what method use to do it. I find InventOnHandReserve.reserveNow() but i can't get it to work.
I have the next code on a clicked() method. (its not complete)
void clicked()
{
Args args;
SalesTable salesTableLocal;
SalesLine salesLine;
InventTable inventTable;
InventDim inventDim;
InventSum inventSum;
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;
InventQty qty;
VSSPriorityLocation vssPriorityLocation;
WMSStandardPalletQuantity qtyPallet;
TmpPdsBatchSelect tmpPdsBatchSelect;
InventOnhandReserve inventOnHandReserve;
args = new Args();
salesTableLocal = getFirstSelection(SalesTable_ds); //lo recoge bien
//búsqueda la de las líneas de pedido de compra, Puede haber más de una línea de pedido de compra
while select salesLine
where salesLine.SalesId == salesTableLocal.SalesId
{
//búsqueda de la InventTable
select inventTable
where inventTable.ItemId == salesLine.ItemId;
qtyPallet = inventTable.standardPalletQuantity; //cantidad que ocupa el artículo en el pallet
inventTransOrigin = InventTransOrigin::findByInventTransId(salesLine.InventTransId);
select inventTrans
where inventTrans.InventTransOrigin == inventTransOrigin.RecId;
qty = inventTrans.Qty; //la cantidad del pedido
//Si el estado de la linea es "en pedido"
if (inventTrans.StatusIssue == StatusIssue::OnOrder)
{
//recorrer la tabla de prioridades para saber qué almacén/pallet usar
while select vssPriorityLocation order by Prioridad
where vssPriorityLocation.Tipo == PalletMode::Pallet
{
//si enceuntra una localización con el pallet completo
select inventDim
where inventDim.InventLocationId == vssPriorityLocation.InventLocationId;
select inventSum
where inventSum.InventDimId == inventDim.inventDimId;
/*select tmpPdsBatchSelect
where tmpPdsBatchSelect.InventBatchId == inventDim.inventBatchId;*/
inventOnHandReserve.reserveNow(true, inventSum, qty, inventDim);
}
}
}
}
I have a few problems.
- InventSum its not initialized and i don't know how to do it.
- I don't know where i should put the logical to select a specific pallet
- I don't know if im using the right method.
VSSPriorityLocation is a table with pallet with priority, i should use the record who has the higher priority. (FYI)
Anybody knows what method i should use? this one? Where can find another method to reserve?
Thanks.