Variablennamen wurden in 'manage_configs.py' geändert (siehe commit 623f4a1) -> wurde in dieser Datei nachgezogen. Zudem in Methode 'extend_asm_bom' den Key 'Parent' mit aufgenommen, damit die Methode 'parent_children' in 'manage_configs.py' funktioniert. Dadurch kann nun auch der Migrationsstatus von Nummern ohne Stückliste im Treeview korrekt dargestellt werden.

This commit is contained in:
2025-04-20 12:12:08 +02:00
parent 623f4a12e1
commit 832aaf2088
+14 -13
View File
@@ -1,4 +1,4 @@
from manage_configs import SivasAssemblyData, RuleDesignerDatabaseConfig, MigrationStatus, TeilestammMetadata
from manage_configs import SivasBOM, RuleDesignerDatabaseConfig, MigrationStatus, SivasTeilestamm
import argparse
import os
import openpyxl
@@ -25,8 +25,8 @@ class ExcelExport:
load_local_rd_dbase,
no_blue_ids):
self.asm_id = asm_id
self.asm_data = SivasAssemblyData(asm_json_dir, asm_json_filename, load_local_asm_json)
self.asm_metadata = TeilestammMetadata(asm_csv_dir, asm_csv_filename, load_local_asm_csv)
self.asm_data = SivasBOM(asm_json_dir, asm_json_filename, load_local_asm_json)
self.asm_metadata = SivasTeilestamm(asm_csv_dir, asm_csv_filename, load_local_asm_csv)
self.rd_data = RuleDesignerDatabaseConfig(rd_dbase_dir, rd_dbase_filename, load_local_rd_dbase)
self._migration_status = None
@@ -180,8 +180,8 @@ class Treeview:
load_local_rd_dbase,
no_blue_ids):
self.asm_id = asm_id
self.asm_bom_data = SivasAssemblyData(asm_json_dir, asm_json_filename, load_local_asm_json)
self.asm_metadata = TeilestammMetadata(asm_csv_dir, asm_csv_filename, load_local_asm_csv)
self.asm_bom = SivasBOM(asm_json_dir, asm_json_filename, load_local_asm_json)
self.asm_teilestamm = SivasTeilestamm(asm_csv_dir, asm_csv_filename, load_local_asm_csv)
self.rd_data = RuleDesignerDatabaseConfig(rd_dbase_dir, rd_dbase_filename, load_local_rd_dbase)
self.no_blue_ids = no_blue_ids
self._migration_status = None
@@ -190,7 +190,7 @@ class Treeview:
@property
def migration_status(self):
if self._migration_status is None:
self._migration_status = MigrationStatus(self.asm_bom_data.child_ids, self.rd_data.ids)
self._migration_status = MigrationStatus(self.asm_bom.child_ids, self.rd_data.ids)
return self._migration_status
@property
@@ -204,10 +204,10 @@ class Treeview:
if self._longest_entry is None:
self._longest_entry = (self.asm_bom_data.max_bom_depth) * len(Treeview.prefix_types["PIPE"]) \
self._longest_entry = (self.asm_bom.max_bom_depth) * len(Treeview.prefix_types["PIPE"]) \
+ len(longest_connector_symbol) \
+ len(longest_color_code) \
+ len(self.asm_bom_data.longest_child_id) \
+ len(self.asm_bom.longest_child_id) \
+ len(Treeview.console_colors["RESET"]) \
+ padding_after_id
return self._longest_entry
@@ -218,10 +218,11 @@ class Treeview:
die über das Programm 'Sivas2Json' von Hr. Jakob generiert wird. Damit der Baum die Bezeichnung der obersten Baugruppennummer im
Baum angezeigt wird ist es jedoch erforderlich, dass die Nummer mitsamt ihrer Bezeichnung in der JSON enthalten ist"""
metadata = {"Bezeichnung": self.asm_metadata.get_property_values("Bezeichnung1"),
metadata = {"Bezeichnung": self.asm_teilestamm.get_property_values("Bezeichnung1"),
"Parent": None,
"Position": "10/0"}
self.asm_bom_data.extend_asm_bom(self.asm_id, metadata)
self.asm_bom.extend_asm_bom(self.asm_id, metadata)
def generate_tree(self):
@@ -234,7 +235,7 @@ class Treeview:
"""Gibt die Baugruppenstruktur in Form eines Baumes in der Konsole aus"""
parent_children = self.asm_bom_data.parent_children
parent_children = self.asm_bom.parent_children
children_ids = parent_children[parent_id]
for i, id in enumerate(children_ids):
@@ -259,7 +260,7 @@ class Treeview:
amount_in_work = len(self.migration_status.ids_in_progress)
amount_released = amount_in_rd - amount_in_work
progress = int(amount_in_rd / len(self.asm_bom_data.child_ids) * 100)
progress = int(amount_in_rd / len(self.asm_bom.child_ids) * 100)
column_width = 5
border_padding = "".ljust(column_width, "")
@@ -298,7 +299,7 @@ class Treeview:
"""Eintrag in die Konsole drucken"""
text_before_description = f"{prefix}{connector}{color}{child_id}{Treeview.console_colors['RESET']}".ljust(self.longest_entry)
description = self.asm_bom_data.get_prop_val_for_single_id(child_id, "Bezeichnung")
description = self.asm_bom.get_prop_val_for_single_id(child_id, "Bezeichnung")
print(f"{text_before_description}{description}")