Checkpoint before ghost pallet cleanup workflow

This commit is contained in:
2026-05-09 12:18:59 +02:00
parent f556b476ff
commit 6ab42a2303
27 changed files with 3947 additions and 973 deletions

View File

@@ -10,7 +10,7 @@ from tkinter import messagebox, simpledialog, ttk
import customtkinter as ctk
from gestione_aree_frame_async import AsyncRunner, BusyOverlay
from gestione_aree import AsyncRunner, BusyOverlay
SQL_CORSIE = """
WITH C AS (
@@ -94,7 +94,7 @@ WHERE c.ID <> 9999 AND LTRIM(RTRIM(c.Corsia)) = :corsia;
class ResetCorsieWindow(ctk.CTkToplevel):
"""Toplevel used to inspect and clear the pallets assigned to an aisle."""
def __init__(self, parent, db_client):
def __init__(self, parent, db_client, session=None):
"""Create the window and immediately load the list of aisles."""
super().__init__(parent)
self.title("Reset Corsie - svuotamento celle per corsia")
@@ -103,6 +103,7 @@ class ResetCorsieWindow(ctk.CTkToplevel):
self.resizable(True, True)
self.db = db_client
self.session = session
self._busy = BusyOverlay(self)
self._async = AsyncRunner(self)
@@ -256,9 +257,22 @@ class ResetCorsieWindow(ctk.CTkToplevel):
self._async.run(self.db.query_json(SQL_DELETE, {"corsia": corsia}), _ok_del, _err_del, busy=self._busy, message=f"Svuoto {corsia}...")
def open_reset_corsie_window(parent, db_app):
def open_reset_corsie_window(parent, db_app, session=None):
"""Create, focus and return the aisle reset window."""
win = ResetCorsieWindow(parent, db_app)
win.lift()
win.focus_set()
key = "_reset_corsie_window_singleton"
ex = getattr(parent, key, None)
if ex and ex.winfo_exists():
try:
ex.lift()
ex.focus_force()
return ex
except Exception:
pass
win = ResetCorsieWindow(parent, db_app, session=session)
setattr(parent, key, win)
try:
win.lift()
win.focus_force()
except Exception:
pass
return win