Info | ||
---|---|---|
| ||
|
Description
Excerpt |
---|
Line selection The LineSelection functionality makes it possible to:
|
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.
Code Block | ||||
---|---|---|---|---|
| ||||
<service id="Pick" type="Order" orderType="Pick"> <requests> <getOrders>GetPickOrders</getOrders> <getOrderLines>GetPickOrderLines</getOrderLines> <postOrder>PostPickOrder</postOrder> <lineSelection>SearchForPickOrderLine<<lineSelection>PickOrderLineSelection</lineSelection> </requests> </service> |
...
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)]
localprocedure OnAfterCreateDefaultDocumentTypes()
var
MobWmsSetupDocTypes: Codeunit "MOB WMS Setup Doc. Types";
begin
MobWmsSetupDocTypes.CreateDocumentType('SearchForPickOrderLinePickOrderLineSelection', '', Codeunit::"MOB WMS Whse. Inquiry");
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentType', '', true, true)]
localprocedure 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: Dictionaryof [Text, Text];
begin
// Handle only "GetLineSelectionInformation"
ifnot (_DocumentType.Contains('SearchForPickOrderLinePickOrderLineSelection')) 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) thenbegin
// 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 with the 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;
localprocedure 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;
localprocedure 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
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?> <request name="SearchForPickOrderLinePickOrderLineSelection" created="2022-12-12T12:44:51+01:00" xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/Request"> <requestData name="SearchForPickOrderLinePickOrderLineSelection"> <OrderType>Pick</OrderType> <BackendID>PI000003</BackendID> <SerialNumber>01</SerialNumber> </requestData> </request> |
...