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, manager_names: Union[str, List[str], None] = None,
headless=False, headless=False,
verbose=True, verbose=True,
dryrun=False,
): ):
self.username = username self.username = username
self.password = password self.password = password
self.headless = headless self.headless = headless
self.verbose = verbose self.verbose = verbose
self.dryrun = dryrun
# 参数规范化:支持 str、List[str]、None # 参数规范化:支持 str、List[str]、None
if manager_names is None: if manager_names is None:
@@ -244,6 +246,9 @@ class DiscreteMaterialPlanCleaner:
collapse_btn.click() collapse_btn.click()
# 执行最终保存逻辑(如业务需要) # 执行最终保存逻辑(如业务需要)
if self.dryrun:
self._log("[DRYRUN] 跳过保存操作")
else:
save_button_locator.click() save_button_locator.click()
self._log("已点击保存,等待保存完成...") self._log("已点击保存,等待保存完成...")
save_button_locator.wait_for( save_button_locator.wait_for(