st-ten 5 fix for second leak test and instruction extra showing in spec
This commit is contained in:
parent
d085e1d90e
commit
b94f739214
|
|
@ -66,7 +66,7 @@ istruzione_abilitata: x
|
|||
numero nastri (n):0
|
||||
numero sensori anello (sa):0
|
||||
numero sensori presenza (sp):0
|
||||
|
||||
istruzione_abilitata_extra:
|
||||
prova_tenuta_abilitata: x
|
||||
tempo_pre_riempimento: 0
|
||||
pressione_pre_riempimento: 5000
|
||||
|
|
|
|||
|
|
@ -248,8 +248,7 @@ def import_recipes(config, csv_path=None, defaults=None, unsupported_steps=None,
|
|||
"instruction": len(
|
||||
row.get("istruzione_abilitata", defaults["istruzione_abilitata"])) and "instruction" not in (
|
||||
unsupported_steps or []),
|
||||
"instruction_extra": len(row.get("istruzione_abilitata_extra", defaults[
|
||||
"istruzione_abilitata_extra"])) and "instruction_extra" not in (unsupported_steps or []),
|
||||
"instruction_extra": (str(row.get("istruzione_abilitata_extra", defaults["istruzione_abilitata_extra"])) or "").strip().lower() == "x" and "instruction_extra" not in (unsupported_steps or []),
|
||||
"pipe_cutter": len(row.get("tagliatubi", defaults["tagliatubi"])) and "pipe_cutter" not in (unsupported_steps or []),
|
||||
"vision": len(
|
||||
row.get("test_visione_abilitato", defaults["test_visione_abilitato"])) and "vision" not in (
|
||||
|
|
|
|||
|
|
@ -37,9 +37,16 @@ class Recipe_Selection(Widget):
|
|||
global noner
|
||||
super().__init__()
|
||||
self.config = config
|
||||
self.second_leak_test_enabled = self.config["hardware_config"]["second_leak_test"] == "present"
|
||||
self.second_leak_test_enabled = self.config["hardware_config"].get("second_leak_test", "absent") == "present"
|
||||
self.defaults = self.config.get("recipes_defaults", noner)
|
||||
self.unsupported_steps = unsupported_steps
|
||||
self.unsupported_steps = set(unsupported_steps or set())
|
||||
# Hide instruction_extra entirely unless explicitly enabled in recipes_defaults (istruzione_abilitata_extra: x)
|
||||
try:
|
||||
instr_extra_enabled = str(self.config.get("recipes_defaults", noner)["istruzione_abilitata_extra"]).strip().lower() == "x"
|
||||
except Exception:
|
||||
instr_extra_enabled = False
|
||||
if not instr_extra_enabled:
|
||||
self.unsupported_steps.add("instruction_extra")
|
||||
session = Users.get_session()
|
||||
if session.is_admin:
|
||||
readonly = False
|
||||
|
|
@ -147,11 +154,11 @@ class Recipe_Selection(Widget):
|
|||
self.config.get("recipes_defaults", noner)["verifica_resistenza_connettore_abilitata"]) and "resistance" not in self.unsupported_steps,
|
||||
"screws": len(self.config.get("recipes_defaults", noner)["avvitatura_abilitata"]) and "screws" not in self.unsupported_steps,
|
||||
"instruction": len(self.config.get("recipes_defaults", noner)["istruzione_abilitata"]) and "instruction" not in self.unsupported_steps,
|
||||
"instruction_extra": len(self.config.get("recipes_defaults", noner)["istruzione_abilitata_extra"]) and "instruction_extra" not in self.unsupported_steps,
|
||||
"instruction_extra": (str(self.config.get("recipes_defaults", noner)["istruzione_abilitata_extra"]).strip().lower() == "x") and "instruction_extra" not in self.unsupported_steps,
|
||||
"pipe_cutter": len(self.config.get("recipes_defaults", noner)["tagliatubi_abilitata"]) and "pipe_cutter" not in self.unsupported_steps,
|
||||
"vision": len(self.config.get("recipes_defaults", noner)["test_visione_abilitato"]) and "vision" not in self.unsupported_steps,
|
||||
"leak_1": len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata"]) and "leak_1" not in self.unsupported_steps,
|
||||
"leak_2": len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata_2"]) and "leak_2" not in self.unsupported_steps,
|
||||
"leak_2": (self.second_leak_test_enabled and len(self.config.get("recipes_defaults", noner)["prova_tenuta_abilitata_2"]) and "leak_2" not in self.unsupported_steps),
|
||||
"print": len(self.config.get("recipes_defaults", noner)["stampa_etichetta_abilitata"]) and "print" not in self.unsupported_steps,
|
||||
"step_editors": step_defaults,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ class Test(Widget):
|
|||
# if dependency not in self.components or not self.components[dependency].ready:
|
||||
if dependency not in self.components:
|
||||
self.unsupported_steps.add(step_name)
|
||||
# Enforce second leak test hardware flag
|
||||
if self.config["hardware_config"].get("second_leak_test", "absent") != "present":
|
||||
self.unsupported_steps.add("leak_2")
|
||||
# INIT PIECES COUNTER
|
||||
self.pieces = {"ok": 0, "ko": 0}
|
||||
# INIT CYCLE STATES
|
||||
|
|
@ -164,7 +167,8 @@ class Test(Widget):
|
|||
"leak_1": Test_Assembly(img_path=None, text=None, widget=Test_Leak(config=self.config,components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces, parent=self))
|
||||
if self.config["hardware_config"]["tecna_t3"] != "absent" or self.config["hardware_config"]["furness_controls"] !="absent" else None,
|
||||
"leak_2": Test_Assembly(img_path=None, text=None, widget=Test_Leak(config=self.config,components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces, parent=self))
|
||||
if self.config["hardware_config"]["tecna_t3"] != "absent" or self.config["hardware_config"]["furness_controls"] != "absent" else None,
|
||||
if ((self.config["hardware_config"]["tecna_t3"] != "absent" or self.config["hardware_config"]["furness_controls"] != "absent")
|
||||
and self.config["hardware_config"].get("second_leak_test", "absent") == "present") else None,
|
||||
"flush": Test_Assembly(img_path=None, text=u"SCARICO ARIA IN CORSO - ATTENDERE...", widget=Test_Warning_Img(components=self.components, recipe=self.recipe, step=self.step)),
|
||||
"instruction": Test_Assembly(img_path=None, text=u"ESEGUIRE LE OPERAZIONI DI MONTAGGIO INDICATE IN FIGURA",
|
||||
widget=Test_Instructions(config=self.config,components=self.components, recipe=self.recipe, bench_name=self.config.machine_id, step=self.step)),
|
||||
|
|
@ -407,8 +411,13 @@ class Test(Widget):
|
|||
self.set_recipe(recipe=None)
|
||||
if self.config["hardware_config"]["tecna_t3"] == "present" or self.config["hardware_config"][
|
||||
"furness_controls"] == "present":
|
||||
self.cycle_available_steps["leak_1"].widget.recipe_written = False
|
||||
self.cycle_available_steps["leak_2"].widget.recipe_written = False
|
||||
# Reset recipe_written flags for leak widgets if they exist
|
||||
leak1 = self.cycle_available_steps.get("leak_1")
|
||||
if leak1 is not None and getattr(leak1, "widget", None) is not None:
|
||||
leak1.widget.recipe_written = False
|
||||
leak2 = self.cycle_available_steps.get("leak_2")
|
||||
if leak2 is not None and getattr(leak2, "widget", None) is not None:
|
||||
leak2.widget.recipe_written = False
|
||||
self.step = Step(step_type="select_recipe")
|
||||
self.cycle_index = -1
|
||||
self.recipe = None
|
||||
|
|
@ -633,12 +642,12 @@ class Test(Widget):
|
|||
leak1_index = step_types.index("leak_1")
|
||||
leak2_index = step_types.index("leak_2")
|
||||
if leak1_index + 1 == leak2_index: # Ensure 'leak_1' is immediately followed by 'leak_2'
|
||||
if self.config["hardware_config"].get("second_leak_test", "yes") == "no":
|
||||
if recipe and getattr(recipe, 'spec', None) and recipe.spec.get("instruction_extra") and "instruction_extra" not in self.unsupported_steps:
|
||||
steps.insert(leak2_index, Step(step_type="instruction_extra", spec={}))
|
||||
inserted_instruction = True
|
||||
|
||||
# Insert 'instruction_extra' after the first 'instructions' if not inserted between leaks
|
||||
if not inserted_instruction:
|
||||
if not inserted_instruction and recipe and getattr(recipe, 'spec', None) and recipe.spec.get("instruction_extra") and "instruction_extra" not in self.unsupported_steps:
|
||||
for i, step in enumerate(steps):
|
||||
if step.step_type == "instructions":
|
||||
steps.insert(i + 1, Step(step_type="instruction_extra", spec={}))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user