Bei einigen Dateien kann ich den Montageort nicht bearbeiten, da sie auf einmal Zahlen sind
This commit is contained in:
@@ -17,13 +17,14 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>450</x>
|
<x>450</x>
|
||||||
<y>10</y>
|
<y>0</y>
|
||||||
<width>250</width>
|
<width>171</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
<pointsize>18</pointsize>
|
<pointsize>18</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@@ -40,6 +41,11 @@
|
|||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Speichern unter</string>
|
<string>Speichern unter</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -50,9 +56,15 @@
|
|||||||
<x>300</x>
|
<x>300</x>
|
||||||
<y>60</y>
|
<y>60</y>
|
||||||
<width>331</width>
|
<width>331</width>
|
||||||
<height>16</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
<enum>Qt::RightToLeft</enum>
|
<enum>Qt::RightToLeft</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -77,6 +89,7 @@
|
|||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
<pointsize>12</pointsize>
|
<pointsize>12</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@@ -90,12 +103,17 @@
|
|||||||
<widget class="QPushButton" name="openBtn">
|
<widget class="QPushButton" name="openBtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>160</x>
|
<x>150</x>
|
||||||
<y>30</y>
|
<y>30</y>
|
||||||
<width>85</width>
|
<width>121</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Öffnen</string>
|
<string>Öffnen</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -111,6 +129,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<family>Arial Unicode MS</family>
|
||||||
<pointsize>13</pointsize>
|
<pointsize>13</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ from pathlib import Path
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from icecream import ic
|
from icecream import ic
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
class MainUI(QDialog): # erbt von QDialog
|
class MainUI(QDialog): # erbt von QDialog
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# super (MainUI, self).__init__() #Aufrufen des Konstruktors von QDialog
|
# super (MainUI, self).__init__() #Aufrufen des Konstruktors von QDialog
|
||||||
@@ -21,13 +23,6 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
self.group = None
|
self.group = None
|
||||||
self.typ = None
|
self.typ = None
|
||||||
|
|
||||||
def changegroup(self):
|
|
||||||
self.group = self.gruppierung.currentText()
|
|
||||||
# ic("Gruppen: ", self.group)
|
|
||||||
|
|
||||||
def changegtyp(self):
|
|
||||||
self.typ = self.geraetetyp.currentText()
|
|
||||||
# ic("Typ: ", self.typ)
|
|
||||||
|
|
||||||
def open_file_dialog(self):
|
def open_file_dialog(self):
|
||||||
self.filename, _ = QFileDialog.getOpenFileName(
|
self.filename, _ = QFileDialog.getOpenFileName(
|
||||||
@@ -42,29 +37,29 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
if self.filename:
|
if self.filename:
|
||||||
self.path = Path(self.filename)
|
self.path = Path(self.filename)
|
||||||
|
|
||||||
#self.changetable()
|
self.collect_grundgeraete()
|
||||||
self.collectdata()
|
|
||||||
|
# self.collect_erweiterung()
|
||||||
|
|
||||||
def onClicked(self):
|
def onClicked(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def collect_grundgeraete(self):
|
||||||
def collectdata(self):
|
|
||||||
|
|
||||||
# Einlesen der Sheets
|
# Einlesen der Sheets
|
||||||
self.df_vte = pd.read_excel(self.filename,header=7,na_filter=False,sheet_name="VTE-Input",engine='pyxlsb',usecols=['Hostname','Gruppierung','CONFIG-ID','CMDB Status'])
|
self.df_vte = pd.read_excel(self.filename, header=7, na_filter=False, sheet_name="VTE-Input", engine='pyxlsb',
|
||||||
|
usecols=['Hostname', 'Gruppierung', 'CONFIG-ID', 'CMDB Status'])
|
||||||
# print(self.df_vte.head)
|
# print(self.df_vte.head)
|
||||||
self.df_cmdb = pd.read_excel(self.filename, header=2, sheet_name="CMDB", engine='pyxlsb')
|
self.df_cmdb = pd.read_excel(self.filename, header=2, sheet_name="CMDB", engine='pyxlsb')
|
||||||
# self.df_sw_asset = pd.read_excel(self.filename,sheet_name="SW-Asset", engine='pyxlsb')
|
# self.df_sw_asset = pd.read_excel(self.filename,sheet_name="SW-Asset", engine='pyxlsb')
|
||||||
|
|
||||||
|
|
||||||
# Nach relevanten Spalten filtern
|
# Nach relevanten Spalten filtern
|
||||||
self.df_vte = self.df_vte[self.df_vte['Gruppierung'] == 'Grundgerät']
|
self.df_vte = self.df_vte[self.df_vte['Gruppierung'] == 'Grundgerät']
|
||||||
# self.df_vte = self.df_vte.drop(columns=['RAM','Bestelldatum','Hersteller','Lieferant','SAP-Nr.','Lieferdatum','Lieferschein-Nr.','WV-Start','WV-Ende','Aufgaben Schritt','Verkehrsart','Anz.\nHE '])
|
# self.df_vte = self.df_vte.drop(columns=['RAM','Bestelldatum','Hersteller','Lieferant','SAP-Nr.','Lieferdatum','Lieferschein-Nr.','WV-Start','WV-Ende','Aufgaben Schritt','Verkehrsart','Anz.\nHE '])
|
||||||
self.df_cmdb = self.df_cmdb[self.df_cmdb['Filter'].isin(['Grundgerät', 'Erweiterung'])]
|
self.df_cmdb = self.df_cmdb[self.df_cmdb['Filter'].isin(['Grundgerät', 'Erweiterung'])]
|
||||||
|
|
||||||
self.df_cmdb = self.df_cmdb.drop(columns=['WV-Start','WV-Ende','CMDB-Status','Aufgabe Schritt','Filter','Waermeabgabe [BTU/h]','kalk. Strom [A]'])
|
self.df_cmdb = self.df_cmdb.drop(
|
||||||
|
columns=['WV-Start', 'WV-Ende', 'CMDB-Status', 'Aufgabe Schritt', 'Filter', 'Waermeabgabe [BTU/h]',
|
||||||
|
'kalk. Strom [A]'])
|
||||||
|
|
||||||
# Einfügen von Spalten in die CMDB-Tabelle
|
# Einfügen von Spalten in die CMDB-Tabelle
|
||||||
self.dfb = self.df_vte.merge(self.df_cmdb, on=['Hostname'], how='left')
|
self.dfb = self.df_vte.merge(self.df_cmdb, on=['Hostname'], how='left')
|
||||||
@@ -96,7 +91,9 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
# Führende Leerzeichen in allen Spalten entfernen
|
# Führende Leerzeichen in allen Spalten entfernen
|
||||||
self.dfb = self.dfb.apply(lambda x: x.str.lstrip() if x.dtype == "object" else x)
|
self.dfb = self.dfb.apply(lambda x: x.str.lstrip() if x.dtype == "object" else x)
|
||||||
|
|
||||||
|
self.dfb = self.dfb.apply(self.suche_Einschub, axis=1)
|
||||||
|
|
||||||
|
self.dfb = self.dfb.apply(self.montageort, axis=1)
|
||||||
|
|
||||||
self.dfb = self.dfb.apply(self.prüfe_und_setze_wert, axis=1)
|
self.dfb = self.dfb.apply(self.prüfe_und_setze_wert, axis=1)
|
||||||
|
|
||||||
@@ -105,35 +102,44 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
self.dfb['belegte\nHE'] = self.dfb['belegte\nHE'].apply(lambda x: x if pd.isnull(x) else str(int(x)))
|
self.dfb['belegte\nHE'] = self.dfb['belegte\nHE'].apply(lambda x: x if pd.isnull(x) else str(int(x)))
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################################
|
||||||
|
#def collect_erweiterung(self):
|
||||||
|
|
||||||
|
def suche_Einschub(self, einschub):
|
||||||
|
if einschub['Montageort'][-1] in ('v' 'h'):
|
||||||
|
print (einschub['Montageort'])
|
||||||
|
einschub['Einschub'] = einschub['Montageort'][-1]
|
||||||
|
return einschub
|
||||||
|
|
||||||
def prüfe_und_setze_wert(self, zeile):
|
def montageort(self, montage):
|
||||||
ic(zeile)
|
|
||||||
|
|
||||||
# Fehlerbereinigung
|
# Fehlerbereinigung
|
||||||
if zeile['ID\nStandort'] not in ("Ber-PS","Bon-BTW"):
|
if montage['ID\nStandort'] not in ("Ber-PS", "Bon-BTW"):
|
||||||
print("Kein Standort P40 oder BTW")
|
print("Kein Standort P40 oder BTW")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
if len((zeile['Montageort'][8:13])) !=2:
|
if len((montage['Montageort'][8:13])) != 2:
|
||||||
zeile['HE'] = zeile['Montageort'][8:10]
|
montage['HE'] = montage['Montageort'][8:10]
|
||||||
zeile['Montageort'] = zeile['Montageort'][0:7]
|
montage['Montageort'] = montage['Montageort'][0:7]
|
||||||
else:
|
else:
|
||||||
zeile['HE'] = zeile['Montageort'][8:10]
|
montage['HE'] = montage['Montageort'][8:10]
|
||||||
zeile['Montageort'] = zeile['Montageort'][0:7]
|
montage['Montageort'] = montage['Montageort'][0:7]
|
||||||
# TODO:
|
|
||||||
# Einschub vorn/hinten einbauen
|
return montage
|
||||||
|
|
||||||
|
def korrektur_hersteller(self, hersteller):
|
||||||
|
if hersteller['Hersteller'].lower() == "cisco":
|
||||||
|
hersteller['Hersteller'] = "Cisco Systems"
|
||||||
|
elif hersteller['Hersteller'].lower() == "genua":
|
||||||
|
hersteller['Hersteller'] = "genua GmbH"
|
||||||
|
elif hersteller['Hersteller'].lower() == "digi":
|
||||||
|
hersteller['Hersteller'] = "Digi International Inc."
|
||||||
|
|
||||||
|
return hersteller
|
||||||
|
|
||||||
|
|
||||||
if zeile['Hersteller'].lower() == "cisco":
|
|
||||||
zeile['Hersteller'] = "Cisco Systems"
|
|
||||||
elif zeile['Hersteller'].lower() == "genua":
|
|
||||||
zeile['Hersteller'] = "genua GmbH"
|
|
||||||
elif zeile['Hersteller'].lower() == "digi":
|
|
||||||
zeile['Hersteller'] = "Digi International Inc."
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
def prüfe_und_setze_wert(self, zeile):
|
||||||
|
#ic(zeile)
|
||||||
################################################################
|
################################################################
|
||||||
if zeile['Hostname'][4:6] == "10":
|
if zeile['Hostname'][4:6] == "10":
|
||||||
zeile['ID\nMandanten'] = 'm10 CMP Plattform / iM.0 / iM.4 / PAP sIMCP'
|
zeile['ID\nMandanten'] = 'm10 CMP Plattform / iM.0 / iM.4 / PAP sIMCP'
|
||||||
@@ -320,7 +326,6 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
# Terminalserver Objekttyp = C__OBJTYPE__TERMINALSERVER -
|
# Terminalserver Objekttyp = C__OBJTYPE__TERMINALSERVER -
|
||||||
# wenn vho dann Objekttyp = C__OBJTYPE__VIRTUAL_HOST -
|
# wenn vho dann Objekttyp = C__OBJTYPE__VIRTUAL_HOST -
|
||||||
|
|
||||||
|
|
||||||
if zeile['Objekttyp (CMDB)'] == 'Genucenter':
|
if zeile['Objekttyp (CMDB)'] == 'Genucenter':
|
||||||
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__APPLIANCE'
|
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__APPLIANCE'
|
||||||
elif zeile['Objekttyp (CMDB)'] == 'HW Appliance':
|
elif zeile['Objekttyp (CMDB)'] == 'HW Appliance':
|
||||||
@@ -346,28 +351,18 @@ class MainUI(QDialog): # erbt von QDialog
|
|||||||
elif zeile['Objekttyp (CMDB)'] == 'Router':
|
elif zeile['Objekttyp (CMDB)'] == 'Router':
|
||||||
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__ROUTER'
|
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__ROUTER'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if zeile['Hostname'][1:3] == "vho":
|
if zeile['Hostname'][1:3] == "vho":
|
||||||
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__VIRTUAL_HOST'
|
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__VIRTUAL_HOST'
|
||||||
|
|
||||||
################################################################
|
|
||||||
|
|
||||||
# Einschub
|
|
||||||
if zeile['Montageort'][-1].isin('v', 'h'):
|
|
||||||
zeile['Einschub'] = zeile['Montageort'][-1]
|
|
||||||
|
|
||||||
################################################################
|
|
||||||
|
|
||||||
return zeile
|
return zeile
|
||||||
|
|
||||||
|
|
||||||
def save_file_dialog(self):
|
def save_file_dialog(self):
|
||||||
ic(self.dfb)
|
ic(self.dfb)
|
||||||
options = QFileDialog.Options()
|
options = QFileDialog.Options()
|
||||||
options |= QFileDialog.DontUseNativeDialog
|
options |= QFileDialog.DontUseNativeDialog
|
||||||
self.savefilename, _ = QFileDialog.getSaveFileName(self,
|
self.savefilename, _ = QFileDialog.getSaveFileName(self,
|
||||||
"Save File", "", "CSV(*.csv);;CSV Files(*.csv)", options = options)
|
"Save File", "", "CSV(*.csv);;CSV Files(*.csv)",
|
||||||
|
options=options)
|
||||||
|
|
||||||
self.dfb.to_csv(self.savefilename, index=None, header=True, encoding='utf-8')
|
self.dfb.to_csv(self.savefilename, index=None, header=True, encoding='utf-8')
|
||||||
print("Datei wurde gespeichert:", self.savefilename)
|
print("Datei wurde gespeichert:", self.savefilename)
|
||||||
|
|||||||
42
Fehler.ui
Normal file
42
Fehler.ui
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Fehler</class>
|
||||||
|
<widget class="QDialog" name="Fehler">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>569</width>
|
||||||
|
<height>294</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>430</x>
|
||||||
|
<y>230</y>
|
||||||
|
<width>113</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QTextEdit" name="textEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>511</width>
|
||||||
|
<height>191</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user