feat(real-data): carga dinamica de workstations y tickets/movimientos reales desde SQL Server

This commit is contained in:
Carlos Tello
2026-10-13 16:41:20 -03:00
parent c3810a6525
commit e5b2b98d41
17 changed files with 564 additions and 147 deletions
+26
View File
@@ -155,3 +155,29 @@ class AccessService:
)
for f in filas
]
@staticmethod
def obtener_ultimos_movimientos(limite: int = 50) -> List[dict]:
"""Retorna los últimos movimientos reales registrados en SQL Server mvthist."""
from app.schemas.access_schema import MovementHistoryDTO
filas = AccessRepository.listar_ultimos_movimientos(limite)
resultado = []
for f in filas:
fh = f["FechaHora"]
fh_str = fh.strftime("%Y-%m-%d %H:%M:%S") if isinstance(fh, datetime) else str(fh)
resultado.append(
MovementHistoryDTO(
mvt_hist_id=f["MvtHistID"],
ticket_id=f["TicketID"] or 0,
sentido=str(f["Sentido"] or "Ingreso"),
patente=f.get("Patente"),
apellido=f.get("Apellido"),
nombre=f.get("Nombre"),
documento=f.get("Documento"),
lote_codigo=None,
modulo_nombre=f.get("ModuloNombre"),
fecha_hora=fh_str,
entidad=f.get("Entidad"),
)
)
return resultado