AutoLab4j Operation

From Commander4j

This page describes the end-to-end operational workflow of AutoLab4j — from an operator assigning a process order in Commander4j through to a label being printed on the production line.

Step 1 — Assign a Process Order

In the Commander4j desktop application, an operator assigns a Process Order to a production line using the Pallet Labelling screen.

Commander4j validates the assignment and writes a CSV data file to the dataset directory configured for that line. The filename follows the format LINE_NAME_PRINTER_NAME.CSV. See AutoLab4j Dataset CSV for the full list of fields in this file.

Step 2 — Data File Detection

AutoLab4j monitors the dataset directory continuously. When the CSV file appears, it is parsed and all fields are loaded into memory and made available to the label generation and Modbus threads for that production line.

If a new CSV file arrives while production is active, it replaces the previous data immediately. The next pallet printed will use the new product information.

Step 3 — Modbus Polling

AutoLab4j polls the Modbus coil address configured for the production line every 250 ms. When the coil transitions to the configured trigger value (typically true), a print sequence is initiated.

A second coil address is read at the same time to determine whether this is a full pallet or a semi-pallet. Full pallets and semi-pallets can have different quantities of SSCCs per pallet and labels per SSCC, as configured in config.xml.

Step 4 — SSCC Generation

For each SSCC to be printed on the pallet, AutoLab4j reads the next sequence number from the SSCC sequence file for this printer (xml/sscc/PRINTER_NAME.xml), calculates the EAN-13 check digit, and composes the 18-digit SSCC. The sequence file is updated immediately after each read so that the number is never reused even if the application restarts.

If the sequence number reaches the configured warning limit, an email alert is sent to the SSCC distribution list.

Step 5 — Label Generation

For each label to be printed, AutoLab4j loads the ZPL label template specified in the REPORT_FILENAME field of the CSV file. Field placeholders in the template (for example <*MATERIAL*>, <*SSCC*>, <*EXPIRY_DATE*>) are replaced with values from the dataset.

Batch numbers are calculated dynamically from the pattern configured for the customer in config.xml, using values such as the Julian day, week number, year, or process order number.

Expiry dates are calculated from the date of manufacture and shelf life values in the CSV.

Step 6 — Sending to the Printer

The completed ZPL is sent to the printer's IP address and port (read from the CSV dataset) over a raw TCP/IP socket connection on port 9100. AutoLab4j waits for the print thread to confirm transmission before moving to the next label.

If the Labelary preview is enabled, the ZPL is also sent to the Labelary API to render a preview image, which is displayed in the preview window on screen.

Step 7 — Production Declaration

After all labels for the pallet have been printed, AutoLab4j writes a Production Declaration XML file to the output directory. One file is produced per SSCC. The file records the SSCC, product, batch number, shelf life, and other details for downstream integration.

Step 8 — Ready for Next Pallet

The Modbus poller immediately resumes monitoring for the next coil transition. When the signal fires again, the same process repeats with the next SSCC sequence number.

Monitoring

System Tray Icons

AutoLab4j shows one system tray icon per production line. The icon colour indicates status:

Colour Meaning
Green Operating normally
Yellow Warning (SSCC sequence approaching limit)
Red Error (Modbus connection failure or print failure)

Right-click any tray icon for options:

  • Information — shows the Modbus and printer connection details for that line
  • View Order — shows the current product data loaded from the CSV
  • View Log — opens the notification window for that line

Log Windows

Each production line has its own notification window showing the last 50 log messages for that line. A separate System Log window shows service-level events. Right-click the system tray icon and select View Log to open it.

Log Files

All activity is written to logs/AutoLab.log with rolling rotation (10 MB per file, 14 days retention). The log records every Modbus poll result, every SSCC generated, every label sent, and every print confirmation.

Changing the Active Product

To switch product on a running line, an operator assigns a new process order in Commander4j. Commander4j overwrites the CSV file in the dataset directory. AutoLab4j detects the new file and loads it. The next Modbus trigger will use the new product data.

Stopping AutoLab4j

Stopping the service (via Windows Services, Ctrl+C, or the system tray Exit option) triggers a graceful shutdown. AutoLab4j signals all threads to stop, waits for any in-progress print jobs to complete, flushes the email queue, and exits cleanly.

See also: Overview AutoLab4j, AutoLab4j Configuration, AutoLab4j Dataset CSV, Installation AutoLab4j