Bir forum sayfasından bulduğum çözümü kendim için class haline getirdim:
class KRC_WMSOrder
{
WMSShipment wmsShipment;
SalesTable salesTable;
WMSPickingRoute wmsPickingRoute;
WMSPickingRouteLink wmsPickingRouteLink;
salesLine salesLine;
}
void createOrderLine(Qty _qty = salesLine.RemainSalesPhysical)
{
InventMovement inventMovement;
WMSOrder wmsOrder;
WMSOrderCreate orderCreate;
WMSOrderTrans wmsOrderTrans;
;
inventMovement = InventMovement::construct(salesLine);
orderCreate = WMSOrderCreate::newMovement(inventMovement,_qty);
orderCreate.parmMustBeWMSOrderControlled(true);
orderCreate.parmQty(_qty);
orderCreate.parmMaxQty(_qty);
orderCreate.run();
wmsOrder = orderCreate.parmWMSOrder();
wmsOrder.updateShipment(wmsShipment,_qty, wmsPickingRoute.PickingRouteID);
}
void createWmsPickingRoute()
{
;
wmsPickingRoute.clear();
wmsPickingRoute.initTypeOrderPick(wmsShipment, WMSExpeditionStatus::Activated,
WMSPickRequestTable::construct(salesTable),"", true);
wmsPickingRoute.ActivationDateTime = DateTimeUtil::utcNow();
wmsPickingRoute.insert();
}
void createWmsPickingRouteLink()
{
;
wmsPickingRouteLink.clear();
wmsPickingRouteLink.initFromSalesTable(salesTable);
wmsPickingRouteLink.initFromWMSPickingRoute(wmsPickingRoute);
wmsPickingRouteLink.insert();
}
void createWmsShipment()
{
;
wmsShipment.clear();
wmsShipment.initTypeOrderPick();
wmsShipment.insert();
}
SalesLine parmSalesLine(SalesLine _salesLine = salesLine)
{
;
salesLine = _salesLine;
return salesLine;
}
SalesTable parmSalesTable(SalesTable _salesTable = salesTable)
{
;
salesTable = _salesTable;
return salesTable;
}
void reserveItem(Qty _qty = salesLine.RemainSalesPhysical)
{
InventUpd_Reservation invUpdReservation;
;
invUpdReservation = InventUpd_Reservation::newInventDim(InventMovement::construct(salesLine,InventMovSubType::None),
salesLine.inventDim(),_qty,false);
invUpdReservation.updateNow();
}
Örnek kullanım:
KRC_WMSOrder kWMS = new krc_wmsorder();
kWMS.createWmsShipment();
;
ttsbegin;
kWMS.parmSalesTable(salesTable);
kWMS.createWmsPickingRoute();
kWMS.createWmsPickingRouteLink();
kWMS.parmSalesLine(salesLine);
kWMS.reserveItem();
kWMS.createOrderLine();
ttscommit;
Axapta - Usable functions for queries
5 yıl önce
Hiç yorum yok:
Yorum Gönder