WangdianTQ Purchase Stock-In to Kingdee Cloud: P_Join-Query Strategy Tutorial
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_mongoQueryusingFBillNo = {{outer_no}}against the upstream purchase order, avoiding hard-coding on the stock-in document;FBillNo←{{order_no}}, stock-in dateFDate←{{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:
- Source platform: select WangdianTQ, choose interface
wdt.stockin.order.query.purchase, enableautoFillResponseso the system parses the response structure; - Target platform: select Kingdee Cloud, choose interface
batchSavewith type EXECUTE, and enableidCheckfor idempotency; - Join-query templates: for fields such as
FBillTypeID,FBusinessType,FStockOrgId,FPurchaseOrgId, use_mongoQueryexpressions withouter_noas the key to look up the upstream document; - 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;
- Variables and time window:
start_timeuses{{LAST_SYNC_TIME|datetime}},end_timeuses{{CURRENT_TIME|datetime}}, ensuring only incremental data is pulled each run; - Idempotency and dedup:
idCheck=true, with source primary keystockin_idaligned to target primary keyidto avoid duplicate pushes.
Implementation Steps
- Incremental starting point: for first-time go-live, set
LAST_SYNC_TIMEto a historical midnight as the initial value and perform a full backfill first, then reconcile documents and inventory on both sides; - Full trigger: on the cutover day, manually trigger a full run to synchronize all historical documents;
- 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; - Dependency order: this strategy depends on upstream purchase orders being synchronized first, so it is scheduled after the "purchase order sync" strategy;
- 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
wherecondition inside_mongoQuerymust use the upstream purchase order'sFBillNo, not the stock-in document'sorder_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_timeand Kingdee'sFDatemust be unified to the same time zone andyyyy-MM-dd HH:mm:ssformat, 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.