|
@@ -48,8 +48,8 @@ def date_format(d: datetime):
|
|
|
|
|
|
|
|
|
def convert_csv(import_csv, export_json, year, month):
|
|
|
- date_min = datetime(year, month, 1, 0, 0, 0)
|
|
|
- date_max = datetime(year, month, 1, 0, 0, 0) + relativedelta(days=5)
|
|
|
+ date_min = datetime(year, month, 5, 0, 0, 0)
|
|
|
+ date_max = datetime(year, month, 5, 0, 0, 0) + relativedelta(days=5)
|
|
|
|
|
|
date_cols = ["invoiceDate", "orderDate", "orderCompletionDate", "vehicleIntakeDate", "nextMotDueDate"]
|
|
|
df = pd.read_csv(import_csv, encoding="latin-1", decimal=",", sep=";", parse_dates=date_cols)
|
|
@@ -117,8 +117,8 @@ def convert_csv(import_csv, export_json, year, month):
|
|
|
for order in orders:
|
|
|
order["vehicle"] = orders_vehicle.get_group(order["orderNumber"]).to_dict("records")[0]
|
|
|
order["vehicle"]["nextMotDueDate"] = date_format(order["vehicle"]["nextMotDueDate"])
|
|
|
- odo_str = str(order["vehicle"]["odometer"])
|
|
|
- order["vehicle"]["odometer"] = int(odo_str) if odo_str.isnumeric() else 0
|
|
|
+ # odo_str = str(order["vehicle"]["odometer"])
|
|
|
+ order["vehicle"]["odometer"] = int(order["vehicle"]["odometer"])
|
|
|
|
|
|
order["orderDate"] = date_format(order["orderDate"])
|
|
|
order["orderCompletionDate"] = date_format(order["orderCompletionDate"])
|
|
@@ -150,8 +150,8 @@ def convert_csv(import_csv, export_json, year, month):
|
|
|
"manufacturer": item["manufacturer"],
|
|
|
"partNumber": item["partNumber"],
|
|
|
"quantity": item["quantity"],
|
|
|
- "serialNumber": item["serialNumber"],
|
|
|
- "unit": item["unit"],
|
|
|
+ "serialNumber": str(item["serialNumber"]),
|
|
|
+ "unit": str(item["unit"]),
|
|
|
},
|
|
|
}
|
|
|
)
|
|
@@ -190,7 +190,7 @@ def convert_csv(import_csv, export_json, year, month):
|
|
|
|
|
|
def upload(oauth: OAuth2Session, data):
|
|
|
headers = {
|
|
|
- "accept": "application/vnd.mazdaeur.dms.v4+json",
|
|
|
+ "accept": "application/vnd.mazdaeur.dms.v5+json",
|
|
|
"x-mme-organisation": cfg.dealer_number,
|
|
|
"X-mazda-org": cfg.dealer_number,
|
|
|
"Content-Type": "application/json",
|