Generated page. Written from IdaMilk/SunApps_Printer at commit 44520dc on 2026-07-28, version 1.1.1. No README; inferred from source.
SunApps Printer
What is it?
The service that turns "print this pallet label" into ZPL on a Zebra printer. It also drives two pieces of plant hardware directly over TCP.
Its package.json summarises it as "TCP hardware control and Zebra label printing".
Purpose
Labels are how physical inventory stays connected to its record — a pallet without a correct label is untraceable. Concentrating label rendering here means templates live in one reviewable place instead of being assembled ad hoc by whichever app needs a label.
Queueing to the database rather than printing inline also means an offline printer delays a label rather than failing the operation that requested it.
How it Works
Two route families sit on the same service. /api/printer covers printer management and hardware control; /api/zebra covers label printing.
A print request resolves a ZPL template, substitutes values via helpers/zplTemplate.js, and writes a row to PrintJob. The Print Worker — a separate process running near the printers — claims that row and sends it to the printer over TCP. This service does not talk to the printers itself for queued jobs.
utils/printerRegistry.js maps logical printer names to their configuration, so callers ask for a printer by role rather than by address.
A Bottleneck limiter throttles hardware calls, as in the NetSuite service — plant hardware is less forgiving of concurrent connections than a web API.
ZPL templates
Templates are committed as .zpl files, split by DPI where the same label has to render on both 203 and 300 dpi hardware:
| Template | Purpose |
|---|---|
Pallets/NON_FG_Pallet_300_DPI.zpl | Non-finished-goods pallet, 300 dpi |
Pallets/203_DPI/FG_Pallet_203_DPI.zpl | Finished-goods pallet, 203 dpi |
Pallets/203_DPI/FG_Pallet_203_DPI_CUST_LOT.zpl | Finished goods with customer lot |
Samples/Sample_Label.zpl | QC sample |
Samples/Milk_Truck_Sample_Label.zpl | Milk truck sample |
Samples/Vial_Label.zpl | Sample vial |
Samples/Streak_Plate_Record_Label.zpl | Microbiological streak plate |
Hardware control
Beyond labels, the service issues commands to two plant devices, each with its own command module:
| Module | Device |
|---|---|
utils/cc1000Commands.js | CC1000 controller |
utils/mkg1000Commands.js | MKG1000 controller |
These are raw TCP command sets rather than an API — a genuinely different concern from label printing, sharing a service mainly because both speak TCP to plant hardware.
Data model
| Model | Holds |
|---|---|
Printer | Printer registry — address, port, DPI, role |
PrintJob | Queued jobs and their status |
Tech Stack
| Technology | Version | Purpose |
|---|---|---|
| Express | 5.2.1 | HTTP framework |
| Sequelize | 6.37.8 | ORM |
| tedious | 19.2.1 | SQL Server driver |
| bottleneck | 2.19.5 | Hardware call throttling |
| morgan | 1.10.1 | Request logging |
| rotating-file-stream | 3.2.9 | Log rotation |
| cors | 2.8.6 | Cross-origin support |
| dotenv | 17.4.2 | Configuration |
Interfaces
| System | Direction | Purpose |
|---|---|---|
| SunApps Gateway | inbound | Proxies /api/printer and /api/zebra here |
| SQL Server | outbound | Printer registry and job queue |
| Print Worker | indirect | Consumes PrintJob rows and does the actual printing |
| Zebra printers | outbound | Direct control paths |
| CC1000 / MKG1000 | outbound | TCP hardware commands |
Operations
Deployed by GitHub Actions to an internal application server under a process supervisor, using the standard development / production / tagging workflow trio.
When a label does not appear, the split architecture determines where to look: a PrintJob row that was never created is a problem in this service; a row stuck pending is a problem in the Print Worker or the printer itself.
Repository
| Repository | IdaMilk/SunApps_Printer |
| Version | 1.1.1 |
| Primary language | JavaScript (Node, CommonJS) |
| Files | 28 |
| Last activity | 2026-05-18 |
| Status | Active |
| README | None — the ZPL template naming convention and the printer registry would benefit most from documenting |