Besprechung der nächsten Schritte. Skelett von bat und lib dazu eingecheckt
This commit is contained in:
@@ -0,0 +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
|
||||
python %CREMIG_LIB%\get_sivas_teilestamm.py --sivas=%SIVAS_ID%
|
||||
deactivate
|
||||
@@ -18,4 +18,6 @@ set RD_DATABASE_SOURCE=\\ssg.local\freigaben\SIVAS_CAD_EDM\Migration\07_RD_Teile
|
||||
set RD_DATABASE_NAME=RD_Teilenummern.csv
|
||||
set VBA_MACRO_NAME=vba_format_excel.xlsm
|
||||
set SIVAS_DATABASE_QUERY=Y:\jit\programme\Sivas2json.exe
|
||||
REM set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\NetEnv\Sivas4.exe
|
||||
set SIVAS_TEILESTAMM=Y:\NetEnv\Sivas4.exe
|
||||
popd
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- Unterordner im Ordner CREMIG_DATA= für Teilestamm und für Baugruppenstruktur
|
||||
- Ergänzung der Applikation Sivas4.exe um den Schalter -o für das Ausgabeverzeichnis
|
||||
- Ergänzung der Applikation Sivas4.exe -s/-q für quiet, also dass Sivas nicht explizit sichtbar wird (Performance)
|
||||
- Ergänzung der Applikation Sivas4.exe, dass die Ausgabedatei nicht mehr from_siv.csv, sondern wie die SivasId heissen soll
|
||||
- @Simon Excel mit Tree eines Assembly wird jedes mal neu geschrieben, nur werden vorher Bemerkungen etc. aus der Altdatei gelesen und in den neuen Export wieder rein geschrieben
|
||||
@@ -0,0 +1,44 @@
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
"""
|
||||
Dieses Programm:
|
||||
- Holt sich alle notwendigen Einzelteil-Informationen aus SIVAS in Tabellenform
|
||||
"""
|
||||
|
||||
|
||||
def get_sivas_teilestamm(sivas_id, out_dir):
|
||||
sivas_teilestamm_exe = os.environ.get('SIVAS_TEILESTAMM')
|
||||
|
||||
if os.path.isfile(sivas_teilestamm_exe):
|
||||
|
||||
if os.path.isdir(out_dir):
|
||||
print(f"Attempting to generate a json-file of all parts to be migrated in relation with '{sivas_id}'")
|
||||
subprocess.run(f"{sivas_teilestamm_exe} userid=sivas password=forte database=sivas program=ExcelUeb LFDNR=500 EINSTIEG=SQL PARAMETER1={sivas_id}")
|
||||
|
||||
if os.path.isfile(os.path.join(out_dir, sivas_id + ".csv")):
|
||||
print("done")
|
||||
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.")
|
||||
exit()
|
||||
else:
|
||||
print(f"'Output directory for .json-file {out_dir}' doesn't exist.")
|
||||
else:
|
||||
print(f"Can't execute SIVAS-database query. Check if you have established a VPN connection to the company's network and check the path of %SIVAS_DATABASE_QUERY% in cremig_setenv.bat")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='fetches data from sivas or ruledesigner fusion', prog='update_database')
|
||||
parser.add_argument('-s', '--sivas', action='store', help='fetch data of this id from sivas fo local database folder', metavar='id')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
out_dir = os.environ.get('CREMIG_DATA')
|
||||
|
||||
if args.sivas:
|
||||
get_sivas_teilestamm(args.sivas, out_dir)
|
||||
|
||||
else:
|
||||
parser.print_help()
|
||||
Reference in New Issue
Block a user