Practical Tutorial: Direct Transfer Order Sync from MySQL to Kingdee Cloud
What This Strategy Solves
In a discrete manufacturing scenario, when a production line finishes goods, materials often need to be transferred directly from the production organization warehouse to a sales organization or a remote warehouse in an "inbound equals transfer" pattern. The original transaction logic lives in a MySQL intermediate table on the MES side, while finance and inventory books are kept in Kingdee Cloud. If the two sides drift apart, cost settlement and outbound shipping are directly affected. A stable, scheduled, restartable channel is needed to push the picking results from MySQL into Kingdee Cloud as direct transfer orders. This is exactly the kind of strategy we typically implement on the Qeasy Data Integration Platform.
Data Flow and Field Mapping
The overall flow is MySQL → Qeasy middleware → Kingdee Cloud. The source side uses a WebAPI (SQL query) with paged retrieval, while the target side calls the batchSave interface to write transfer orders in batches.
Key field mapping (desensitized, semantic only):
| Semantic | MySQL Source Field | Kingdee Target Field |
|---|---|---|
| Bill Number | instruction_doc_num + line + iface_id concatenation | FBillNo |
| Bill Date | account_date (with accounting period fallback) | FDate |
| Bill Type | erp_doc_type_id | FBillTypeID |
| Transfer Type | transfer_biz_type | FTransferBizType |
| Transfer Direction | transfer_direct | FTransferDirect |
| Out Stock Org | stock_out_orgid | FStockOutOrgId |
| In Stock Org | stock_org_id | FStockInOrgId |
| Material | erp_material_id | FMaterialId |
| Out/In Warehouse | erp_from_locator_id / erp_to_locator_id | FOutWarehouse / FInWarehouse |
| Transfer Qty | quantity | FQty |
| Owner / Keeper | owner_* / keeper_* | FOwnerOut/In, FKeeperOut/In |
| Lot, Plan Tracking | attribute1 / mto_no | FLot / FPlanTrackNo |
The source uses Chinese aliases, but the Qeasy mapping layer normalizes everything to the target system's standard field names, preventing errors caused by casing or semantic differences.
Configuring on Qeasy
Create an A_TO_B sync strategy in Qeasy, choose MySQL as the source platform and Kingdee Cloud as the target, and classify the business module as "Inventory Sync."
On the source side, build the request using WebAPI + a main SQL. Replace :limit and :offset with placeholders and bind them to main_params. This is one of the most common patterns we use on customer sites: parameterizing pagination keeps execution stable and simplifies boundary handling during restart scenarios. The response's sourceid acts as the idempotency key. With idCheck enabled on the target side, Qeasy will use it to deduplicate and avoid duplicate bill creation.
On the target side's batchSave interface, all field values use {{FieldName}} placeholders, with the business type defaulting to NORMAL. The Qeasy configuration layer handles conditions such as "stock_out_orgid equals a specific value" centrally. Since the source SQL already restricts stock_out_orgid, the target side should not re-filter to avoid logic conflicts between the two sides.
Implementation Steps
Step 1 — Define the incremental starting point. Use STATUS in ('N','E') and return_order = 1 as the pending sync set on the source side, then use iface_id as the watermark. For the first run, use created_at to do a historical full backfill, and switch to incremental afterwards.
Step 2 — Full trigger. Manually run the strategy once in Qeasy to push accumulated inbound picking results from the past N days to Kingdee. After completion, reconcile the bill numbers on both sides to confirm nothing is missing.
Step 3 — Scheduling frequency. The source side is recommended at a 10-minute level (a staggered pattern like 3,13,23,33,43,52 * * * * helps avoid peak congestion), while the target side polls every minute to flatten the queue backlog.
Step 4 — Exceptions and rerun. Failed bills enter the Qeasy error queue, are manually inspected, and then resubmitted. The source STATUS is written back to S by the sync program to avoid duplicate retrieval in the next round.
Lessons Learned
- Bill number concatenation overflow: Concatenating
instruction_doc_num + line + iface_idcan exceed the target field length limit and get truncated. The safe approach is to truncate and zero-pad explicitly in the Qeasy mapping layer rather than relying on the target system's auto-truncation. - Stuck on closed accounting periods: The source SQL has an
aft_quiet_timefallback, but the target side truly trusts the business date. A common customer-site mistake is to passaccount_datedirectly, causing the entire batch to fail during a closed accounting period. The safe approach is to do date correction once in the middleware before sync. - Inconsistent owner and keeper dimensions: Kingdee Cloud strictly validates the combination of owner type and owner ID. Mismatches between
owner_type_out_idandowner_out_idare frequent. A common Qeasy customer pattern is to centralize this group of mappings in a configuration table so that one change applies globally. - Lot and plan tracking number mis-transmission: The source SQL already applies empty-value handling for non-out identifiers. If the middleware applies another empty check, it becomes an empty string and fails target validation. Recommendation: handle it only once on the source SQL side and pass through transparently in the middleware.
- Pagination boundary issues: When the last page has less than a full page of data,
:limit :offsetcan cause duplicate retrieval. Recommendation: explicitly record the last maximumsourceidin Qeasy, and add asourceid > last_maxcondition as a safety net in the next query.
Applicable and Non-applicable Scenarios
Applicable: scenarios where production inbound needs to immediately transfer across stock organizations, and the transfer rules can be clearly preset in source SQL; warehouse, owner, and keeper dimensions are relatively fixed. Not applicable: scenarios where transfer rules require manual approval workflows, multi-level multi-organization accounting, or the target system requires real-time business status writeback.