FBA Shipment Cost Stream to Kingdee Transfer-In Order: A Single-Strategy Sync Tutorial
What This Strategy Solves
Cross-border e-commerce teams almost always hit the same pain point: FBA shipments, replenishments, in-transit losses, and returns all generate cost streams in LingXing ERP, but the finance-side inventory ledger lives in Kingdee Cloud Xincheng. Once the two diverge, month-end closing becomes rework. This tutorial zooms in on one specific strategy — pulling FBA shipment-related cost streams from LingXing monthly and writing them as transfer-in orders into Kingdee, so that FBA replenishment and in-transit loss recovery hit the Kingdee ledger on time, with quantity and cost kept in sync.
Data Flow and Field Mapping
The flow is LingXing ERP (cost stream) → Qeasy Data Integration Platform (middleware) → Kingdee Cloud Xincheng V2 (transfer-in order). The source endpoint is POST /cost/center/api/cost/stream, filtered by business types (10 Transfer-In-FBA Replenishment, 11 Transfer-In-FBA In-Transit Loss Recovery), queried by inventory action date across a single month, and paginated. The target endpoint is POST /jdy/v2/scm/inv_tfin, which writes and auto-audits the transfer-in order.
Key field mapping (source → middleware → target):
| Business meaning | LingXing field | Middleware variable | Kingdee field | Notes |
|---|---|---|---|---|
| Bill date | stream_date | {{stream_date}} | bill_date | Inventory action date |
| Bill number | origin_account | {{origin_account}} | bill_no | Used for idempotency |
| Operation type | — | Fixed value | operation_key | Set to audit directly |
| Remark | — | Fixed value | remark | "LingXing-FBA Shipment" for traceability |
| Allocation rule | — | Fixed value | allocate_rule | 1 = allocate by price-tax total |
| Transfer status | — | Fixed value | trans_fer_status | Usually draft or audited |
| Business type filter | business_types | — | — | Only 10,11 |
| Date type | query_type=01 | — | — | By inventory action date |
How to Configure in Qeasy
We use the Qeasy Data Integration Platform (轻易云数据集成平台) to host this strategy. Configuration has three blocks.
Source collection: On the "Source System - LingXing ERP" node, choose API /cost/center/api/cost/stream, method POST. Hard-code business_types to 10,11 and query_type to 01. For start_date and end_date, use _function expressions to dynamically compute the first and last day of the previous month — cross-month queries are forbidden by the source API. Pagination uses offset and length; default offset=1, loop based on total in the response.
Middleware processing: This step transforms LingXing field names into variables Kingdee can recognize. The safe practice is to centralize all code mappings (warehouse, SKU, unit) in Qeasy's "Code Table Management" instead of hard-coding them in scripts. One of our customers maintains a single code table mapping every FBA warehouse to its Kingdee counterpart — switching warehouses later means editing one row.
Target writing: On the "Target System - Kingdee Cloud Xincheng V2" node, choose API /jdy/v2/scm/inv_tfin, method POST. Fix operation_key to audit (using submit leaves a pile of pending documents that someone has to review manually — a classic mistake). Keep idCheck enabled so the source unique_key maps 1:1 to the target id, preventing duplicate postings.
Implementation Steps
We roll this out in three phases, centered on "incremental start point + full-volume trigger + schedule frequency".
Phase 1: Full-volume trigger (initialization). Before the first go-live, manually run a full-volume job for the previous month to confirm both sides agree. Set start_date to the first day and end_date to the last day of the previous month, then immediately switch to incremental mode.
Phase 2: Incremental start point. In daily scheduling, the start date becomes "last successful run's end date + 1", and the end date is the last day of the month preceding the current run date. Note: cross-month pulls are not allowed — this is a hard constraint of the source API and will throw an error if violated.
Phase 3: Schedule frequency. Source crontab is 45 20-22 6 * * (pulls previous-month data on the 6th of each month at night); target crontab is 30 22-23 6 * *. Source runs 15 minutes before target, leaving time for middleware assembly. In Qeasy's "Schedule Management", configure 3 retries with a 5-minute interval.
Header and body phased rollout: For transfer-in orders with both header and body, start with a single-line test payload, then expand to multi-line. A common pitfall at customer sites is that an empty body field causes the entire order to fail audit; the safe approach is to add a validation rule in Qeasy's "Data Validation" step: body line count > 0 and key fields non-null, otherwise route to manual handling.
Lessons Learned
Pitfall 1: Cross-month queries fail immediately. The source rejects any cross-month request. Someone once tried to pull three months in one shot to save time — instant error. The safe practice is to slice by month and run each one separately.
Pitfall 2: Poor idempotency keys cause duplicate orders. If bill_no is used as the unique key but the source can produce multiple streams on the same day, Kingdee will reject duplicates incorrectly. The correct approach is 1:1 mapping from source unique_key to target id, with idCheck enabled in Qeasy.
Pitfall 3: Wrong operation_key. Setting it to submit leaves a pile of pending documents in Kingdee, which blows up finance at the start of the month. Set it to audit directly so the document is posted immediately.
Pitfall 4: Code tables scattered across scripts. Warehouse and SKU mappings were originally written into transformation scripts; later, three FBA warehouses changed and it took a week to fix. Centralizing them in Qeasy's Code Table Management reduced future changes to 5 minutes.
Pitfall 5: Empty body rows still get audited. Once the source returned abnormal data with an empty body, Kingdee still created and audited an empty order, inflating the ledger. The fix was to add a "body non-empty" validation in Qeasy.
When to Use and When Not to Use
Use when: A cross-border e-commerce business uses both LingXing ERP and Kingdee Cloud Xincheng and needs to sync FBA replenishment and in-transit loss recovery to the finance ledger monthly; the closing cycle is monthly, and T+6 day latency for previous-month data is acceptable.
Do not use when: Real-time inventory is required (this strategy is T+6 batch); sales outbound or return outbound also need syncing (this strategy covers only business types 10,11); or the source is not LingXing ERP, or the target is not Kingdee Cloud Xincheng.