- Created by Michael Voigt, last modified by Johannes Sebastian Nielsen on Mar 21, 2023
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 23 Next »
Minimum Requirements
Extension version MOB5.17
Case
Add custom step for To-Location when posting Unplanned Move from/to locations without "Directed Putaway-and-pick"
Proposed solution
This customization for Unplanned Move will:
- Hide "ToBin"-Step
- Prevents error on validating Bin from a different location when "New Location Code" is not set
- Create new "MyToLocation"-step
- Create new "MyToBin"-step
- Populate Item Journal on posting
Limitations
- Only locations with NO Directed-putaway-and-pick, as the reclassification whse. journal line do not support Location-to-Location transfer.
- In that case a Transfer-Order Must be used
Event
Populating ItemJnlLine with the Steps values is done using event OnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateItemJnlLine
This event is executed after the Item Journal Line has been populated by the standard Mobile WMS Code. The event is mostly intended for populating new custom fields at the Item Journal Line table (fields created from tableextensions).
Changing how standard Mobile WMS is populating the journal prior to event being called is currently not possible.
However, this exact customization can work due to two lucky circumstances:
- 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] [Add Custom step 'To-Location' to Unplanned Move]
//
/// <summary>
/// Hide 'ToBin' step from standard registrationcollector 'UnplannedMove' for locations with no directed-putaway-and-pick
/// </summary>
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAfterAddStep', '', true, true)]
local procedure OnGetRegistrationConfiguration_OnAfterAddStep(_RegistrationType: Text; var _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::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAddSteps', '', true, true)]
local procedure OnGetRegistrationConfiguration_OnAddSteps(_RegistrationType: Text; var _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::Codeunit, Codeunit::"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', false));
Evaluate(ToBinCode, _RequestValues.GetValue('MyToBin', 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).
- Create a new datatable for locations with "Bin Mandatory" but no directed-putaway-and-pick, Event OnGetReferenceData_OnAddDataTables can be used for this.
- Use your new datatable for the 'MyToLocation'-step by modifying the _Steps.Set_dataTable(...) statement.
Version History
Version | Changes |
---|---|
MOB5.17 | Introduced |
Standard Bin-Step. You are hiding this and replacing it with a custom step.
- No labels