Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -52,16 +52,6 @@ def process_rental_company(company_name: str):
|
|
| 52 |
|
| 53 |
|
| 54 |
def process_rental_company_with_voucher(uploaded_file_path, voucher_number):
|
| 55 |
-
"""
|
| 56 |
-
μ¬μ©μκ° μ
λ‘λν νμΌκ³Ό μ νλ²νΈλ₯Ό λ°μ ERP μλ μ ννμΌμ μμ±νλ ν¨μ
|
| 57 |
-
|
| 58 |
-
Args:
|
| 59 |
-
uploaded_file_path (str): μ
λ‘λλ νμΌ κ²½λ‘ (CSV λ³νλ κ²½λ‘)
|
| 60 |
-
voucher_number (str): μ¬μ©μ μ
λ ₯ μ νλ²νΈ
|
| 61 |
-
|
| 62 |
-
Returns:
|
| 63 |
-
output_path (str): μ΅μ’
μ μ₯λ νμΌ κ²½λ‘ (xlsx)
|
| 64 |
-
"""
|
| 65 |
company_name = "νκ΅λ ν"
|
| 66 |
company_config = cfg.RENTAL_COMPANIES[company_name]
|
| 67 |
|
|
@@ -74,23 +64,26 @@ def process_rental_company_with_voucher(uploaded_file_path, voucher_number):
|
|
| 74 |
erp_df = erp_generator.prepare_erp_columns(erp_df)
|
| 75 |
erp_df = erp_generator.set_management_items(erp_df, df_filtered, company_config)
|
| 76 |
|
| 77 |
-
# μ νλ²νΈ
|
| 78 |
if 'ROW_ID' in erp_df.columns:
|
| 79 |
erp_df['ROW_ID'] = voucher_number
|
| 80 |
if 'NO_DOCU' in erp_df.columns:
|
| 81 |
erp_df['NO_DOCU'] = voucher_number
|
| 82 |
|
| 83 |
-
#
|
| 84 |
erp_form = file_handler.load_erp_form_template(company_config['erp_form_file'])
|
|
|
|
|
|
|
| 85 |
result_df = file_handler.prepare_file_with_template(erp_df, erp_form)
|
| 86 |
|
| 87 |
# μ μ₯
|
| 88 |
output_filename = f"μλμ ν_μμ±νμΌ_{datetime.now().strftime('%Y%m%d')}.xlsx"
|
| 89 |
output_path = os.path.join(cfg.OUTPUT_DIR, output_filename)
|
|
|
|
| 90 |
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
|
| 91 |
|
| 92 |
-
#
|
| 93 |
-
result_df.to_excel(output_path, index=False, engine=
|
| 94 |
|
| 95 |
return output_path
|
| 96 |
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
def process_rental_company_with_voucher(uploaded_file_path, voucher_number):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
company_name = "νκ΅λ ν"
|
| 56 |
company_config = cfg.RENTAL_COMPANIES[company_name]
|
| 57 |
|
|
|
|
| 64 |
erp_df = erp_generator.prepare_erp_columns(erp_df)
|
| 65 |
erp_df = erp_generator.set_management_items(erp_df, df_filtered, company_config)
|
| 66 |
|
| 67 |
+
# μ νλ²νΈ μ±μλ£κΈ°
|
| 68 |
if 'ROW_ID' in erp_df.columns:
|
| 69 |
erp_df['ROW_ID'] = voucher_number
|
| 70 |
if 'NO_DOCU' in erp_df.columns:
|
| 71 |
erp_df['NO_DOCU'] = voucher_number
|
| 72 |
|
| 73 |
+
# ERP μμ λ‘λ
|
| 74 |
erp_form = file_handler.load_erp_form_template(company_config['erp_form_file'])
|
| 75 |
+
|
| 76 |
+
# ERP μμμ λ§μΆ°μ λ°μ΄ν° μ€λΉ
|
| 77 |
result_df = file_handler.prepare_file_with_template(erp_df, erp_form)
|
| 78 |
|
| 79 |
# μ μ₯
|
| 80 |
output_filename = f"μλμ ν_μμ±νμΌ_{datetime.now().strftime('%Y%m%d')}.xlsx"
|
| 81 |
output_path = os.path.join(cfg.OUTPUT_DIR, output_filename)
|
| 82 |
+
|
| 83 |
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
|
| 84 |
|
| 85 |
+
# μ΄μ μ€λΉλ result_dfλ₯Ό μ μ₯
|
| 86 |
+
result_df.to_excel(output_path, index=False, engine='openpyxl')
|
| 87 |
|
| 88 |
return output_path
|
| 89 |
|