[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAddSteps', '', true, true)] localprocedure MyOnGetRegistrationConfiguration_OnAddSteps(_RegistrationType: Text; var _HeaderFieldValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text) var MobWmsToolbox: Codeunit "MOB WMS Toolbox"; MobPrint: Codeunit "MOB Print"; begin // Verify this should only affects Tote-shipping if _RegistrationType <> MobWmsToolbox."CONST::ToteShipping"() then exit;
_Steps.Create_ListStep_Printer(2, 'Printer'); _Steps.Set_header('Label print'); _Steps.Set_listValues(' ;' + MobPrint.GetMobilePrinters('Item Label 3x2')); // Allow user to select blank printer + the printers attached to this labeltemplate _Steps.Set_helpLabel('If you want a label, please select a printer.'); _Steps.Set_optional(true); end;
Step 2: Handle step and issue print
// We read the collected step (printer). // Issue a print based on printer, label and the current context (Posted Shipment Line) // Print engine will build a dataset [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAfterPostToteShipping', '', true, true)] localprocedure OnPostAdhocRegistration_OnAfterPostToteShipping(_WhseShipmentLine: Record "Warehouse Shipment Line"; var _RequestValues: Record "MOB NS Request Element"; var _SuccessMessage: Text) var TempPrintParameter: Record "MOB Print REST Parameter" temporary; MobPrinter: Record "MOB Printer"; Item: Record Item; MobPrint: Codeunit "MOB Print"; MobLanguage: Codeunit "MOB WMS Language"; MobWmsToolbox: Codeunit "MOB WMS Toolbox"; MobPrintBuffer: Codeunit "MOB Print Buffer"; RecRef: RecordRef; PrintCommand: Text; begin
// Verify this should only affects Tote-shipping if _RequestValues.GetValue('RegistrationType') <> MobWmsToolbox."CONST::ToteShipping"() then exit; // -- Prepare to Print // Did user select a printer? if _RequestValues.GetValue('Printer') = ' 'then exit;
// Print is based on a record // Tote-shipping gives a Whse. Shipment Line record // We will instead use the Item record, as the source of our Item label Item.Get(_WhseShipmentLine."Item No."); RecRef.GetTable(Item);