microsoft / ALAppExtensions

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

[Event Request] Codeunit 7316 "Whse. Int. Put-away Release".Reopen #27677

Open fridrichovsky opened 17 hours ago

fridrichovsky commented 17 hours ago

Describe the request

Please add new event


    procedure Reopen(WhseInternalPutAwayHeader: Record "Whse. Internal Put-away Header")
    var
        WhsePutawayRqst: Record "Whse. Put-away Request";
        WhseWkshLine: Record "Whse. Worksheet Line";
        WhseActivLine: Record "Warehouse Activity Line";
    begin
        if WhseInternalPutAwayHeader.Status = WhseInternalPutAwayHeader.Status::Open then
            exit;

        WhseWkshLine.SetCurrentKey("Whse. Document Type", "Whse. Document No.");
        WhseWkshLine.SetRange("Whse. Document Type", WhseWkshLine."Whse. Document Type"::"Internal Put-away");
        WhseWkshLine.SetRange("Whse. Document No.", WhseInternalPutAwayHeader."No.");
        if not WhseWkshLine.IsEmpty() then
            Error(Text001);

        WhseActivLine.SetCurrentKey("Whse. Document No.", "Whse. Document Type", "Activity Type");
        WhseActivLine.SetRange("Whse. Document No.", WhseInternalPutAwayHeader."No.");
        WhseActivLine.SetRange("Whse. Document Type", WhseActivLine."Whse. Document Type"::"Internal Put-away");
        WhseActivLine.SetRange("Activity Type", WhseActivLine."Activity Type"::"Put-away");
        //-------------------------------------------------------------OnReopenOnBeforeWhseActivLineIsEmpty:BEGIN
        OnReopenOnBeforeWhseActivLineIsEmpty(WhseInternalPutAwayHeader,WhseActivLine);
        //-------------------------------------------------------------OnReopenOnBeforeWhseActivLineIsEmpty:END
        if not WhseActivLine.IsEmpty() then
            Error(Text002);

        WhsePutawayRqst.SetRange("Document Type", WhsePutawayRqst."Document Type"::"Internal Put-away");
        WhsePutawayRqst.SetRange("Document No.", WhseInternalPutAwayHeader."No.");
        WhsePutawayRqst.SetRange(Status, WhseInternalPutAwayHeader.Status::Released);
        if WhsePutawayRqst.Find('-') then
            repeat
                WhsePutawayRqst.Status := WhseInternalPutAwayHeader.Status::Open;
                WhsePutawayRqst.Modify();
            until WhsePutawayRqst.Next() = 0;

        WhseInternalPutAwayHeader.Status := WhseInternalPutAwayHeader.Status::Open;
        WhseInternalPutAwayHeader.Modify();
    end;

    //-------------------------------------------------------------OnReopenOnBeforeWhseActivLineIsEmpty:BEGIN
    [IntegrationEvent(false, false)]
    local procedure OnReopenOnBeforeWhseActivLineIsEmpty(WhseInternalPutAwayHeader: Record "Whse. Internal Put-away Header"; var WhseActivLine: Record "Warehouse Activity Line")
    begin
    end;
    //-------------------------------------------------------------OnReopenOnBeforeWhseActivLineIsEmpty:END

Additional context

We need change filters before check