diff --git a/销售订单自动导入.py b/销售订单自动导入.py index 821594e..8b391d5 100644 --- a/销售订单自动导入.py +++ b/销售订单自动导入.py @@ -550,25 +550,8 @@ def main(workbook=None): print(f'[警告] 分页选项设置失败') pass - match args.automation: - case 'draft', 'final': - while ready(driver): - for link in driver.find_elements(By.CSS_SELECTOR, ".list-frame-table .vue-recycle-scroller__item-wrapper .cell[data-cci='1'] a"): - try: - modify(link) - except Exception as e: - print(f'[!!!!] 编辑订单时发生了错误:{e}') - return 85 - - try: - button = locate(".paas-invoice-list-frame .list-okki-footer-wrap li.okki-pagination-next button", wait=False) - if bool(button.get_attribute('disabled')): raise KeyboardInterrupt() - click(button) - except: - print('[信息] 已经是最后一页') - break - case 'override': - for number in workbook['订单号'].unique(): + if args.automation == 'override': + for number in workbook['订单号'].unique(): try: box = locate(".list-header-wrap div[data-item-name='订单号']", condition=None) search = locate("input", parent=box, condition=None) @@ -615,6 +598,24 @@ def main(workbook=None): except Exception as e: print(f'[!!!!] {number}: 编辑订单时发生了错误:{e}') continue + + return 0 + + while ready(driver): + for link in driver.find_elements(By.CSS_SELECTOR, ".list-frame-table .vue-recycle-scroller__item-wrapper .cell[data-cci='1'] a"): + try: + modify(link) + except Exception as e: + print(f'[!!!!] 编辑订单时发生了错误:{e}') + return 85 + + try: + button = locate(".paas-invoice-list-frame .list-okki-footer-wrap li.okki-pagination-next button", wait=False) + if bool(button.get_attribute('disabled')): raise KeyboardInterrupt() + click(button) + except: + print('[信息] 已经是最后一页') + break return 0