Thursday, September 11, 2014

Printing labels with the new Warehouse management solution

Hi all,

This blog post is based on a document I got from Boštjan Golob, a solution architect working with Dynamics AX. You can connect with Boštjan through LinkedIn.

I really enjoyed the information he provided and therefore wanted to share it publicly so all the AX community can learn how to configure and print labels with the new warehouse management solution. So here it is, enjoy:

Step 1: Understanding

How does AX actually print the labels? It is important to know that most label printers currently in use (such as Zebra brand printers) include some sort of a programming language interpreter and that the print job sent to a label printer is actually a small program. This is no different than with larger printers that use Postscript (there are web servers written in Postscript). In label printing, the feature set of a command language is usually quite rich: you can control the cutting of labels, the printer itself knows how to draw barcodes, you can select fonts that it has loaded in its memory and so on. This is an example of a ZPL (Zebra Programming Language) program:

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ
^XA
^MMT
^PW320
^LL0160
^LS0
^FT20,58^A0N,28,28^FH\^FDNalepka:^FS
^FT20,81^AAN,18,10^FH\^FD$LicensePlateId$^FS
^BY1,3,17^FT20,106^BCN,,Y,N,N,A
^FD$LicensePlateId$^FS
^PQ1,,,Y^XZ

AX can print a very sophisticated label by sending such a »program« to the label printer, while at the same time knowing absolutely nothing about label layouting. The labels stored in AX are command snippets like above. These are stored in Document routing layouts (Warehouse management – Setup – Document routing – Document routing layouts).
Knowing when to print a label is the job of configuration of menu items and work templates. AX can initiate printing of labels at work creation (for example in receiving scenarios), or during work execution. Which label to print is the job of document routing setup, where we tell the system, based on what we are currently doing, which label to pick and which label to send it to. We well get to configuration later.

Step 2: Getting the label in a text format

In order for this walk-through to be as comprehensive as possible (and as easy to click through without any annoying »this is left as an exercise to the reader« parts), the process of creating a small demo label will be demonstrated. I will use the NiceLabel labeling software (Made in Slovenia).
First, get the NiceLabel Designer Pro from the web site (www.nicelabel.com) and install the 30-day trial. Also download the NiceLabel Label Printer Drivers, as we will need them to create a dummy printer for NiceLabel to adapt the label to. This is important – label designs can be printer dependent and if you use multiple types of printers, it's best to export the labels with NiceLabel set to every different printer you will use the label with!
Before creating the label, follow these steps to create a dummy printer:
  1. Open the »Devices and Printers« in Control Panel, click on any printer and from the toolbar, select Print Server Properties.
  2. In the next form, select the Ports tab.
  3. Click Add Port…
  4. Select Local port and click New Port…
  5. For the port name, enter a file name (I use C:\_TEMP for misc. crap, so I put in C:\_TEMP\ZEBRAPRINT.TXT)
  6. OK out of everything.
  7. Run the installation program for the NiceLabel Printer Drivers and select a printer you would like to use (I have chosen a pretty basic »ZEBRA GC420d ZPL« printer).
  8. Select the port you have just created.
  9. Finish the installation.
  10. Rejoice!
After the printer is ready, open NiceLabel Designer and create a new label, selecting the printer you have just installed. You will get a blank canvas and you can start drawing. I have created the following layout using the Text and Bar code tools:

Label designer

The second text field is a variable field with the variable name LicensePlateId and the same variable is used for the bar code as well. You can design the label with fixed values, but you will then need to change the text in AX. NiceLabel also comes with plenty of out of the box sample labels, including GS1 SSCC label and so on, which can also be used as a starting point.
To get the text version of the label, you can use several options. NiceLabel Designer Pro supports export of templates for use in external systems. First, let's configure the AX specifics for export. Select File – Export – Printer Template Export Configuration and Add a new system. Give it a name (Dynamics AX WHS) and an extension (txt) and in the Variables tab page, enter $[Name]$ in Variables field like so:

NiceLabel Printer Template Export Configuration

This will cause variables used in the label to be exported in the generated file as $VariableName$, which is the format expected by AX when it does its own substitution of variable contents.
After you are done with this definition, click File – Export – Dynamics AX WHS and NiceLabel will create a nice text file which you then copy and paste into AX:

Document routing layouts

Step 3: Configuring document routing

We will use this label as part of the receiving put-away process 24 PO Direct, so we need to configure the document routing record. In the Document routing form, create a record similar to this one:

Document routing

I have used my dummy printer that I have installed on the AOS. Feel free to experiment with other filter values, which you will probably use in production, at least to differentiate to which printer you want to print the label (note to Microsoft: some web browsers can print to locally attached printers that people carry around with them, so printing could also be done via the web interface). Again – to use the printers, AOS will need to be able to print to them. I would strongly suggest using networked printers, not printers connected locally to computers in the warehouse and then shared, at least from experience. It is best to log on locally to the AOS as the AOS service account and check if you can print to the printers.
Lastly, we need to configure the work templates to print the label as part of the process. To do this, insert a Print step in the Work Template. In our example, 24 PO Direct gets another work step:

Work templates
 
The same approach can be used in the Sales order scenario as well, to create shipping labels for the picked license plates.
In case you would like to print your own labels as a part of receiving goods, you can use the "Print label" check-box on Mobile device menu items for several Work creation processes (PO receiving, Report as finished, Load receiving, TO receiving, Kanban). There is also an indirect activity "Reprint label" for later printing of LP labels.

Step 4: Demo

Create a purchase order for some goods and receive it using the mobile device (web or AX form). There will be no visible change from the user perspective, but, if all goes well, the file you set up for the dummy printer should appear and under Inquires – License plate labels, you should be able to see the newly created label. If you open the file using Notepad, it should contain ZPL with LicensePlateId substituted for the actual license plate number:

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ
^XA
^MMT
^PW320
^LL0160
^LS0
^FT20,58^A0N,28,28^FH\^FDNalepka:^FS
^FT20,81^AAN,18,10^FH\^FDTESTLP00001^FS
^BY1,3,17^FT20,106^BCN,,Y,N,N,A
^FDTESTLP00001^FS
^PQ1,,,Y^XZ

To see how the label would be printed out, you can use for example the Labelary service. The above example can be rendered using this URL.

Giving a nice result like this:
Printed label

That's it, you are all set to explore this on your own further, and thanks to Boštjan again for providing this comprehensive description of the process.


15 comments:

  1. Sorry for my ignorance, I would like to know if this is a kind of vendor lockin to ZPL?

    ReplyDelete
    Replies
    1. I am not sure what you mean. Can you clarify your question? Thanks

      Delete
  2. How can I setup D365FO to print labels for de inventory movement process?

    ReplyDelete
  3. How can I setup D365FO to print label during inventory movement process?

    ReplyDelete
    Replies
    1. Custom work type step?
      I do not believe that is supported out of the box.
      Why would you even want to?

      Delete
    2. say you had 2000# on LP 1234. You do an inventory movement and split off 1000# onto a new license plate: 5678. How do we go about printing that new license plate 5678?

      Delete
    3. I think you'd need a custom flow for this right now.

      Delete
  4. Is it possible to print multiple labels from one work order. Example like one PO with 2 quantities and need to print it using the work automatically 2 labels.

    ReplyDelete
    Replies
    1. Well, only if you do that through ZPL itself.
      If it's multiple different labels, then no, not out of the box for inbound flows like PO

      Delete
  5. How to configure ZPL printer in Dynamics 2012 R3?

    ReplyDelete
  6. Really a superb information this provided me and was able do this successful.

    Thank You

    ReplyDelete
  7. Can I create a pick label for sales and a different pick label for Transfer order?

    ReplyDelete
    Replies
    1. Sure. You can filter the document routing based on work order type, so dedicated for sales - transfer

      Delete
  8. Excellent tutorial as always, so thank you. (You have taught me many things.) Can you clarify one point for me please? What is the difference between adding the print step in a PO receiving work template or using the "Print Label" on the PO Receiving mobile device menu? You made a comment, "In case you would like to print your own labels as a part of receiving goods, you can use the "Print label" check-box on Mobile device..." but I don't fully understand what you mean. Thanks Vanya!
    Robert

    ReplyDelete
    Replies
    1. The main difference is in the time when the label is printed/generated. WIth the check-box, it's after registration is done before work, as far as I remember, while with work template line it's after the pick step. As a result, the information available, and thus what you can print on the label, is slightly different. I believe I described this in detail in some other post about label printing, but am not 100%

      Delete

Please don't forget to leave your contact details if you expect a reply from me. Thank you