This post is not for the reader to use the suggested code but to test it and enhance it as required. Yeap, this is a disclaimer so reader knows that testing should always be done. Also, the below code is not complete it but might provide a good idea on how to enhance NAV planning with Jobs material planning.
What I would like to cover here is how to integrate MRP with Jobs so material required for jobs create action messages. Before that, lets see how CU99000854 determines where the demands are coming from. This is done on function DemandToInvProfile. Here it goes through the different types of demand (Service, Sales, Production, …) and make planning aware of them.
Back to our case, this same function is where we need to add code so MRP is aware that Job Planning Lines carry demands (material requirements). As an example, the piece of code we could consider is the following:
…JobPlanningLine.SETCURRENTKEY(Type,”No.”,”Variant Code”,”Location Code”,”Planning Date”);JobPlanningLine.SETRANGE(Type,JobPlanningLine.Type::Item);JobPlanningLine.SETRANGE(“No.”,Item.”No.”);Item.COPYFILTER(“Location Filter”,JobPlanningLine.”Location Code”);Item.COPYFILTER(“Variant Filter”,JobPlanningLine.”Variant Code”);JobPlanningLine.SETFILTER(“Planning Date”,’>%1&<=%2',0D,ToDate);
IF JobPlanningLine.FIND('-') THENREPEATInventoryProfile.INIT;InventoryProfile."Line No." := NextLineNo;InventoryProfile.TransferFromJobPlanningLine(JobPlanningLine);IF InventoryProfile.IsSupply THENInventoryProfile.ChangeSign;InventoryProfile.INSERT;UNTIL JobPlanningLine.NEXT = 0;…
What we are doing above is using the job planning lines of type "Item" to be considered as demand and use the planning date as due date for the demand.
Going forward, reader could take it from here to finalize the development.