From 2d0c7b15898e16ab4bdc22bd95c23b13e3455c0a Mon Sep 17 00:00:00 2001 From: xuyonghao <898441624@qq.com> Date: 星期三, 25 十二月 2024 14:24:12 +0800 Subject: [PATCH] 合并webSocket修改 --- app/utils/excelmerge/conformity.py | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/utils/excelmerge/conformity.py b/app/utils/excelmerge/conformity.py index 6a609b3..bca8868 100644 --- a/app/utils/excelmerge/conformity.py +++ b/app/utils/excelmerge/conformity.py @@ -19,20 +19,16 @@ [source_sheet.cell(row=row, column=col).value for col in range(1, source_sheet.max_column + 1)]) -def run_conformity(): +def run_conformity(file_path, print_path): try: # 鍔犺浇妯℃澘鏂囦欢 template_path = os.path.join('app', 'utils', 'excelmerge', '鍥界綉涓婃捣鐢靛姏鏁村悎妯$増.xlsx') template_excel = load_workbook(template_path) - EXCEL_FILES_PATH = os.path.join('data', 'output') - template_sheets = {sheet.title: sheet for sheet in template_excel} - - source_folder = os.path.join('data', 'source') - source_files = [f for f in os.listdir(source_folder) if f.endswith('.xlsx') and not f.startswith('~$')] + source_files = [f for f in os.listdir(file_path) if f.endswith('.xlsx') and not f.startswith('~$')] for file in source_files: - source_path = os.path.join(source_folder, file) + source_path = os.path.join(file_path, file) source_excel = load_workbook(source_path) # 鍔ㄦ�佽幏鍙栧伐浣滆〃 @@ -59,7 +55,7 @@ template_sheets[name].cell(row=i, column=1).value = i - start_row + 1 timestamp = datetime.now().strftime('%Y_%m_%d_%H_%M_%S') - output_path = os.path.join(EXCEL_FILES_PATH, f'{timestamp}.xlsx') + output_path = os.path.join(print_path, f'{timestamp}.xlsx') template_excel.save(output_path) template_excel.close() -- Gitblit v1.8.0