Printer and Services
Printer
Sales Point does support the printout of a receipt using a standard ESC/POS printer like the Epson TM-T88V.
This printer can receive printing jobs via a LAN interface and communicates via the ESC/POS protocol.
For this protocol a simple library found at lib/escpos/ was created.
If an order is submitted a receipt is printed using a Active Job (part of Ruby on Rails framework, see Services).
From the application perspective a printer must be added to the printer table in the database. This table contains its IP and whether a printer is enabled. This structure is foreseen for a multi-printer setup (i.e., multiple cashdesks served by one server; not yet implemented).
The Epson printer supports DHCP but it does not work reliably. Thus, it is recommended to configure the router to set a static IP for the given MAC address.
ESC/POS printing command references
The list provides some useful references on what commands are available when printing.
- https://aures-support.com/DATA/drivers/Imprimantes/Commande%20ESCPOS.pdf
- https://www.novopos.ch/client/EPSON/TM-T88V/APG/Use_tips_eng_apg_1006.pdf
- https://upload.wikimedia.org/wikipedia/commons/1/1b/ASCII-Table-wide.svg
The printer uses code pages for characters. A useful reference is https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=32
Printer selection
As of now, the printer name to look for in the database is hardcoded.
Edit the name of the printer in app/jobs/order_print_job.rb.
It is intended to make this selection configurable.
Services
For printing a receipt ActiveJobs are used which are handled with the SolidQueue backend. See documentation and also the actual SolidQueue docs for more details.
Printer thread safety
As the printer can only handle one job at once, the ActiveJob is limited to one concurrent execution with the SolidQueue limits_concurrency option.