Practical Guide: Syncing Other Stock-Out Orders from Wangdiantong to MySQL
What This Strategy Solves
A retail enterprise uses Wangdiantong for warehouse operations and centralizes stock-out orders in MySQL for finance, operations, and reporting. The challenge is not merely inserting records; it is maintaining continuous incremental collection, filtering by status, preserving every line of a multi-item order, and preventing duplicate writes when an order changes. We use the Qeasy Data Integration Platform for this flow, with Qeasy handling configuration management. Centralized code mapping and a dual-track approach combining incremental and full synchronization balance timeliness with historical backfills.
Data Flow and Field Mapping
The flow is: Wangdiantong other stock-out orders → Qeasy query and transformation layer → MySQL master and detail tables. The source query uses a start time, end time, and the fixed status “110.” The transformation layer standardizes warehouse, product, specification, and logistics codes while checking values, data types, and detail completeness.
| Business meaning | Source field example | Transformation field | Target field |
|---|---|---|---|
| Stock-out order ID | stockout_id | stockout_id | tp_wdt_stockout_order.stockout_id |
| Stock-out order number | order_no | order_no | order_no |
| Source order number | src_order_no | src_order_no | src_order_no |
| Warehouse code | warehouse_no | warehouse_no | warehouse_no |
| Order status | status | status | status |
| Stock-out time | consign_time | consign_time | consign_time |
| Goods quantity | goods_count | goods_count | goods_count |
| Logistics number | logistics_no | logistics_no | logistics_no |
| Detail line ID | rec_id | rec_id | Detail table.rec_id |
| Product code | goods_no | goods_no | goods_no |
| Specification code | spec_no | spec_no | spec_no |
| Batch remark | batch_remark | batch_remark | batch_remark |
The master table uses stockout_id as its idempotency key, while the detail table uses both stockout_id and rec_id. REPLACE INTO can overwrite the master record, but the detail table should enforce uniqueness for the combined key to prevent duplicates. Personally identifiable information, addresses, and telephone fields must be masked according to enterprise rules in the transformation layer.
Configuring the Flow in Qeasy
First, configure the Wangdiantang query connection and the MySQL write connection, and verify public-cloud network access and database permissions. The query action uses a POST request, the stock-out order query method, order_no as the number field, stockout_id as the ID field, duplicate-ID checking disabled, and automatic response filling enabled.
Second, configure the time window, status, and filters. The start time is the last synchronization time and the end time is the current time. The order status is fixed to 110. Optional filters such as warehouse_no and src_order_no remain empty to retain a broader data scope; add them only when the business range is clearly defined.
Third, establish centralized code mapping. Convert warehouse, logistics, product, and specification codes into values recognized by the target system. Configure the main parameters and extended detail parameters, mapping consignee, amount, weight, logistics, and remark fields. Define precision rules for monetary and decimal fields before writing them to SQL.
Fourth, enable execution logs, retry, and alerts. Failed requests can be retried automatically, but terminal failures should be added to an exception list for business review and backfill rather than silently skipped.
Implementation Steps
1. Incremental starting point. Determine a traceable start time and complete mappings for inventory, products, warehouses, and other basic data. An incremental task can run every 11 minutes: the source side uses */11 * * * *, while the target side can use 3-59/11 * * * * to avoid simultaneous contention.
2. Full synchronization trigger. Run a full synchronization before the formal cutover. After it completes, verify order totals, detail-line counts, and key fields. Historical data does not need to run indefinitely in parallel with incremental processing; after the flow is stable and new orders continue to arrive, switch to a dual-track model of incremental plus on-demand full synchronization.
3. Scheduling frequency. Run a fixed time-window increment every cycle, using the last successful time and the current time. If rate limits or database errors occur, reduce the window size and continue by paging through the result set.
4. Acceptance and cutover. Reconcile at three levels: order number, stockout_id, and detail rec_id. Sample-check status, warehouse, and logistics fields. Retain a repeatable backfill mechanism during the cutover period.
Lessons from Production
Time-window boundaries can cause trouble. Overlapping execution windows may retrieve records more than once. The write remains idempotent, but overlapping windows waste logs and resources. A safer approach is to narrow the time window and confirm the actual source response before each run.
Writing only the master table is insufficient. A common mistake is to write the header but omit the body, leaving only the aggregated quantity for a multi-item order. Configure 1:N extension parameters and use stockout_id plus rec_id for detail idempotency.
Field types are not always uniform. Passing amounts, weights, timestamps, and empty strings directly can expose problems only when SQL executes. Standardize types and precision in the transformation layer, and define rules for nulls, time zones, and addresses.
Failure recovery is mandatory. A single retry is not a substitute for backfill. Preserve failed requests, rerun them in smaller time windows, and compare master and detail row counts in the target database.
Mappings should not be scattered. Do not repeat code-conversion logic inside every SQL statement. Qeasy supports centralized mapping management, allowing business and IT teams to maintain one consistent definition and avoid semantic drift.
Suitable and Unsuitable Scenarios
This strategy is suitable when approved other stock-out orders must periodically enter MySQL for querying, reconciliation, or downstream analysis, and the source provides stable identifiers and a clear status definition. It is not suitable as a replacement for real-time inventory, bidirectional financial synchronization, or a complex process involving drafts, cancellations, and reversals. Those cases should use separate real-time inventory and transaction-audit flows; this strategy handles one-way business-document synchronization.