|
@@ -38,6 +38,7 @@ def load_data(config, source, year=None, month=None):
|
|
|
year = curr_date.strftime("%Y")
|
|
|
month = curr_date.strftime("%m")
|
|
|
period = f"{year}-{month}"
|
|
|
+ period2 = int(f"{year}{month}")
|
|
|
|
|
|
select_befehl_auftraege = f"SELECT * FROM [Auftraege_NASA_gruppiert] WHERE Periode = '{period}'"
|
|
|
select_befehl_mitarbeiter = f"SELECT * FROM [Mitarbeiter_NASA] WHERE Periode = '{period}'"
|
|
@@ -62,6 +63,7 @@ def load_data(config, source, year=None, month=None):
|
|
|
df = pd.read_sql(select_befehl_auftraege, con=source_db)
|
|
|
else:
|
|
|
df = pd.read_csv(source_auftraege, sep=";", encoding="latin-1", decimal=",")
|
|
|
+ df = df[df["Periode"] == period2]
|
|
|
|
|
|
# auftragsart = ["Extern", "Garantie", "Intern", "Theke"]
|
|
|
# auftragstyp = ["Inspektion", "Karosseriearbeit", "Lackierung", "Verschleißteile", "Sonstiges"]
|
|
@@ -135,12 +137,20 @@ def print_result(period, result, len_pos):
|
|
|
print(f"{len_pos - result} von {len_pos} Datensätzen nicht verarbeitet!")
|
|
|
|
|
|
|
|
|
-def main():
|
|
|
- config = get_config()
|
|
|
- payload = load_data(config, "csv", "2024", "01")
|
|
|
+def workflow(config, year, month):
|
|
|
+ period = f"{year}-{month}"
|
|
|
+ payload = load_data(config, "csv", year, month)
|
|
|
result = submit_data(config, payload)
|
|
|
len_pos = len(payload["AfterSalesPositionen"])
|
|
|
- print_result("2024-01", result, len_pos)
|
|
|
+ print_result(period, result, len_pos)
|
|
|
+
|
|
|
+
|
|
|
+def main():
|
|
|
+ config = get_config()
|
|
|
+ year = "2023"
|
|
|
+ for p in range(1, 13):
|
|
|
+ month = f"{p:02}"
|
|
|
+ workflow(config, year, month)
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|