Versions Compared

Key

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


Info
titleRequirements
  • 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

...

Code Block
languagexml
titleMobile configuration application.cfg
<service id="Pick" type="Order" orderType="Pick">
  <requests>
    <getOrders>GetPickOrders</getOrders>
    <getOrderLines>GetPickOrderLines</getOrderLines>
    <postOrder>PostPickOrder</postOrder>
    <lineSelection>SearchForPickOrderLine<<lineSelection>PickOrderLineSelection</lineSelection>
  </requests>
</service>

...

    [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 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
languagexml
titleSample request
<?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>

...