WHS Label copies, Custom work, display methods on labels

by Eugen Glasow

Todays exercise is seemingly simple: print a voluntary number of warehouse label copies where the standard Dynamics 365 SCM only prints one. The ingredients are quite exquisite and variegated:

^PQ

Let’s start with a proof of concept: print as many labels as there are items. Assuming there are 3 items on the license plate (pallet), let’s print the same label 3 times. This sounds simple, yet you need the latest and the coolest feature Enhanced license plate label layouts. With that feature you can finally carve a substring from Dynamics data, but also format numbers and dates. This is exactly what we need.

In Warehouse management > Setup > Document routing > Document routing layouts, every Zebra label template ends with something like
^PQ1,0,1,Y
which is the instruction to the label printer how many copies to print. Now replace this line with
^PQ$Qty:0$,0,1,Y
The quantity as a real number is truncated to an integer on the label, and the ZPL printer makes as many copies as there were pieces on the pallet.

Display method

A real game changer is now the ability to parse a display method on the WMSLicensePlateLabel table. Let Dynamics calculate the number of copies on the fly, leveraging the PackingQty factor which is the number of pieces in the topmost unit of the Unit sequence group. Assuming the unit sequence group is PCS-BOX i.e. pieces in boxes and if the nominal quantity per box is 20, for a license plate with 100 items on it I would like to have 5 copies of the label.

Extend the WMSLicensePlateLabel as follows
[ExtensionOf(tableStr(WHSLicensePlateLabel))]
final class WHSLicensePlateLabel_Extension
{
display Num noOfCopiesSimple()
{
return int2Str(this.PackingQty > 1 ? any2Int(roundUp(this.Qty / this.PackingQty,1)) : 1);
}
}

and embed it into the ZPL code like this:
^PQ$noOfCopiesSimple()$,0,1,Y

Now the number of copies is dynamic, configurable and obeys the master data settings.

Custom work

The high-end solution is to let the user override and decide how many copies to print. In order to do that, before the Print line in the Work template we need an extra screen of the Custom work type:
Custom work type

This brings the following prompt on the mobile device

You may also want to explore possibilities of simple validations and post-processing of the data captured on the Custom work screen:
Custom method tutorial.

The number of copies entered by the user is then interpreted by a more sophisticated display method:
display Num noOfCopies()
{
int noOfCopies;
WHSWorkLineCustom workLineCustom;
WHSWorkLine workLine;
select firstonly Data from workLineCustom
exists join workLine
where workLine.WorkId == this.WorkId
&& workLine.WorkType == WHSWorkType::Custom
&& workLineCustom.WorkId == workLine.WorkId
&& workLineCustom.LineNum == workLine.LineNum;
if (workLineCustom.Data)
{
noOfCopies = str2Int(workLineCustom.Data);
}
if (! noOfCopies)
{
noOfCopies = this.PackingQty > 1 ? any2Int(roundUp(this.Qty / this.PackingQty,1)) : 1;
}
return int2Str(noOfCopies);
}

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *