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 completed 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, we might need to refresh how CU99000854 determines where the demands are coming from. This was covered on my earlier post about CU 99000854 (Demand Types). As a remider, logic is on function DemandToInvProfile. Here it goes through the different types of demand (Service, Sales, Production, …) and make planning aware of them.
Back to our topic, 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:
// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
…
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(‘-‘) THEN
REPEAT
InventoryProfile.INIT;
InventoryProfile.”Line No.” := NextLineNo;
InventoryProfile.TransferFromJobPlanningLine(JobPlanningLine);
IF InventoryProfile.IsSupply THEN
InventoryProfile.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.