Hi Stefan,
thank you for the information. This I still do not have noticed. :-(
Sorry for that.
Yes, i think i have a "better" or let my say working solution for creating
production oderers with x++. :-)
I played a litte bit and found this way:
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.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Post by Stefan EbertHi,
prodTable.RouteId = inventTable.routeId (dateNull(), myQty);
prodTable.BOMId = inventTable.BOMId (dateNull(), myQty);
I tried prodTable.insert() approach some time ago, but recovered that no
record in InventTrans table will be created.
So I had a look on Form "ProdTableCreate" which uses
"prodTable.insertFromForm(...)" method instead. Unfortunately, those form
contains mixture of methods, event handlers and data sources methods (and
.... of course, a gui).
Jörg, did you meantime resolve the problem?
Axel, do you know a "better" encapsulation of the po creation process? I'm
very interested.
--
Ciao,
Stefan Ebert
Post by Axel KühnHi,
static void CreateProd(Args _args)
{
ProdTable prodTable;
InventTable inventTable;
;
inventTable = InventTable::find("YourItemId");
prodTable.initValue();
prodTable.ItemId = inventTable.ItemId;
prodTable.initFromInventTable(inventTable);
prodTable.QtySched = <YourQty>;
prodTable.insert();
}
Hope that hepls you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Post by josHi,
is there an easy way to create production orders with x++?
For example: Is there any class with function createProd(itemId _itemId, Qty
_qty)?
How do you create productions?
--
Regards
Joerg