...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Use this event to
Excerpt |
---|
Create "Transport Orders" (or similar) in 3rd party Shipping App |
Description
This event is triggered prior to a Warehouse Shipment being posted. You may use the event to:
- Update values at the Whse. Shipments (header or lines) prior to posting
- Create transport orders (or similar) for the Whse. Shipment (or use Shipping Provider ConnectorOnPostPackingOnAfterPostWarehouseShipment (MOS) OnPostPackingOnAfterPostWarehouseShipment event if you want the Transport Order to be created after posting)
- Create transport order packages (or similar) based on untransferred license plates
- Mark untransferred license plates as now already Transferred to Shipping.
Note: This event is similar to standard event "Whse.-Post Shipment.OnAfterCheckWhseShptLine". It is included in the codeunit "MOS Pack API" for But more accessible "interface" (all neccessary events are in one codeunit).
See also: Write Transaction Data to 3rd party Shipping ProviderApp
Template
/// <remarks><remarks>
/// Redirected from standard event OnAfterCheckWhseShptLine to new local event for more accessible Redirected from standard event OnAfterCheckWhseShptLine to new local event for more accessible "interface" (all neccessary events in Codeunit MOS Pack API(all neccessary events in Codeunit MOS Pack API)
/// <</remarks>
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOS Pack APIMOB Pack API", 'OnPostPackingOnBeforePostWarehouseShipment', '', falsefalse, falsefalse)]
local procedure OnPostPackingOnBeforePostWarehouseShipment OnPostPackingOnBeforePostWarehouseShipment(var WhseShptHeader WhseShptHeader: Record "Warehouse Shipment HeaderWarehouse Shipment Header"; var WhseShptLine WhseShptLine: Record "Warehouse Shipment LineWarehouse Shipment Line")
begin
end;
Example - Create Transport Order, Transport Order Packages and mark untransferred License Plates as now already Transferred to Shipping
...
Had the new Transport Order No. been known in our OnPostPackingOnBeforePostWarehouseShipment-subscriber below, we could have created Transport Order Packages directly within this event and a good chunk of the code from the example below would no longer be needed (including all code in CollectShipItTransportOrderNosByWhseShipment, CollectShipItTransportOrderNosBySource and GetWhseShipmentNoBySourceLine).
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOS Pack API", 'OnPostPackingOnBeforePostWarehouseShipment', '', false, false)]
local procedure OnPostPackingOnBeforePostWarehouseShipment(var WhseShptHeader: Record "Warehouse Shipment Header"; var WhseShptLine: Record "Warehouse Shipment Line")
begin
UpdateQuantityToTransport(WhseShptLine);
...
/// <summary>
/// For each new transport order line created, transfer untransferred license plates to the transport order.
/// May transfer many or zero LP's (especially if all lines was transferred in a prior call to the event).
/// </summary>
[EventSubscriber(ObjectType::Codeunit, Codeunit::"IDYS Publisher", 'OnAfterCreateTransportOrderLine', '', true, true)]
local procedure OnAfterCreateTransportOrderLine(var TransportOrderLine: Record "IDYS Transport Order Line")
var
MobSessionData: Codeunit "MOB SessionData";
begin
if IsNullGuid(MobSessionData.GetPostingMessageId()) then
exit; // Not posting from Mobile WMS
InsertPackagesForTransportOrderLine(TransportOrderLine);
end;
internal procedure InsertPackagesForTransportOrder(_TransportOrderNo: Code[20]) _PackagesInserted: Integer
var
TransportOrderLine: Record "IDYS Transport Order Line";
begin
Clear(_PackagesInserted);
TransportOrderLine.Reset();
TransportOrderLine.SetRange("Transport Order No.", _TransportOrderNo);
if TransportOrderLine.FindSet() then
repeat
_PackagesInserted := _PackagesInserted + InsertPackagesForTransportOrderLine(TransportOrderLine);
until TransportOrderLine.Next() = 0;
exit(_PackagesInserted);
end;
/// <summary>
/// Insert all untransferred packages from all shipments related to a transport order line
/// </summary>
local procedure InsertPackagesForTransportOrderLine(_TransportOrderLine: Record "IDYS Transport Order Line") _PackagesInserted: Integer
var
WhseShipmentNo: Code[20];
begin
Clear(_PackagesInserted);
if _TransportOrderLine."Source Document Table No." = Database::"Sales Header" then begin
_TransportOrderLine.TestField("Source Document Type", 1); // 1 = Sales Order
_TransportOrderLine.TestField("Source Document No."); // Sales Order No
_TransportOrderLine.TestField("Source Document Line No."); // Sales Order No
...
...
Version History
...
TODO
Filter by label (Content by label) showLabels false showSpace false sort title title More examples excerptType simple cql label = "onbeforepost" and label = "example" and label = "pack"
Version History
Version | Changes |
---|---|
MOB5.42 | Introduced |