Keeping Serial, Batch and Expiry Data From Colliding
Duplicate or mismatched codes are the common failure on labels with several variable fields. Field sources, the counter, restart rules and verification cover most of it.
A label printing a product code, batch, production date, expiry date and a running serial usually draws those values from several places. The clock supplies the date, the work order supplies the batch, and a counter or database supplies the serial. Two errors matter most: the same number printed twice, or a batch paired with the serial from the previous label. Both look perfectly normal to the eye and surface much further downstream.
List the source of every field
Write down who supplies it, the exact format, whether it may be empty and what happens when it overruns. Date formats cause the most trouble: order of year, month and day, separators, and whether expiry is calculated from the production date plus a number of months or supplied directly. If an operator types free text for each batch, duplicates and format errors are close to inevitable. Pull the values from the work order system instead.

Keep the counter in a database
Do not keep serials in a local file on an operator's PC. A copied file, a restored backup or a different machine can restart the count from the beginning. A database with transactions and a unique constraint reserves the number at the moment it is issued, which is far stronger than checking for duplicates afterwards.
Define what happens on an interruption
The usual cycle is issue a number, print one label, write back a used status. The hard part is exceptions: a jam, a power cut, a software restart or an empty roll leaves a number already issued. Mark it as allocated in a log at issue time, and only mark it complete after the print succeeds and the inline read passes. After an abnormal exit, have a person decide whether to reprint or void, rather than letting the software quietly restart the sequence. Log voided numbers too, because a silent gap is hard to explain during an audit.
Multiple machines
When several printers run the same batch, they cannot each hold their own counter. Use one issuing service, or assign each machine a non-overlapping number range and record the boundaries, with a new range requested only when the previous one is exhausted.
Restart rules
Resuming after a jam is where duplicates breed. The common habit is to tear off the unprinted labels and carry on, which breaks the correspondence between software state and physical stock. Make a rule: after an abnormal stop, reconcile the counter, the count of applied labels and the inline read log before restarting, and have a person check the first label after every restart. On lines with a reject station, the number belonging to a rejected label must be marked unused or voided in the database so a reprint does not consume it twice.
Verification is the last gate
Read every printed code and compare the decoded value with the value that should have been printed, then stop or reject on mismatch. Simply checking that a code scans is not enough, since a mismatched code scans perfectly well. Store the read result with a timestamp, machine ID and work order, and reconcile the exported list against the work order count at the end of the batch. Release only when the difference is zero.
Watch the template
One more failure is easy to miss: a variable field covered by fixed artwork, or a field box too short so the last character is clipped. The print looks right but a digit is missing. After any template change, including a wider box, a smaller font or a different symbology, test with real-length data rather than a short sample.
Archive and hand over
Keep template version, data source configuration, number range assignments and void records together, and hand them over at every shift change. At HuaiLion, a variable data setup ships with a field source sheet and a first-article check form, signed at start-up and after every abnormal restart. These habits look fussy until a traceability dispute arrives, when they remove most of the investigation. The system blocks the majority of errors; the first-article check and the log catch the remainder.

