Rafforza controlli carico barcode

This commit is contained in:
2026-07-03 15:40:06 +02:00
parent 7ecc906d59
commit e575c748cc
4 changed files with 98 additions and 13 deletions

View File

@@ -86,6 +86,15 @@ WHERE g.BarcodePallet = :pallet
ORDER BY g.IDCella;
"""
SQL_OPEN_PALLETS_BY_CELL = """
SELECT
g.BarcodePallet,
g.IDCella
FROM dbo.XMag_GiacenzaPallet AS g
WHERE g.IDCella = :id_cella
ORDER BY g.BarcodePallet;
"""
SQL_RESOLVE_PHYSICAL_CELL = """
DECLARE @raw int = TRY_CONVERT(int, :destination);
DECLARE @cell_id int =
@@ -204,6 +213,12 @@ class BarcodeRepository:
res = await self.db_client.query_json(SQL_OPEN_LOCATIONS_BY_PALLET, {"pallet": str(pallet or "").strip()})
return _rows_to_dicts(res)
async def fetch_open_pallets_by_cell(self, id_cella: int) -> list[dict[str, Any]]:
"""Return pallets currently present in a physical cell."""
res = await self.db_client.query_json(SQL_OPEN_PALLETS_BY_CELL, {"id_cella": int(id_cella)})
return _rows_to_dicts(res)
async def resolve_physical_cell(self, destination: str) -> DestinationCell | None:
"""Accept either an internal cell ID or the scanned legacy cell barcode."""