OPENAPI V3
登录控制台
首次登录赠送 10000 Token,可直接调试接口
接口调试、调用日志和账务查询均在控制台完成

订货单接口文档

订货接口用于查询门店向配货门店发起的订货单。总部账号可查询总部及子门店订货单,子门店账号只查询本门店订货单。

订货单接口

查询订货单

POST
/openapi/v3/product-request/increment-page

按主键游标增量分页查询订货单。接口先分页返回订货主单,再按当前页订货单批量返回商品明细,避免明细关联后导致主单分页错乱。

Token 消耗 基础 800 token/次;needItems=true 时额外 50 token

请求参数

参数 类型 必填 说明
accountstring业务账号。传总部账号时查询总部及子门店订货单;传子门店账号时只查询该子门店订货单。
targetAccountstring配货门店账号。
orderNumberstring订货单号,精确匹配 productrequest.orderNumber,最大 64 位。
statusListarray<int>订货单状态列表。支持 -4,-3,-2,-1,0,1,2,3
createdDatetimeBeginstring创建开始时间,格式 yyyy-MM-dd HH:mm:ss,包含该时间。
createdDatetimeEndstring创建结束时间,格式 yyyy-MM-dd HH:mm:ss,不包含该时间。
lastIdlong分页游标。首次查询传 0 或不传;下一页传上次返回的 nextLastId
orderstring主键排序方向,支持 asc / desc,默认 desc
limitint本次返回最大条数,默认 100,最大 100
needItemsboolean是否返回订货商品明细。默认返回;传 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"
  }
}

主单返回字段

字段 类型 说明
idlong订货单主键 ID。
userIdint订货门店 userId。
accountstring订货门店账号。
uidlong订货单业务 UID。
targetUserIdint配货门店 userId。
targetAccountstring配货门店账号。
remarksstring订货备注。
createdDatetimestring创建时间。
statusint订货单状态。
specifiedDeliveryTimestring期望发货时间。
specifiedArriveTimestring期望到货时间。
alreadyPayAmountdecimal已支付金额。
businessTypeint业务类型。
requestSourceint订货来源。
cashierUidlong操作收银员 UID。
orderNumberstring订货单号。
totalAmountdecimal订货总金额。
shippingFeedecimal运费。
productrequesttemplateIdint订货模板 ID。
productrequesttemplateNamestring订货模板名称。
productRequestItemsarray<object>订货商品明细。传 needItems=false 时不返回。

明细返回字段

字段 类型 说明
idlong订货商品明细主键 ID。
productRequestIdlong所属订货单 ID。
userIdint商品所属门店 userId。
productUidlong商品 UID。
productNamestring商品名称,来自 product.name
productBarcodestring商品条码,来自 product.barcode
supplierUidlong供应商 UID。
quantitydecimal订货数量。
productUnitUidlong订货单位 UID。
productUnitPricedecimal订货单位单价。
totalAmountdecimal明细金额。
quantityAmountdecimal计划单明细源单总数。
originProductUnitPricedecimal原始订货价。
giftUnitQuantitydecimal赠送量。
giftProductUnitUidlong赠送单位 UID。
remarkstring订单单品备注。
buyerInputQuantitydecimal买家输入数量。

业务规则

  • 总部账号查询范围包含总部自己和所有子门店。
  • 子门店账号查询范围只包含该子门店自己的订货单。
  • 时间范围使用左闭右开规则:包含 createdDatetimeBegin,不包含 createdDatetimeEnd
  • 分页按 productrequest.id 游标推进,服务端按 limit + 1 预读判断是否还有下一页。

订货单配货

POST
/openapi/v3/product-request/ration

按订货门店 account 和订货单主键 productRequestId 定位订货单,并使用 targetAccount 指定本次配货门店。订货单状态必须为:配货中。

Token 消耗 500 token/次。

请求参数

参数 类型 必填 说明
accountstring订货门店账号。传总部账号时可定位该连锁下所有订货单;传子门店账号时只定位该子门店订货单。
targetAccountstring配货门店账号。必须在 account 对应连锁可访问范围内。
productRequestIdlong订货单主键 ID,需大于 0
remarksstring配货备注。不传时使用订货单备注。
needCorfirmstring是否需要确认,默认 0。字段名沿用下游接口拼写。
isPartOrderboolean是否部分配货,默认 false
itemsarray<object>配货商品明细。不传或传空时使用订货单商品明细自动组装。

items 参数

参数 类型 必填 说明
barcodestring商品条码。
quantitydecimal配货数量,不能小于 0
buyPricedecimal进货价,不能小于 0
remarkstring单品备注。

常用请求示例

{
  "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 必须与该配货门店一致。