浏览代码

gcstruct_uebersetzung aus gcstruct ausgelagert

gc-server3 1 年之前
父节点
当前提交
74d609e97b
共有 2 个文件被更改,包括 33 次插入33 次删除
  1. 0 32
      gcstruct/gcstruct.py
  2. 33 1
      gcstruct/gcstruct_uebersetzung.py

+ 0 - 32
gcstruct/gcstruct.py

@@ -738,38 +738,6 @@ class GCStruct:
         )
 
 
-def gcstruct_uebersetzung(base_dir=None):
-    # base_dir = 'P:/SKR51_GCStruct/'
-    if base_dir is None:
-        base_dir = Path(".").absolute()
-    else:
-        base_dir = Path(base_dir)
-    import_dir = base_dir
-    if base_dir.name == "scripts":
-        if base_dir.parent.parent.name == "Portal":
-            base_dir = base_dir.parent.parent.parent
-            import_dir = base_dir.joinpath("Portal/System/IQD/Belege/Kontenrahmen")
-        else:
-            base_dir = base_dir.parent.parent
-            import_dir = base_dir.joinpath("System/OPTIMA/Export")
-    elif not base_dir.joinpath("GCStruct_Aufbereitung").exists():
-        base_dir = Path("//192.168.2.21/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
-        if not base_dir.exists():
-            base_dir = Path("//media/fileserver1/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
-        import_dir = base_dir
-
-    struct = GCStruct(str(base_dir.joinpath("GCStruct_Aufbereitung")))
-    struct.skr51_translate(import_dir.glob("Kontenrahmen_kombiniert*.csv"))
-    print("Kontenrahmen_uebersetzt.csv erstellt.")
-    # copyfile('c:/Projekte/Python/Gcstruct/Kontenrahmen_kombiniert.csv', base_dir + 'GCStruct_Modell/Export/Kontenrahmen_kombiniert.csv')
-
-    struct2 = GCStruct(str(base_dir.joinpath("GCStruct_Modell")))
-    struct2.skr51_translate2(str(base_dir.joinpath("GCStruct_Aufbereitung/Export/Kontenrahmen_uebersetzt.csv")))
-    print("SKR51_Uebersetzung.csv erstellt.")
-    struct2.skr51_vars()
-    print("SKR51_Struktur.csv erstellt.")
-
-
 def dresen():
     struct = GCStruct("c:/projekte/GCHRStruct_Hyundai_Export")
     struct.get_structure_and_tree()

+ 33 - 1
gcstruct/gcstruct_uebersetzung.py

@@ -1,4 +1,36 @@
-from gcstruct import gcstruct_uebersetzung
+from gcstruct.gcstruct import GCStruct
+from pathlib import Path
+
+
+def gcstruct_uebersetzung(base_dir=None):
+    if base_dir is None:
+        base_dir = Path(".").absolute()
+    else:
+        base_dir = Path(base_dir)
+    import_dir = base_dir
+    if base_dir.name == "scripts":
+        if base_dir.parent.parent.name == "Portal":
+            base_dir = base_dir.parent.parent.parent
+            import_dir = base_dir.joinpath("Portal/System/IQD/Belege/Kontenrahmen")
+        else:
+            base_dir = base_dir.parent.parent
+            import_dir = base_dir.joinpath("System/OPTIMA/Export")
+    elif not base_dir.joinpath("GCStruct_Aufbereitung").exists():
+        base_dir = Path("//192.168.2.21/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
+        if not base_dir.exists():
+            base_dir = Path("//media/fileserver1/verwaltung/Kunden/Luchtenberg/1 Umstellung SKR51/")
+        import_dir = base_dir
+
+    struct = GCStruct(str(base_dir.joinpath("GCStruct_Aufbereitung")))
+    struct.skr51_translate(import_dir.glob("Kontenrahmen_kombiniert*.csv"))
+    print("Kontenrahmen_uebersetzt.csv erstellt.")
+    # copyfile('c:/Projekte/Python/Gcstruct/Kontenrahmen_kombiniert.csv', base_dir + 'GCStruct_Modell/Export/Kontenrahmen_kombiniert.csv')
+
+    struct2 = GCStruct(str(base_dir.joinpath("GCStruct_Modell")))
+    struct2.skr51_translate2(str(base_dir.joinpath("GCStruct_Aufbereitung/Export/Kontenrahmen_uebersetzt.csv")))
+    print("SKR51_Uebersetzung.csv erstellt.")
+    struct2.skr51_vars()
+    print("SKR51_Struktur.csv erstellt.")
 
 
 if __name__ == "__main__":