Aggiungi diagnostica UDC SAM non entrate in WMS
This commit is contained in:
@@ -69,6 +69,34 @@ INNER JOIN dbo.Celle AS c
|
||||
ORDER BY CELLA, UDC;
|
||||
"""
|
||||
|
||||
SQL_SAM_UDC_NOT_IN_WMS = """
|
||||
WITH sam_udc AS (
|
||||
SELECT
|
||||
LTRIM(RTRIM(Pallet)) AS UDC,
|
||||
MIN(Lotto) AS Lotto,
|
||||
MIN(Prodotto) AS Prodotto,
|
||||
MIN(Descrizione) AS Descrizione
|
||||
FROM dbo.vXTracciaProdotti
|
||||
WHERE NULLIF(LTRIM(RTRIM(Pallet)), '') IS NOT NULL
|
||||
AND TRY_CONVERT(int, LTRIM(RTRIM(Pallet))) > 0
|
||||
AND Lotto LIKE CONCAT('P', RIGHT(CONVERT(varchar(4), YEAR(GETDATE())), 2), '%')
|
||||
GROUP BY LTRIM(RTRIM(Pallet))
|
||||
)
|
||||
SELECT
|
||||
s.UDC,
|
||||
s.Lotto,
|
||||
s.Prodotto,
|
||||
s.Descrizione
|
||||
FROM sam_udc AS s
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM dbo.MagazziniPallet AS mp
|
||||
WHERE LTRIM(RTRIM(mp.Attributo)) COLLATE Latin1_General_CI_AS =
|
||||
s.UDC COLLATE Latin1_General_CI_AS
|
||||
)
|
||||
ORDER BY s.UDC;
|
||||
"""
|
||||
|
||||
SHIPPED_NOT_DISASSOCIATED_COLUMNS = (
|
||||
("UDC", "diagnostics.col.udc", "UDC", 130, "w"),
|
||||
(
|
||||
@@ -86,6 +114,13 @@ MULTIPLE_UDC_COLUMNS = (
|
||||
("UDC", "diagnostics.col.udc", "UDC", 160, "w"),
|
||||
)
|
||||
|
||||
SAM_UDC_NOT_IN_WMS_COLUMNS = (
|
||||
("UDC", "diagnostics.col.udc", "UDC", 130, "w"),
|
||||
("Lotto", "diagnostics.col.lot", "Lotto", 160, "w"),
|
||||
("Prodotto", "diagnostics.col.product", "Prodotto", 150, "w"),
|
||||
("Descrizione", "diagnostics.col.description", "Descrizione", 360, "w"),
|
||||
)
|
||||
|
||||
|
||||
def _rows_to_dicts(res: dict[str, Any] | None) -> list[dict[str, Any]]:
|
||||
if not isinstance(res, dict):
|
||||
@@ -156,7 +191,7 @@ class DiagnosticaWindow(ctk.CTkToplevel):
|
||||
fg_color=theme_color(self._theme, "toolbar_frame_fg_color", ("#d7d7d7", "#3b3b3b")),
|
||||
)
|
||||
top.grid(row=0, column=0, sticky="ew", padx=8, pady=8)
|
||||
top.grid_columnconfigure(2, weight=1)
|
||||
top.grid_columnconfigure(3, weight=1)
|
||||
|
||||
button_font = theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold"))
|
||||
ctk.CTkButton(
|
||||
@@ -181,6 +216,17 @@ class DiagnosticaWindow(ctk.CTkToplevel):
|
||||
font=button_font,
|
||||
).grid(row=0, column=1, sticky="w", padx=(0, 8))
|
||||
|
||||
ctk.CTkButton(
|
||||
top,
|
||||
text=loc_text(
|
||||
"diagnostics.button.sam_udc_not_in_wms",
|
||||
catalog=self._locale_catalog,
|
||||
default="UDC in SAM non in WMS",
|
||||
),
|
||||
command=self._load_sam_udc_not_in_wms,
|
||||
font=button_font,
|
||||
).grid(row=0, column=2, sticky="w", padx=(0, 8))
|
||||
|
||||
self.btn_export = ctk.CTkButton(
|
||||
top,
|
||||
text=loc_text("diagnostics.button.export", catalog=self._locale_catalog, default="Esporta XLSX"),
|
||||
@@ -188,7 +234,7 @@ class DiagnosticaWindow(ctk.CTkToplevel):
|
||||
font=button_font,
|
||||
state="disabled",
|
||||
)
|
||||
self.btn_export.grid(row=0, column=3, sticky="e")
|
||||
self.btn_export.grid(row=0, column=4, sticky="e")
|
||||
|
||||
ctk.CTkLabel(
|
||||
self,
|
||||
@@ -257,6 +303,18 @@ class DiagnosticaWindow(ctk.CTkToplevel):
|
||||
),
|
||||
)
|
||||
|
||||
def _load_sam_udc_not_in_wms(self) -> None:
|
||||
self._run_check(
|
||||
key="sam_udc_not_in_wms",
|
||||
sql=SQL_SAM_UDC_NOT_IN_WMS,
|
||||
columns=SAM_UDC_NOT_IN_WMS_COLUMNS,
|
||||
busy_text=loc_text(
|
||||
"diagnostics.busy.sam_udc_not_in_wms",
|
||||
catalog=self._locale_catalog,
|
||||
default="Cerco UDC presenti in SAM ma non ancora in WMS...",
|
||||
),
|
||||
)
|
||||
|
||||
def _run_check(self, *, key: str, sql: str, columns, busy_text: str) -> None:
|
||||
if self._load_in_progress or not self._is_alive():
|
||||
return
|
||||
|
||||
10
locale.json
10
locale.json
@@ -79,12 +79,17 @@
|
||||
"diagnostics.title": "Diagnostica",
|
||||
"diagnostics.button.shipped_not_disassociated": "UDC spedite non disassociate",
|
||||
"diagnostics.button.multiple_udc_by_cell": "Celle con multiple UDC",
|
||||
"diagnostics.button.sam_udc_not_in_wms": "UDC anno in SAM non in WMS",
|
||||
"diagnostics.button.export": "Esporta XLSX",
|
||||
"diagnostics.busy.shipped_not_disassociated": "Cerco UDC spedite ma ancora in cella...",
|
||||
"diagnostics.busy.multiple_udc_by_cell": "Cerco celle con multiple UDC...",
|
||||
"diagnostics.busy.sam_udc_not_in_wms": "Cerco UDC dell'anno presenti in SAM ma non ancora in WMS...",
|
||||
"diagnostics.status.rows": "Righe trovate: {count}",
|
||||
"diagnostics.col.udc": "UDC",
|
||||
"diagnostics.col.cell": "CELLA",
|
||||
"diagnostics.col.lot": "Lotto",
|
||||
"diagnostics.col.product": "Prodotto",
|
||||
"diagnostics.col.description": "Descrizione",
|
||||
"diagnostics.col.shipped_not_disassociated": "Spedita ma non disassociata",
|
||||
"diagnostics.col.symbolic_cell": "Nome simbolico cella",
|
||||
"diagnostics.export.title": "Esporta",
|
||||
@@ -211,12 +216,17 @@
|
||||
"diagnostics.title": "Diagnostics",
|
||||
"diagnostics.button.shipped_not_disassociated": "Shipped UDC not disassociated",
|
||||
"diagnostics.button.multiple_udc_by_cell": "Cells with multiple UDC",
|
||||
"diagnostics.button.sam_udc_not_in_wms": "Current-year UDC in SAM not in WMS",
|
||||
"diagnostics.button.export": "Export XLSX",
|
||||
"diagnostics.busy.shipped_not_disassociated": "Searching shipped UDC still assigned to cells...",
|
||||
"diagnostics.busy.multiple_udc_by_cell": "Searching cells with multiple UDC...",
|
||||
"diagnostics.busy.sam_udc_not_in_wms": "Searching current-year UDC present in SAM but not yet in WMS...",
|
||||
"diagnostics.status.rows": "Rows found: {count}",
|
||||
"diagnostics.col.udc": "UDC",
|
||||
"diagnostics.col.cell": "CELL",
|
||||
"diagnostics.col.lot": "Lot",
|
||||
"diagnostics.col.product": "Product",
|
||||
"diagnostics.col.description": "Description",
|
||||
"diagnostics.col.shipped_not_disassociated": "Shipped but not disassociated",
|
||||
"diagnostics.col.symbolic_cell": "Symbolic cell name",
|
||||
"diagnostics.export.title": "Export",
|
||||
|
||||
@@ -18,7 +18,7 @@ MODULE_VERSIONS: dict[str, str] = {
|
||||
"barcode_service": "1.0.24",
|
||||
"busy_overlay": "1.0.0",
|
||||
"db_config": "1.0.0",
|
||||
"diagnostica": "1.0.2",
|
||||
"diagnostica": "1.0.3",
|
||||
"gestione_aree": "1.0.1",
|
||||
"gestione_layout": "1.0.2",
|
||||
"gestione_pickinglist": "1.0.4",
|
||||
|
||||
Reference in New Issue
Block a user