Add zero-count validation for Baishi undelivered data extraction

This commit is contained in:
Misaka_Company
2026-06-17 15:27:51 +08:00
parent 7cae24fae3
commit 7f8d81af21

View File

@@ -33,6 +33,14 @@ def baishi_download_undelivered_data(page):
print(">> 正在解析表格,提取当日到件未扫明细...") print(">> 正在解析表格,提取当日到件未扫明细...")
# 表头结构复杂,精准定位第一行数据的第 13 列(索引 12 # 表头结构复杂,精准定位第一行数据的第 13 列(索引 12
target_cell = page.locator(".ant-table-tbody > tr").first.locator("td").nth(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() target_cell.locator("a").click()
# 等待下方弹出的明细表格区域加载完毕 # 等待下方弹出的明细表格区域加载完毕