In order to describe the production process, Microsoft Dynamics AX 2012 introduces the concept of routes. Each route contains several combinations of operations and other resource requirements for a specific item describing its production process.
One of our clients needed a technical specific solution to provide his company a route recalculation that will propose a new combination of resources for a specific item. To achieve this, an automatic function was developed.
The standard form where the overview of the routes for the items is available can be accessed via Product information management > Common > Released products where the product can be selected, and then the next step is to click on the Route in the Engineer tab. The upper grid shows the route versions assigned to the item (RouteVersion is set as a datasource) and the grid below displays all the information for the route. Although, ProdRoute is set as a datasource on the lower grid, it actually uses data from two other tables – Route and RouteOpr. This means that the changes for the operations need to be made in these two tables and then transferred to ProdRoute so they will be visible in the form. The RouteInventForm class makes this possible. In the form where you want to display the routes and operations, you have to override the executeQuery method on the ProdRoute datasource and make a call to the prodRouteDSExecuteQueryPre method of the RouteInventForm class:
public void executeQuery()
routeInventForm.prodRouteDSExecuteQueryPre(routeVersion, configAll ? ” : configId);
This way, all operations required to produce the item will be visible in the lower grid. (Take in mind that RouteVersion is in a relation with InventTable by ItemId)
The ProdRoute data source is set as a temporary table in the prodRouteDSInitPost method of the previously mentioned class. The instantiating of the class object is also tricky and it is done as following:
routeInventForm = RouteInventForm::newForm(element);
Thus, you can have a preview of the routes and operations for the item you specify as a parameter in the prodRouteDSExecuteQueryPre method.
In addition, the following Job is given as an example to demonstrate how you can change some of the values of the operations required for a specific item. Here, the testing operation is increased by one hour, and the routeOpr buffer is updated, but it is visible in the lower grid because ProdRoute is pulling data from this table.
static void Job10(Args _args)
//iterate through all operations for the Item with an ItemId = D0003 and RouteId = 000002
while select forUpdate routeOpr
exists join route
where routeOpr.RouteRelation == route.RouteId
&& routeOpr.RouteRelation == ‘000002’
&& routeOpr.ItemRelation == ‘D0003’
if(routeOpr.OprId == ‘Testing’)
routeOpr.ProcessTime += 1;