microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 7312 "Create Pick" - OnCheckReservationOnAfterSetSrcDocQtyToBeFilledByInvt #27036

Closed 1languste closed 1 month ago

1languste commented 1 month ago

Describe the request

I want to document the SrcDocQtyBaseToBeFilledByInvt & SrcDocQtyToBeFilledByInvt in a custom logistics log. Therefore, I request the following event:

procedure CheckReservation(QtyBaseAvailToPick: Decimal; SrcType: Integer; SrcSubType: Option; SrcNo: Code[20]; SrcLineNo: Integer; SrcSubLineNo: Integer; AlwaysCreatePickLine: Boolean; QtyPerUnitOfMeasure: Decimal; var Quantity: Decimal; var QuantityBase: Decimal)
var
    ReservationEntry: Record "Reservation Entry";
    Quantity2: Decimal;
    QuantityBase2: Decimal;
    QtyBaseResvdNotOnILE: Decimal;
    QtyResvdNotOnILE: Decimal;
    SrcDocQtyBaseToBeFilledByInvt: Decimal;
    SrcDocQtyToBeFilledByInvt: Decimal;
begin
    // ...
        QtyBaseResvdNotOnILE := QtyResvdNotOnILE;
        QtyResvdNotOnILE := Round(QtyResvdNotOnILE / QtyPerUnitOfMeasure, UnitOfMeasureManagement.QtyRndPrecision());

        WhseManagement.GetOutboundDocLineQtyOtsdg(SrcType, SrcSubType,
          SrcNo, SrcLineNo, SrcSubLineNo, SrcDocQtyToBeFilledByInvt, SrcDocQtyBaseToBeFilledByInvt);
        OnCheckReservationOnAfterGetOutboundDocLineQtyOtsdg(ReservationEntry, SrcDocQtyToBeFilledByInvt, SrcDocQtyBaseToBeFilledByInvt, QtyResvdNotOnILE, QtyBaseResvdNotOnILE);
        SrcDocQtyBaseToBeFilledByInvt := SrcDocQtyBaseToBeFilledByInvt - QtyBaseResvdNotOnILE;
        SrcDocQtyToBeFilledByInvt := SrcDocQtyToBeFilledByInvt - QtyResvdNotOnILE;
        // NEW BEGIN
        OnCheckReservationOnAfterSetSrcDocQtyToBeFilledByInvt(ReservationEntry, SrcDocQtyBaseToBeFilledByInvt, SrcDocQtyToBeFilledByInvt)
        // NEW END      
        if QuantityBase > SrcDocQtyBaseToBeFilledByInvt then begin
            QuantityBase := SrcDocQtyBaseToBeFilledByInvt;
            Quantity := SrcDocQtyToBeFilledByInvt;
        end;

[IntegrationEvent(false, false)]
local procedure OnCheckReservationOnAfterSetSrcDocQtyToBeFilledByInvt(var ReservationEntry: Record "Reservation Entry"; var SrcDocQtyBaseToBeFilledByInvt: Decimal; var SrcDocQtyToBeFilledByInvt: Decimal)
begin
end;

Additional context

I want to document the SrcDocQtyBaseToBeFilledByInvt & SrcDocQtyToBeFilledByInvt in a custom logistics log. Internal work item: AB#544566

JakovljevicDusan commented 1 month ago

As far as I can tell, this can be implmented using existing event OnCheckReservationOnAfterGetOutboundDocLineQtyOtsdg(). Just replicate these two lines SrcDocQtyBaseToBeFilledByInvt := SrcDocQtyBaseToBeFilledByInvt - QtyBaseResvdNotOnILE; SrcDocQtyToBeFilledByInvt := SrcDocQtyToBeFilledByInvt - QtyResvdNotOnILE;