How-to: Conditional Tote Picking

Description

You want to enable TotePicking only based on certain conditions - or you would like the user to decide what is tote picked from the device.


Enable TotePicking based on conditions

No events exists specifically to manage TotePicking being enabled or not.

However, the two Mobile WMS events exists to set set values based on WarehouseActivityHeaders and WarehouseActivityLines. 
Those two events can be utilized to "revert" the Tote Picking flags that  is being set by the standard Mobile WMS Code.

For this code to work the standard flag "Mobile Setup"."Tote Picking Enabled" must be set. 


Example 1 - Disable Tote Picking for a specific location code:

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Pick", 'OnGetPickOrders_OnAfterSetFromWarehouseActivityHeader''', true, true)]
    procedure OnGetPickOrders_OnAfterSetFromWarehouseActivityHeader(_WhseActHeader: Record "Warehouse Activity Header"; var _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
    var
        MobSetup: Record "MOB Setup";
    begin
        MobSetup.Get();

        if (MobSetup."Enable Tote Picking") and (_WhseActHeader.Type = _WhseActHeader.Type::Pickthen
            _BaseOrderElement.Set_TotePicking(TotePickingIsEnabledByLocation(_WhseActHeader."Location Code"));
    end;

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Pick", 'OnGetPickOrderLines_OnAfterSetFromWarehouseActivityLine''', true, true)]
    procedure OnGetPickOrderLines_OnAfterSetFromWarehouseActivityLine(_WhseActLineTake: Record "Warehouse Activity Line"; var _BaseOrderLineElement: Record "MOB Ns BaseDataModel Element")
    var
        MobSetup: Record "MOB Setup";
    begin
        MobSetup.Get();
        if (MobSetup."Enable Tote Picking") and (_WhseActLineTake."Activity Type" = _WhseActLineTake."Activity Type"::Pickthen
            if not TotePickingIsEnabledByLocation(_WhseActLineTake."Location Code"then begin
                // revert Tote Picking flags originally written to the BaseOrderElement by standard Mobile WMS code
                _BaseOrderLineElement.Set_DisplayLine4('');
                _BaseOrderLineElement.Set_Destination('');
            end;
    end;

    procedure TotePickingIsEnabledByLocation(_LocationCode: Code[10]_TotePickingIsEnabled: Boolean
    begin
        _TotePickingIsEnabled := _LocationCode <> 'WHITE';
        exit(_TotePickingIsEnabled);
    end;

Example 2 - Disable tote picking if warehouse shipment only consists of one unique sales order (source no.):

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnGetPickOrders_OnAfterSetFromWarehouseActivityHeader', '', true, true)]
localprocedureMy01OnGetPickOrders_OnAfterSetFromWarehouseActivityHeader(_WhseActHeader: Record"Warehouse Activity Header"; var_BaseOrderElement: Record"MOB Ns BaseDataModel Element")
var
WhseActLines: Record"Warehouse Activity Line";
begin
WhseActLines.SetRange("Activity Type", _WhseActHeader.Type);
WhseActLines.SetRange("No.", _WhseActHeader."No.");
ifWhseActLines.FindFirst() thenbegin
WhseActLines.SetFilter("Source No.", '<>%1', WhseActLines."Source No.");
ifWhseActLines.IsEmpty() then
_BaseOrderElement.Set_TotePicking(false);
end;
end;

Enable TotePicking from the device

If it should be left to the user to decide whether TotePicking is enabled or not, a simple change in the application.cfg is required.

This will add an action to the menu that will enable or disable Tote Picking.


Example 1 - ToggleTotePicking in Pick OrderList

<page id="Pick" type="OrderList" icon="mainmenupick">
<title defaultValue="@{PagePickOrderListTitle}"/>
<orderListConfiguration automaticOrderSelectionAfterFilter="true">
<service id="Pick"/>
<filter configurationKey="PickOrderFilters"/>
<list listId="Orders"/>
<onOrderSelected navigateTo="PickLines"/>
<unlockOrder title="@{ReleaseOrderMenuItemWithOrderId}"/>
</orderListConfiguration>
<actions>
<open id="RegisterImage" icon="camera" title="@{AttachImages}">
<returnTransfer property="UnplannedItemRegistrationCompleted" to="RefreshOnResume"/>
</open>
<open id="Attachments" icon="attachment" title="@{Attachments}"/>
<!-- Enable if Warehouse Worker is allowed to decide what is tote picked -->
<adhocRegistration id="ToggleTotePicking" icon="mainmenuboxpicking" title="{ToggleTotePickingTitle}" sendRegistrationData="Order" registrationType="ToggleTotePicking">
<onSuccessfulPost refreshOnSuccess="true"/>
</adhocRegistration> 
</actions>
</page>


 Example 1 - How it looks on the device