Skip to content

[Event Request] Codeunit 99000781 "Mfg. Calculate BOM Tree" - CalcRoutingLineCosts procedure #30106

@MaricaPiazzalungaActionNet

Description

Why do you need this change?

Dear support, for a customer we need to manage additional costs in BOM Buffer related to routing line. For this purpose, we need a new integration event at the end of CalcRoutingLineCosts procedure. The existing event OnCalcRoutingLineCostsOnBeforeBOMBufferAdd() does not have the ParentItem as parameter and, in addition to this, we need to add the custom code only after the costs are added to BOM Buffer.

Describe the request

Add a new integration event OnAfterCalcRoutingLineCosts() in Codeunit 99000781 "Mfg. Calculate BOM Tree", so extensions can react after the costs are added to BOM Buffer.

Location in CalcRoutingLineCosts() procedure (at line 294):

local procedure CalcRoutingLineCosts(RoutingLine: Record "Routing Line"; LotSize: Decimal; ScrapPct: Decimal; var BOMBuffer: Record "BOM Buffer"; var ParentItem: Record Item; var sender: Codeunit "Calculate BOM Tree")
var
    CalcStdCost: Codeunit "Calculate Standard Cost";
    CapCost: Decimal;
    SubcontractedCapCost: Decimal;
    CapOverhead: Decimal;
begin
    OnBeforeCalcRoutingLineCosts(RoutingLine, LotSize, ScrapPct, ParentItem);

    CalcStdCost.SetProperties(WorkDate(), false, false, false, '', false);
    CalcStdCost.CalcRtngLineCost(
      RoutingLine, MfgCostCalcMgt.CalcQtyAdjdForBOMScrap(LotSize, ScrapPct), CapCost, SubcontractedCapCost, CapOverhead, ParentItem);

    OnCalcRoutingLineCostsOnBeforeBOMBufferAdd(RoutingLine, LotSize, ScrapPct, CapCost, SubcontractedCapCost, CapOverhead, BOMBuffer);

    BOMBuffer.AddCapacityCost(CapCost, CapCost);
    BOMBuffer.AddSubcontrdCost(SubcontractedCapCost, SubcontractedCapCost);
    BOMBuffer.AddCapOvhdCost(CapOverhead, CapOverhead);
    -->OnAfterCalcRoutingLineCosts(RoutingLine, LotSize, ScrapPct, CapCost, SubcontractedCapCost, CapOverhead, BOMBuffer, ParentItem);
end;

Event Publisher

[IntegrationEvent(false, false)]
local procedure OnAfterCalcRoutingLineCosts(RoutingLine: Record Microsoft.Manufacturing.Routing."Routing Line"; LotSize: Decimal; ScrapPct: Decimal; var CapCost: Decimal; var SubcontractedCapCost: Decimal; var CapOverhead: Decimal; var BOMBuffer: Record "BOM Buffer"; var ParentItem: Record Item)
begin
end;

Internal work item: AB#636087

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions