feat(real-data): carga dinamica de workstations y tickets/movimientos reales desde SQL Server
This commit is contained in:
@@ -1,29 +1,48 @@
|
||||
# ==============================================================================
|
||||
# Endpoints de Puestos de Control y Workstations (/api/v1/control-posts)
|
||||
# ==============================================================================
|
||||
from typing import List, Dict, Any
|
||||
from typing import List
|
||||
from fastapi import APIRouter
|
||||
from app.schemas.workstation_schema import WorkstationStatusResponse
|
||||
from app.schemas.workstation_schema import (
|
||||
WorkstationStatusResponse,
|
||||
WorkstationConfigResponse,
|
||||
WorkstationItemDTO,
|
||||
)
|
||||
from app.services.workstation_service import WorkstationService
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get(
|
||||
"/workstations",
|
||||
response_model=List[WorkstationItemDTO],
|
||||
summary="Listar todas las Workstations reales registradas en SQL Server",
|
||||
)
|
||||
async def list_workstations():
|
||||
"""Listado real de estaciones desde la tabla wks para selector de login."""
|
||||
return WorkstationService.listar_estaciones_disponibles()
|
||||
|
||||
|
||||
@router.get(
|
||||
"/{name}/config",
|
||||
response_model=WorkstationConfigResponse,
|
||||
summary="Consultar configuración de módulos de carril asignados a la workstation",
|
||||
)
|
||||
@router.get(
|
||||
"/workstation/{name}/config",
|
||||
response_model=WorkstationConfigResponse,
|
||||
summary="Consultar configuración de módulos de carril asignados a la workstation (alias)",
|
||||
)
|
||||
async def get_workstation_config(name: str):
|
||||
"""Retorna los módulos de entrada y salida asignados a la estación en wksmdl y mdl."""
|
||||
return WorkstationService.obtener_config_workstation(name)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/workstation/{name}/status",
|
||||
response_model=WorkstationStatusResponse,
|
||||
summary="Consultar estado y carriles asignados a una Workstation",
|
||||
summary="Consultar estado y módulos de la Workstation",
|
||||
)
|
||||
async def get_workstation_status(name: str):
|
||||
"""Verifica si la tablet/estación está autorizada como Puesto de Control y retorna sus carriles."""
|
||||
return WorkstationService.obtener_estado_workstation(name)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/workstations",
|
||||
response_model=List[Dict[str, Any]],
|
||||
summary="Listar todas las Workstations registradas",
|
||||
)
|
||||
async def list_workstations():
|
||||
"""Listado de estaciones para selector de tablets o supervisores."""
|
||||
return WorkstationService.listar_estaciones_disponibles()
|
||||
|
||||
Reference in New Issue
Block a user