Code highlighting

Showing posts with label print. Show all posts
Showing posts with label print. Show all posts

Saturday, October 01, 2016

Tutorial: Label printing in Microsoft Dynamics AX 7

A while back I posted a tutorial on how to configure and use the label printing functionality in Microsoft Dynamics AX 2012 R3:

http://kashperuk.blogspot.dk/2014/09/printing-labels-with-new-warehouse.html

With the release of Microsoft Dynamics AX 7 and the move to the Cloud, printing has become a bit more complicated than before, since the printers are not on the same domain / network as it used to be when everything was installed on-premise.

The major change that I will talk about in this post is the way we set up printers now.

Installing & configuring the Document Routing Agent

The wiki article describing the installation and configuration of the Document routing agent is very well written and contains a lot of details about the restrictions and requirements for this to work, so I will not repeat it here. Here is the link:


For example, one of the unexpected requirements is that Adobe Acrobat Reader is installed.

Note, that with a recent update of the AX platform, the Document Routing Agent can now be run in the background as a Windows service, which adds a number of benefits. Read more about that in the below wiki article:



Now that the document routing agent application / service is installed and can sign in to AX, you can select the printers you want to expose, activate them in the Network printers form, as described in the above wiki article.

After that, they will show up in the Printer name lookup on the Document Routing form as before.

Everything else is pretty much the same from a user standpoint, nothing changed in terms of document routing configuration or the WMDP configuration.

So when a label needs to be printed, here's what happens now:
  1. The label is generated in the ZPL code, as before, containing all the replaced variables from the document routing layout
  2. It is then saved in a file in the Azure Blob Storage (since the AOS does not have access to the client machine, we cannot just go and do something with it) in a pre-configured folder, including all the relevant settings, specifically, which printer to use for this label
  3. The Document Routing Agent application / service on the network printer server or just as a local application one of the network PCs will periodically query if there are any pending files to be printed, downloads them from the Azure Blob storage and, depending on the printer settings defined for the specific file, re-routes the file to be printed, whether that is to a Zebra printer, or, in the case of regular SSRS reports, to a PDF document, or a regular printer.

Note that before Platform Update 2 there was an unpleasant bug in this framework, which prevented printing of labels from the Warehouse Mobile Devices Portal. That has since been fixed, and you should be able to print labels without any problems (Workaround for people on earlier installations is to use the WMDP enumlator form from AX web client)

Give it a try and report back here in case you find some of the instructions unclear, or if something is not working according to your expectations.

Thanks!

Tuesday, September 16, 2014

Tutorial: Generating shipping labels using the GS1 SSCC-18 barcode format

As a follow up to my previous post about printing labels using the new WHS solution, I wanted to describe an extra feature that is available out of the box in the new Warehouse management solution and allows to generate the license plate shipping label in the format of an 18-digit serial shipping container code (SSCC), which is "used by many companies to identify a logistics unit, which can be any combination of trade items packaged together for storage and/or transport purposes; for example, a case, a pallet or parcel.", as quoted from GS1.

Here is an example of an SSCC-18 barcode (description of each of its components is provided here):

Configuring the SSCC in Dynamics AX

Let's take each part of the code above and see where we set it up in Dynamics AX:


  • Application Identifier for SSCC is always 00 and is therefore also hard-coded in the X++ code
  • Extension Digit in AX is used to specify the type of the logistics unit - pallet, case, etc. This is set up in the Unit sequence groups by specifying a digit 1-9 in the field License plate packing type, and is during work execution retrieved based on the item being processed. If no item is specified, Extension Digit will be set to 0.

Note

There is currently no validation implemented for this field, meaning you can type in any integer. Typing in a value that is more than 1 digit will obviously compromise your SSCC integrity

Here is how I have set up my Unit sequence group "Ea PL" for this demonstration:


  • GS1 company prefix is set up in the Warehouse management parameters and thus will be unique per company in Dynamics AX.

Note

There is currently no validation implemented for this field, meaning you can type in any string with a length of 8 or less characters. The requirement is of course that you only type in numerical data. Note also that according to the standard, the company prefix can be as large as 10 digits, which is not supported in AX right now, but is rather easy to customize if necessary.

Here is how I have set up the GS1 company prefix for this demonstration:


  • Serial reference is currently only set up to be generated based on a number sequence for License plate IDs. Many people request that the Container ID (used as part of manual packing or containerization flows) is used instead, but that's as of right now not possible and requires a customization. 

Note

There is currently no validation implemented to ensure the length of the generated number is within the required 6-9 digits, or that the generated string actually only consists of digits. It is therefore your responsibility to ensure the corresponding number sequence segments are set up correctly, ensuring that the combined length of GS1 company prefix and generated license plate ID is always 16 digits.

Here is how I have set up the License Plate ID number sequence for this demonstration:


  • The check digit is calculated automatically based on the generated ID and appended as the last symbol. No extra setup is required for this.

Mobile device menu item configuration

In order for all of the above to work, we need to make sure that the license plate is generated automatically by selecting the "Generate LP" check-box on the corresponding mobile device menu item.

Here is how I have set up the menu item for executing sales picking work for this demonstration:



OK, that's pretty much it. Now every time that a new target license plate is generated as part of picking sales orders, it will be in the format of a serial shipping container code. All you need to do is actually configure the work template to print the license plates, as shown in the above-mentioned post about printing labels.

The same will apply not only to sales picking work, but to many other types of mobile device flows, which as part of the flow generate a new license plate, both inbound and outbound.

Actual demonstration

To start off, I have configured the work template for sales orders to include an additional step to print the label, as shown on the screenshot below:


Next, I created a new sales order for 75 ea of item 000148_202, where a unit conversion is set up so that 1 PL = 75 ea. The order line is to be dispatched from warehouse 42, as shown below:


I reserve the line (you need to ensure there is sufficient on-hand inventory available for item 000148_202, and it is in a location, which is part of your location directives setup for Sales order picking), and release the order to warehouse, which, in turn, based on my wave template, creates a new wave and processes it, resulting in the creation of picking work that is shown on the image below:


As you can see, the Print steps is there, and the work lines are for 1 PL, which means that when printing the label, PL will be used to determine the value of the Extension digit.

Since the actual printing is already described in my previous post, I will use a different approach this time and will not setup the document routing at all. This will generate the label for me, but won't actually print it.

OK, so now let's proceed and actually execute the work. At the Pick screen, you will see the generated license plate ID, and can confirm that the format is right.


Note

The field is currently editable, so the work user can accidentally overwrite the generated value. This might improve in future AX releases to prevent human error.

Hotfix

I am afraid the contents of the generated ID are a bit off at the moment. If you type in the below SSCC code into a check digit calculator (e.g., here), you will see that the calculator produces a different check digit as compared to Dynamics AX. This is a product issue Microsoft is aware of, and it has been hot-fixed since RTM. The KB article number is 3001157 (should be available on LCS soon).


Once the Pick line is executed, the printing itself will happen, and will create a record in the License plate labels table. Go ahead and complete the Put, and let's review the label information that was persisted by navigating to Warehouse management \ Inquiries \ License plate labels. I took the liberty of hiding the uninteresting fields from the view.


As you can see, all the vital information about the license plate label, as well as the context in which this label was generated are stored, and can be used in the future.
You can, for example, reprint the label, if necessary, using a mobile device menu item with an Activity Code = Reprint label

That's it for today! Stay tuned for more.

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.