docs: add Shopee project docs

This commit is contained in:
曾志威
2026-07-14 19:09:00 +08:00
parent 0cee884a04
commit 8b4240b1d0
4 changed files with 14085 additions and 0 deletions
+13234
View File
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 25 MiB

@@ -0,0 +1,513 @@
# Shopee 4.6 查询移库拣货接口测试用例
## 接口信息
- 接口:4.6 库内发起 Vendor 查询拣货接口
- URL`POST http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list`
- Content-Type`application/json`
- EDI 配置 key`query_picking_list`
- WMS API`shopee.inventory.racktransfer.queryPickingList`
- XSLT`edi-shopee/src/main/resources/xslt/out/4_6_query_picking_list.xslt`
## 前置条件
1. 本地已启动 EDI `9002` 和 WES `9001`
2. 当前测试库有效仓库为 `PHIXP`;文档示例仓库 `SGL` 当前未命中测试数据。
3. 当前测试库存在 RT 任务数据:
- `source_id = RTSGL00020250102001`
- `source_id = RTSGL00020250102002`
- `source_id = 对应Geek+的唯一单号`
4. 当前测试数据未查到可通过 `rt_order_id_list` 命中的 `wave.shopeeWaveCode`,因此 `rt_order_id_list` 场景返回空列表。
## 字段转换说明
请求报文使用 Shopee 原始字段,XSLT 负责转换到 WMS 内部字段:
| Shopee 字段 | WMS 字段 |
| --- | --- |
| `whs_id` | `warehouseCode` |
| `source_id_list` | `sourceIdList` |
| `rt_order_id_list` | `rtOrderIdList` |
| `wave_flag` | `waveFlag` |
| `start_time` | `startTime` |
| `end_time` | `endTime` |
| `exclude_source_id_list` | `excludeSourceIdList` |
## 测试结果汇总
| 用例 | 场景 | 预期结果 | 实测结果 |
| --- | --- | --- | --- |
| TC-01 | 按 `source_id_list` 查询命中数据 | 成功,返回 1 条 `rt_order_info_list` | 通过 |
| TC-02 | 只传 `whs_id` 查询 | 当前实现返回最近 RT 任务列表 | 通过,返回 3 条 |
| TC-03 | 不存在的 `source_id_list` | 成功,返回空列表 | 通过 |
| TC-04 | `exclude_source_id_list` 排除指定 source | 成功,排除指定 source | 通过 |
| TC-05 | 按时间范围查询 | 成功,返回时间范围内数据 | 通过,返回 3 条 |
| TC-06 | 按 `rt_order_id_list` 查询 | 当前测试数据无 wave 绑定,返回空列表 | 通过 |
| TC-07 | 缺少 `whs_id` | 返回无效消息体 | 通过 |
| TC-08 | 文档示例仓库 `SGL` | 当前测试库无数据,返回空列表 | 通过 |
## TC-01 按 source_id_list 查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"source_id_list": [
"RTSGL00020250102001"
],
"rt_order_id_list": []
}'
```
实测结果:
```json
{
"retcode": 0,
"message": "success",
"data": {
"whs_id": "PHIXP",
"rt_order_info_list": [
{
"source_id": "RTSGL00020250102001",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "sku1:null:",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
},
{
"device_id": "B10922",
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku1:null:B10922",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:B10922",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
}
]
}
}
```
分析:接口调用成功。返回中未出现 `rt_order_id`,原因是当前测试数据没有可还原的 `wave.shopeeWaveCode`
## TC-02 只传 whs_id 查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP"
}'
```
实测结果:
```json
{
"retcode": 0,
"message": "success",
"data": {
"whs_id": "PHIXP",
"rt_order_info_list": [
{
"source_id": "RTSGL00020250102002",
"is_complete": 0,
"device_list": []
},
{
"source_id": "RTSGL00020250102001",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "sku1:null:",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
},
{
"device_id": "B10922",
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku1:null:B10922",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:B10922",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
},
{
"source_id": "对应Geek+的唯一单号",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
}
]
}
}
```
分析:当前实现允许只传 `whs_id`,会按任务创建时间倒序返回最多 200 条。接口文档描述 `source_id_list``rt_order_id_list` 必传一个,与当前实现存在差异。
## TC-03 不存在 source_id 查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"source_id_list": [
"NOT_EXIST_SOURCE_ID"
]
}'
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"whs_id":"PHIXP","rt_order_info_list":[]}}
```
分析:报文合法但无匹配数据,按成功空列表返回。
## TC-04 exclude_source_id_list 排除查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"exclude_source_id_list": [
"RTSGL00020250102001"
]
}'
```
实测结果:
```json
{
"retcode": 0,
"message": "success",
"data": {
"whs_id": "PHIXP",
"rt_order_info_list": [
{
"source_id": "RTSGL00020250102002",
"is_complete": 0,
"device_list": []
},
{
"source_id": "对应Geek+的唯一单号",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
}
]
}
}
```
分析:`RTSGL00020250102001` 已被排除,扩展过滤条件生效。
## TC-05 按时间范围查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"start_time": 1780790400,
"end_time": 1780876799
}'
```
实测结果:
```json
{
"retcode": 0,
"message": "success",
"data": {
"whs_id": "PHIXP",
"rt_order_info_list": [
{
"source_id": "RTSGL00020250102002",
"is_complete": 0,
"device_list": []
},
{
"source_id": "RTSGL00020250102001",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "sku1:null:",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
},
{
"device_id": "B10922",
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku1:null:B10922",
"sku_id": "sku1",
"qty": 1.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
},
{
"id": "sku2:null:B10922",
"sku_id": "sku2",
"qty": 10.0,
"unit_list": [],
"picking_time": 0,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
},
{
"source_id": "对应Geek+的唯一单号",
"is_complete": 0,
"device_list": [
{
"is_close": 0,
"sku_info_list": [
{
"id": "geek+侧拣货明细的唯一id",
"sku_id": "sku1",
"qty": 1.0,
"batch_no": "20250100010010101",
"unit_list": [],
"picking_time": 1708388992833,
"operator": "yijia.yang@shopee.com",
"block_type": 0
}
]
}
]
}
]
}
}
```
分析:时间范围过滤生效,当前范围内返回 3 条测试数据。
## TC-06 按 rt_order_id_list 查询
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_id_list": [
"SH260709005004"
]
}'
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"whs_id":"PHIXP","rt_order_info_list":[]}}
```
分析:当前测试数据没有可通过 `wave.shopeeWaveCode` 命中的 RT 单号绑定,因此接口成功但返回空列表。
## TC-07 缺少 whs_id
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{}'
```
实测结果:
```json
{"retcode":-10010002,"message":"无效的消息体","data":{}}
```
分析:`whs_id` 必填校验生效。
## TC-08 文档示例仓库 SGL
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/query_picking_list' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "SGL",
"source_id_list": [
"RTSGL00020250102001"
],
"rt_order_id_list": []
}'
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"whs_id":"SGL","rt_order_info_list":[]}}
```
分析:报文格式正确,当前测试库 `SGL` 无匹配 RT 任务数据,所以返回空列表。使用当前测试数据仓库 `PHIXP` 可命中。
## 问题记录
1. 文档要求 `source_id_list``rt_order_id_list` 必传一个,但当前实现允许只传 `whs_id` 并返回最近 200 条 RT 任务。
2. 当前测试数据部分明细缺少 `device_id``batch_no`、UID,接口会按现有 task_detail 数据原样返回空字段或空列表。
3. 当前测试数据没有可通过 `rt_order_id_list` 命中的 `wave.shopeeWaveCode`,所以该场景只能验证成功空列表,不能验证命中明细。
@@ -0,0 +1,338 @@
# Shopee 4.7 更新移库单接口测试用例
## 接口信息
- 接口:4.7 更新移库单
- URL`POST http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order`
- Content-Type`application/json`
- EDI 配置 key`update_rt_order`
- WMS API`shopee.inventory.racktransfer.updateRtOrder`
- XSLT`edi-shopee/src/main/resources/xslt/out/4_7_update_rt_order.xslt`
## 前置条件
1. 本地已启动 EDI `9002` 和 WES `9001`
2. 测试库 `shipment_header_ext1` 已包含 4.7 更新字段:
- `urgentFlag`
- `futureOrderQty`
- `futureSkuQty`
- `oosOrderQty`
3. 测试库存在 RT 单:
- `whs_id = PHIXP`
- `rt_order_id = SH260709005004`
4. `SGL / RTSGL00020250102001` 当前用于验证单据不存在场景。
## 字段转换说明
请求报文使用 Shopee 原始字段,XSLT 负责转换到 WMS 内部字段:
| Shopee 字段 | WMS 字段 |
| --- | --- |
| `whs_id` | `warehouseCode` |
| `rt_order_list` | `rtOrderList` |
| `rt_order_id` | `rtOrderId` |
| `attr_list` | `attrList` |
| `urgent_flag` | `shipment_header_ext1.urgentFlag`,并同步 `shipment_header.priority` |
| `future_order_qty` | `shipment_header_ext1.futureOrderQty` |
| `future_sku_qty` | `shipment_header_ext1.futureSkuQty` |
| `oos_order_qty` | `shipment_header_ext1.oosOrderQty` |
## 测试结果汇总
| 用例 | 场景 | 预期结果 | 实测结果 |
| --- | --- | --- | --- |
| TC-01 | 真实 RT 单更新 `future_order_qty` | 成功,`fail_order_id_list=[]` | 通过 |
| TC-02 | 真实 RT 单更新 `future_sku_qty` | 成功,`fail_order_id_list=[]` | 通过 |
| TC-03 | 真实 RT 单更新 `oos_order_qty` | 成功,`fail_order_id_list=[]` | 通过 |
| TC-04 | 真实 RT 单全字段更新 | 成功,`fail_order_id_list=[]` | 通过 |
| TC-05 | 不存在 RT 单 | 接口成功,单号进入 `fail_order_id_list` | 通过 |
| TC-06 | 重复 `attr_key` | 返回具体无效报文错误 | 通过 |
| TC-07 | 不支持 `attr_key` | 返回具体无效报文错误 | 通过 |
## TC-01 更新 future_order_qty
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "future_order_qty",
"attr_value_id": "21",
"attr_value_name": "21"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
## TC-02 更新 future_sku_qty
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "future_sku_qty",
"attr_value_id": "22",
"attr_value_name": "22"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
## TC-03 更新 oos_order_qty
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "oos_order_qty",
"attr_value_id": "23",
"attr_value_name": "23"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
## TC-04 全字段更新
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "urgent_flag",
"attr_value_id": "5",
"attr_value_name": "5"
},
{
"attr_key": "future_order_qty",
"attr_value_id": "31",
"attr_value_name": "31"
},
{
"attr_key": "future_sku_qty",
"attr_value_id": "32",
"attr_value_name": "32"
},
{
"attr_key": "oos_order_qty",
"attr_value_id": "33",
"attr_value_name": "33"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":[]}}
```
## TC-05 不存在 RT 单
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "SGL",
"rt_order_list": [
{
"rt_order_id": "RTSGL00020250102001",
"attr_list": [
{
"attr_key": "future_order_qty",
"attr_value_id": "1",
"attr_value_name": "1"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":["RTSGL00020250102001"]}}
```
实测结果:
```json
{"retcode":0,"message":"success","data":{"fail_order_id_list":["RTSGL00020250102001"]}}
```
分析:报文和字段转换成功,WES 未查到该 RT 单,按协议放入 `fail_order_id_list`
## TC-06 重复 attr_key
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "urgent_flag",
"attr_value_id": "1",
"attr_value_name": "1"
},
{
"attr_key": "urgent_flag",
"attr_value_id": "2",
"attr_value_name": "2"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":-10010002,"message":"无效的消息体: rtOrderList[0].attrList[1].attrKey is duplicated: urgent_flag","data":{}}
```
实测结果:
```json
{"retcode":-10010002,"message":"无效的消息体: rtOrderList[0].attrList[1].attrKey is duplicated: urgent_flag","data":{}}
```
## TC-07 不支持 attr_key
```bash
curl --location --request POST 'http://localhost:9002/api/v2/automation/tovendor/inventory/racktransfer/update_rt_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"whs_id": "PHIXP",
"rt_order_list": [
{
"rt_order_id": "SH260709005004",
"attr_list": [
{
"attr_key": "unknown_flag",
"attr_value_id": "1",
"attr_value_name": "1"
}
]
}
],
"update_event": 2
}'
```
预期结果:
```json
{"retcode":-10010002,"message":"无效的消息体: rtOrderList[0].attrList[0].attrKey is not supported: unknown_flag","data":{}}
```
实测结果:
```json
{"retcode":-10010002,"message":"无效的消息体: rtOrderList[0].attrList[0].attrKey is not supported: unknown_flag","data":{}}
```
## 历史问题记录
字段添加前,真实 RT 单更新 `future_order_qty` 会返回系统异常,WES 日志包含:
```text
Unknown column 'futureOrderQty' in 'field list'
```
原因:测试库 `shipment_header_ext1` 缺少 4.7 新增字段。
处理:执行仓库已有 migration:
```sql
ALTER TABLE `shipment_header_ext1`
ADD COLUMN `futureOrderQty` int NOT NULL DEFAULT 0 COMMENT 'Shopee预计订单数量' AFTER `urgentFlag`,
ADD COLUMN `futureSkuQty` int NOT NULL DEFAULT 0 COMMENT 'Shopee预计SKU数量' AFTER `futureOrderQty`,
ADD COLUMN `oosOrderQty` int NOT NULL DEFAULT 0 COMMENT 'Shopee缺货订单数量' AFTER `futureSkuQty`;
```
字段添加后,`future_order_qty``future_sku_qty``oos_order_qty` 和全字段组合均已 curl 验证成功。