Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Filter and reduce Order Lines by a scanned value.This article builds on the concept of Select Order Line by custom barcode

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Setup Doc. Types", 'OnAfterCreateDefaultDocumentTypes''', true, true)]
    local procedure OnAfterCreateDefaultDocumentTypes()
    var
        MobWmsSetupDocTypes: Codeunit "MOB WMS Setup Doc. Types";
    begin
        MobWmsSetupDocTypes.CreateDocumentTypeAndAddToMobileGroup('GetLineSelectionInformation'Codeunit::"MOB WMS Whse. Inquiry", 'WMS');
    end;


Remember to run Create Document Types from Mobile WMS Setup. Otherwise you will get this error.

 


3rd step:

...

Respond with Item No.

Respond to the "GetLineSelectionInformation" request and return an Item no.

...

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentTypeAsXml''', true, true)]
    procedure MyOnWhseInquiryOnCustomDocumentTypeAsXml(_DocumentType: Textvar _XMLRequestDoc: XmlDocumentvar _XMLResponseDoc: XmlDocumentvar _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 := 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;
    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;