ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 5870 "Calculate BOM Tree" - OnAfterModifyBomBufferAfterTransferFromProdRouting

Open Nyryus opened this issue 6 years ago • 2 comments

Hi,

please add event OnAfterModifyBomBufferAfterTransferFromProdRouting in procedure GenerateProdCompSubTree

local procedure GenerateProdCompSubTree(ParentItem: Record Item; var BOMBuffer: Record "BOM Buffer") FoundSubTree: Boolean
    var
        CopyOfParentItem: Record Item;
        ProdBOMLine: Record "Production BOM Line";
        RoutingLine: Record "Routing Line";
        ParentBOMBuffer: Record "BOM Buffer";
        UOMMgt: Codeunit "Unit of Measure Management";
        VersionMgt: Codeunit VersionManagement;
        CostCalculationMgt: Codeunit "Cost Calculation Management";
        LotSize: Decimal;
        BomQtyPerUom: Decimal;
        IsHandled: Boolean;
    begin

        [...]

        if RoutingLine.ReadPermission then
            with RoutingLine do
                if (TreeType in [TreeType::" ", TreeType::Cost]) and
                   CertifiedRoutingVersionExists(ParentItem."Routing No.", WorkDate)
                then begin
                    repeat
                        if "No." <> '' then begin
                            BOMBuffer.SetLocationVariantFiltersFrom(ItemFilter);
                            BOMBuffer.TransferFromProdRouting(
                              EntryNo, RoutingLine, ParentBOMBuffer.Indentation + 1,
                              ParentBOMBuffer."Qty. per Top Item" *
                              UOMMgt.GetQtyPerUnitOfMeasure(ParentItem, ParentBOMBuffer."Unit of Measure Code"),
                              ParentBOMBuffer."Needed by Date",
                              ParentBOMBuffer."Location Code");
                            OnAfterTransferFromProdRouting(BOMBuffer, RoutingLine);
                            if TreeType = TreeType::Cost then begin
                                LotSize := ParentBOMBuffer."Lot Size";
                                if LotSize = 0 then
                                    LotSize := 1;
                                CalcRoutingLineCosts(RoutingLine, LotSize, ParentBOMBuffer."Scrap %", BOMBuffer, ParentItem);
                                BOMBuffer.RoundCosts(
                                  ParentBOMBuffer."Qty. per Top Item" *
                                  UOMMgt.GetQtyPerUnitOfMeasure(ParentItem, ParentBOMBuffer."Unit of Measure Code") / LotSize);
                                BOMBuffer.Modify();
                            end;

                            //new code
                            OnAfterModifyBomBufferAfterTransferFromProdRouting(BOMBuffer, RoutingLine, LotSize);
                            //end new code
                        end;
                    until Next = 0;
                    FoundSubTree := true;
                end;

        BOMBuffer := ParentBOMBuffer;
    end;

    [IntegrationEvent(false, false)]
    local procedure OnAfterModifyBomBufferAfterTransferFromProdRouting(var BOMBuffer: Record "BOM Buffer"; RoutingLine: Record "Routing Line";var LotSize: Decimal)
    begin
    end;

Nyryus avatar Sep 04 '20 12:09 Nyryus

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.

bc-ghost avatar Sep 10 '20 13:09 bc-ghost

Created with name OnGenerateProdCompSubTreeOnAfterBOMBufferModify

Nyryus avatar Nov 04 '20 11:11 Nyryus