model liest nur die Daten ein wie sie sind. Dann übernimmt die Controller Logik
This commit is contained in:
+13
-37
@@ -94,38 +94,7 @@ class CadItem():
|
||||
"cb_oberflaeche_neu",
|
||||
"cb_farbe_neu",
|
||||
]
|
||||
# dies sind die Excel Headel der SIVAS csv Export Datei
|
||||
# und wie diese in das Datenmodell der Gui integriert werden kann
|
||||
excel_to_gui = {
|
||||
"Teilenummer":"teilenummer",
|
||||
"Bezeichnung1":"bezeichnung1_sivas",
|
||||
"Bezeichnung2":"bezeichnung2_sivas",
|
||||
"Beschaffungsart":"beschaffungsart_sivas",
|
||||
"Mengeneinheit":"mengeneinheit_sivas",
|
||||
"Halbzeug":"halbzeug_sivas",
|
||||
"TOS_Gruppe":"tosgruppe_sivas",
|
||||
"Dispogruppe":"dispolaufgruppe_sivas",
|
||||
"Dispolaufgruppe":"dispolaufgruppe_sivas",
|
||||
"ErsatzFuer":"ersatzfuer_neu",
|
||||
"ErsetztDurch":"ersetztdurch_neu",
|
||||
"AktuellerIndex":"aenderungsindex_sivas",
|
||||
"Hersteller":"hersteller_sivas",
|
||||
"HerstellerTeilenummer":"herstteilenr_sivas",
|
||||
"Version":"version_sivas",
|
||||
"HalbzeugExtern":"halbzeug_sivas",
|
||||
"Werkstoff":"werkstofftyp_sivas",
|
||||
"Oberfläche":"oberflaeche_neu_combo",
|
||||
# "Truemmer":"truemmer",
|
||||
# "HzOhneSaegeliste":"",
|
||||
"Ruestcode":"ruestcode_sivas",
|
||||
"Fertigungsart":"fertigungsart_sivas",
|
||||
"FosGruppe":"fosGruppe_sivas",
|
||||
"Kalkulationsart":"kalkulationsart_sivas",
|
||||
"Indexerfasser":"",
|
||||
"Aenderungstext":"aenderungstext_sivas",
|
||||
"Freigabevermerk":"freigabevermerk_sivas",
|
||||
# "Indexbearbeiter":"in"
|
||||
}
|
||||
|
||||
|
||||
def __init__(self):
|
||||
""" is initalized with its unique id"""
|
||||
@@ -218,15 +187,22 @@ class CadItem():
|
||||
path = os.path.join(self.environment.out_dir, cid + '.csv')
|
||||
if os.path.exists(path):
|
||||
data = self.load_csv(path)
|
||||
self.set_gui_dict(data)
|
||||
return data
|
||||
return None
|
||||
def load_csv(self, path):
|
||||
"""lädt die SIVAS csv Datei in die Felder für die Oberfläche """
|
||||
if not os.path.exists(path):
|
||||
return None
|
||||
df = pd.read_csv(path)
|
||||
df = pd.read_csv(path, sep=';')
|
||||
ret = dict()
|
||||
columns = df.columns.values
|
||||
for colname in columns:
|
||||
ret[self.excel_to_gui[colname]] = df[0][colname]
|
||||
# baue aus der gegebenen Zeile ein dict
|
||||
d = df.to_dict()
|
||||
for k,v in d.items():
|
||||
value = v[0]
|
||||
# schmeisse alle NaN raus
|
||||
if pd.isna(value):
|
||||
value = None
|
||||
ret[k] = value
|
||||
return ret
|
||||
|
||||
def from_json(self, json_str):
|
||||
|
||||
Reference in New Issue
Block a user