Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...


Info
title(Legacy) OnPrem/Per-Tenant Extension

This article was written for a connector used with the separate Pack & Ship Extension (OnPrem or Per-Tenant).
Pack & Ship is now a feature in the standard Mobile WMS (since MOB5.42) and will use a new API to connect directly to the Mobile WMS App.

Existing custom connectors can be migrated by following the guide How-to: Migration of Pack & Ship.

Links:

Mobile WMS - Implementing a new Shipping Provider Connector
Mobile WMS - Write Transaction Data to 3rd party Shipping App

Use this event to

...

Book and Print external "Transport Orders" (or similar) in 3rd party Shipping App

Description

This event is triggered after a Warehouse Shipment has been posted. You may use the event to:

...

See also: Pack & Ship Extension - Write transaction data to 3rd party Shipping App


Template

    /// <remarks>
    /// Redirected from standard event OnAfterPostWhseShipment to new local event for more accessible "interface" (all neccessary events in Codeunit MOS Pack API)
    /// </remarks>
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOS Pack API", 'OnPostPackingOnAfterPostWarehouseShipment''', false, false)]
    local procedure OnPostPackingOnAfterPostWarehouseShipment(var WarehouseShipmentHeader: Record "Warehouse Shipment Header")
    begin
    end;


Example - Book and Print an existing Transport Order for a Warehouse Shipment when shipment is fully posted

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOS Pack API", 'OnPostPackingOnAfterPostWarehouseShipment''', false, false)]
    local procedure OnPostPackingOnAfterPostWarehouseShipment(var WarehouseShipmentHeader: Record "Warehouse Shipment Header")
    begin
        if not WarehouseShipmentHeader.Find('='then   // No longer exists = fully posted
            BookAndPrintWhseShipment(WarehouseShipmentHeader);
    end;

    local procedure BookAndPrintWhseShipment(var _WhseShptHeader: Record "Warehouse Shipment Header")
    var
        IdysTransportOrderHeader: Record "IDYS Transport Order Header";
        TransportOrderNos: Dictionary of [Code[20], Code[20]];  // Assuming identical keys and values
        TransportOrderNo: Code[20];
    begin
        CollectShipItTransportOrderNosByWhseShipment(_WhseShptHeader."No.", TransportOrderNos);

        foreach TransportOrderNo in TransportOrderNos.Values() do begin
            IdysTransportOrderHeader.Get(TransportOrderNo);
            if IdysTransportOrderHeader.Status = IdysTransportOrderHeader.Status::New then
                BookAndPrintShipItTransportOrder(IdysTransportOrderHeader);
        end;
    end;

    local procedure BookAndPrintShipItTransportOrder(var _TransportOrderHeader: Record "IDYS Transport Order Header")
    var
        MobSessionData: Codeunit "MOB SessionData";
        IdysTransportOrderAPI: Codeunit "IDYS Transport Order API";
    begin
        _TransportOrderHeader.CalcFields("Total No. of Packages");

        MobSessionData.SetRegistrationTypeTracking(
            MobSessionData.GetRegistrationTypeTracking() ' / ' +
            Format(_TransportOrderHeader.RecordId) ' / ' +
            StrSubstNo('Packages: %1', _TransportOrderHeader."Total No. of Packages"));  // Packages to book (nay include packages previously at the Transport Order)

        if _TransportOrderHeader."Total No. of Packages" = 0 then
            exit;   // No packages was inserted from OnAfterCreateTransportOrderLine events

        // "Preferred Pick-up Date From" may be greater than CurrentDateTime() but still invalid, hence always update to tomorrow
        if _TransportOrderHeader."Preferred Pick-up Date" <> (Today() 1then begin
            _TransportOrderHeader.Validate("Preferred Pick-up Date", Today() 1);
            _TransportOrderHeader.Modify(true);
        end;
        IdysTransportOrderAPI.BookAndPrint(_TransportOrderHeader);
    end;

Version History

VersionChanges
MOS1.0.0Introduced

...