feat: add cumulative pending quantity validation before material deletion
Added validation to check if cumulative pending quantity is empty before allowing material deletion, with appropriate emoji indicators for delete eligibility. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -206,12 +206,15 @@ class DiscreteMaterialPlanCleaner:
|
|||||||
self._print(f"材料名称:{material_name}")
|
self._print(f"材料名称:{material_name}")
|
||||||
|
|
||||||
# 获取累计待发数量
|
# 获取累计待发数量
|
||||||
|
# 创建一个变量来保存累计待发数量的值,以便后续使用
|
||||||
|
cumulative_pending_quantity = 0
|
||||||
input_box = (
|
input_box = (
|
||||||
child_form.locator("div")
|
child_form.locator("div")
|
||||||
.filter(has_text=re.compile(r"^累计待发数量$"))
|
.filter(has_text=re.compile(r"^累计待发数量$"))
|
||||||
.locator("input[type='text']")
|
.locator("input[type='text']")
|
||||||
)
|
)
|
||||||
self._print(f"累计待发数量:{input_box.input_value()}")
|
cumulative_pending_quantity = input_box.input_value()
|
||||||
|
self._print(f"累计待发数量:{cumulative_pending_quantity}")
|
||||||
|
|
||||||
# 获取累计出库数量
|
# 获取累计出库数量
|
||||||
input_box = (
|
input_box = (
|
||||||
@@ -226,6 +229,10 @@ class DiscreteMaterialPlanCleaner:
|
|||||||
should_delete = should_delete_material(manager_name, material_code)
|
should_delete = should_delete_material(manager_name, material_code)
|
||||||
|
|
||||||
if should_delete:
|
if should_delete:
|
||||||
|
if not cumulative_pending_quantity :
|
||||||
|
self._print(f"✅ 可以删除")
|
||||||
|
else:
|
||||||
|
self._print(f"❌ 累计待发数量不为空,无法删除")
|
||||||
self._print(
|
self._print(
|
||||||
f">>> 需要清理:材料名称【{material_name}】材料编码【{material_code}】"
|
f">>> 需要清理:材料名称【{material_name}】材料编码【{material_code}】"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user