DataItem ‘NoOfPackages’
This bespoke Codeunit subscribes to events in WMS Devices – specifically codeunit HHW Std. Trans. Activity Mgt. - adding a “No. Of Packs” DataItem to warehouse activities after Initialise, and populating a field on Warehouse Activity Line immediately before registering the activity…
Picking Example: Validate ‘ActivityNo’
This bespoke codeunit subscribes to the events and uses the ValidateTransDataItem function to reduce the overhead of code.
On Initialise, ActivityNo is set to Blank and is not Locked - It will be prompted for.
After Initialise a Lookup is built for Warehouse Shipments which have Warehouse Activity Pick Lines - ‘ShipmentKey’.
When this is validated ‘ActivityNo’ is Validated with the first pick line assigned to the chosen Warehouse shipment.
This is advantageous because now all the standard WMS Devices validation code for ‘ActivityNo’ will take place with the developer having to replicate anything or write any more code. The new value will be validated into ‘ActivityNo’, the user will not have to prompt for it and all the dependant fields will be populated accordingly.
The flow is as follows:
./media/image5.png
Function - Consolidate
This is a real example of a function originally created for one of our customers under a previous version of Handheld: A bespoke pallet/container confirmation screen was required. This function uses the bespoke tables “Container Header” and “Container Line” and sets a Boolean confirmation that the container has been consolidated.
A function was added manually to the Device Function table and added to the device menu.
A new codeunit called “Custom Handheld Functions” was created.
Four new handlers were created that hooked into OnFunctionInitialise, OnFunctionValidate, OnFunctionCancel and OnFunctionPost respectively.
The codeunit is designed to cater to multiple bespoke functions, hence the use of CASE statements.
Functions were then created for each consolidation request type.
The ValidationItems are cycled through in turn (We only need to worry about validating the container). We check the data is valid and set the responses accordingly (SetResponseData). We also add visual elements or ColumnStyles (AddColumnStyleGroup and AddColumnStyle).
Sets Consolidated on the container lines and marks the Status DataItem as ‘Confirmed’.
The resulting behaviour looks like this…
Initialise > Validate > Post
It’s also worth adding an event subscriber for table HHF Device Function event OnAfterGenerateFunctions so that the bespoke function is re-added when “Generate Functions” is clicked.
As Clever WMS Devices is not referenced we only need a dependency on the framework, so the dependencies section in app.json will require the following entry...