FBA Cost-Value Stream to Kingdee Cloud Staged Transfer-In: A Single-Strategy Walkthrough
What this strategy solves
In cross-border operations, FBA replenishment inbound is the entry action that pushes head-haul goods into the FBA warehouse. The "cost-value stream" behind it defines inventory value and feeds back into gross margin, reconciliation, and tax reporting. The source lives in one ERP (Lingxing), the accounting view lives in another (Kingdee Cloud), and the two do not share a table. This strategy picks the FBA replenishment inbound business type out of Lingxing's Amazon-action-dated cost stream and lands it as a staged transfer-in document in Kingdee, so finance has a traceable inbound voucher.
Data flow and field mapping
The flow is Lingxing ERP (cost-value stream source) → Qeasy middle layer (encoding / date / bill number conversion) → Kingdee Cloud (staged transfer-in document). The source side queries by month, the target side writes by document, and Qeasy sits in between handling filtering, calculation, and assembly.
| Business meaning | Source (Lingxing) field | Middle-layer handling | Target (Kingdee) field |
|---|---|---|---|
| Business type filter | business_types = 10 (FBA replenishment inbound) | Pass-through, scoped to window | Implicit in document type |
| Query dimension | query_type = 01 (inventory action date) | Fixed value | — |
| Time window | start_date / end_date (no cross-month) | Function: first day of last month ~ last day of last month | FDate |
| Unique identifier | unique_key (origin document number) | Take right 12 chars and concatenate | FBillNo: FBA补货入库- + 12 chars |
| Warehouse / owner | wh_name | _findCollection lookup for org code | FStockOrgID, FOwnerIdHead |
| Document type | — | Business type → document type mapping | FBillTypeID |
| Owner type | — | Fixed | FOwnerTypeIdHead = BD_OwnerOrg |
How to configure it in Qeasy
In the Qeasy Data Integration Platform, this is a standard "source query → target write" pipeline. The configuration effort falls into four places:
- Source data source: pick the Lingxing ERP platform, use the
/cost/center/api/cost/streamAPI with POST. Build the request body per the table above.business_typesis hard-coded to 10,query_typeto 01, and the time window uses_functionexpressions to derive the previous full month. - Target data source: pick the Kingdee Cloud platform, use
batchSavewith POST. The real trick here is not field-by-field mapping but the bill-number generation rule —_function concat('FBA补货入库','-',RIGHT(unique_key,12)). The right-12 of the source unique key keeps uniqueness while preserving traceability. - Middle-layer field mapping: warehouse / owner uses
_findCollectionto look up org code by name. This is a common pattern among Qeasy customers: centralized encoding mapping, avoiding hard-coded wids scattered across fields. - Nulls and exceptions:
origin_accountson the source can be null, but on the Qeasy side you must decide whether to skip the whole batch or handle field-level nulls. The recommendation is a pre-filter that drops rows with empty origin document numbers.
Implementation steps
We rolled this strategy out in three phases:
- Incremental starting point (first run): pull one full batch for the previous full month as the baseline. The source date window uses
_functionexpressions to auto-derive the first and last day of the previous month, bound directly in the Qeasy source query. - Full-batch trigger: after the first run completes, manually reconcile bill number, inventory organization, and amount on the Kingdee side. Only after that confirmation should the schedule be opened up.
- Scheduling frequency: the crontab in the source material is
1 1 1 1 1, which is just a placeholder. In practice we recommend running once at the start of each month — the window is strictly limited to "no cross-month", and any cross-month query either returns nothing or drops boundary days. This is a typical "incremental and full-batch dual-track" approach leaning toward full-batch.
Lessons learned
- Cross-month queries lose data. The source explicitly forbids start_date / end_date crossing a month, so the function must first
DATE_SUBto the first day of the previous month, then useLAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))for the last day. Do not invert the order. - Bill-number concatenation must stay stable. In
_function concat('FBA补货入库','-',RIGHT(unique_key,12)), do not casually change the RIGHT length. If the historical bill-number rule changes, the idempotency logic on the Kingdee side that keys on bill number will break. - Look up org code by name at your own risk.
_findCollection find wid from … where name={{wh_name}}looks safe, but if Kingdee renames an org the whole chain breaks. The safer approach is to maintain org wids in Qeasy's "encoding mapping" table and use names only for display. - Filter empty origin document numbers early. In the FBA replenishment inbound scenario, records without
origin_accountsdo appear occasionally. If they flow through, the target FBillNo becomesFBA补货入库-, which trips Kingdee's duplicate check. Add a filter right after the source query in Qeasy to drop rows where unique_key is empty. - Do not treat a sync strategy as a transaction. FBA cost streams only stabilize at month-end. Running at the start of the month means late-arriving corrections haven't flowed back yet, and the target transfer-in documents will already have been generated with mismatched amounts. The business rule is "run last month at the start of this month"; on the Qeasy side, just pin the schedule to the start of the month and don't try to build complex compensations inside the platform.
Where it fits and where it doesn't
Fits: cross-border sellers where FBA replenishment inbound goes through Amazon logistics, and the cost stream sliced by Amazon action date in Lingxing needs to land in Kingdee for financial accounting, settled monthly. Does not fit: other business types such as FBA sales outbound, stocktake, or small-balance adjustments — their document shape, cost basis, and bill-number rules are all different and need their own strategies. It also does not fit scenarios that require real-time FBA in-transit inventory; this strategy is a monthly batch process, not a real-time sync.