format string for datetime
This commit is contained in:
parent
c7a3feee1c
commit
508f8b984f
14
api.py
14
api.py
@ -21,14 +21,15 @@ class Info(BaseModel):
|
||||
def imprimir_ticket_de_prueba(data, address):
|
||||
d = data
|
||||
# Crea una instancia de la impresora ficticia
|
||||
printer = Network(str(address))
|
||||
printer.open()
|
||||
#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("Pedido Por: " + str(d['user'])+ '\n')
|
||||
printer.text(str(datetime.now())+'\n')
|
||||
format_date_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
printer.text(str(format_date_time)+'\n')
|
||||
printer.set(align='center', bold=False, height=2, width=2, custom_size=True)
|
||||
printer.text('========================\n')
|
||||
text = 'MESA: ' + str(d['table'] + "\n")
|
||||
@ -64,14 +65,13 @@ def imprimir_ticket_de_prueba(data, address):
|
||||
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'))
|
||||
|
||||
@app.post("/order_kitchen")
|
||||
def print_ticket_file_kitchen(info : Info):
|
||||
print(info)
|
||||
info = dict(info)
|
||||
data = info["content"]
|
||||
address = info["ip_printer"]
|
||||
|
Loading…
Reference in New Issue
Block a user