Qeasy Cloud
Get Started

Querying Purchase Return Orders from WMS: An Incremental Pull Strategy on Qeasy

· 吕修远· Integration Solutions· 22 views· 4 min read
WDTKingdee Cloud轻易云采购退料单Incremental Sync供应链集成

What This Strategy Solves

In supply chain integration projects for retail and manufacturing companies, the "purchase return order" is an easily overlooked yet financially critical document. It is typically initiated by a store or workshop to return defective materials upstream. WMS serves as the front-end receiving system and generates the return document first; the downstream ERP needs this data for accounts payable and cost accounting.

In one real project, we discovered that if only purchase orders and goods-received notes are synchronized while the "return" branch is missed, month-end reconciliation between the two systems fails and finance has to make manual adjustments. This is exactly why the "Query Purchase Return Orders from WMS" strategy exists—it reliably and traceably moves return-side data into an intermediate layer for downstream ERP strategies to consume.

Data Flow and Field Mapping

The flow direction is A → intermediate layer: the source is the WMS Open Platform, and the target is the Qeasy DataHub. The strategy itself is a starting point of "data movement" whose output is an intermediate table, later read by ERP-side strategies.

Key field mapping (source API: wdt.purchase.return.query, POST, QUERY semantics):

DimensionSource Field (WMS)Intermediate Layer Handling
Document No.return_noWritten as the unique business number in number
Primary Keyreturn_ididCheck=true, used for idempotency
Incremental Startstart_timeSet to "yesterday 00:00" to avoid missing records
Incremental Endend_timeSet to "current time"
Status FilterstatusOptional, filter audited and later statuses as needed
Paginationpage_no / page_sizeDefault 40 per page, loop until empty

The reason for landing return orders in an intermediate layer instead of pushing directly to the ERP is that the ERP-side write strategy still needs to validate and transform organization, vendor, and inventory dimensions. Centralized mapping and unified scheduling is a common pattern for supply chain integration on Qeasy.

How to Configure on Qeasy

In the Qeasy integration platform, this strategy falls into the "source system → intermediate layer" category. The typical configuration points are:

  1. Register the data source: select platform code WangdianQM, use the wdt.purchase.return.query interface, POST method, and enable autoFillResponse so the platform auto-parses the response structure.
  2. Configure the write target: register platform datahub, choose RESTful API type, effect=EXECUTE, map number to return_no, map id to return_id, and enable idCheck for idempotency.
  3. Variables and functions: use built-in time variables DAYS_AGO_1 and CURRENT_TIME to compose the incremental window; use PAGINATION_PAGE_SIZE and PAGINATION_START_PAGE for unified pagination reuse across strategies.
  4. No-op placeholder: both target request and response are empty—this is just a "landing" action into the intermediate table, no additional API call needed.

It is worth noting that one common Qeasy customer pattern is "centralized encoding mapping management": vendor codes, warehouse codes, and product codes from the WMS are cleaned at the very first entry into the intermediate layer, and subsequent strategies consume the cleaned result directly, avoiding repeated conversion logic in every strategy.

Implementation Steps

We recommend a three-phase rollout:

Phase 1: Align the incremental starting point. At first go-live, use a "full + incremental" dual-track approach: manually trigger one full backfill (e.g., the past 90 days), confirm the intermediate layer can receive everything completely, then switch to a 2-minute incremental schedule (*/2 * * * *). The incremental window uses "yesterday 00:00 → current time" because WMS return orders can be back-dated, and cross-day reruns can catch missed records.

Phase 2: Status filter convergence. In the initial stage, do not filter status—receive everything and tag it in the intermediate layer; once stable, switch to only 40 (audited) and later statuses to reduce the impact of invalid data on downstream ERP strategies.

Phase 3: Tune the scheduling frequency. Return order volume is typically far smaller than goods-received notes, so it does not need to run every minute. In production, a cron of */5 * * * * is generally appropriate, balancing latency and API pressure. The crontab field on Qeasy can be adjusted online without modifying scripts.

Pitfall Review

Pitfall 1: Incremental start misalignment causing missing records. Setting start_time to the last execution's end time seems convenient, but server clock drift or scheduling delay can cause overlapping or missing windows. The safe approach is to fix it at "yesterday 00:00" and rely on return_id idempotency in the intermediate layer for deduplication.

Pitfall 2: Misinterpreting the status field. The WMS documentation describes status as an enumeration string like "10,cancelled,20,editing…". Beginners often pass the string "40" to a numeric field. Always confirm the field type during configuration and validate with sample logs.

Pitfall 3: Submitting before pagination finishes. page_no starts from 0 by default, with a max of 100 per page. If the code forgets to break on an empty response, it will treat "only one page fetched" as "all fetched"—a classic mistake. Qeasy's built-in pagination variables auto-loop until the response is empty, but explicit checks in the script are still recommended.

Pitfall 4: Ignoring the back-dating scenario. Return orders are often "drafted first, then audited, then modified", and the WMS sorts by the final modification time. The incremental field must be confirmed to be "modification time" rather than "creation time", otherwise back-dated orders will never be fetched.

Pitfall 5: No cleanup strategy for the intermediate layer. Long-term accumulation in the intermediate table slows down downstream strategies. It is recommended to add an independent archiving strategy in Qeasy to migrate data older than N months out of the hot table, preserving traceability without occupying hot storage.

Applicable and Non-applicable Scenarios

Applicable: retail/manufacturing enterprises using WMS as the business front-end and ERP as the back-end; scenarios with high return order volume requiring real-time financial accounting; and teams that prefer a "centralized intermediate-layer cleaning" pattern for managing multi-source heterogeneous systems.

Non-applicable: single-system setups using only WMS with extremely low return volume (single digits per month) where automation is unnecessary; or scenarios requiring bypass of the intermediate layer with direct WMS-to-ERP push for ultra-low latency—in such cases, the value of the intermediate layer is weakened and the strategy must be redesigned.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-wdt-kingdee-cloud-0874-ne2745480-2072ab83

Comments