Qeasy Cloud
Get Started

Authoritative Tutorial on the Jushuitan Allocate Order Query API Field Handbook: From Multi-Scenario Practice to Qeasy Cloud Configuration

· 高金凤· Engineering Best Practices· 8 views· 4 min read
MySQLJushuitan调拨单轻易云供应链集成接口字段手册

What Problem This API Solves

The Jushuitan Allocate Order Query API (/open/allocate/query) is used to pull cross-warehouse transfer data (transfer-out and transfer-in) from the Jushuitan system by time window or document number, and write it into local data sources such as MySQL. Typical scenarios include cross-warehouse inventory transfer tracking, transfer-out/in reconciliation, FBA restock synchronization, financial cost accounting, and data integration with ERP/WMS. In the multiple customer projects we have worked on, this is the foundational data API for warehouse balancing and inventory visibility.

API Capability Overview

  • Authentication: Standard signature authentication for the Jushuitan Open Platform (appkey + token + sign), typically encapsulated by the Qeasy Cloud adapter.
  • Request structure: POST JSON body containing pagination parameters page_index / page_size (max 50), time window modified_begin / modified_end, date_type (0 = modification time, 2 = inbound/outbound time), type (transfer-out/transfer-in), io_ids or so_ids (cannot be empty at the same time as the time range).
  • Response structure: The top-level data.datas is an array of documents; each document contains main table fields, an items detail array, and nested labels / sns objects.
  • Pagination/Incremental: Standard cursor pagination, incremental by modification time or inbound/outbound time; typical schedule is 10 */2 * * *, rolling pull every 2 hours.

Typical Field Mapping

Field NameTypeMeaningPractical Notes
io_idstringAllocate order number (primary key)Both number and id in metadata point to this field; recommended as MySQL primary key.
typestringTransfer type (transfer-out/transfer-in)The same API can query both transfer-out and transfer-in; default is "transfer-out".
status / f_statusstringDocument status / financial statusTransfer-out "Confirmed" + transfer-in "Confirmed" is considered completed.
io_date / modifiedstringInbound/outbound date / modification timeThe incremental window is based on this field; combine with date_type to differentiate.
wh_id / link_wh_idstringOutbound warehouse / target warehouseIn transfer-out scenario wh_id→link_wh_id; reversed in transfer-in.
co_id / wms_co_idstringCompany / sub-warehouse codeMust be differentiated in multi-owner scenarios, otherwise warehouses will be confused.
link_io_idstringRelated allocate order numberThe association key between paired transfer-out and transfer-in documents.
out_io_idstringOutbound order numberThe actual outbound document number in the transfer-out scenario.
so_idstringOnline order numberBound to sales orders in scenarios such as FBA restocking.
receiver_*stringReceiver state/city/district/addressIn transfer scenarios, it refers to the target warehouse or receiver, different from sales outbound.
items_sku_id / items_qty / items_cost_pricestringDetail SKU / quantity / cost priceThe items array needs to be flattened into items_* fields for the target table.
bfn_id / bfn_num / bfn_linestringBatch ID / batch number / batch line numberRequired for batch management scenarios, affects subsequent cost accounting.

How to Configure on Qeasy Cloud

In the Qeasy Cloud Data Integration Platform, the call to this API typically uses the "Jushuitan Open Platform Adapter" to uniformly encapsulate authentication and signing. Developers only need to select /open/allocate/query on the data source configuration page and fill in AppKey/Secret. The incremental window is automatically bound through variable placeholders {{LAST_SYNC_TIME}} and {{CURRENT_TIME}}, eliminating the need to manually write cron expressions.

For field mapping, the Qeasy Cloud field mapper automatically expands the items array into flat items_* fields and supports the "REPLACE INTO" batch write mode. The write strategy for the target table jst_allocate_query can be configured with an AfterTargetGenerate hook script that unifies empty strings into null and filters emoji and four-byte characters, avoiding MySQL errors caused by character set issues.

Cross-Scenario Practical Points

  1. Incremental field must be one or the other: date_type=0 uses modified, date_type=2 uses io_date; mixing them will cause documents in the same window to be missed or duplicated.
  2. Transfer-out/in written as a pair: Transfer-out and transfer-in are two independent documents, linked through link_io_id; it is recommended to build an index in the target table for easier reconciliation.
  3. Multi-owner must carry co_id: We have seen cases in customer projects where omitting the owner code caused cross-warehouse data to mix together; the safe practice is to always pass it through.
  4. When to flatten items: Flattening at the Source end makes the configuration cleaner, but loses the original array structure; it is recommended to flatten before writing to Target, making it easier for subsequent SKU-dimensional analysis.
  5. Time window and specified document number are mutually exclusive: io_ids / so_ids and modified_begin/end cannot be empty at the same time, but you cannot pass specified document numbers and a time range together; the platform parameter validation has covered this.
  6. Pagination cap of 50: The default page_size is 30; in actual scenarios it is recommended to explicitly set it to 50 to reduce the number of requests.

Troubleshooting Replay

  • Empty string write to MySQL fails: Fields returned by Jushuitan often appear as "", and writing directly to MySQL in strict mode will fail. This is a common pitfall; the safe practice is to use COALESCE or platform hooks to convert empty strings to null before writing.
  • Four-byte character truncation: If the receiver's name contains emoji or rare characters, the target table utf8 (not utf8mb4) will lose data. Be sure to filter before writing, or upgrade the target table character set.
  • Status field semantic confusion: Transfer-out "in transfer" corresponds to transfer-in "pending receipt"; making downstream business judgments based on a single status field will lead to misjudgment, and combined queries are needed to identify "completed".
  • Incremental missed documents: In customer projects we have encountered cases where an allocate order is modified at a boundary time point, causing a "missed document" that is neither pulled in the previous window nor in the next window. It is recommended to add a 1–2 minute buffer at both ends of the window.
  • Multi-warehouse code conflict: The semantics of wh_id and link_wh_id are reversed in transfer-out and transfer-in scenarios. If the in/out marker is not recorded when the document is written, subsequent warehouse balance reports will calculate the direction incorrectly.

When to Choose This

This API is suitable for scenarios that require cross-warehouse transfer visualization, transfer-out/in reconciliation, FBA restock synchronization, and batch-level cost accounting; if you only need single-warehouse inventory query or sales outbound synchronization, you should use the Jushuitan inventory query API or sales outbound order API instead, to avoid introducing an unnecessary complex state machine.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/engineering/hb-p2-011-mysql-ok-301a

Comments