Impfen mit dem DataPrep Werkzeug eingebaut
This commit is contained in:
@@ -30,6 +30,7 @@ set VBA_MACRO_NAME=vba_format_excel.xlsm
|
|||||||
set SIVAS_DATABASE_QUERY=Y:\jit\programme\Sivas2json.exe
|
set SIVAS_DATABASE_QUERY=Y:\jit\programme\Sivas2json.exe
|
||||||
set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\jit\programme\KSbExcelExportSivasTeilestamm.exe
|
set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\jit\programme\KSbExcelExportSivasTeilestamm.exe
|
||||||
set SIVAS_EXCEL_EXPORT_DIR=%CREMIG_DATA%
|
set SIVAS_EXCEL_EXPORT_DIR=%CREMIG_DATA%
|
||||||
|
set SIEMENS_DATA_PREP_TOOL=C:\Program Files\Siemens\Solid Edge 2023\Program\DataPrepUtility.exe
|
||||||
|
|
||||||
rem Um den Python-Interpreter auf U:\ zu nutzen, Kommentar (rem) in nachfolgender Zeile entfernen
|
rem Um den Python-Interpreter auf U:\ zu nutzen, Kommentar (rem) in nachfolgender Zeile entfernen
|
||||||
rem set NETWORK_INTERPRETER_PATH=\\ssg.local\freigaben\Allgemein\Programmierumgebung\Python312
|
rem set NETWORK_INTERPRETER_PATH=\\ssg.local\freigaben\Allgemein\Programmierumgebung\Python312
|
||||||
|
|||||||
+37
-1
@@ -3,6 +3,7 @@ import pandas as pd
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
class DataModel:
|
class DataModel:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -841,6 +842,39 @@ class CadItem(DataModel):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def call_prep_tool(self, impf_pfad):
|
||||||
|
data_prep_tool = os.environ.get(r'SIEMENS_DATA_PREP_TOOL')
|
||||||
|
if not os.path.isfile(data_prep_tool):
|
||||||
|
self.message_error('Impftool not found', 'wrong_impftool_path')
|
||||||
|
return False
|
||||||
|
|
||||||
|
out_dir = self._controller.get_env('out')
|
||||||
|
subprocess.run(f"{data_prep_tool} /file {impf_pfad} /ModifyProperties")
|
||||||
|
all_logs = glob.glob(os.path.join(out_dir, "*.log"))
|
||||||
|
if len(all_logs) > 1:
|
||||||
|
self.message_error('too many logfiles found', 'too_many_logfiles')
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
path = all_logs[0]
|
||||||
|
try:
|
||||||
|
with open(path, 'r', encoding='utf-16le') as f:
|
||||||
|
content = f.read()
|
||||||
|
f.close()
|
||||||
|
if re.findall(r'1 out of 1', content):
|
||||||
|
os.remove(path)
|
||||||
|
self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad})
|
||||||
|
return True
|
||||||
|
elif re.findall(r'Error', content):
|
||||||
|
self.message_error('Something went wrong', 'some_error_in_log')
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
self.message_error('Something went wrong', 'some_error_in_log')
|
||||||
|
return False
|
||||||
|
except Exception:
|
||||||
|
raise Exception("log file could not be opened")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_migration_file(self, data):
|
def create_migration_file(self, data):
|
||||||
"""erzeugt Verzeichnis und Datei"""
|
"""erzeugt Verzeichnis und Datei"""
|
||||||
datenbank = self.get_gui_data("datenbank")
|
datenbank = self.get_gui_data("datenbank")
|
||||||
@@ -963,7 +997,9 @@ class CadItem(DataModel):
|
|||||||
# New_path = \\ssg.local\freigaben\SIVAS_CAD_EDM\Migration\02_Bedarfspool\
|
# New_path = \\ssg.local\freigaben\SIVAS_CAD_EDM\Migration\02_Bedarfspool\
|
||||||
# ELSE:
|
# ELSE:
|
||||||
# New_path = \\ssg.local\freigaben\SIVAS_CAD_EDM\Schulung\Migration\02_Bedarfspool
|
# New_path = \\ssg.local\freigaben\SIVAS_CAD_EDM\Schulung\Migration\02_Bedarfspool
|
||||||
zielpfad = self._controller.get_config().Pfade.get('Zielpfade', datenbank )
|
zpfad = self._controller.get_config().Pfade.get('Zielpfade', datenbank )
|
||||||
|
username = os.environ.get("USERNAME")
|
||||||
|
zielpfad = os.path.join(zpfad, username)
|
||||||
data["New Path"] = zielpfad
|
data["New Path"] = zielpfad
|
||||||
data["New Filename"] = teilenummer + "." +ending
|
data["New Filename"] = teilenummer + "." +ending
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -39,7 +39,11 @@ messages = {
|
|||||||
"export_sucessful":'Export der Migrationsdatei erfolgreich. Siehe {path}',
|
"export_sucessful":'Export der Migrationsdatei erfolgreich. Siehe {path}',
|
||||||
"export_not_sucessful":'Export der Migrationsdatei fehlgeschlagen. Überprüfe Schreibrechte für {path}.',
|
"export_not_sucessful":'Export der Migrationsdatei fehlgeschlagen. Überprüfe Schreibrechte für {path}.',
|
||||||
"export_not_sucessful_file_open":'Export fehlgeschlagen. Datei offen?',
|
"export_not_sucessful_file_open":'Export fehlgeschlagen. Datei offen?',
|
||||||
"blacklist_not_exist": 'Bitte Blacklist vom Server holen'
|
"blacklist_not_exist": 'Bitte Blacklist vom Server holen',
|
||||||
|
"wrong_impftool_path": 'Pfad zur DataPrepUtility.exe nicht gefunden. Bitte setenv.bat prüfen.' ,
|
||||||
|
"too_many_logfiles":'Keine eindeutige Logdatei zum aktuellen DataPrep Prozess gefunden. Bitte löschen Sie die überflüssigen .log files',
|
||||||
|
"some_error_in_log":'Log Datei enthlt einben Fehler. Bitte prüfen.',
|
||||||
|
"preparation_sucessful":'Preparation mit der Datei {path} erfolgreich'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,6 +320,7 @@ class Controller(Observer):
|
|||||||
self.message_error('export of excel', 'export_not_sucessful')
|
self.message_error('export of excel', 'export_not_sucessful')
|
||||||
else:
|
else:
|
||||||
self.message_info('export of excel', 'export_sucessful', {'path': infos['path']})
|
self.message_info('export of excel', 'export_sucessful', {'path': infos['path']})
|
||||||
|
self._model.call_prep_tool(infos['path'])
|
||||||
|
|
||||||
|
|
||||||
def zuruecksetzen(self):
|
def zuruecksetzen(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user