fix: ensure page2 is closed even on exception in process_single_order

Wrap the order processing logic in try-finally to guarantee cleanup
of the popup page regardless of whether processing succeeds or fails.

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-26 14:19:56 +08:00
parent 8d51c5b368
commit 784007c8d4

View File

@@ -220,6 +220,7 @@ class DiscreteMaterialPlanCleaner:
).group(1) ).group(1)
# 6. 执行清理逻辑 # 6. 执行清理逻辑
try:
if detail_status == "审批通过": if detail_status == "审批通过":
if detail_count > 0: if detail_count > 0:
# 更新总物料数统计 # 更新总物料数统计
@@ -392,6 +393,7 @@ class DiscreteMaterialPlanCleaner:
self._log("订单已完成,无需处理") self._log("订单已完成,无需处理")
else: else:
self._log(f"订单状态为 [{detail_status}],不符合处理条件", "warn") self._log(f"订单状态为 [{detail_status}],不符合处理条件", "warn")
finally:
page2.close() page2.close()
def setup_query_interface(self, inner_frame): def setup_query_interface(self, inner_frame):