fix: reg_501 tolera NULL en Destino y CLAVETRANSFER #2

Merged
acazares merged 1 commits from fix/reg501-null-hang into development 2026-08-03 16:54:59 +00:00
3 changed files with 9 additions and 7 deletions

View File

@@ -184,7 +184,7 @@ class InterfazFlet:
self.page.run_task(_done)
except Exception as ex:
print(f"[UI ERROR] {ex}")
log.error(f"[UI ERROR] Fallo en el hilo de sincronizacion: {ex}", exc_info=True)
async def _err():
self.status_label.value = f"Error: {ex}"
self.page.update()

View File

@@ -9,10 +9,11 @@ class Generador501SCAF:
"""
# Lógica de Destino/Zona (SCAF a veces usa códigos distintos, pero el if parece igual)
destino = datos_pedi.get("OPCIONDESTINO", "")
# OJO: usar "or ''" y no get(k, ''), porque un NULL de BD llega como None y el default no aplica
destino = datos_pedi.get("OPCIONDESTINO") or ""
codigo_destino = "9" if "Interior" in destino else "7" if any(x in destino for x in ["Región", "Franja"]) else ""
clave_transfer = datos_cliente.get("CLAVETRANSFER", "").strip() if datos_cliente else ""
clave_transfer = (datos_cliente.get("CLAVETRANSFER") or "").strip() if datos_cliente else ""
# Construcción del Registro 501 SCAF
registro = {

View File

@@ -9,11 +9,12 @@ class Generador501:
"""
# Lógica de Destino/Zona (Opcional)
destino = datos_pedi.get("Destino", "")
# OJO: usar "or ''" y no get(k, ''), porque un NULL de BD llega como None y el default no aplica
destino = datos_pedi.get("Destino") or ""
codigo_destino = "9" if "Interior" in destino else "7" if any(x in destino for x in ["Región", "Franja"]) else ""
# Clave del Importador/Exportador
clave_transfer = datos_cliente.get("CLAVETRANSFER", "").strip() if datos_cliente else ""
clave_transfer = (datos_cliente.get("CLAVETRANSFER") or "").strip() if datos_cliente else ""
# Construcción del Registro 501
registro = {