Implementa picking bilista 2.1.0 con test, patch SQL e rollback
This commit is contained in:
@@ -40,7 +40,8 @@ WHERE Ordinamento > 0
|
||||
AND s.IDStato = pl.IDStato
|
||||
AND s.Risolto = 0
|
||||
)
|
||||
ORDER BY OrdinePrelievoGruppo, Ordinamento, Pallet, Documento;
|
||||
ORDER BY CASE WHEN Cella=1000 THEN 0 ELSE 1 END,
|
||||
OrdinePrelievoGruppo, Ordinamento, Pallet, Documento;
|
||||
"""
|
||||
|
||||
SQL_PICKING_BY_PALLET = """
|
||||
@@ -452,6 +453,8 @@ class BarcodeRepository:
|
||||
barcode_pallet: str,
|
||||
numero_cella: int,
|
||||
refresh_picking_reservation: bool = True,
|
||||
pair_run_id: str | None = None,
|
||||
pair_document: str | None = None,
|
||||
) -> LegacyMoveResult:
|
||||
"""Execute the same stored procedure used by the C# barcode form."""
|
||||
|
||||
@@ -473,7 +476,30 @@ class BarcodeRepository:
|
||||
),
|
||||
)
|
||||
try:
|
||||
res = await self.db_client.query_json(SQL_LEGACY_MOVE, params, commit=True)
|
||||
sql = SQL_LEGACY_MOVE
|
||||
if pair_run_id:
|
||||
# Guard and movement share the caller's transaction and app lock.
|
||||
# No extra SQL is added to free or monolist movements.
|
||||
params.update(pair_run_id=pair_run_id, pair_document=pair_document)
|
||||
sql = """
|
||||
SET NOCOUNT ON; SET XACT_ABORT ON;
|
||||
EXEC dbo.py_sp_PickingPair @Action='G',@IDOperatore=:id_operatore,
|
||||
@RunId=:pair_run_id,@Documento=:pair_document,@Pallet=:barcode_pallet,@Silent=1;
|
||||
""" + SQL_LEGACY_MOVE
|
||||
sql = sql.replace("SELECT\n @RC AS RC,", """
|
||||
-- Legacy @RC is the inserted movement identity, not a zero-success code.
|
||||
IF NOT EXISTS(SELECT 1 FROM dbo.XMag_GiacenzaPallet
|
||||
WHERE BarcodePallet COLLATE Latin1_General_CI_AS=:barcode_pallet COLLATE Latin1_General_CI_AS AND IDCella=9999)
|
||||
OR EXISTS(SELECT 1 FROM dbo.XMag_GiacenzaPallet
|
||||
WHERE BarcodePallet COLLATE Latin1_General_CI_AS=:barcode_pallet COLLATE Latin1_General_CI_AS AND IDCella<>9999)
|
||||
THROW 51115, 'Movimento bilista non confermato nella cella spedita.', 1;
|
||||
EXEC dbo.py_sp_PickingPair @Action='F',@IDOperatore=:id_operatore,
|
||||
@RunId=:pair_run_id,@Silent=1;
|
||||
SELECT
|
||||
@RC AS RC,""")
|
||||
# Pair reservations are independent of the legacy singleton.
|
||||
params["refresh_picking_reservation"] = 0
|
||||
res = await self.db_client.query_json(sql, params, commit=True)
|
||||
except Exception as exc:
|
||||
log_exception(
|
||||
"Barcode WMS",
|
||||
|
||||
Reference in New Issue
Block a user