Qeasy Cloud
Get Started

Syncing Inventory Loss Stock-Out from Wangdian to Kingdee Cosmos: A Practical Breakdown of One Strategy

· 王浩宇· Integration Solutions· 14 views· 3 min read
WDTKingdee Cloud供应链集成Inventory Sync盘亏出库轻易云

What This Strategy Solves

In one retail engagement, inventory-loss (盘亏) stock-out orders are generated in Wangdian after store counts, while the financial and inventory ledger lives in Kingdee Cosmos. The two lines drift apart, and monthly reconciliation turns into a small disaster. We use the Qeasy data integration platform to host a single, focused strategy: incrementally pull Wangdian's "other stock-out (盘亏)" orders and land them as Kingdee Cosmos "other stock-out" documents. The book-to-physical variance window shrinks from T+1 to near-real-time.

Data Flow and Field Mapping

The overall flow is "Wangdian → Middle Layer → Kingdee Cosmos". The source side pulls incrementally by last-modified time; the target side writes idempotently by document number. The key field mapping is as follows:

Business MeaningWangdian FieldKingdee Cosmos FieldNotes
Document numberorder_noFBillNoIdempotency key and resume anchor
Document typeorder_type=4FBillTypeID=QTCKD01_SYSFixed value for 盘亏
Warehouse / stock orgwarehouse_noFStockOrgId / FPickOrgIdRequires warehouse code mapping
Stock directionderivedFStockDirect=0Normal out direction
Datesource order timeFDatePosted by business date
Item / quantitygoods detailsFEntityLine items

Master data such as warehouses, SKUs, and departments must be centrally maintained in Qeasy's "Code Mapping", not scattered across strategies — one of the most common patterns among Qeasy customers.

How to Configure in Qeasy

The source strategy (wdt.stockout.order.query, POST, QUERY type) hard-codes order_type=4 (盘亏) and status=110 (completed), so the returned data is already a clean target set. start_time uses {{LAST_SYNC_TIME|datetime}} and end_time uses {{CURRENT_TIME|datetime}}, with the cursor maintained automatically by Qeasy.

The target side uses Kingdee's batchSave API and writes the source order_no directly into FBillNo. Even on duplicate triggers, Kingdee's number check serves as a backstop — this is the idempotency line of defense at the header level. Line items are assembled in Qeasy's "Field Mapping + Script Transform", where SKU translation and auxiliary-unit conversion happen.

The dual-track pattern of full sync + incremental sync is another high-frequency pattern in Qeasy: before the first go-live, run a one-off historical backfill to load legacy 盘亏 orders, then switch to a 5-minute incremental schedule.

Implementation Steps

  1. Pre-work: Finish syncing master data such as items, warehouses, and departments to avoid "Kingdee-unrecognized" keys inside 盘亏 orders.
  2. Incremental Start Point: Rewind start_time to midnight of the cutover day, then run a small 1–2 day window to validate fields.
  3. Full Sync Trigger: Land historical 盘亏 orders via a one-off backfill strategy and confirm totals reconcile with the store report.
  4. Schedule Frequency: Source runs every 5 minutes (*/5 * * * *), target every 10 minutes (*/10 * * * *) — a 2:1 consumption rhythm that gives Kingdee headroom.
  5. Exception Backstop: Failed documents go into Qeasy's retry queue; alerts fire to the enterprise IM when thresholds are exceeded.

Lessons Learned

  1. Missing or wrong order_type: Without it, the result set is empty and 盘亏 orders are never fetched — the most common rookie mistake.
  2. Using warehouse number directly as the org: Kingdee's FStockOrgId is at the organization dimension, not the warehouse dimension; ERP warehouse codes must be mapped to the correct stock organization in code mapping first.
  3. Only querying status=110: 盘亏 orders often sit at "approved but not shipped"; only querying completed will drop data. The safe approach is to pull 95/110 together and branch by status inside Qeasy.
  4. Line items dropped on whole-order retry: On retry, only the header was re-sent and the lines were lost, producing "document without lines". The fix is to push header and lines in separate stages, each with its own cursor.
  5. Timezone and window edges: Boundary documents across days are easy to miss or duplicate; rely on Qeasy's last-modified-time anchor for deduplication.

Applicable and Non-applicable Scenarios

Applicable: Multi-store / multi-warehouse retail where store 盘亏 results need to post into the financial ERP on the same day. Not applicable: scenarios where 盘亏 is fully closed inside the ERP with no need to write back to Wangdian; or special businesses where 盘亏 must follow a transfer flow rather than a direct stock-out.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-wdt-kingdee-cloud-2008-n19ee4351-380ab214

Comments