Qeasy Cloud
Get Started

Syncing Kingdee Cloud Cosmos Master Material Data to MES: A Practical Incremental Strategy with Qeasy

· 卢剑航· Integration Solutions· 22 views· 4 min read
四化智造MES(API)Kingdee Cloud物料主数据MESIncremental Sync轻易云私有化

What This Strategy Solves

In a private deployment at a manufacturing enterprise, Kingdee Cloud Cosmos serves as the ERP for master data, while a discrete MES handles shop-floor execution. Material codes, names, specifications, base units, and inventory categories must flow from the ERP into the MES—otherwise shop-floor issuing, BOM maintenance, and line reporting all stall. We use the Qeasy data integration platform to carry this one-way sync. The goal is straightforward: keep MES material master data consistent with the ERP without disturbing production hours. We pick an incremental pattern—filtered by modification time, use organization, and material group—so each material change is pushed to MES within an hourly window.

Data Flow and Field Mapping

Data flows in one direction only: Kingdee Cloud Cosmos (source) → Qeasy intermediate layer → MES (target). The source calls executeBillQuery against the BD_MATERIAL form; the target writes /api/createMaterialInfo. The intermediate layer handles field mapping, incremental cursor (LAST_SYNC_TIME), and pagination.

Key field mapping:

Target Field (MES)Source Field (Kingdee)Mapping TypeNotes
companyCodeConstant fdd8dc88CONSTANTCompany code, fixed
classifyNoFMaterialGroupDIRECTMaterial category UUID
parentClassifyNoFMaterialGroupDIRECTTop-level category, same as classifyNo
materialUuidFMasterIdDIRECTMaster key used as MES material UUID
partNoFNumberDIRECTMaterial code
gradeNameFNameDIRECTMaterial name
specFSpecificationDIRECTSpecification
unitUuidFBaseUnitIdDIRECTUnit of measure UUID
purchaseUnitUuidFBaseUnitIdDIRECTPurchase unit UUID, same as unitUuid
erpClassifyCodeFCategoryID.FNumberDIRECTERP inventory category code passthrough
quality / brand / picNo / picVersion / texturesType / density / coefficientConstant ""CONSTANTNot maintained on MES side, empty string

Note: both classifyNo and parentClassifyNo directly take the Kingdee material group ID. This means the material-group strategy must run first, otherwise the MES side will receive a category UUID that does not exist and the write will fail. Mark this dependency explicitly in the metadata.

Configuring in Qeasy

In the Qeasy strategy editor, four configuration points matter for this strategy:

  1. Source metadata: API executeBillQuery, form ID BD_MATERIAL, pagination Limit 2000, TopRowCount=0 (do not return total row count, to reduce source pressure), filter FUseOrgId.fnumber='100' and FModifyDate>='{{LAST_SYNC_TIME|dateTime}}' and FMaterialGroup.FNumber!='virtual'.
  2. Target metadata: API /api/createMaterialInfo, POST, write row by row (autoFillResponse=true, idCheck=true).
  3. Field mapping: Configure DIRECT and CONSTANT entries per the table above. If MES unit UUIDs diverge from Kingdee IDs in the future, switch unitUuid and purchaseUnitUuid from DIRECT to COLLECTION and introduce a unit code mapping table.
  4. Centralized coding mapping: A common pattern among Qeasy customers is to place all master-data coding mappings in a dedicated "coding hub" strategy set and reuse them via _findCollection across strategies, rather than maintaining them per strategy. This strategy currently has no cross-strategy lookup, but leave room for it.

Implementation Steps

We recommend a three-phase rollout:

  • Phase 1: material group first. Stabilize the "Kingdee material group → MES material category" strategy first. Confirm MES category UUIDs map one-to-one with Kingdee FMaterialGroup. This is the prerequisite for the material master strategy.
  • Phase 2: trigger a one-time full sync. For go-live, set LAST_SYNC_TIME to a historical start point (for example, one year back) and trigger a manual full sync to flush historical materials into MES. This step exposes any missing mappings (empty spec, unreachable FCategoryID, and so on). Run outside production hours.
  • Phase 3: incremental steady state. Schedule * 7-22 * * *, hourly during the 7:00–22:00 working window, avoiding the overnight MES maintenance window. After one week, observe whether LAST_SYNC_TIME advances steadily and per-window row counts converge (ideally most windows return zero to a few dozen rows).

A typical Qeasy pattern, "incremental and full dual track", is to keep a separate full-sync strategy (manually triggered, low frequency) as a fallback while daily traffic runs on the incremental strategy; when issues arise, you can always re-flush.

Lessons Learned from the Field

  • Pitfall one: running material before material group is synced. classifyNo directly takes FMaterialGroup; if the group strategy has not run, MES writes fail because the category UUID does not exist. The safe approach is to declare depends_on in the metadata and let the scheduler trigger strategies serially.
  • Pitfall two: not excluding virtual materials. If the source filter omits FMaterialGroup.FNumber!='virtual', MES receives a pile of virtual materials that exist in ERP only for auxiliary accounting and pollutes the MES master list.
  • Pitfall three: blindly passing through unit UUIDs. In this strategy, MES unit UUIDs happen to equal Kingdee FBaseUnitId, so DIRECT works. But if MES uses a different auto-increment ID, unitUuid will hold the wrong value—and it will not raise an error; subsequent business queries simply find nothing. The safe approach is to verify against the coding mapping table up front, switching to COLLECTION if needed.
  • Pitfall four: empty fields written as null. Fields such as quality and brand are intentionally empty, but some target interfaces validate strictly and expect empty strings rather than null. We configure these as "" constants in Qeasy to avoid HTTP 400 responses.
  • Pitfall five: ignoring unmapped fields. Fields like FOldNumber, FForbidStatus, and FIsBatchManage are not currently written. Three months later, when business needs forbidden-status sync or batch management, you will revisit the mapping from scratch. The pragmatic move is to expose these fields on the source metadata even if the target does not yet map them, so future expansion does not require going back to Kingdee to add fields.

Where This Strategy Applies—and Where It Doesn't

Applies: one-way ERP-to-MES master material sync, where the source provides reliable modification timestamps, the target supports upsert by material UUID, and there is no requirement to write MES-side fields back to ERP.

Does not apply: scenarios that need bidirectional material change sync, scenarios that require MES to feed routing or BOM back into ERP, and legacy ERPs whose modification timestamps are unreliable (for example, batch imports). In those cases, switch to event-driven or full-comparison approaches instead of this incremental strategy.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mes-api-kingdee-cloud-4233-mes-23cf905b

Comments