From 7f8d81af215abb34fdbf33952b205499bb02624a Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Wed, 17 Jun 2026 15:27:51 +0800 Subject: [PATCH] Add zero-count validation for Baishi undelivered data extraction --- site_baishi.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site_baishi.py b/site_baishi.py index 2a14441..5c215bb 100644 --- a/site_baishi.py +++ b/site_baishi.py @@ -33,6 +33,14 @@ def baishi_download_undelivered_data(page): print(">> 正在解析表格,提取当日到件未扫明细...") # 表头结构复杂,精准定位第一行数据的第 13 列(索引 12) target_cell = page.locator(".ant-table-tbody > tr").first.locator("td").nth(12) + + # 特殊情况处理:检查未扫数量是否为0 + cell_text = target_cell.inner_text().strip() + if cell_text == "0" or cell_text == "": + print(f" ℹ️ 注意:当日未扫数量为【{cell_text}】,无数据需要提取,任务结束。") + return + + # 有未扫数据,继续点击操作 target_cell.locator("a").click() # 等待下方弹出的明细表格区域加载完毕