Versions Compared

Key

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

Description

...

  • The standard "New Bin Code" can be validated with a blank value with no error. The standard "ToBin"-step is hidden by the customization, but the value is still picked up by standard Mobile WMS code (empty) and validated – with no error.
  • Fields "New Location Code" and "New Bin Code" can be validated after all other fields at journal line is already populated. OnValidate-triggers for these fields fortunately do not overwrite any values already populated to the journal line.


Example

codeunit 50825 "CUS Howto Unpl. Move LocToLoc"
{


    //
    // [How To] [Enable Unplanned Move Location-To-Location transfer for locations with no directed putaway-and-pick]
    //

    /// <summary>
    /// Hide 'ToBin' step from standard registrationcollector 'UnplannedMove' for locations with no directed-putaway-and-pick
    /// </summary>
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAfterAddStep''', true, true)]
    procedure OnGetRegistrationConfiguration_OnAfterAddStep(_RegistrationType: Textvar _HeaderFieldValues: Record "MOB NS Request Element"; var _Step: Record "MOB Steps Element")
    var
        Location: Record Location;
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
        LocationCode: Code[10];
    begin
        if (_RegistrationType <> MobWmsToolbox."CONST::UnplannedMove"()) then
            exit;

        if (_Step.Get_name() 'ToBin'then begin
            Evaluate(LocationCode, _HeaderFieldValues.GetValue('Location', true));
            Location.Get(LocationCode);
            if not Location."Directed Put-away and Pick" then
                _Step.Set_visible(false);
        end;
    end;

    /// <summary>
    /// Add custom steps 'MyToLocation' and 'MyToBin' to standard registrationcollector 'UnplannedMove' for locations with no directed-putaway-and-pick
    /// </summary>
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAddSteps''', true, true)]
    procedure OnGetRegistrationConfiguration_OnAddSteps(_RegistrationType: Textvar _HeaderFieldValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
    var
        Location: Record Location;
        MobToolbox: Codeunit "MOB Toolbox";
        MobWmsLanguage: Codeunit "MOB WMS Language";
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
        MobReferenceData: Codeunit "MOB WMS Reference Data";
        LocationCode: Code[10];
        ItemNo: Code[20];
    begin
        if _RegistrationType <> MobWmsToolbox."CONST::UnplannedMove"() then
            exit;

        Evaluate(LocationCode, _HeaderFieldValues.GetValue('Location'));
        Evaluate(ItemNo, _HeaderFieldValues.GetValue('ItemNumber'));

        Location.Get(LocationCode);

        if not Location."Directed Put-away and Pick" then begin
            _Steps.Create_ListStep(50000'MyToLocation');
            _Steps.Set_header(MobWmsLanguage.GetMessage('ITEM'' ' + ItemNo + ' - ' + 'Enter To Location');
            _Steps.Set_label('To Location:');
            _Steps.Set_helpLabel('Location to move goods to');
            _Steps.Set_dataTable(MobReferenceData.DataTable_LOCATION_TABLE());
            _Steps.Set_dataKeyColumn('Code');
            _Steps.Set_dataDisplayColumn('Code');
            _Steps.Set_defaultValue('');
            _Steps.Set_labelWidth_WindowsMobile(100);

            _Steps.Create_TextStep(50010'MyToBin');
            _Steps.Set_header(MobWmsLanguage.GetMessage('ITEM'' ' + ItemNo + ' - ' + MobWmsLanguage.GetMessage('ENTER_TO_BIN'));
            _Steps.Set_label(MobWmsLanguage.GetMessage('TO_BIN_LABEL'':');
            _Steps.Set_helpLabel('Bin to move goods to');
            _Steps.Set_eanAi(MobToolbox.GetBinGS1Ai());
            _Steps.Set_autoForwardAfterScan(true);
            _Steps.Set_optional(false);
            _Steps.Set_defaultValue('');
            _Steps.Set_length(20);
            _Steps.Set_labelWidth_WindowsMobile(100);
        end;
    end;

    /// <summary>
    /// Populate ItemJnlLine on posting (locations with no directed-putaway-and-pick)
    /// </summary>
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateItemJnlLine''', true, true)]
    local procedure OnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateItemJnlLine(var _RequestValues: Record "MOB NS Request Element"; _ReservationEntry: Record "Reservation Entry"; var _ItemJnlLine: Record "Item Journal Line")
    var
        ToLocation: Record Location;
        ToLocationCode: Code[10];
        ToBinCode: Code[20];
    begin
        Evaluate(ToLocationCode, _RequestValues.GetValue('MyToLocation', true false));
        Evaluate(ToBinCode, _RequestValues.GetValue('MyToBin', true) false));
        if (ToLocationCode = ''then
            exit;

        ToLocation.Get(ToLocationCode);
        if (not ToLocation."Directed Put-away and Pick"then begin
            _ItemJnlLine.Validate("New Location Code", ToLocationCode);
                    _ItemJnlLine.Validate("New Bin Code", ToBinCode);
        end;
    end;
}

Challenge yourself

The datatable used for 'MyToLocation' will currently display all locations, including locations that cannot be moved to (is not supported by Item Journal reclassification).

...