| | |
| | | |
| | | from datetime import datetime |
| | | from openpyxl import load_workbook |
| | | from Log import logger |
| | | |
| | | |
| | | def clear_blank_rows(sheet): |
| | |
| | | source_sheet.cell(row=row, column=col).value for col in range(4, source_sheet.max_column + 1)): |
| | | target_sheet.append( |
| | | [source_sheet.cell(row=row, column=col).value for col in range(1, source_sheet.max_column + 1)]) |
| | | |
| | | |
| | | def delete_file_after_delay(file_path, delay_minutes): |
| | | from main import scheduler |
| | | |
| | | def delete_file(): |
| | | try: |
| | | if os.path.exists(file_path): |
| | | os.remove(file_path) |
| | | except Exception as e: |
| | | logger.error(f"定时删除Excel文件时发生错误: {e}") |
| | | |
| | | scheduler.add_job(delete_file, 'interval', minutes=delay_minutes, id=f"delete_{file_path}") |
| | | |
| | | |
| | | def run_conformity(file_path, print_path): |
| | |
| | | output_path = os.path.join(print_path, f'{file_name}.xlsx') |
| | | template_excel.save(output_path) |
| | | template_excel.close() |
| | | |
| | | delete_file_after_delay(output_path, 3) |
| | | |
| | | try: |
| | | for filename in os.listdir(file_path): |