Info | ||
---|---|---|
| ||
|
...
Example 1: LineSelection on Pick (scan SerialNumber to select a line)
Step 1: Enable LineSelection in application.cfg
Add <lineSelection> tags to the existing Pick Service (or Receive etc.)
...
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('SearchForPickLine', '', 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('SearchForPickLine')) 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 Example 1 deployed
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<request name="SearchForPickLine" created="2022-12-12T12:44:51+01:00" xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/Request">
<requestData name="SearchForPickLine">
<OrderType>Pick</OrderType>
<BackendID>PI000003</BackendID>
<SerialNumber>01</SerialNumber>
</requestData>
</request> |
Code Block | ||||
---|---|---|---|---|
| ||||
<?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> |