feat(real-data): carga dinamica de workstations y tickets/movimientos reales desde SQL Server
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user