Practical Tutorial: Syncing Kingdee Cloud Master Material Data to MySQL
What This Strategy Solves
Master material data is the "root" of supply chain integration. In a private deployment of a manufacturing enterprise, Kingdee Cloud Sky serves as the ERP master data source, while MES, SRM, and in-house business platforms consume a material mirror table in MySQL. When a material is added or modified on the Kingdee side, downstream systems fail to receive timely updates, causing BOM lookup failures, mismatched procurement specifications, and workshop picking errors. This strategy implements "Kingdee Cloud Sky → MySQL" material add/modify sync, anchoring the root firmly in the ERP.
Data Flow and Field Mapping
The overall pipeline is Kingdee Cloud Sky (QUERY) → Qeasy Integration Platform middleware → MySQL (WebAPI EXECUTE). The Kingdee side uses the executeBillQuery API to pull incremental materials by FNumber; the middleware performs field mapping, unit/category conversion, and code cleaning; the MySQL side executes an INSERT … ON DUPLICATE KEY UPDATE statement into basic_material_info to upsert records.
Key field correspondence (source → target):
| Kingdee Cloud Sky Field | Meaning | MySQL Target Field | Note |
|---|---|---|---|
| FNumber | Material code | material_info_no | Primary key, centralized mapping |
| FName | Material name | grade_name | Direct mapping |
| FSpecification | Specification | spec | Nullable |
| FMaterialGroup_FNumber | Material group code | big_classify_id | Mapping table required |
| FErpClsID | ERP classification ID | material_type / material_attribute | Industry-dependent semantics |
| FBaseUnit | Base unit | unit_no | Unified code value |
| FTextures / FBrand etc. | Extended attributes | textures_type / brand etc. | Cover by target columns |
The recommended practice is to centralize this mapping in Qeasy's "Field Mapping" configuration rather than scattering logic across scripts.
How to Configure on Qeasy
- Source (Kingdee Cloud Sky): Create a new source platform connection, select
executeBillQuery, pull incrementally by ascendingFNumber, and enable pagination with a single-fetch cap to avoid pulling the entire material table at once. - Target (MySQL): Create a WebAPI-type writer, HTTP Method=POST,
effect=EXECUTE;main_paramscarries field values,main_sqlusesINSERT … ON DUPLICATE KEY UPDATEto write intobasic_material_info, with the unique key set tomaterial_info_no. - Strategy orchestration: Link source and target into a SYNC strategy,
sequence=Aindicates the active pull direction; schedules*/2 * * * *(source) and*/3 * * * *(target) are staggered by minutes to reduce burst concurrency. - Parameterization: Place group, unit, brand and other code values in Qeasy's "Dictionary Mapping" component for one-to-one source-to-target maintenance; adding a new group only requires updating the dictionary, not the main flow.
- Response handling: Enable
autoFillResponseso the platform auto-fills the write response into the context for idempotency checks.
Implementation Steps
We typically break material sync into three phases:
- Phase 1: Incremental Starting Point. Confirm the most recent material modification timestamp or max
FMasterIdin the source as the initial starting point for the first incremental run. This avoids the embarrassment of "only 5 records on day one." - Phase 2: Full Refresh Trigger. Add a "full rebuild" switch in the strategy; normally inactive, manually triggered when material group structure changes or dictionary upgrades occur, performing a complete comparison.
- Phase 3: Scheduling Frequency. In production, the source runs
*/2 * * * *and the target*/3 * * * *, staggered; during off-hours, frequency can drop to*/10 * * * *to save database pressure.
The dual-track of incremental and full refresh is our standard for material sync: daily incremental keeps data current, periodic full refresh serves as a safety net.
Pitfall Review
- Code mapping scattered across scripts. A typical mistake is writing a JS conversion for every field; three months later, nobody remembers the rules. The robust approach is to centralize all code-value mappings in Qeasy's dictionary table with naming like
src_group → tgt_group. idChecknot enabled. The MySQL target defaults toidCheck=true, which checks existence bymaterial_info_nobefore writing; do not disable it for convenience, or ON DUPLICATE KEY will fail.- Full pull in one shot. When the source
executeBillQueryhas no pagination parameters, all materials are pulled into memory at once. A retail enterprise's first launch overwhelmed Qeasy workers as a result. Always set pagination and batch limits. - Unit/group code values not aligned. Kingdee's "base unit" and the downstream MySQL
unit_nofollow different naming conventions; a unit mapping table must be prepared in advance, or materials with the same spec but different units will be incorrectly merged. - Schedule collisions. Running material sync, sales order sync, and purchase order sync in the same 5-minute window causes periodic IO spikes on the source database. Staggered design is fundamental discipline.
Applicable and Non-Applicable Scenarios
Applicable: ERP serves as the master data source, multiple downstream business systems need a material mirror, and the data volume is within hundreds of thousands of records, typical for manufacturing or retail enterprises. Not applicable: Scenarios requiring bidirectional material editing sync, source data volume in the millions, or second-level real-time requirements—these should use event streams or a dedicated MDM platform instead.