Scan a Document No. when opening a page to improve performance in very long lists.

Description

Most lists for planned document types in standard Mobile WMS will load automatically as soon as the page is opened from the main menu at the mobile device. 

While being the preferred behaviour in most cases, it also causes the mobile device to be not responsive as the list is loading. In very long lists with hundreds or even thousands of entries it may be preferred to prompt for a specific Document No. rather than loading an entire list straight away.

In the example below a customization for the Production page is implemented. The customization adds or changes the following behaviour:

  • The 'Production'  page no longer automatically loads the entires list of production order lines but instead displays the filter pane
  • The filter pane includes a new (custom) "Prod. Order No." field
  • If "Prod. Order No." is left empty the entire list will load (as standard behaviour)
  • If "Prod Order No." is populated (keyed in or scanned) only lines for this exact Production Order No. is loaded. Also, all other filters are ignored in this case.
  • When the Production page is reloaded 'on return' from Consumption/Output pages the "Prod. Order No." filter is still applied.


Note: With this customization the Prod Order No. must always be filtered using the new "Prod. Order No." field.  Standard "ScannedValue" directly from the full list of Production Orders now only works when Prod. Order No. filter is empty.


Example

Filters are displayed when Production page is opened incl. new custom headerfield "Prod. Order No."Key in or scan a specific Prod. Order No.Only the filtered Prod. Order No. is displayedChange or clear the "Prod. Order No." filter in the filter pane to work on the next production order


1st Step: Changes to application.cfg

The Production-page in application.cfg must be changed to no longer load the list immidiately when the page is opened.

The initial read can be delayed by setting attribute automaticAcceptOnOpen="false" at the <filter>-element:



When making changes to application.cfg make sure to raise a ticket and share the changes with our delivery team, to ensure the changes are included in our source control and when new configuration files are being deployed to your devices.


Mobile configuration application.cfg
    <page id="Production" type="OrderList" icon="mainmenuproduction">
      <title defaultValue="@{PageProdOrderLinesTitle}"/>
      <orderListConfiguration automaticOrderSelectionAfterFilter="false">
        <service id="Production"/>
        <filter configurationKey="ProdOrderLineFilters" automaticAcceptOnOpen="false"/>
        <list listId="ProdOrderLinesList">
          <open menuPlacement="1" contextMenuPlacement="1" icon="productionConsumption" title="@{PageProdConsumptionLinesTitle}"/>
        </list>
        <onOrderSelected navigateTo="ProdConsumptionLines"/>
        <unlockOrder title="@{ReleaseOrderMenuItemWithOrderId}"/>
      </orderListConfiguration>
      <actions>
        <open id="ProdOutputLines" icon="productionOutput" title="@{PageProdOutputLinesTitle}" menuPlacement="2" contextMenuPlacement="2"/>
        <open icon="mainmenuprint" id="PrintLabelTemplate" title="@{PagePrintLabelTitle}" menuPlacement="3" contextMenuPlacement="3"/>
        <!-- <showImage id="ShowImage" enabled="true" imageProperty="ItemImage" title="@{MenuItemShowImageTitle}"/> -->
      </actions>
      <menu numberOfPromotedItems="2"/>
    </page>


2nd Step: Changes to Business Central

Add a new custom field "MyProdOrderNo" to the Production page (ConfigurationKey: "ProdOrderLineFilters") and handle the new filter when the list of production order lines is read.

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations''', true, true)]
    local procedure MyOnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
    begin
        // Add a field to an existing ConfigurationKey from standard Mobile WMS
        _HeaderFields.InitConfigurationKey('ProdOrderLineFilters');

        _HeaderFields.Create_TextField(5'MyProdOrderNo')// Lower Id than existing fields to ensure this filter is processed first to allow ignoring all other filters when MyProdOrderNo is set
        _HeaderFields.Set_label('Prod. Order No.');
        _HeaderFields.Set_length(20);
        _HeaderFields.Set_optional(true);
    end;

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Production Consumption", 'OnGetProdOrderLines_OnSetFilterProdOrderLine''', true, true)]
    local procedure MyOnGetProdOrderLines_OnSetFilterProdOrderLine(_HeaderFilter: Record "MOB NS Request Element"; var _ProdOrderLine: Record "Prod. Order Line"; var _ProductionOrder: Record "Production Order"; var _IsHandled: Boolean)
    begin
        if _HeaderFilter.Name = 'MyProdOrderNo' then begin
            _ProdOrderLine.SetFilter("Prod. Order No.", _HeaderFilter."Value");
            _IsHandled := true;
            exit;
        end;

        // Ignore all other filters if MyProdOrderNo is set and is not '*' (Note: MyProdOrderNo is processed first due to lowest Id)
        if (_ProdOrderLine.GetFilter("Prod. Order No."<> '') and (_ProdOrderLine.GetFilter("Prod. Order No."<> '*'then
            _IsHandled := true;
    end;


Rewriting this example for other Document Types

The example above was implemented for Production. When rewriting this example to other document types, one need to take in account a difference in how events was named for Production and (for example) Picks:

“From each production order multiple items may be produced (the "Production Order Lines"). Therefore, the Production OrderList displays information from table "Prod. Order Line", not from "Production Order".
Consequently "OnGetProdOrderLines" events - despite the naming - are for the "toplevel" in an OrderList/OrderLines page, elsewhere named the "OrderList".”
(from https://docs.taskletfactory.com/display/TFSK/Production+Order+Lines)


In other words, events for production are named “xxxLines”, while really being the "front page". The similar events for i.e. the "front page" for Picks are named without “Lines”. Therefore (for example):

use OnGetPickOrders_OnSetFilterWarehouseActivity
instead of OnGetProdOrderLines_OnSetFilterProdOrderLine


  • No labels