Qeasy Cloud
Get Started

WangdianTQ Purchase Stock-In to Kingdee Cloud: P_Join-Query Strategy Tutorial

· 何海波· Integration Solutions· 4 views· 3 min read
WDTKingdee Cloud采购入库供应链集成轻易云单据同步

What This Strategy Solves

In supply-chain operations for retail or manufacturing companies, the purchasing team performs daily stock-ins in the front-end e-commerce ERP (WangdianTQ), while the finance and general ledger live in Kingdee Cloud. When purchase stock-in documents are not synchronized between the two systems, you end up with "mismatched numbers on both sides, manual reconciliation, and two sets of inventory views." This strategy pulls WangdianTQ purchase stock-in orders by an incremental time window, applies join-query field mapping, and writes them into Kingdee, achieving unified documents on both sides.

Data Flow and Field Mapping

The overall flow is: WangdianTQ (source) → Qeasy middleware → Kingdee Cloud (target). The middleware handles pulling, cleansing, joining, and enrichment.

The source (WangdianTQ) uses the query interface wdt.stockin.order.query.purchase, with start_time / end_time as the incremental window. order_no is the document number and stockin_id is the idempotency key, with idCheck enabled to prevent duplicate pushes.

The target (Kingdee Cloud) invokes the execute interface batchSave to write the purchase stock-in document. Header key fields are backfilled via a join query against the upstream purchase order (matched by outer_no):

  • FBillTypeID / FBusinessType / FStockOrgId / FPurchaseOrgId: looked up via _mongoQuery using FBillNo = {{outer_no}} against the upstream purchase order, avoiding hard-coding on the stock-in document;
  • FBillNo ← {{order_no}}, stock-in date FDate ← {{check_time}};
  • Line-item details (material, quantity, tax-included amount, etc.) are mapped row by row, with SKU/price/quantity aligned one-to-one.

This pattern of "header via join query, body via row mapping" is the most common approach among Qeasy customers, centralizing volatile fields instead of hard-coding them.

How to Configure on Qeasy

On the Qeasy Data Integration Platform, this strategy is a standard SYNC strategy. Key configuration points:

  1. Source platform: select WangdianTQ, choose interface wdt.stockin.order.query.purchase, enable autoFillResponse so the system parses the response structure;
  2. Target platform: select Kingdee Cloud, choose interface batchSave with type EXECUTE, and enable idCheck for idempotency;
  3. Join-query templates: for fields such as FBillTypeID, FBusinessType, FStockOrgId, FPurchaseOrgId, use _mongoQuery expressions with outer_no as the key to look up the upstream document;
  4. Code mapping: materials, suppliers, warehouses, stock locations, and other master data are managed through a centralized code-mapping pattern, sharing the same mapping tables with the master-data sync strategies;
  5. Variables and time window: start_time uses {{LAST_SYNC_TIME|datetime}}, end_time uses {{CURRENT_TIME|datetime}}, ensuring only incremental data is pulled each run;
  6. Idempotency and dedup: idCheck=true, with source primary key stockin_id aligned to target primary key id to avoid duplicate pushes.

Implementation Steps

  1. Incremental starting point: for first-time go-live, set LAST_SYNC_TIME to a historical midnight as the initial value and perform a full backfill first, then reconcile documents and inventory on both sides;
  2. Full trigger: on the cutover day, manually trigger a full run to synchronize all historical documents;
  3. Daily scheduling: set the strategy cron to */21 9-21 * * * (source) and */24 9-21 * * * (target), enabling high-frequency increments during the day while avoiding clashes with business peaks;
  4. Dependency order: this strategy depends on upstream purchase orders being synchronized first, so it is scheduled after the "purchase order sync" strategy;
  5. Monitoring and reconciliation: enable Qeasy's run logs and reconciliation dashboard, watch for two anomaly types — "exists in source but missing in target" and "exists in target but missing in source" — and produce daily reconciliation differences automatically.

Pitfall Recap

  • Wrong join-query key: the where condition inside _mongoQuery must use the upstream purchase order's FBillNo, not the stock-in document's order_no — this is a common pitfall;
  • Incremental window too small: although a 21/24-minute cycle looks dense, if upstream stock-ins concentrate at a specific time, records can be missed; the safer approach is to use overlapping windows (e.g., pull an extra 5 minutes);
  • Header and body pushed in one shot: Kingdee's purchase stock-in document strictly validates header fields (such as organization and business type); it is more stable to "save the header first, then append the body" in two steps;
  • idCheck disabled: when the source primary key has dedup disabled, reprocessing or backfilling can create duplicate documents on the target — a typical mistake;
  • Time zone and date format: both start_time/end_time and Kingdee's FDate must be unified to the same time zone and yyyy-MM-dd HH:mm:ss format, especially important for cross-time-zone enterprises.

Applicable and Non-Applicable Scenarios

Applicable: retail/manufacturing companies using WangdianTQ as the front-end stock-in system and Kingdee as the back-end finance and general ledger; scenarios requiring time-based incremental sync with complete upstream purchase orders as the join-query anchor. Not applicable: stock-ins without an upstream purchase order (such as transfers or miscellaneous stock-ins); scenarios with frequently changing cross-legal-entity or cross-book organizational structures, where join-query keys become invalid.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-wdt-kingdee-cloud-2652-p-a-c2da0d26

Comments