Skip to main content

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:

TemplatePurpose
Pallets/NON_FG_Pallet_300_DPI.zplNon-finished-goods pallet, 300 dpi
Pallets/203_DPI/FG_Pallet_203_DPI.zplFinished-goods pallet, 203 dpi
Pallets/203_DPI/FG_Pallet_203_DPI_CUST_LOT.zplFinished goods with customer lot
Samples/Sample_Label.zplQC sample
Samples/Milk_Truck_Sample_Label.zplMilk truck sample
Samples/Vial_Label.zplSample vial
Samples/Streak_Plate_Record_Label.zplMicrobiological streak plate

Hardware control

Beyond labels, the service issues commands to two plant devices, each with its own command module:

ModuleDevice
utils/cc1000Commands.jsCC1000 controller
utils/mkg1000Commands.jsMKG1000 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

ModelHolds
PrinterPrinter registry — address, port, DPI, role
PrintJobQueued jobs and their status

Tech Stack

TechnologyVersionPurpose
Express5.2.1HTTP framework
Sequelize6.37.8ORM
tedious19.2.1SQL Server driver
bottleneck2.19.5Hardware call throttling
morgan1.10.1Request logging
rotating-file-stream3.2.9Log rotation
cors2.8.6Cross-origin support
dotenv17.4.2Configuration

Interfaces

SystemDirectionPurpose
SunApps GatewayinboundProxies /api/printer and /api/zebra here
SQL ServeroutboundPrinter registry and job queue
Print WorkerindirectConsumes PrintJob rows and does the actual printing
Zebra printersoutboundDirect control paths
CC1000 / MKG1000outboundTCP 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

RepositoryIdaMilk/SunApps_Printer
Version1.1.1
Primary languageJavaScript (Node, CommonJS)
Files28
Last activity2026-05-18
StatusActive
READMENone — the ZPL template naming convention and the printer registry would benefit most from documenting