Source: http://www.eggheadcafe.com/software/aspnet/31983659/how-to-create-a-production-order-with-x.aspx
static void CreateProductionOrder(Args _args)
{
ProdQtySched productionQty = 1;
ItemId productionItem = "AKU-1000";
ProdTable prodTable;
InventTable inventTable;
;
inventTable = InventTable::find(productionItem);
//Initialise the base values
prodTable.initValue();
prodTable.ItemId = inventTable.ItemId;
prodTable.initFromInventTable(inventTable);
prodTable.DlvDate = today();
prodTable.QtySched = productionQty;
prodTable.RemainInventPhysical = prodTable.QtySched;
//Set the active bom and route
prodTable.BOMId = BOMVersion::findActive(prodTable.ItemId,
prodTable.BOMDate,
prodTable.QtySched).BOMId;
prodTable.RouteId = RouteVersion::findActive(prodTable.ItemId,
prodTable.BOMDate,
prodTable.QtySched).RouteId;
prodTable.initRouteVersion();
prodTable.initBOMVersion();
//Use ProdTableType class to create the production order
prodTable.type().insert();
}
The code above set the active BOM / Route and also creates the InventTrans
data.
donderdag 26 augustus 2010
How to create a production order with x++
Abonneren op:
Reacties posten (Atom)
Geen opmerkingen:
Een reactie posten