diff --git a/bin/gui.bat b/bin/gui.bat index 3d01e5f..700cc05 100644 --- a/bin/gui.bat +++ b/bin/gui.bat @@ -1,6 +1,6 @@ @echo off CALL cremig_setenv.bat -IF NOT EXIST %CREMIG%\.venv CALL %CREMIG_BIN%\install_py.bat -CALL %CREMIG%\.venv\Scripts\activate.bat +CALL manage_interpreter.bat activate_interpreter python %CREMIG_LIB%\CreoMigrateGui.py %* -deactivate +CALL manage_interpreter.bat deactivate_interpreter + diff --git a/lib/controller.py b/lib/controller.py index 50cdd4f..706e098 100644 --- a/lib/controller.py +++ b/lib/controller.py @@ -35,6 +35,7 @@ messages = { "color_not_defined":'Teilenummer kann nicht ohne festgelegte Farbe migriert werden!', "aenderungstext_too_long":'Änderungstext_weist zu viele Zeichen auf. Bitte auf 400 Zeichen verkürzen!', "missing_data":'Fehlende Angaben in der Oberfläche: {Labels}', + "sivas_db_error":'Diese Assembly existiert nicht. Eventuell ist es nur ein Teil?', } @@ -107,7 +108,12 @@ class Controller(Observer): # falls uselocal True, dann keine Serverabfrage, sondern mit den lokalen Daten arbeiten sivas_teilestamm.fetch_from_db(uselocal) if not uselocal: - sivas_teilestamm.get_unmigrated_teilstamm_csvs() + try: + sivas_teilestamm.get_unmigrated_teilstamm_csvs() + except: + self.message_error('Abfrage hat nicht funktioniert', 'sivas_db_error') + return + redids = sivas_teilestamm.get_red_ids() sad = SivasAssemblyData(data_dir, asmid + '.json') diff --git a/lib/manage_configs.py b/lib/manage_configs.py index 16b8c0d..f1e5178 100644 --- a/lib/manage_configs.py +++ b/lib/manage_configs.py @@ -146,7 +146,9 @@ class MigrationStatus: """Gibt zurück, ob die Teilenummern der Baugruppe bereits migriert wurden, oder nicht""" out_dir = self._file_dir if self._uselocal == False: - update_database.get_sivas_dbase(self._assembly_json, out_dir) + ok = update_database.get_sivas_dbase(self._assembly_json, out_dir) + if not ok: + raise Exception("no json file could be generated") update_database.get_rd_dbase() else: if not os.path.exists(os.path.join(out_dir, self._assembly_json)): diff --git a/lib/update_database.py b/lib/update_database.py index 2cae387..02619d9 100644 --- a/lib/update_database.py +++ b/lib/update_database.py @@ -71,15 +71,16 @@ def get_sivas_dbase(sivas_id, out_dir): if os.path.isfile(os.path.join(out_dir, sivas_id + ".json")): print("done") + return True else: print(f"Failure - Couldn't generate {sivas_id}.json. Check for any spelling/typing errors. Otherwise given number is a part without a BOM.") - sys.exit(0) + return False else: print(f"'Output directory for .json-file {out_dir}' doesn't exist. Check cremig_setenv.bat or VPN connection.") - sys.exit(0) + return False else: print(f"Can't execute SIVAS-database query. Check VPN connection and check the path of %SIVAS_DATABASE_QUERY% in cremig_setenv.bat") - sys.exit(0) + return False def get_sivas_teilestamm(sivas_ids, out_dir): """call the sivas exe for getting all csv files with the item data for the given sivas ids"""