diff --git a/requirements.cli.txt b/requirements.cli.txt index d1662e3a6f..5e1ab81cf7 100644 --- a/requirements.cli.txt +++ b/requirements.cli.txt @@ -1,5 +1,5 @@ python-escpos[all]==3.1 -python-socketio[client] +python-socketio[client]==5.11.4 requests==2.32.3 aiohttp==3.10.2 argparse==1.4.0 diff --git a/requirements.kivy.txt b/requirements.kivy.txt index 8871583c14..17cbc6816e 100644 --- a/requirements.kivy.txt +++ b/requirements.kivy.txt @@ -1,5 +1,5 @@ python-escpos[all]==3.1 -python-socketio[client] +python-socketio[client]==5.11.4 websocket-client==1.8.0 simple-websocket==1.0.0 requests==2.32.3 diff --git a/requirements.txt b/requirements.txt index 818d658b59..c11a0ca83f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ pillow==10.4.0 pypng==0.20220715.0 python-barcode==0.15.1 python-escpos[all]==3.1 -python-socketio[client] +python-socketio[client]==5.11.4 PyYAML==6.0.2 qrcode==7.4.2 requests==2.32.3 diff --git a/src/cli.py b/src/cli.py index 77d7d2d422..6cc727221a 100644 --- a/src/cli.py +++ b/src/cli.py @@ -29,13 +29,14 @@ def start(): + logger.info("Iniciando Fiscalberry Server") + + serverUrl = configberry.config.get("SERVIDOR", "sio_host", fallback="") + uuid = configberry.config.get("SERVIDOR", "uuid") + send_discover_in_thread() while True: - logger.info("Preparando Fiscalberry Server") - serverUrl = configberry.config.get("SERVIDOR", "sio_host", fallback="") - uuid = configberry.config.get("SERVIDOR", "uuid") - send_discover_in_thread() sio = FiscalberrySio(serverUrl, uuid) sio.start_print_server() logger.warning("Termino ejecucion de server socketio?.. reconectando en 5s") diff --git a/src/common/EscPComandos.py b/src/common/EscPComandos.py index cd86257d7d..4f936149ad 100644 --- a/src/common/EscPComandos.py +++ b/src/common/EscPComandos.py @@ -324,10 +324,6 @@ def printFacturaElectronica(self, escpos: EscposIO, **kwargs): importeUnitario = floatToString( importe ) totalProducto = f"{round( qty * importe , 2 ):,.2f}" - # si la cantidad qty o el importe importe son 0, no se imprime - if qty == 0 or importe == 0: - continue - if tipoComprobante in tiposInscriptoString or tipoCmp in tiposInscriptoCod: printer.set(font='b', bold=True, align='left', normal_textsize=True) printer.text(f"{itemCant} x {importeUnitario} ({floatToString(alicIva)})\n") diff --git a/src/common/fiscalberry_sio.py b/src/common/fiscalberry_sio.py index 889303ad96..4a528b020a 100644 --- a/src/common/fiscalberry_sio.py +++ b/src/common/fiscalberry_sio.py @@ -34,27 +34,27 @@ class FiscalberrySio(): stop_event = threading.Event() def __init__(self, sockeiIoServer, uuid, namespaces = ["/paxaprinter"]) -> None: - self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=sioLogger) + self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=False) self.sockeiIoServer = sockeiIoServer self.uuid = uuid self.namespaces = namespaces - @self.sio.on("connect", namespace='/paxaprinter') - def handleConnect(**kwargs): - def handleJoin(*args, **kwargs): - print(f"Joined!!!!!!!! OKK {args} {kwargs}") - + @self.sio.event(namespace='/paxaprinter') + def connect(): logger.info(f"connection established with sid {self.sio.sid}") - self.sio.emit("join", data=uuid, namespace='/paxaprinter', callback=handleJoin) + @self.sio.event(namespace='/paxaprinter') + def connect_error(err): + logger.error(f"Connection failed due to: {err}") - @self.sio.on('disconnect', namespace='*') - def handleDisconnect(): + @self.sio.event(namespace='/paxaprinter') + def disconnect(): logger.info("Disconnected from server") sys.exit(0) + def start_only_status(self): self.__run() @@ -67,7 +67,7 @@ def start_only_status_in_thread(self) -> threading.Thread: def __run(self): try: logger.info("FiscalberrySio: ******************************* CONECTANDO *******************************") - self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"X_UUID":self.uuid}) + self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"x-uuid":self.uuid}) logger.info("Iniciado SioClient en %s con uuid %s" % (self.sockeiIoServer, self.uuid)) self.sio.wait()