Files
ircloud-assistant/skills/irun-yidianhuo/inventory.md

67 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 库存查询接口
## 库存列表(按 SKU 查)
```
POST https://openapi.77ircloud.com/invoicing-aggregation/inventories-sku/search
```
**Header:** `access_token: {token}` + `Content-Type: application/json`
**Body 参数:**
```json
{
"currentPage": 1,
"pageSize": 10,
"warehouseId": 2116753909958624,
"skuIds": [2116792188293408, 2287816343303072]
}
```
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `warehouseId` | int | **必填** | 仓库ID从仓库列表接口获取 |
| `skuIds` | array | 可选 | 商品SKU ID数组不传则返回该仓库全部库存 |
| `currentPage` | int | 可选 | 页码默认1 |
| `pageSize` | int | 可选 | 每页数量默认10 |
**返回:**
```json
{
"code": 200,
"data": {
"totalCount": 80,
"currentPage": 1,
"pageSize": 10,
"items": [
{
"skuId": 2116792188293408,
"spuId": 2116792188162336,
"name": "霜火菓子(柿子+花生)",
"code": "101-030-0008",
"amount": 3,
"availableAmount": 7,
"preOrderCount": 83,
"unitName": "件",
"unitId": 2116753910024416,
"status": 23
}
]
}
}
```
**关键字段说明:**
| 字段 | 类型 | 说明 |
|------|------|------|
| `availableAmount` | number | **可用库存**(扣减预占后的真实可用),用于判断是否充足 |
| `amount` | number | 总库存(含预占) |
| `preOrderCount` | number | 预占数量(被其他订单占用) |
| `skuId` | number | 商品SKU ID与订单中商品对应 |
**注意:**
- ⚠️ **只有产生过出入库数据的商品才会出现在结果中**无业务数据的SKU不返回
- `warehouseId` 必填,必须先从仓库列表获取
- 库存判断用 `availableAmount > 3` 作为是否充足的条件