API Events VAPS

OnProvideCustomReservationsForProdOrderLine

This event occurs on creating and updating a simulation. With it, the users can create their own links between production order lines that are processed by the scheduler like normal reservations.

[IntegrationEvent(/*IncludeSender*/false, /*GlobalVarAccess*/false)]

procedure OnProvideCustomReservationsForProdOrderLine (var pSourceProdOrderLinePosition:
Text; var pDestinationProdOrderLinesPositions: List of [Text]; var pHandled: Boolean)

 

Data type

Description

var pSourceProdOrderLinePosition

Text

The production order line that is processed in the load and update process, in form of its position

var pDestinationProdOrderLinesPositions

List of [Text]

A list of the target production order lines that get linked to the source

var pHandled

Boolean

The event will be handled if it returns true

Example:

In this example, a production order line that produces a "bicycle" is assigned a front and rear wheel as a feeder. This happens across production order limits so that there are three different production orders involved. If, therefore, the production order line for the front wheel is processed during loading, which is indicated here by a special identifier, the bicycle is then assigned to this line as the destination. The same is then done with the special rear wheel.

  [EventSubscriber(ObjectType::Codeunit, Codeunit::"NETVAPS IntegrationMgmt", 'OnProvideCustomReservationsForProdOrderLine', '', false, false)] 

    local procedure handleOnProvideCustomReservationsForProdOrderLine(pSourceProdOrderLinePosition: Text; var pDestinationProdOrderLinesPositions: List of [Text]; var pHandled: Boolean) 

    var 

        _BCPol: Record "Prod. Order Line"; 

        _BCPol2: Record "Prod. Order Line"; 

         

    begin 

        _BCPol.SetPosition(pSourceProdOrderLinePosition); 

        if _BCPol.Get(_BCPol.RecordId) then begin 

            if _BCPol."Description 2".Contains('CustomLinked') then begin 

                //front wheel or back wheel 

                case _BCPol."Item No." of 

                    '1100', '1200': 

                        begin 

                            // might be custom linked to a ‘custom linked’  bycicle  

                            // look for bicycle with Description 2 containing the specific custom link connection info 

                            //same status 

                            _BCPol2.SetRange(Status, _BCPol.Status); 

                            _BCPol2.SetRange("Description 2", _BCPol."Description 2"); 

                            _BCPol2.SetRange("Item No.", '1000'); 

                            if _BCPol2.FindLast() then begin 

    // Custom reservation, add destination position 

                                pDestinationProdOrderLinesPositions.Add(_BCPol2.GetPosition(false)); 

                                pHandled := true; 

                            end; 

                        end; 

                end; 

            end; 

 

And this is the result:

Ein Bild, das Text, Screenshot, Reihe, Diagramm enthält.

Automatisch generierte Beschreibung

These links are treated like normal reservations in the calculation. The picture below shows the situation after an "AddAll":

Ein Bild, das Text, Screenshot, Reihe, Diagramm enthält.

Automatisch generierte Beschreibung