Qeasy Cloud
Get Started

WDT Sales Order Line Detail Interface Field Handbook: Authoritative Tutorial from API to MySQL Table

· 何海波· Engineering Best Practices· 28 views· 4 min read
MySQLWDT销售订单Field MappingMySQL轻易云Incremental Sync

What Problem Does This Interface Solve

In supply chain integration from WDT to MySQL, the line items of "completed" sales orders are the most critical downstream analytics data. The header tells you "which order," while each line in detail_list represents the actual SKU-level detail — SKU, specification, quantity, unit price, allocated shipping, line-level discount, payment and delivery status, and so on. This interface incrementally syncs the line items of status=2 sales orders into a MySQL table body, supporting localized reporting, profit accounting, inventory occupancy tracking, and platform reconciliation.

Interface Capability Overview

  • Authentication: Invoked through the QueryStrategyData adapter encapsulated by the Qeasy Cloud Data Integration platform. Internal signing and session management are handled by the platform — no need to worry about tokens or signatures.
  • Request Structure: Core parameters include status=2 (completed), response_at_begin / response_at_end (10-digit Unix timestamp window), and page_no / page_size (pagination parameters).
  • Response Structure: Returns an array of order header objects, each containing an embedded detail_list array. The actual data to land in the database is each line within detail_list; header fields serve as context.
  • Pagination & Incremental Mode: Time-windowed incremental based on response_at, typically a 15-minute cycle. Across cycles, the F_response_at timestamp is used as the watermark for miss/duplicate prevention.

Typical Field Mapping

Header Key Fields

Field NameTypeMeaningPractical Notes
trade_idstringWDT order unique identifierUsed by line items to join the header — preserve as-is
trade_nostringBusiness order numberReconciliation primary key — do not mix with trade_id
shop_nostringShop codeRequired in multi-shop scenarios; affects warehouse and inventory ownership
warehouse_nostringWarehouse codeDetermines the shipping warehouse for line items
pay_time / trade_timestringPayment and order placement timeReference for incremental window boundaries
detail_listarrayLine items arrayActual sync target; header only provides context

Platform Extension Fields (F_ prefix)

Field NameTypeMeaningPractical Notes
F_statusstringPlatform processing statusNot used in business mapping; for platform scheduling only
F_response_atstringData response timestampKey field for incremental watermark — must persist
F_created_atstringRecord creation timeUsed to investigate duplicates and delays
F_resultstringProcessing resultEntry point for failure diagnosis
F_responeobjectRaw response bodyUsed to recheck during exception post-mortem

Line Item (detail_list) Key Fields

Field NameTypeMeaningPractical Notes
rec_idstringLine item unique identifierTarget table primary key, overwrite on conflict — preserve as-is
trade_idstringAssociated header order IDJoin key between table body and header
src_oid / src_tidstringPlatform-side sub-order/transaction IDUsed for refund reconciliation and platform callbacks
goods_no / spec_nostringGoods/specification business codeCore key for master data mapping
api_goods_id / api_spec_idstringPlatform-side goods/specification IDEssential for cross-platform product matching
num / price / order_pricestringQuantity, unit price, line amountAll strings — cast to decimal before persistence
share_price / share_amountstringAllocated unit price and amountResult of order-level discount allocation — use for profit accounting
adjust / discountstringLine-level adjustment and discountAffects final receivable
refund_num / paidstringRefund quantity, paid amountRefund tracking
pay_status / refund_statusstringLine-level payment/refund statusKey for platform reconciliation
is_consigned / is_receivedstringWhether shipped / receivedProcess node monitoring
stock_statestringInventory occupancy statusBasis for integration with inventory module
pay_time / modified_datestring/datetimePayment time, modification dateReference for incremental and reconciliation

How to Configure on Qeasy Cloud

On the Qeasy Cloud Data Integration platform, this interface is typically configured using a two-stage approach: strategy adapter + field mapper.

  1. Source Adapter: Choose "WDT · Flagship Qimen" as the source, enable the QueryStrategyData strategy query, and set status=2 along with the time window parameters. The platform automatically handles signing, rate limiting, and pagination.
  2. Field Mapper: For line items, flatten detail_list[*] into a flat structure and map each field to the MySQL table wdt_sales_trade_order_detail. Set rec_id as the upsert primary key; retain trade_id for header join. It is recommended to persist F_ prefix fields to dedicated columns for easier troubleshooting.
  3. Scheduling Strategy: Configure a 15-minute cron cycle, persist F_response_at as the watermark, and let it automatically chain across cycles.

Cross-Scenario Practical Essentials

  1. Line items are the real sync target: The header only provides context; the real data volume lives in detail_list. Always flatten the array during configuration, or the table body will be empty.
  2. rec_id must be persisted as-is: It is the unique primary key of the table body. The Qeasy Cloud field mapper outputs it as-is by default — do not apply secondary cleansing.
  3. Time window boundaries must align: response_at_begin and response_at_end should fall on pay_time or modified of completed orders to avoid missing data.
  4. All amount fields are strings: num / price / order_price / share_amount etc. are all strings — cast to decimal before persisting to MySQL, otherwise aggregations will fail.
  5. Prefer allocated fields over original price: For profit accounting, use share_price / share_amount rather than price / order_price, otherwise order-level discounts will be "missed."
  6. Store F_ fields separately: Do not mix them into the business field table; use a sidecar table or dedicated columns for fast backtracking during incidents.

Pitfall Post-Mortem

  • Pitfall 1: Treating detail_list as an ordinary field. Insufficient flattening causes the table body to contain only a header record while losing all line items. The safe approach is to explicitly flatten the array in the field mapper.
  • Pitfall 2: Using price for profit-accounting unit price. After order-level discount allocation, the actual unit price is share_price; using price directly inflates profit margins.
  • Pitfall 3: Wrong field used for the time window. Using trade_time as the incremental boundary also pulls in unpaid orders, causing line items and headers to have inconsistent statuses. Use pay_time or modified instead.
  • Pitfall 4: Ignoring stock_state. It directly reflects inventory occupancy/release; omitting it from downstream available-inventory calculations triggers oversell alerts.
  • Pitfall 5: F_ fields accidentally used in business logic. F_status and F_result are internal platform statuses; using them as business status filters produces a "all empty" phantom result.

When to Use This Interface

Suitable for local storage of completed sales order line items, profit analysis, inventory occupancy tracking, and e-commerce platform reconciliation. If you only need order headers or real-time orders, use the header strategy or a status≠2 query strategy. For refund line items, use the dedicated return-inbound linkage.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/engineering/hb-p2-007-mysql-5efa

Comments