From be238e8e4835bdb35697584a6d02d183c135bfc4 Mon Sep 17 00:00:00 2001 From: Rodia Date: Fri, 22 Dec 2023 07:39:09 -0500 Subject: [PATCH] revert 81acf82312b158ea7e944355bda9fc285647feb8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert feat: Se aƱade tipo USB --- api.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/api.py b/api.py index 7cd2fb2..1ed17f7 100644 --- a/api.py +++ b/api.py @@ -15,23 +15,16 @@ app = FastAPI( class Info(BaseModel): content: str - printer_type: str ip_printer: str - idVendor: str - idProduct: str user_name: str -def print_bill(data, address=None, idVendor=None idProduct=None, waiter): +def print_bill(data, address, waiter): d = data # Crea una instancia de la impresora ficticia - if address: - printer = Network(str(address)) - elif idVendor and idProduct: - printer = Usb(int(idVendor), int(idProduct), 0) - else: - printer = Dummy() - + # printer = Network(str(address)) + # printer.open() + printer = Dummy() # Imprime el encabezado printer.set(align='center', bold=False, height=1, width=1) printer.text(d["shop_name"]+'\n') @@ -101,9 +94,9 @@ def print_bill(data, address=None, idVendor=None idProduct=None, waiter): printer.cut() printer.close() # Obtiene el contenido del ticket de prueba - # ticket_contenido = printer.output + ticket_contenido = printer.output # Imprime el contenido en la consola - # sys.stdout.write(ticket_contenido.decode('utf-8')) + sys.stdout.write(ticket_contenido.decode('utf-8')) def print_customer_order(data, address, waiter): @@ -177,7 +170,6 @@ def print_ticket_bill(info: Info): info = dict(info) data = info["content"] address = info["ip_printer"] - waiter = info["user_name"] data = json.loads(data.replace("'", "\"")) print_bill(data, address, waiter)