Requirements
- Extension version MOB5.26
- Android App 1.5.8
Description
Group matching order lines by tags having the same value at multiple lines.
With Grouping order lines functionality you can condense order lines lists at the mobile device, when multiple lines from the same order lines list shares enough characteristics to make it reasonable to combine (group) them.
Any response returning 'BaseOrderLineElement's (see eventdescriptions) can be customized to group matching order lines.
Group conditions may vary based on your exact requirement but could be:
- Same Item No.
- Same Unit of Measure
- Same Take-bin ("FromBin")
- Same Place-bin ("ToBin")
- ... other?
Sample uses for "GroupBy" could be:
- Group lot tracked and/or serial tracked items on Put-away or Pick for a better workflow on mobile device (see Example, below)
- Group all items on documents (i.e. when picks are consolidated picks with same item number many times on the same pick document)
Example: Group Put-away lines for Serial No. Tracked items, but leave everything else as-is
Starting point: Standard Put-away behaviour with no "GroupBy" customization
A warehouse receipt was registered for a purchase order of:
Item TF-002, 15 PCS (no tracking)
Item TF-003, 15 PCS (lot no. tracked)
Item TF-004, 3 PCS (serial no. tracked)
The Put-away created for this receipt reflects that 3 different serial numbers for Item TF-004 is in the receive area and ready to Put-away (3 take/place-pairs = 6 lines for item TF-004):
At the mobile device each serial no. is displayed as separate lines during the Put-away process, including the exact serial number to Put-away for each line:
Figure 1: Put-away standard behaviour with no "GroupBy" enabled
Grouping matching order lines
In this example, requirement is to group all lines for Serial No. Tracked items, but leave every other item ungrouped. The Put-Away Order Lines at the mobile should look like this, rather than like in the screenshot above:
- Summarized Quantity
- Modify texts that can no longer be specific for the grouped line (as the group element is representing several underlying lines)
Figure 2: Put-away customized behaviour with "GroupBy"
How to enable it
Step 1: Handle in code
To group a number of lines, two events is needed to get the group working: One event to define how lines are grouped (mandatory) and one event to handle how each group is displayed at the mobile device (optional).
- 'OnGetXXXOrderLines_OnAfterSetFromXXX' : Use any SetFrom-event from (planned) Wms Document Handlers to define how lines are grouped
- 'OnAfterGroupByBaseOrderLineElements' : Triggered once per group. Here you can optionally change how the "grouped" element is displayed at the mobile device
- (Also, changes are needed to application.cfg to enable the group/ungroup functionatlity see below)
// Putaway: Decide which elements can be grouped (SN specific tracking)
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Put Away", 'OnGetPutAwayOrderLines_OnAfterSetFromWarehouseActivityLine', '', true, true)]
local procedure OnGetPutAwayOrderLines_OnAfterSetFromWarehouseActivityLine(_WhseActLineTake: Record "Warehouse Activity Line"; var _BaseOrderLineElement: Record "MOB NS BaseDataModel Element")
var
Item: Record Item;
ItemTrackingCode: Record "Item Tracking Code";
begin
Item.Get(_WhseActLineTake."Item No.");
if (ItemTrackingCode.Get(Item."Item Tracking Code") and ItemTrackingCode."SN Specific Tracking") then begin
// Group SN Specific Tracked items
_BaseOrderLineElement.SetGroupBy('ItemNumber,UnitOfMeasure,FromBin,ToBin');
_BaseOrderLineElement.SetValue('MyGroupName', 'PutAway.GroupBySerialNumber'); // Some unique identifier for this GroupBy condition to look for in OnAfterGroupBy-event
end;
end;
// Putaway: Handle appearance of "grouped" element to be displayed at mobile device
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Base Document Handler", 'OnAfterGroupByBaseOrderLineElements', '', true, true)]
local procedure OnAfterGroupByBaseOrderLineElements(var _GroupOrderLineElement: Record "MOB Ns BaseDataModel Element"; var _IsGrouped: Boolean; var _BaseOrderLineElements: Record "MOB Ns BaseDataModel Element"; var _IsHandled: Boolean)
begin
if (_GroupOrderLineElement.GetValue('MyGroupName') = 'PutAway.GroupBySerialNumber') then begin
_IsGrouped := _BaseOrderLineElements.Count() > 1; // Suppress grouping if this group includes only a single element
_GroupOrderLineElement.Set_DisplayLine4(StrSubstNo('Serial No.: Yes')); // Only used if the elements is actually grouped
// Optional: Since these elements can be grouped/ungrouped on the fly at the mobile device, add some text to indicate this
if _IsGrouped then begin
_BaseOrderLineElements.FindSet();
repeat
_BaseOrderLineElements.Set_DisplayLine4(_BaseOrderLineElements.Get_DisplayLine4() + ' (can be grouped)');
until _BaseOrderLineElements.Next() = 0;
end;
_IsHandled := true;
end;
end;
Step 2: Enable in Mobile config
<page id="PutAwayLines" type="OrderLines" icon="mainmenuputaway"> <title defaultValue="@{PagePutAwayOrderLinesTitle}"/> <orderLinesConfiguration> <service id="PutAway"/> <list listId="OrderLines"/> <..> <toggleOrderLineGrouping enabled="true" title="@{MenuItemOrderLineUngroup}" icon="menuplus" groupTitle="@{MenuItemOrderLineGroup}" groupIcon="menuminus" contextMenuPlacement="1" menuPlacement="1" /> <------------------------------- </orderLinesConfiguration> </page>
At time of writing (MOB5.26 / Android App 1.5.8) the group/ungroup functionality is not yet enabled by default in application.cfg – therefore, a "toggleOrderLineGrouping" tag must be added to all pages where where the actions are to be enabled.
Addtionally, you may choose to promote the group/ungroup button in case you prefer the button to be always visible (otherwise group/ungroup is hidden in the mobile device menu, as in the screenshots below).
How it looks on mobile
The registration flow at the mobile device now reflects the grouping of matched lines for the SN tracked item:
- Stays in the "flow" for SN tracked item no. TF-004 until the full quanity is recorded
- Serial numbers can be scanned in any order
- Serial numbers is validated on posting rather than on entry
Ungroup and group lines on the fly
When a number of lines is grouped, you ungroup and re-group on the fly at the mobile device.
Notice customized text "can be grouped" from the customization example above |
This Grouping order lines knowledgebase article explains what is happening "behind the scenes", including how registered quantities are distributed among grouped lines.
The changes to the Xml response format for grouped elements (as explained in that article) are handled implicitely by the _BaseOrderLineElement.SetGroupBy()-method, as in the example above.
See also