Aggiungi salto UDC nel picking barcode
This commit is contained in:
@@ -26,9 +26,17 @@ SELECT TOP (1)
|
||||
Ubicazione,
|
||||
Ordinamento,
|
||||
IDStato
|
||||
FROM dbo.py_XMag_ViewPackingList
|
||||
FROM dbo.py_XMag_ViewPackingList AS pl
|
||||
WHERE Ordinamento > 0
|
||||
AND IDStato = :id_stato
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM dbo.py_BarcodePickingListSkip AS s
|
||||
WHERE s.Documento = CAST(pl.Documento AS varchar(50))
|
||||
AND s.Pallet = CAST(pl.Pallet AS varchar(50))
|
||||
AND s.IDStato = pl.IDStato
|
||||
AND s.Risolto = 0
|
||||
)
|
||||
ORDER BY Ordinamento;
|
||||
"""
|
||||
|
||||
@@ -136,6 +144,44 @@ SELECT
|
||||
:numero_cella AS NumeroCella;
|
||||
"""
|
||||
|
||||
SQL_SKIP_PICKING_PALLET = """
|
||||
SET NOCOUNT ON;
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM dbo.py_BarcodePickingListSkip
|
||||
WHERE Documento = :documento
|
||||
AND Pallet = :pallet
|
||||
AND IDStato = :id_stato
|
||||
AND Risolto = 0
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO dbo.py_BarcodePickingListSkip (
|
||||
Documento,
|
||||
Pallet,
|
||||
IDStato,
|
||||
IDOperatore,
|
||||
DataOra,
|
||||
Motivo,
|
||||
Risolto
|
||||
)
|
||||
VALUES (
|
||||
:documento,
|
||||
:pallet,
|
||||
:id_stato,
|
||||
:id_operatore,
|
||||
SYSDATETIME(),
|
||||
:motivo,
|
||||
0
|
||||
);
|
||||
END;
|
||||
|
||||
SELECT
|
||||
:documento AS Documento,
|
||||
:pallet AS Pallet,
|
||||
:id_stato AS IDStato;
|
||||
"""
|
||||
|
||||
|
||||
def _rows_to_dicts(res: dict[str, Any] | None) -> list[dict[str, Any]]:
|
||||
"""Convert ``query_json`` payloads to a list of row dictionaries."""
|
||||
@@ -219,6 +265,45 @@ class BarcodeRepository:
|
||||
res = await self.db_client.query_json(SQL_OPEN_PALLETS_BY_CELL, {"id_cella": int(id_cella)})
|
||||
return _rows_to_dicts(res)
|
||||
|
||||
async def skip_picking_pallet(
|
||||
self,
|
||||
*,
|
||||
documento: str,
|
||||
pallet: str,
|
||||
id_stato: int,
|
||||
operator_id: int,
|
||||
motivo: str = "UDC non trovata dal magazziniere",
|
||||
) -> None:
|
||||
"""Persist one skipped picking-list pallet so the queue can advance."""
|
||||
|
||||
params = {
|
||||
"documento": str(documento or "").strip(),
|
||||
"pallet": str(pallet or "").strip(),
|
||||
"id_stato": int(id_stato),
|
||||
"id_operatore": int(operator_id),
|
||||
"motivo": str(motivo or "").strip(),
|
||||
}
|
||||
log_runtime_event(
|
||||
"Barcode WMS",
|
||||
(
|
||||
"PICKING SKIP START "
|
||||
f"documento={params['documento']} "
|
||||
f"pallet={params['pallet']} "
|
||||
f"id_stato={params['id_stato']} "
|
||||
f"operator={params['id_operatore']}"
|
||||
),
|
||||
)
|
||||
await self.db_client.query_json(SQL_SKIP_PICKING_PALLET, params, commit=True)
|
||||
log_runtime_event(
|
||||
"Barcode WMS",
|
||||
(
|
||||
"PICKING SKIP OK "
|
||||
f"documento={params['documento']} "
|
||||
f"pallet={params['pallet']} "
|
||||
f"id_stato={params['id_stato']}"
|
||||
),
|
||||
)
|
||||
|
||||
async def resolve_physical_cell(self, destination: str) -> DestinationCell | None:
|
||||
"""Accept either an internal cell ID or the scanned legacy cell barcode."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user