Tests: Flake8, Rakefile
This commit is contained in:
24
Api/main.py
24
Api/main.py
@@ -1,5 +1,6 @@
|
||||
from fastapi import FastAPI, Response
|
||||
from escpos.printer import Dummy, Network
|
||||
from escpos.printer import Dummy
|
||||
# from escpos.printer import Network
|
||||
import sys
|
||||
import json
|
||||
|
||||
@@ -139,17 +140,28 @@ def print_customer_order(data, address, waiter):
|
||||
for line in d["lines"]:
|
||||
if line['type'] != 'title':
|
||||
if combination_pizza and pizza < 2:
|
||||
printer.set(align='center', bold=False, height=2, width=2, custom_size=True)
|
||||
printer.set(
|
||||
align='center',
|
||||
bold=False,
|
||||
height=2,
|
||||
width=2,
|
||||
custom_size=True)
|
||||
pizza += 1
|
||||
elif pizza >= 2:
|
||||
combination_pizza = False
|
||||
printer.set(
|
||||
align='left', bold=False, height=2, width=2, custom_size=True
|
||||
align='left',
|
||||
bold=False,
|
||||
height=2,
|
||||
width=2, custom_size=True
|
||||
)
|
||||
else:
|
||||
printer.set(
|
||||
align='left', bold=False, height=2, width=2, custom_size=True
|
||||
)
|
||||
align='left',
|
||||
bold=False,
|
||||
height=2,
|
||||
width=2,
|
||||
custom_size=True)
|
||||
|
||||
text = line['product'] + " " + str(line['quantity']) + "\n"
|
||||
printer.text(text)
|
||||
@@ -175,7 +187,7 @@ def print_customer_order(data, address, waiter):
|
||||
ticket_contenido = printer.output
|
||||
|
||||
# Imprime el contenido en la consola
|
||||
#sys.stdout.write(ticket_contenido.decode('utf-8', errors='replace'))
|
||||
sys.stdout.write(ticket_contenido.decode('utf-8', errors='replace'))
|
||||
|
||||
|
||||
@app.post("/print_bill")
|
||||
|
||||
Reference in New Issue
Block a user