Qeasy Cloud
Get Started

Practical Tutorial: Direct Transfer Order Sync from MySQL to Kingdee Cloud

· 吕修远· Integration Solutions· 8 views· 4 min read

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):

SemanticMySQL Source FieldKingdee Target Field
Bill Numberinstruction_doc_num + line + iface_id concatenationFBillNo
Bill Dateaccount_date (with accounting period fallback)FDate
Bill Typeerp_doc_type_idFBillTypeID
Transfer Typetransfer_biz_typeFTransferBizType
Transfer Directiontransfer_directFTransferDirect
Out Stock Orgstock_out_orgidFStockOutOrgId
In Stock Orgstock_org_idFStockInOrgId
Materialerp_material_idFMaterialId
Out/In Warehouseerp_from_locator_id / erp_to_locator_idFOutWarehouse / FInWarehouse
Transfer QtyquantityFQty
Owner / Keeperowner_* / keeper_*FOwnerOut/In, FKeeperOut/In
Lot, Plan Trackingattribute1 / mto_noFLot / 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

  1. Bill number concatenation overflow: Concatenating instruction_doc_num + line + iface_id can 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.
  2. Stuck on closed accounting periods: The source SQL has an aft_quiet_time fallback, but the target side truly trusts the business date. A common customer-site mistake is to pass account_date directly, 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.
  3. Inconsistent owner and keeper dimensions: Kingdee Cloud strictly validates the combination of owner type and owner ID. Mismatches between owner_type_out_id and owner_out_id are frequent. A common Qeasy customer pattern is to centralize this group of mappings in a configuration table so that one change applies globally.
  4. 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.
  5. Pagination boundary issues: When the last page has less than a full page of data, :limit :offset can cause duplicate retrieval. Recommendation: explicitly record the last maximum sourceid in Qeasy, and add a sourceid > last_max condition 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.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mysql-kingdee-cloud-2246-mom-zjdb-t02-9fe701be

Comments