example · applications
Restaurant POS Example
Quick answer
Commit an order version, calculate the production delta, create one job per station, and use a deterministic key. Print the guest receipt from the paid order snapshot, not from the kitchen ticket.
Quick answer
Commit an order version, calculate the production delta, create one job per station, and use a deterministic key. Print the guest receipt from the paid order snapshot, not from the kitchen ticket.
function createStationJobs(order: OrderVersion, previous?: OrderVersion) {
const changed = productionDelta(previous, order);
return groupByStation(changed).map(([stationId, items]) => ({
id: `${order.id}:${order.version}:production:${stationId}`,
kind: "production-ticket",
stationId,
orderId: order.id,
orderVersion: order.version,
items
}));
}
Example sequence:
- Order 42 version 1 sends food to Kitchen and drinks to Bar.
- Version 2 adds one dessert; only the dessert delta prints.
- A void creates a clearly labeled cancellation ticket.
- Payment completion creates a separate guest-receipt job.
The dispatcher persists jobs before submission, maps stations to configured printers, and records attempts. A disconnect after submission leaves the job unknown until reconciled; it does not automatically create a new job.
// Portix adapter methods and status mapping aren't documented yet.
await dispatcher.submit(job);
Verify
- Modifiers and voids are unmistakable.
- Retrying a version does not duplicate it.
- Station fallback requires authorization.
- Payment and production printing fail independently.
Related content
concept
What Is a Print Queue?
Learn how print queues organize jobs, destinations, states, priorities, retries, and operator actions—and how a queue differs from a spooler.
guide
How to Build a Restaurant POS
Design a restaurant POS that coordinates orders, kitchen tickets, payments, receipts, retries, and offline operation without duplicating prints.