feat: add dryrun parameter to skip save operations

Add dryrun boolean parameter to DiscreteMaterialPlanCleaner.
When dryrun=True, the save_button_locator.click() is skipped,
allowing preview of changes without actually saving.

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-26 10:09:05 +08:00
parent 167fa2893f
commit 63601a994f

View File

@@ -41,11 +41,13 @@ class DiscreteMaterialPlanCleaner:
manager_names: Union[str, List[str], None] = None,
headless=False,
verbose=True,
dryrun=False,
):
self.username = username
self.password = password
self.headless = headless
self.verbose = verbose
self.dryrun = dryrun
# 参数规范化:支持 str、List[str]、None
if manager_names is None:
@@ -244,12 +246,15 @@ class DiscreteMaterialPlanCleaner:
collapse_btn.click()
# 执行最终保存逻辑(如业务需要)
save_button_locator.click()
self._log("已点击保存,等待保存完成...")
save_button_locator.wait_for(
state="hidden", timeout=60000
) # 等待按钮消失超时60秒
self._log("✅ 保存成功(保存按钮已消失)")
if self.dryrun:
self._log("[DRYRUN] 跳过保存操作")
else:
save_button_locator.click()
self._log("已点击保存,等待保存完成...")
save_button_locator.wait_for(
state="hidden", timeout=60000
) # 等待按钮消失超时60秒
self._log("✅ 保存成功(保存按钮已消失)")
else:
self._log("订单无备料计划数据,无需处理")
elif detail_status == "完成":