Requirements
- Android App 1.5.9
- Extension version: MOB5.38
- Only the following data types are supported:
- ItemNumber
- SerialNumber
- GS1 barcodes are required unless a Barcode converter is used that supports the above data types
Description
Line selection functionality makes it possible to:
- Select a line based on a response from the backend
- Set default values on the line steps
Selecting a Line
The selection can be done on any value defined on the order line, either standard like ItemNumber, or custom elements added the lines on Order Lines GetOrderLines Response
If LineNumber is returned as the selection name the Android App will go straight for that line.
If any other value is returned, the Android App will go through the automatic searching mechanism where order line registration status is taken into account as well as the position of the selection.
Setting Step default values
The response can also include values to be set on the line steps as predefined default values.
See also: LineSelection
Example 1: LineSelection on Pick (scan SerialNumber to select a line)
Step 1: Enable LineSelection in application.cfg
Add <lineSelection> tag to the existing Pick Service (or Receive etc.) pointing to the new Mobile Document Type defined in the customization below.
<service id="Pick" type="Order" orderType="Pick"> <requests> <getOrders>GetPickOrders</getOrders> <getOrderLines>GetPickOrderLines</getOrderLines> <postOrder>PostPickOrder</postOrder> <lineSelection>PickOrderLineSelection</lineSelection> </requests> </service>
Add <lineSelection> to the PickLines page (or ReceiveLines etc.)
<page id="PickLines" type="OrderLines" icon="mainmenupick"> <title defaultValue="@{PagePickOrderLinesTitle}"/> <orderLinesConfiguration> <service id="Pick"/> <list listId="OrderLinesWithImages"/> ... <lineSelection type="OnlineFirst"/> ... </orderLinesConfiguration> ... </page>
See Mobile Configuration Files for how to edit application.cfg
Step 2: Customization to select an ItemNumber based on scanned SerialNumber
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Setup Doc. Types", 'OnAfterCreateDefaultDocumentTypes', '', true, true)]
local procedure OnAfterCreateDefaultDocumentTypes()
var
MobWmsSetupDocTypes: Codeunit "MOB WMS Setup Doc. Types";
begin
MobWmsSetupDocTypes.CreateDocumentType('PickOrderLineSelection', '', Codeunit::"MOB WMS Whse. Inquiry");
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentType', '', true, true)]
local procedure MyOnWhseInquiryOnCustomDocumentType(_DocumentType: Text; var _RequestValues: Record "MOB NS Request Element"; var _ResponseElement: Record "MOB NS Resp Element"; var _IsHandled: Boolean)
var
ItemLedgEntry: Record "Item Ledger Entry";
BinContent: Record "Bin Content";
WhseActLine: Record "Warehouse Activity Line";
MobWmsToolbox: Codeunit "MOB WMS Toolbox";
OrderType: Text;
BackendID: Text;
SerialNumber: Code[50];
StepValue: Dictionary of [Text, Text];
begin
// Handle only "GetLineSelectionInformation"
if not (_DocumentType.Contains('PickOrderLineSelection')) or _IsHandled then
exit;
// Get the request value of "SerialNumber" - we mapped the incoming barcode to this field
OrderType := _RequestValues.GetValue('OrderType');
BackendID := _RequestValues.Get_BackendID();
SerialNumber := _RequestValues.GetValue('SerialNumber');
if (OrderType <> 'Pick') or (SerialNumber = '') then
exit;
// Find ItemNo./Variant from ILE for performance reasons (prerequisite: Assuming adjustment bin is fully posted)
if FindOpenItemLedgEntryBySN(ItemLedgEntry, SerialNumber) then
if FindBinContentByItemLedgerEntry(BinContent, ItemLedgEntry) then begin
// Select Item No. from BinContent and leave it to the device to find first element without current registrations
// Variant Code is not handled (hence prerequisite is no two pick lines has same Item No. but different Variant Codes)
_ResponseElement.Create('select');
_ResponseElement.SetValue('@name', 'ItemNumber'); // Attribute on select node
_ResponseElement.SetValue('@value', BinContent."Item No."); // Attribute on select node
_ResponseElement.SetValue('values', ''); // values to register
_ResponseElement.SetValue('/values/fromBin', BinContent."Bin Code"); // stepname and value
end;
_IsHandled := true;
end;
local procedure FindOpenItemLedgEntryBySN(var _ItemLedgEntry: Record "Item Ledger Entry"; _SerialNumber: Code[50]): Boolean
begin
_ItemLedgEntry.Reset();
_ItemLedgEntry.SetCurrentKey("Serial No.", "Item No.", Open, "Variant Code");
_ItemLedgEntry.SetRange("Serial No.", _SerialNumber);
_ItemLedgEntry.SetRange(Open, true);
_ItemLedgEntry.SetRange(Positive, true);
exit(_ItemLedgEntry.FindFirst());
end;
local procedure FindBinContentByItemLedgerEntry(var _BinContent: Record "Bin Content"; _ItemLedgEntry: Record "Item Ledger Entry"): Boolean
begin
_ItemLedgEntry.TestField("Serial No.");
_ItemLedgEntry.TestField(Quantity, 1);
_BinContent.Reset();
_BinContent.SetCurrentKey("Item No.");
_BinContent.SetRange("Item No.", _ItemLedgEntry."Item No.");
_BinContent.SetRange("Variant Code", _ItemLedgEntry."Variant Code");
_BinContent.SetRange("Serial No. Filter", _ItemLedgEntry."Serial No.");
_BinContent.SetRange(Quantity, 1); // Code is written for Serial tracked item
exit(_BinContent.FindFirst());
end;
Sample request/response xml with customization deployed
<?xml version="1.0" encoding="utf-8"?> <request name="PickOrderLineSelection" created="2022-12-12T12:44:51+01:00" xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/Request"> <requestData name="PickOrderLineSelection"> <OrderType>Pick</OrderType> <BackendID>PI000003</BackendID> <SerialNumber>01</SerialNumber> </requestData> </request>
<?xml version="1.0" encoding="UTF-8"?> <response xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/Response" messageid="4C556C64-76E3-442A-8F27-823AD77998C3" status="Completed"> <description /> <responseData xmlns="http://schemas.taskletfactory.com/MobileWMS/BaseDataModel"> <select name="LineNumber" value="30000" xmlns="http://schemas.taskletfactory.com/MobileWMS/WarehouseInquiryDataModel"> <values> <fromBin>W-01-0001</fromBin> <lotNumber>LOT100</lotNumber> </values> </select> </responseData> </response>