feat(shipping-notice): 增加 RPA 库存回调处理逻辑,支持跳过无库存情况

This commit is contained in:
hugo committed 2026-07-10 17:21:11 +08:00
1 parent f21216f81e
commit c3f05ba96b
25 files changed
+1619 -81

No files matched your search

@@ -316,6 +316,27 @@ SUCCESS — DSV session ready
python scripts\rpa\dsv_export_smoke.py DSV360_AWSBI_BYAWSCMH01
```
可选:验证 DSV **批量**导出链路(一次登录连续多仓,不回调后端):
```powershell
python scripts\rpa\dsv_export_batch_smoke.py warehouse
python scripts\rpa\dsv_export_batch_smoke.py source_code
python scripts\rpa\dsv_export_batch_smoke.py all
```
batch smoke **默认语义**:链路跑完即通过(退出码 0),**全 skipped(确认无库存、未导出 Excel)也算通过**。
若 CI 或联调需要“至少真实导出一个 Excel”,启用严格模式:
```powershell
$env:FREIGHT_RPA_SMOKE_REQUIRE_EXPORT = "true"
python scripts\rpa\dsv_export_batch_smoke.py warehouse
```
| 环境变量 | 默认值 | 说明 |
| --- | --- | --- |
| `FREIGHT_RPA_SMOKE_REQUIRE_EXPORT` | `false` | 为 `true` 时要求至少一条 `success` 导出;全 skipped 时退出码 **2** |
如果登录或导出失败,先排查 Windows 主机是否能手工打开 DSV/Crane、账号密码是否正确、是否需要 MFA/验证码/SSO、公司代理和证书是否正常。
#### 1.5.6 Ubuntu 后端主机:安装 SMB 工具并测试共享
@@ -3211,6 +3232,7 @@ API 层
- **multi_select**:worker `_fill_dsv_multi_select` 支持多选控件(非仅取第一个值)
- Worker:`scripts/rpa/freight_rpa_worker.py` → `_handle_inventory_batch_trigger`
- 回调:`POST /api/shipping-notice/rpa/inventory-batch-ready`
- **回调响应语义**(2026-07):`status` 恒为 `ok`(payload 合法且回调处理完成);**业务成败**看顶层 `result_status` 或 `data.result_status`(`success` / `partial_failed` / `failed`),全失败回调也是 `status=ok` + `result_status=failed`。**排程场景**(含 `schedule_run_id` 且 finalize 成功)时 `result_status` 与 `ScheduleRun.status` 一致;`data.callback_result_status` 保留仅按回调 results 计算的原始结果。worker 回调 payload 顶层含 `status`、`success`(legacy)、`has_success`、`success_count`、`skipped_count`、`failed_count`、`results[]`(每项含 `status`)。
- 定时排程:`schedule_type=platform_job`,`platform_api_path=shipping-inventory-rpa`,`data_source_type=null`;建议 cron `0 3 * * *`(Asia/Shanghai)
- 排程语义:`data_source_type` 仅用于 `schedule_type=data_pipeline`(`database` | `external_api`);平台任务通过 Job Registry 注册,由 `platform_api_path` 引用 job key