Info | ||
---|---|---|
| ||
|
...
[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('PickOrderLineSelection', '', 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('PickOrderLineSelection')) 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
...