ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 7321 "Create Inventory Put-away" - OnAfterRepeat

Open Pepito-lab opened this issue 5 years ago • 5 comments

Hi, would it be possible to get many events OnAfterRepeat in codeunit 7321 "Create Inventory Put-away", like this :

    local procedure CreatePutAwayLinesFromTransfer(TransferHeader: Record "Transfer Header")
    var
        TransferLine: Record "Transfer Line";
        NewWhseActivLine: Record "Warehouse Activity Line";
        WhseItemTrackingSetup: Record "Item Tracking Setup";
        ItemTrackingMgt: Codeunit "Item Tracking Management";
        IsHandled: Boolean;
                                NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Purchase Return Order";
                            OnBeforeNewWhseActivLineInsertFromPurchase(NewWhseActivLine, PurchLine);
                            if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
                                repeat
                                    IsHandled: false;
                                    OnAfterRepeat(IsHandled,ReservationFound);
                                    if not IsHandled then begin
                                          NewWhseActivLine."Line No." := NextLineNo;
                                          InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
                                    end;              
                                  until RemQtyToPutAway <= 0  
                                NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Sales Return Order";
                            OnBeforeNewWhseActivLineInsertFromSales(NewWhseActivLine, SalesLine);
                            if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
                                repeat
                                    OnAfterRepeat(ReservationFound,SNRequired);
                                    NewWhseActivLine."Line No." := NextLineNo;
                                    InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
                                until RemQtyToPutAway <= 0
                            NewWhseActivLine."Due Date" := "Receipt Date";
                            OnBeforeNewWhseActivLineInsertFromTransfer(NewWhseActivLine, TransferLine);
                            if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then
                                repeat
                                    IsHandled: false;
                                    OnAfterRepeat(IsHandled,ReservationFound);
                                    if not IsHandled then begin
                                         NewWhseActivLine."Line No." := NextLineNo;
                                         InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup);
                                end;
                                until RemQtyToPutAway <= 0
                           ```

NewWhseActivLine."Due Date" := "Due Date"; NewWhseActivLine."Source Document" := NewWhseActivLine."Source Document"::"Prod. Output"; OnBeforeNewWhseActivLineInsertFromProd(NewWhseActivLine, ProdOrderLine); if not ReservationFound and WhseItemTrackingSetup."Serial No. Required" then repeat IsHandled: false; OnAfterRepeat(IsHandled,ReservationFound); if not IsHandled then begin NewWhseActivLine."Line No." := NextLineNo; InsertWhseActivLine(NewWhseActivLine, 1, WhseItemTrackingSetup); end; until RemQtyToPutAway <= 0

[IntegrationEvent(false, false)]
local procedure OnAfterRepeat(var ReservationFound: Boolean; var IsHandled: Boolean)
begin
end;
Thanks!

Pepito-lab avatar Feb 15 '21 14:02 Pepito-lab

Could you give more details explaining how will you handle these events and change the code execution? Are you going to change ReservationFound to skip the loops going below? How SNRequired will work? Also in the third case you put: OnAfterRepeat(IsHandled,ReservationFound,SNRequired); but IsHandled is not declared in the event and not used in code. Wouldn't is be better to have an event on before InsertWhseActivLine? maybe with additional params?

StanPesotskiy avatar Feb 19 '21 07:02 StanPesotskiy

I need to change the code in the loops. I don't need to add SNRequired and Reservation Found. Yes I need IsHandled I just forgot it. Excuse me for my mistake. Thanks

Pepito-lab avatar Feb 23 '21 10:02 Pepito-lab

Please update the original request. There are still two calls of OnAfterRepeat with different parameters and there is no usage of IsHandled.

StanPesotskiy avatar Mar 01 '21 07:03 StanPesotskiy

I edited my code

Pepito-lab avatar Mar 08 '21 09:03 Pepito-lab

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. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar Mar 22 '21 11:03 JesperSchulz