stten5
This commit is contained in:
parent
8efbe55108
commit
e17ed4a6c9
@ -10,10 +10,10 @@ extra_label_printer: present
|
|||||||
remote_api: absent
|
remote_api: absent
|
||||||
tecna_t3: present
|
tecna_t3: present
|
||||||
digital_io: present
|
digital_io: present
|
||||||
digital_io_flush_blow: present
|
#digital_io_flush_blow: present
|
||||||
barcode_recipe_selection: present
|
barcode_recipe_selection: present
|
||||||
enforce_piece_removal: yes
|
enforce_piece_removal: yes
|
||||||
external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH
|
#external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH
|
||||||
show_instructions: yes
|
show_instructions: yes
|
||||||
|
|
||||||
[tecna_t3]
|
[tecna_t3]
|
||||||
@ -88,6 +88,8 @@ pressione_di_test_delta_massimo_2: 200
|
|||||||
tempo_svuotamento_2: 1
|
tempo_svuotamento_2: 1
|
||||||
pressione_svuotamento_2: 100
|
pressione_svuotamento_2: 100
|
||||||
|
|
||||||
|
tester_discharge_enable: yes
|
||||||
|
|
||||||
stampa_etichetta_abilitata: x
|
stampa_etichetta_abilitata: x
|
||||||
modello_etichetta: ETA30x16_203dpi.prn
|
modello_etichetta: ETA30x16_203dpi.prn
|
||||||
descrizione: inserire descrizione ricetta
|
descrizione: inserire descrizione ricetta
|
||||||
@ -100,10 +102,10 @@ filling_time: 15
|
|||||||
settling_time: 10
|
settling_time: 10
|
||||||
settling_pressure_min_percent: 5
|
settling_pressure_min_percent: 5
|
||||||
settling_pressure_max_percent: 5
|
settling_pressure_max_percent: 5
|
||||||
test_pressure: 5000
|
test_pressure: 5900
|
||||||
test_time: 10
|
test_time: 10
|
||||||
test_pressure_qpos: 8
|
test_pressure_qpos: 4
|
||||||
test_pressure_qneg: 12
|
test_pressure_qneg: 7
|
||||||
test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube) (positive mbar)
|
test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube) (positive mbar)
|
||||||
test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) (negative mbar)
|
test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) (negative mbar)
|
||||||
flush_time: 1
|
flush_time: 1
|
||||||
|
|||||||
@ -304,11 +304,132 @@ class Recipe_Selection(Widget):
|
|||||||
|
|
||||||
# EXPORT RECIPES TABLE TO CSV FILE
|
# EXPORT RECIPES TABLE TO CSV FILE
|
||||||
def export_recipes(self, csv_path=None):
|
def export_recipes(self, csv_path=None):
|
||||||
export_recipes(
|
if csv_path is None:
|
||||||
config=self.config,
|
csv_path, _ = QFileDialog.getSaveFileName(
|
||||||
csv_path=csv_path,
|
None,
|
||||||
logger=self.log,
|
"Esportazione ricette",
|
||||||
|
"ricette.csv",
|
||||||
|
"CSV data (*.csv);;All Files (*)",
|
||||||
)
|
)
|
||||||
|
csv_path = str(csv_path)
|
||||||
|
if not len(csv_path):
|
||||||
|
return
|
||||||
|
if not csv_path.lower().endswith(".csv"):
|
||||||
|
csv_path += ".csv"
|
||||||
|
csv_dir = os.path.dirname(csv_path)
|
||||||
|
if len(csv_dir):
|
||||||
|
os.makedirs(csv_dir, exist_ok=True)
|
||||||
|
recipe_name_field = self.config.get("recipe", {}).get("recipe_name_field", "codice_ricetta").strip()
|
||||||
|
barcode_enable_field = self.config.get("recipe", {}).get("barcode_enable_field", "verifica_codice_a_barre_abilitata").strip()
|
||||||
|
barcode_serial_field = self.config.get("recipe", {}).get("barcode_serial_field", "codice_a_barre").strip()
|
||||||
|
print_template_field = self.config.get("recipe", {}).get("label_template_field", "modello_etichetta").strip()
|
||||||
|
data = []
|
||||||
|
fieldnames = [
|
||||||
|
recipe_name_field,
|
||||||
|
"cliente",
|
||||||
|
"part_number",
|
||||||
|
"dimensione_lotto_abilitata",
|
||||||
|
"dimensione_lotto",
|
||||||
|
"verifica_connettore_abilitata",
|
||||||
|
"connettore",
|
||||||
|
barcode_enable_field,
|
||||||
|
barcode_serial_field,
|
||||||
|
"verifica_resistenza_connettore_abilitata",
|
||||||
|
"scala_resistenza",
|
||||||
|
"r nominale",
|
||||||
|
"tolleranza_resistenza_pos",
|
||||||
|
"tolleranza_resistenza_neg",
|
||||||
|
"avvitatura_abilitata",
|
||||||
|
"viti",
|
||||||
|
"prova_tenuta_abilitata",
|
||||||
|
"tempo_pre_riempimento",
|
||||||
|
"pressione_pre_riempimento",
|
||||||
|
"tempo_riempimento",
|
||||||
|
"tempo_assestamento",
|
||||||
|
"percentuale_minima_pressione_assestamento",
|
||||||
|
"percentuale_massima_pressione_assestamento",
|
||||||
|
"tempo_di_test",
|
||||||
|
"pressione_di_test_delta_minimo",
|
||||||
|
"pressione_di_test",
|
||||||
|
"pressione_di_test_delta_massimo",
|
||||||
|
"tempo_svuotamento",
|
||||||
|
"pressione_svuotamento",
|
||||||
|
"prova_tenuta_abilitata_2",
|
||||||
|
"tempo_pre_riempimento_2",
|
||||||
|
"pressione_pre_riempimento_2",
|
||||||
|
"tempo_riempimento_2",
|
||||||
|
"tempo_assestamento_2",
|
||||||
|
"percentuale_minima_pressione_assestamento_2",
|
||||||
|
"percentuale_massima_pressione_assestamento_2",
|
||||||
|
"tempo_di_test_2",
|
||||||
|
"pressione_di_test_delta_minimo_2",
|
||||||
|
"pressione_di_test_2",
|
||||||
|
"pressione_di_test_delta_massimo_2",
|
||||||
|
"tempo_svuotamento_2",
|
||||||
|
"pressione_svuotamento_2",
|
||||||
|
"test_visione_abilitato",
|
||||||
|
"ricetta_visione",
|
||||||
|
"stampa_etichetta_abilitata",
|
||||||
|
print_template_field,
|
||||||
|
]
|
||||||
|
for recipe in list(Recipes.select()):
|
||||||
|
steps = recipe.get_steps_map()
|
||||||
|
exportable = {
|
||||||
|
recipe_name_field: recipe.name,
|
||||||
|
"cliente": recipe.client,
|
||||||
|
"part_number": recipe.part_number,
|
||||||
|
# "dimensione_lotto_abilitata": "x" if recipe.spec["count"] else "",
|
||||||
|
# "dimensione_lotto": steps["count"].spec["amount"],
|
||||||
|
"verifica_connettore_abilitata": "x" if recipe.spec["connector"] else "",
|
||||||
|
"connettore": steps["connector"].spec["connector"],
|
||||||
|
barcode_enable_field: "x" if recipe.spec["barcodes"] else "",
|
||||||
|
barcode_serial_field: steps["barcodes"].spec["serial"],
|
||||||
|
"verifica_resistenza_connettore_abilitata": "x" if recipe.spec["resistance"] else "",
|
||||||
|
"scala_resistenza": steps["resistance"].spec["scale"],
|
||||||
|
"r nominale": steps["resistance"].spec["expected"],
|
||||||
|
"tolleranza_resistenza_pos": steps["resistance"].spec["tolerance_pos"],
|
||||||
|
"tolleranza_resistenza_neg": steps["resistance"].spec["tolerance_neg"],
|
||||||
|
# "avvitatura_abilitata": "x" if recipe.spec["screws"] else "",
|
||||||
|
# "viti": steps["screws"].spec["quantity"],
|
||||||
|
"prova_tenuta_abilitata": "x" if recipe.spec["leak_1"] else "",
|
||||||
|
"tempo_pre_riempimento": steps["leak_1"].spec["pre_filling_time"],
|
||||||
|
"pressione_pre_riempimento": steps["leak_1"].spec["pre_filling_pressure"],
|
||||||
|
"tempo_riempimento": steps["leak_1"].spec["filling_time"],
|
||||||
|
"tempo_assestamento": steps["leak_1"].spec["settling_time"],
|
||||||
|
"percentuale_minima_pressione_assestamento": steps["leak_1"].spec["settling_pressure_min_percent"],
|
||||||
|
"percentuale_massima_pressione_assestamento": steps["leak_1"].spec["settling_pressure_max_percent"],
|
||||||
|
"tempo_di_test": steps["leak_1"].spec["test_time"],
|
||||||
|
"pressione_di_test_delta_minimo": steps["leak_1"].spec["test_pressure_qneg"],
|
||||||
|
"pressione_di_test": steps["leak_1"].spec["test_pressure"],
|
||||||
|
"pressione_di_test_delta_massimo": steps["leak_1"].spec["test_pressure_qpos"],
|
||||||
|
"tempo_svuotamento": steps["leak_1"].spec["flush_time"],
|
||||||
|
"pressione_svuotamento": steps["leak_1"].spec["flush_pressure"],
|
||||||
|
"prova_tenuta_abilitata_2": "x" if recipe.spec["leak_2"] else "",
|
||||||
|
"tempo_pre_riempimento_2": steps["leak_2"].spec["pre_filling_time"],
|
||||||
|
"pressione_pre_riempimento_2": steps["leak_2"].spec["pre_filling_pressure"],
|
||||||
|
"tempo_riempimento_2": steps["leak_2"].spec["filling_time"],
|
||||||
|
"tempo_assestamento_2": steps["leak_2"].spec["settling_time"],
|
||||||
|
"percentuale_minima_pressione_assestamento_2": steps["leak_2"].spec["settling_pressure_min_percent"],
|
||||||
|
"percentuale_massima_pressione_assestamento_2": steps["leak_2"].spec["settling_pressure_max_percent"],
|
||||||
|
"tempo_di_test_2": steps["leak_2"].spec["test_time"],
|
||||||
|
"pressione_di_test_delta_minimo_2": steps["leak_2"].spec["test_pressure_qneg"],
|
||||||
|
"pressione_di_test_2": steps["leak_2"].spec["test_pressure"],
|
||||||
|
"pressione_di_test_delta_massimo_2": steps["leak_2"].spec["test_pressure_qpos"],
|
||||||
|
"tempo_svuotamento_2": steps["leak_2"].spec["flush_time"],
|
||||||
|
"pressione_svuotamento_2": steps["leak_2"].spec["flush_pressure"],
|
||||||
|
"test_visione_abilitato": recipe.spec["vision"],
|
||||||
|
"ricetta_visione": steps["vision"].spec["recipe"],
|
||||||
|
"stampa_etichetta_abilitata": "x" if recipe.spec["print"] else "",
|
||||||
|
print_template_field: steps["print"].spec["template"],
|
||||||
|
}
|
||||||
|
data.append(exportable)
|
||||||
|
if len(data):
|
||||||
|
self.log.info(f"recipes: exporting recipes to {csv_path}")
|
||||||
|
with open(csv_path, "w", newline="") as f:
|
||||||
|
w = csv.DictWriter(f, fieldnames, extrasaction="ignore")
|
||||||
|
w.writeheader()
|
||||||
|
w.writerows(data)
|
||||||
|
self.log.info(f"recipes: exported {len(data)} rows.")
|
||||||
|
|
||||||
def delete_recipes(self):
|
def delete_recipes(self):
|
||||||
ret = QMessageBox.warning(
|
ret = QMessageBox.warning(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user