Documentation Index

Fetch the complete documentation index at: https://docs.staedean.com/llms.txt

Use this file to discover all available pages before exploring further.

Warehouse posting functions

Prev Next

This codeunit covers various inlets to initialise posting routines for warehouse documents.

It implements the various ways Anywhere Mobility Solutions allows custom code to be triggered

Expression functions

These functions are called via expression interface.

DAW_PostWhseRcptHeader

procedure DAW_PostWhseRcptHeader(WhseRcptHeaderNo: Code[20])
var
    WhseRcptHeader: Record "Warehouse Receipt Header";
    WhseRcptLine: Record "Warehouse Receipt Line";
    WhsePostRcpt: Codeunit "Whse.-Post Receipt";
begin
    if WhseRcptHeader.GET(WhseRcptHeaderNo) then begin
        WhseRcptLine.SETRANGE("No.", WhseRcptHeader."No.");
        if WhseRcptLine.FINDFIRST() then
            WhsePostRcpt.RUN(WhseRcptLine);
        ANYInitQty.ReceiptInitQty(WhseRcptLine."No.", WhseRcptLine."Line No.");
    end;
end;

DAW_PostWhseRcptLine

procedure DAW_PostWhseRcptLine(WhseRcptNo: Code[20]; WhseRcptLineNo: Integer)
var
    WhseRcptLine: Record "Warehouse Receipt Line";
    WhsePostRcpt: Codeunit "Whse.-Post Receipt";
begin
    if WhseRcptLine.GET(WhseRcptNo, WhseRcptLineNo) then begin
        WhsePostRcpt.RUN(WhseRcptLine);
        ANYInitQty.ReceiptInitQty(WhseRcptLine."No.", WhseRcptLine."Line No.");
    end;
end;

DAW_RegisterWhseActHeader

procedure DAW_RegisterWhseActHeader(WhseActType: Integer; WhseActNo: Code[20])
var
    WhseActHeader: Record "Warehouse Activity Header";
    WhseActivLine: Record "Warehouse Activity Line";
    WhseActivityRegister: Codeunit "Whse.-Activity-Register";
    WMSMgt: Codeunit "WMS Management";
    WhseActivityPost: Codeunit "Whse.-Activity-Post";
begin
    if WhseActHeader.GET(WhseActType, WhseActNo) then
        case WhseActHeader.Type of
            WhseActHeader.Type::"Put-away",
            WhseActHeader.Type::"Pick",
            WhseActHeader.Type::"Movement":
                begin
                    WhseActivLine.SETRANGE("Activity Type", WhseActHeader.Type);
                    WhseActivLine.SETRANGE("No.", WhseActHeader."No.");
                    if WhseActivLine.FINDFIRST() then begin
                        WMSMgt.CheckBalanceQtyToHandle(WhseActivLine);
                        WhseActivityRegister.ShowHideDialog(true);
                        WhseActivityRegister.RUN(WhseActivLine);
                        ANYInitQty.ActivityInitQty(WhseActHeader.Type.AsInteger(), WhseActHeader."No.", 0);
                    end;
                end;
            WhseActHeader.Type::"Invt. Put-away":
                begin
                    WhseActivLine.SETRANGE("Activity Type", WhseActivLine."Activity Type"::"Invt. Put-away");
                    WhseActivLine.SETRANGE("No.", WhseActHeader."No.");
                    if WhseActivLine.FINDFIRST() then begin
                        WhseActivityPost.ShowHideDialog(true);
                        WhseActivityPost.RUN(WhseActivLine);
                        ANYInitQty.ActivityInitQty(WhseActHeader.Type.AsInteger(), WhseActHeader."No.", 0);
                    end;
                end;
            WhseActHeader.Type::"Invt. Pick":
                begin
                    WhseActivLine.SETRANGE("Activity Type", WhseActivLine."Activity Type"::"Invt. Pick");
                    WhseActivLine.SETRANGE("No.", WhseActHeader."No.");
                    if WhseActivLine.FINDFIRST() then begin
                        WhseActivityPost.ShowHideDialog(true);
                        WhseActivityPost.RUN(WhseActivLine);
                        ANYInitQty.ActivityInitQty(WhseActHeader.Type.AsInteger(), WhseActHeader."No.", 0);
                    end;
                end;
        end;
end;

DAW_PostWhseShptHeader

procedure DAW_PostWhseShptHeader(WhseShptHeaderNo: Code[20])
var
    WhseShptHeader: Record "Warehouse Shipment Header";
    WhseShptLine: Record "Warehouse Shipment Line";
    WhsePostShpt: Codeunit "Whse.-Post Shipment";
begin
    if WhseShptHeader.GET(WhseShptHeaderNo) then begin
        WhseShptLine.SETRANGE("No.", WhseShptHeader."No.");
        if WhseShptLine.FINDFIRST() then begin
            WhsePostShpt.SetPostingSettings(false);
            WhsePostShpt.SetPrint(false);
            WhsePostShpt.RUN(WhseShptLine);
            ANYInitQty.ShipmentInitQty(WhseShptHeader."No.", 0);
        end;
    end;
end;

DAW_PostWhseShptLine

procedure DAW_PostWhseShptLine(WhseShptNo: Code[20]; WhseShptLineNo: Integer)
var
    WhseShptLine: Record "Warehouse Shipment Line";
    WhsePostShpt: Codeunit "Whse.-Post Shipment";
begin
    if WhseShptLine.GET(WhseShptNo, WhseShptLineNo) then begin
        WhsePostShpt.RUN(WhseShptLine);
        ANYInitQty.ShipmentInitQty(WhseShptLine."No.", WhseShptLine."Line No.");
    end;
end;

EventGenerator function

The OnRun is triggered via the job queue entry that gets created by the EventGenerator Activity Based on the recordid available in the job queue entry, the related posting routine is called asynchronously.

OnRun

table

trigger OnRun()
var
    ANYSetup: Record "ANY Setup";
    RecRef: RecordRef;
begin
    if ANYSetup.GetSupressDoubleError() then begin
        if not RecRef.Get(Rec."Record ID to Process") then exit;
    end else
        RecRef.Get(Rec."Record ID to Process");

    case RecRef.Number of
        DATABASE::"Warehouse Receipt Header":
            ProcessWhseRcptHeader(RecRef);
        DATABASE::"Warehouse Receipt Line":
            ProcessWhseRcptLine(RecRef);
        DATABASE::"Warehouse Shipment Header":
            ProcessWhseShptHeader(RecRef);
        DATABASE::"Warehouse Shipment Line":
            ProcessWhseShptLine(RecRef);
        DATABASE::"Warehouse Activity Header":
            ProcessWhseActHeader(RecRef);
    end;
end;

ProcessWhseRcptHeader

procedure ProcessWhseRcptHeader(var QueuedSHRrf: RecordRef)
var
    WhseRcptHeader: Record "Warehouse Receipt Header";
begin
    QueuedSHRrf.SetTable(WhseRcptHeader);
    DAW_PostWhseRcptHeader(WhseRcptHeader."No.");
end;

ProcessWhseRcptLine

procedure ProcessWhseRcptLine(var QueuedSHRrf: RecordRef)
var
    WhseRcptLine: Record "Warehouse Receipt Line";
begin
    QueuedSHRrf.SetTable(WhseRcptLine);
    DAW_PostWhseRcptLine(WhseRcptLine."No.", WhseRcptLine."Line No.");
end;

ProcessWhseActHeader

procedure ProcessWhseActHeader(var QueuedSHRrf: RecordRef)
var
    WhseActHeader: Record "Warehouse Activity Header";
    WhseActivLine: Record "Warehouse Activity Line";
    WhseActivityRegister: Codeunit "Whse.-Activity-Register";
    WMSMgt: Codeunit "WMS Management";
    WhseActivityPost: Codeunit "Whse.-Activity-Post";
begin
    QueuedSHRrf.SetTable(WhseActHeader);
    DAW_RegisterWhseActHeader(WhseActHeader.Type.AsInteger(), WhseActHeader."No.");
end;

ProcessWhseShptHeader

procedure ProcessWhseShptHeader(var QueuedSHRrf: RecordRef)
var
    WhseShptHeader: Record "Warehouse Shipment Header";
begin
    QueuedSHRrf.SetTable(WhseShptHeader);
    DAW_PostWhseShptHeader(WhseShptHeader."No.");
end;

ProcessWhseShptLine

procedure ProcessWhseShptLine(var QueuedSHRrf: RecordRef)
var
    WhseShptLine: Record "Warehouse Shipment Line";
begin
    QueuedSHRrf.SetTable(WhseShptLine);
    DAW_PostWhseShptLine(WhseShptLine."No.", WhseShptLine."Line No.");
end;