Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -2
src/streamlit_app.py
CHANGED
|
@@ -164,6 +164,10 @@ def convert_json_to_excel_data_outbound(json_file_content: str, customers_df_inp
|
|
| 164 |
|
| 165 |
processed_data_for_this_file = []
|
| 166 |
for item in details:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
row = {
|
| 168 |
'siteCode': site_code_json,
|
| 169 |
'companyCode': company_code_json,
|
|
@@ -198,6 +202,7 @@ def convert_json_to_excel_data_outbound(json_file_content: str, customers_df_inp
|
|
| 198 |
'details.availability': item.get('availability'),
|
| 199 |
'details.accountingStatus': item.get('accountingStatus'),
|
| 200 |
'details.refOrder': item.get('refOrder'),
|
|
|
|
| 201 |
'noteDDT': note_ddt,
|
| 202 |
'noteMag': note_warehouse,
|
| 203 |
'noteDelivery': note_delivery,
|
|
@@ -351,7 +356,7 @@ if uploaded_json_files and st.session_state.customer_excel_loaded:
|
|
| 351 |
workbook = writer.book
|
| 352 |
worksheet = workbook.add_worksheet(sheet_name_excel)
|
| 353 |
|
| 354 |
-
# Lista delle colonne finali nell'ordine desiderato
|
| 355 |
final_columns_order = [
|
| 356 |
'siteCode', 'companyCode', 'orderNumber', 'orderType', 'deliveryType',
|
| 357 |
'orderDate', 'dateDetail', 'dueDate', 'reasonCode',
|
|
@@ -363,6 +368,7 @@ if uploaded_json_files and st.session_state.customer_excel_loaded:
|
|
| 363 |
'details.positionId', 'details.itemNumber', 'details.requestedQt',
|
| 364 |
'details.lotId', 'details.stockOwner', 'details.magCli', 'details.availability',
|
| 365 |
'details.accountingStatus', 'details.refOrder',
|
|
|
|
| 366 |
'noteDDT', 'noteMag', 'noteDelivery', 'noteShipment',
|
| 367 |
'reasonCodeShp', 'infoDelivery', 'bookingInfo'
|
| 368 |
]
|
|
@@ -373,7 +379,7 @@ if uploaded_json_files and st.session_state.customer_excel_loaded:
|
|
| 373 |
final_df[col] = ""
|
| 374 |
final_df = final_df[final_columns_order]
|
| 375 |
|
| 376 |
-
# Larghezze delle colonne aggiornate
|
| 377 |
col_widths = {
|
| 378 |
'siteCode': 10, 'companyCode': 15, 'orderNumber': 15, 'orderType': 10, 'deliveryType': 12,
|
| 379 |
'orderDate': 12, 'dateDetail': 15, 'dueDate': 12, 'reasonCode': 12,
|
|
@@ -385,6 +391,7 @@ if uploaded_json_files and st.session_state.customer_excel_loaded:
|
|
| 385 |
'details.positionId': 12, 'details.itemNumber': 20, 'details.requestedQt': 15,
|
| 386 |
'details.lotId': 10, 'details.stockOwner': 15, 'details.magCli': 15, 'details.availability': 15,
|
| 387 |
'details.accountingStatus': 18, 'details.refOrder': 15,
|
|
|
|
| 388 |
'noteDDT': 20, 'noteMag': 20, 'noteDelivery': 20, 'noteShipment': 20,
|
| 389 |
'reasonCodeShp': 15, 'infoDelivery': 20, 'bookingInfo': 20
|
| 390 |
}
|
|
|
|
| 164 |
|
| 165 |
processed_data_for_this_file = []
|
| 166 |
for item in details:
|
| 167 |
+
# Logica per cancelPosOda
|
| 168 |
+
cancel_pos_oda_value = item.get('cancelPosOda', False) # Assume default a False se non presente
|
| 169 |
+
cancel_pos_oda_excel = 'X' if cancel_pos_oda_value is True else '' # Metti 'X' se True, altrimenti vuoto
|
| 170 |
+
|
| 171 |
row = {
|
| 172 |
'siteCode': site_code_json,
|
| 173 |
'companyCode': company_code_json,
|
|
|
|
| 202 |
'details.availability': item.get('availability'),
|
| 203 |
'details.accountingStatus': item.get('accountingStatus'),
|
| 204 |
'details.refOrder': item.get('refOrder'),
|
| 205 |
+
'cancelPosOda': cancel_pos_oda_excel, # Nuovo campo
|
| 206 |
'noteDDT': note_ddt,
|
| 207 |
'noteMag': note_warehouse,
|
| 208 |
'noteDelivery': note_delivery,
|
|
|
|
| 356 |
workbook = writer.book
|
| 357 |
worksheet = workbook.add_worksheet(sheet_name_excel)
|
| 358 |
|
| 359 |
+
# Lista delle colonne finali nell'ordine desiderato (aggiunto 'cancelPosOda')
|
| 360 |
final_columns_order = [
|
| 361 |
'siteCode', 'companyCode', 'orderNumber', 'orderType', 'deliveryType',
|
| 362 |
'orderDate', 'dateDetail', 'dueDate', 'reasonCode',
|
|
|
|
| 368 |
'details.positionId', 'details.itemNumber', 'details.requestedQt',
|
| 369 |
'details.lotId', 'details.stockOwner', 'details.magCli', 'details.availability',
|
| 370 |
'details.accountingStatus', 'details.refOrder',
|
| 371 |
+
'cancelPosOda', # Nuovo campo aggiunto qui
|
| 372 |
'noteDDT', 'noteMag', 'noteDelivery', 'noteShipment',
|
| 373 |
'reasonCodeShp', 'infoDelivery', 'bookingInfo'
|
| 374 |
]
|
|
|
|
| 379 |
final_df[col] = ""
|
| 380 |
final_df = final_df[final_columns_order]
|
| 381 |
|
| 382 |
+
# Larghezze delle colonne aggiornate (aggiunto 'cancelPosOda')
|
| 383 |
col_widths = {
|
| 384 |
'siteCode': 10, 'companyCode': 15, 'orderNumber': 15, 'orderType': 10, 'deliveryType': 12,
|
| 385 |
'orderDate': 12, 'dateDetail': 15, 'dueDate': 12, 'reasonCode': 12,
|
|
|
|
| 391 |
'details.positionId': 12, 'details.itemNumber': 20, 'details.requestedQt': 15,
|
| 392 |
'details.lotId': 10, 'details.stockOwner': 15, 'details.magCli': 15, 'details.availability': 15,
|
| 393 |
'details.accountingStatus': 18, 'details.refOrder': 15,
|
| 394 |
+
'cancelPosOda': 10, # Larghezza per il nuovo campo
|
| 395 |
'noteDDT': 20, 'noteMag': 20, 'noteDelivery': 20, 'noteShipment': 20,
|
| 396 |
'reasonCodeShp': 15, 'infoDelivery': 20, 'bookingInfo': 20
|
| 397 |
}
|