Menu Close

Ax 2012 Alternative items in production

Introduction:

after a lot of googling on “Alternative items in AX 2012 R3 Production Orders”, i found only one answer use plan group which located in formula line Form”, I tried this way more than 4-8 times with no result. I already asked some consultant peoples about what i need to create groups of raw material items and link some alternative items with them group and when one item used in production formula doesn’t have enough quantity use another item on the same group which have enough quantity for the production order, they also told me the same way which i found it on google and when i told them that i tried it they told me that you need cumulative update  but i tried to update and also no result but i found that the Plan Group only work on Planned Orders or MRP “Master Plan”

 So i decided to found another way to do my job Let’s Start……

  1. Create table for Items Group
  2. Create table for Alternative Items linked with them group
  3. Create form to Insert/Update/Delete Items or Groups 

In Class ProdUpdStartUp there is a lot of functions responsible for production starting stage one of them Called updateBOMConsumption()  this function trigger while you start the production order we have to make minor customization in this function to check each item have enough quantity for the production order or not, if the item doesn’t have enough quantity search for another item in its group alternative to it. As below:

prodBOM.selectForUpdate(true);
//Start of customization   
           availQty = ItemInfo::ItemQtyByInventDimId(prodBom.inventDim().inventDimId,prodBom.ItemId);
           itemConsumeQty = (prodTable.QtyStUp * prodBOM.BOMQty)/prodBOM.BOMQtySerie;
           
           if(itemConsumeQty > availQty)
           {
                
               altInventDim =  prodBom.InventDim();
               c = AlternativeItems::findItemId(prodBom.ItemId,itemConsumeQty,altInventDim);
               if (c && conpeek(c,1) != “”)
                {
                    altItemId = conpeek(c,1);
                    prodBom.ItemId = altItemId;
                    if (altInventDim)
                        prodBom.InventDimId = altInventDim.inventDimId;
                    else
                        prodBom.InventDimId = InventDim::inventDimIdBlank();
                }
            }
//End of customization
findItemId is a method on table that we create to find suitable item have enough qty for production order
ItemInfo is class contain function that return the physical available qty on given InventDimId

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.