...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Info | ||
---|---|---|
| ||
This article requires Mobile WMS extension version MOB5.25 (or newer). An older version of this article exists, see (Legacy) How-to: Select Line from Custom Barcode (MOB5.19 - MOB5.24) |
Description
Filter and reduce Order Lines by a scanned value.This article builds on the concept of of Select, Add or Refresh Order Line by custom barcodeLines by Scan (LineSelection)
Used for custom barcodes (Non GS1), in special cases where a regular expression is needed to decipher the barcode.
...
Step 1 - Set up mobile config
Follow the setup on Select, Add or Refresh Order Line by custom barcode and Lines by Scan (LineSelection) and define your regular expression for the the Barcode converter.
Step 2 - Register "GetLineSelectionInformation"
...
Use event OnAfterCreateDefaultDocumentTypes
// Step 2
[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.CreateDocumentTypeAndAddToMobileGroupCreateDocumentType('GetLineSelectionInformation', '', Codeunit::"MOB WMS WhseMOB WMS Whse. InquiryInquiry", 'WMS');
end;
Remember to run Create Document Types from Mobile WMS Setup. Otherwise you will get this error.
...
Step 3 - Respond with Item No.
Respond to the "GetLineSelectionInformation" request and return an Item no.
...
You are likely to decipher the "ScannedValue".
// Step 3
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS WhseMOB WMS Whse. InquiryInquiry", 'OnWhseInquiryOnCustomDocumentTypeAsXmlOnWhseInquiryOnCustomDocumentType', '', truetrue, truetrue)]
localprocedure MyOnWhseInquiryOnCustomDocumentTypeAsXml OnWhseInquiryOnCustomDocumentType(_DocumentType: Text; var _XMLRequestDoc: XmlDocument; var _XMLResponseDoc: XmlDocument; var _IsHandled: Boolean)
var
RequestValues: Record "MOB NS Request Element" temporary;
MobToolbox: Codeunit "MOB Toolbox";
MobXMLMgt: Codeunit "MOB XML Management";
RequestMgt: Codeunit "MOB NS Request Management";
XMLResponseData: XmlNode;
SerialNumberInformationNode: XmlNode;
ScannedValue: Text;
begin
// Handle only "GetLineSelectionInformation"
if not (_DocumentType.Contains('GetLineSelectionInformation')) or _IsHandled then
exit;
// Save the incoming request values
RequestMgt.SaveAdhocFilters(_XMLRequestDoc, RequestValues);
// Get the request value of "SerialNumber" - we mapped the incoming barcode to this field
ScannedValue := Text; var _RequestValues: Record "MOB NS Request Element"; var _ResponseElement: Record "MOB NS Resp Element"; var _RegistrationTypeTracking: Text; var _IsHandled: Boolean)
var
SerialNumber: Code[50];
begin
if _IsHandled then
exit;
if _DocumentType = 'GetLineSelectionInformation' then begin
SerialNumber := _RequestValues.GetValue('SerialNumber');
// Do you logic for Searching for the item
// Initialize the response document for order data
MobToolbox.InitializeResponseDoc(_XMLResponseDoc, XMLResponseData);
MobXMLMgt.AddElement(XMLResponseData, 'SerialNumberInformation', '', MobXMLMgt.NS_WHSEMODEL(), SerialNumberInformationNode);
// Respond with the Item, that the Scanned barcode represents
MobXMLMgt.AddElement(SerialNumberInformationNode, 'ItemNumber', GetItemFromBarcode(ScannedValue), MobXMLMgt.NS_WHSEMODEL(), SerialNumberInformationNode);
_IsHandled := true;
, true);
_ResponseElement.Set_SerialNumberInformation(GetItemFromBarcode(SerialNumber));
_IsHandled := true;
end;
end;
procedure GetItemFromBarcode(ScannedValue: Text): Code[20]
var
Item: Record Item;
begin
// Please make your own logic to identify the Item from a barcode
Item.SetRange("Description 2", ScannedValue);
if Item.FindFirst() then
exit(Item."No.");
end;