Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] codeunit 6500 "Item Tracking Management" - OnBeforeSplitProdOrderLineForOutputPutAway #28440

Open
FSchneiderYav opened this issue Mar 31, 2025 · 0 comments
Labels
event-request Request for adding an event SCM GitHub request for SCM area

Comments

@FSchneiderYav
Copy link

FSchneiderYav commented Mar 31, 2025

Describe the request

We need a new event for the function SplitProdOrderLineForOutputPutAway in codeunit 6500 "Item Tracking Management"

Additional context

    internal procedure SplitProdOrderLineForOutputPutAway(ProdOrderLine: Record "Prod. Order Line"; var TempProdOrdLineTrackingBuff: Record "Prod. Ord. Line Tracking Buff." temporary; SplitUpToQtyBase: Decimal)
    var
        ItemLedgerEntry: Record "Item Ledger Entry";
        ItemTrackingSetup: Record "Item Tracking Setup";
        BufferEntryNo: Integer;
        RemainingHandledQtyBase: Decimal;
        QtyBaseAvailableToPutAway: Decimal;
        ExitLoop: Boolean;
        IsHandled: Boolean;
    begin
+      IsHandled := false;
+      OnBeforeSplitProdOrderLineForOutputPutAway(ProdOrderLine, TempProdOrdLineTrackingBuff, SplitUpToQtyBase, IsHandled);
+      If IsHandled then
+        exit;
        TempProdOrdLineTrackingBuff.Reset();
        TempProdOrdLineTrackingBuff.DeleteAll();
        RemainingHandledQtyBase := SplitUpToQtyBase;

        if not GetWhseItemTrkgSetup(ProdOrderLine."Item No.", ItemTrackingSetup) then begin
            CopyProdOrderLineFieldsToTempProdOrdLineTrackingBuff(ProdOrderLine, TempProdOrdLineTrackingBuff);
            TempProdOrdLineTrackingBuff."Buffer Entry No." := 1;
            TempProdOrdLineTrackingBuff.Insert();
            exit;
        end;

        ItemLedgerEntry.SetLoadFields("Order Type", "Order No.", "Order No.", "Serial No.", "Lot No.", "Package No.", "Warranty Date", "Expiration Date", Quantity);
        ItemLedgerEntry.SetSourceFilterForProdOutputPutAway(ProdOrderLine);
        if ItemLedgerEntry.FindSet() then
            repeat
                TempProdOrdLineTrackingBuff.SetTrackingFilterFromItemLedgerEntry(ItemLedgerEntry);
                TempProdOrdLineTrackingBuff.SetRange("Warranty Date", ItemLedgerEntry."Warranty Date");
                TempProdOrdLineTrackingBuff.SetRange("Expiration Date", ItemLedgerEntry."Expiration Date");
                if TempProdOrdLineTrackingBuff.FindFirst() then begin
                    UpdateQtySplitForPutAwayOnProdOrdLineTrackingBuffer(TempProdOrdLineTrackingBuff, ProdOrderLine, ItemLedgerEntry, QtyBaseAvailableToPutAway, RemainingHandledQtyBase);
                    if QtyBaseAvailableToPutAway > 0 then
                        TempProdOrdLineTrackingBuff.Modify();
                end else begin
                    BufferEntryNo += 1;
                    TempProdOrdLineTrackingBuff.Reset();
                    CopyProdOrderLineFieldsToTempProdOrdLineTrackingBuff(ProdOrderLine, TempProdOrdLineTrackingBuff);
                    TempProdOrdLineTrackingBuff."Buffer Entry No." := BufferEntryNo;
                    TempProdOrdLineTrackingBuff.CopyTrackingFromItemLedgerEntry(ItemLedgerEntry);
                    TempProdOrdLineTrackingBuff."Warranty Date" := ItemLedgerEntry."Warranty Date";
                    TempProdOrdLineTrackingBuff."Expiration Date" := ItemLedgerEntry."Expiration Date";
                    TempProdOrdLineTrackingBuff."Qty. split for Put Away (Base)" := 0;

                    UpdateQtySplitForPutAwayOnProdOrdLineTrackingBuffer(TempProdOrdLineTrackingBuff, ProdOrderLine, ItemLedgerEntry, QtyBaseAvailableToPutAway, RemainingHandledQtyBase);
                    if QtyBaseAvailableToPutAway > 0 then
                        TempProdOrdLineTrackingBuff.Insert();
                end;

                if SplitUpToQtyBase <> 0 then
                    ExitLoop := RemainingHandledQtyBase = 0;
            until (ItemLedgerEntry.Next() = 0) or ExitLoop
        else begin
            CopyProdOrderLineFieldsToTempProdOrdLineTrackingBuff(ProdOrderLine, TempProdOrdLineTrackingBuff);
            TempProdOrdLineTrackingBuff."Buffer Entry No." := 1;
            TempProdOrdLineTrackingBuff.Insert();
        end;
    end;

+ [IntegrationEvent(false, false)]
+ local procedure OnBeforeSplitProdOrderLineForOutputPutAway(ProdOrderLine: Record "Prod. Order Line"; var TempProdOrdLineTrackingBuff: Record "Prod. Ord. Line Tracking Buff." temporary; SplitUpToQtyBase: Decimal; var IsHandled: Boolean)
+ begin
+ end;

Internal work item: AB#572968

@JesperSchulz JesperSchulz added event-request Request for adding an event SCM GitHub request for SCM area labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area
Projects
None yet
Development

No branches or pull requests

3 participants