查询订货单
POST
/openapi/v3/product-request/increment-page
按主键游标增量分页查询订货单。接口先分页返回订货主单,再按当前页订货单批量返回商品明细,避免明细关联后导致主单分页错乱。
Token 消耗 基础 800 token/次;needItems=true 时额外 50 token。
请求参数
| 参数 |
类型 |
必填 |
说明 |
account | string | 是 | 业务账号。传总部账号时查询总部及子门店订货单;传子门店账号时只查询该子门店订货单。 |
targetAccount | string | 否 | 配货门店账号。 |
orderNumber | string | 否 | 订货单号,精确匹配 productrequest.orderNumber,最大 64 位。 |
statusList | array<int> | 否 | 订货单状态列表。支持 -4,-3,-2,-1,0,1,2,3。 |
createdDatetimeBegin | string | 否 | 创建开始时间,格式 yyyy-MM-dd HH:mm:ss,包含该时间。 |
createdDatetimeEnd | string | 否 | 创建结束时间,格式 yyyy-MM-dd HH:mm:ss,不包含该时间。 |
lastId | long | 否 | 分页游标。首次查询传 0 或不传;下一页传上次返回的 nextLastId。 |
order | string | 否 | 主键排序方向,支持 asc / desc,默认 desc。 |
limit | int | 否 | 本次返回最大条数,默认 100,最大 100。 |
needItems | boolean | 否 | 是否返回订货商品明细。默认返回;传 false 时仅返回主单。 |
状态说明
| status |
说明 |
-4 | 已作废,供应链预订单作废。 |
-3 | 新供应链未付款预订单。 |
-2 | 被合并。 |
-1 | 客户手动拒绝。 |
0 | 待审核。 |
1 | 配货中。 |
2 | 已配货。 |
3 | 作废。 |
请求示例
{
"account": "store001",
"targetAccount": "warehouse001",
"orderNumber": "DH-20260702165645-981",
"statusList": [1],
"createdDatetimeBegin": "2026-07-01 00:00:00",
"createdDatetimeEnd": "2026-07-15 00:00:00",
"lastId": 0,
"order": "desc",
"limit": 100,
"needItems": true
}
返回示例
{
"status": "success",
"errorCode": 0,
"result": {
"list": [
{
"id": "1640816",
"userId": 1001,
"account": "usmilegz",
"targetUserId": 1002,
"targetAccount": "usmile",
"remarks": "测试2",
"createdDatetime": "2026-07-02 16:56:45",
"status": 1,
"specifiedDeliveryTime": "2026-07-03 00:00:00",
"specifiedArriveTime": "2026-07-05 00:00:00",
"orderNumber": "DH-20260702165645-981",
"totalAmount": 0.00,
"alreadyPayAmount": 0.00,
"productrequesttemplateName": "-",
"productRequestItems": [
{
"id": "233568913",
"productRequestId": "1640816",
"userId": 1001,
"productUid": "2002086",
"productName": "抱抱礼盒封套",
"productBarcode": "2002086",
"quantity": 1.000,
"productUnitPrice": 0.00000000,
"totalAmount": 0.00,
"remark": "-"
}
]
}
],
"hasMore": false,
"nextLastId": "1640816"
}
}
主单返回字段
| 字段 |
类型 |
说明 |
id | long | 订货单主键 ID。 |
userId | int | 订货门店 userId。 |
account | string | 订货门店账号。 |
uid | long | 订货单业务 UID。 |
targetUserId | int | 配货门店 userId。 |
targetAccount | string | 配货门店账号。 |
remarks | string | 订货备注。 |
createdDatetime | string | 创建时间。 |
status | int | 订货单状态。 |
specifiedDeliveryTime | string | 期望发货时间。 |
specifiedArriveTime | string | 期望到货时间。 |
alreadyPayAmount | decimal | 已支付金额。 |
businessType | int | 业务类型。 |
requestSource | int | 订货来源。 |
cashierUid | long | 操作收银员 UID。 |
orderNumber | string | 订货单号。 |
totalAmount | decimal | 订货总金额。 |
shippingFee | decimal | 运费。 |
productrequesttemplateId | int | 订货模板 ID。 |
productrequesttemplateName | string | 订货模板名称。 |
productRequestItems | array<object> | 订货商品明细。传 needItems=false 时不返回。 |
明细返回字段
| 字段 |
类型 |
说明 |
id | long | 订货商品明细主键 ID。 |
productRequestId | long | 所属订货单 ID。 |
userId | int | 商品所属门店 userId。 |
productUid | long | 商品 UID。 |
productName | string | 商品名称,来自 product.name。 |
productBarcode | string | 商品条码,来自 product.barcode。 |
supplierUid | long | 供应商 UID。 |
quantity | decimal | 订货数量。 |
productUnitUid | long | 订货单位 UID。 |
productUnitPrice | decimal | 订货单位单价。 |
totalAmount | decimal | 明细金额。 |
quantityAmount | decimal | 计划单明细源单总数。 |
originProductUnitPrice | decimal | 原始订货价。 |
giftUnitQuantity | decimal | 赠送量。 |
giftProductUnitUid | long | 赠送单位 UID。 |
remark | string | 订单单品备注。 |
buyerInputQuantity | decimal | 买家输入数量。 |
业务规则
- 总部账号查询范围包含总部自己和所有子门店。
- 子门店账号查询范围只包含该子门店自己的订货单。
- 时间范围使用左闭右开规则:包含
createdDatetimeBegin,不包含 createdDatetimeEnd。
- 分页按
productrequest.id 游标推进,服务端按 limit + 1 预读判断是否还有下一页。
订货单配货
POST
/openapi/v3/product-request/ration
按订货门店 account 和订货单主键 productRequestId 定位订货单,并使用 targetAccount 指定本次配货门店。订货单状态必须为:配货中。
Token 消耗 500 token/次。
请求参数
| 参数 |
类型 |
必填 |
说明 |
account | string | 是 | 订货门店账号。传总部账号时可定位该连锁下所有订货单;传子门店账号时只定位该子门店订货单。 |
targetAccount | string | 是 | 配货门店账号。必须在 account 对应连锁可访问范围内。 |
productRequestId | long | 是 | 订货单主键 ID,需大于 0。 |
remarks | string | 否 | 配货备注。不传时使用订货单备注。 |
needCorfirm | string | 否 | 是否需要确认,默认 0。字段名沿用下游接口拼写。 |
isPartOrder | boolean | 否 | 是否部分配货,默认 false。 |
items | array<object> | 否 | 配货商品明细。不传或传空时使用订货单商品明细自动组装。 |
items 参数
| 参数 |
类型 |
必填 |
说明 |
barcode | string | 是 | 商品条码。 |
quantity | decimal | 是 | 配货数量,不能小于 0。 |
buyPrice | decimal | 是 | 进货价,不能小于 0。 |
remark | string | 否 | 单品备注。 |
常用请求示例
{
"account": "store001",
"targetAccount": "配货门店账号",
"productRequestId": 1640816,
"remarks": "按订货单配货"
}
完整请求示例
{
"account": "store001",
"targetAccount": "配货门店账号",
"productRequestId": 1640816,
"remarks": "按订货单配货",
"needCorfirm": "0",
"isPartOrder": false,
"items": [
{
"barcode": "6901234567890",
"quantity": 1,
"buyPrice": 2.5,
"remark": ""
}
]
}
返回说明
接口返回下游 ProductRequestRation 的原始 JSON 响应。业务是否成功以响应体中的下游状态字段为准。
业务规则
account 只表示订货门店,不表示配货门店。
- 总部账号可按
productRequestId 定位该连锁下总部及子门店订货单;子门店账号只能定位本门店订货单。
targetAccount 表示配货门店。
- 订货单的配货门店为空时,允许在配货时通过
targetAccount 指定配货门店。
- 订货单的配货门店不为空时,
targetAccount 必须与该配货门店一致。