Qeasy Cloud
Get Started

Kingdee Miscellaneous Stock-In to MES Inspection Sign-Off: A Single-Strategy Sync Walkthrough

· 何海波· Integration Solutions· 23 views· 4 min read
四化智造MES(API)Kingdee CloudMES送检签收轻易云Inventory Sync私有化部署

What This Strategy Solves

On many manufacturing shop floors, quality inspection sits between ERP stock-in and MES production. An ERP-side miscellaneous stock-in document has already been approved, but the MES never receives an inspection trigger. Inspectors end up flipping through paper forms and re-keying data into the MES — slow and error-prone. This strategy does one concrete thing: it pulls approved miscellaneous stock-in documents from Kingdee Cloud, explodes them by line, and pushes them to the YSD MES as inspection tasks, giving QA a single, consistent entry point for stock-in sign-off and inspection dispatch.

Data Flow and Field Mapping

Data flows from Kingdee Cloud, through the Qeasy integration platform (the middle layer), into the YSD MES inspection sign-off endpoint. The source calls executeBillQuery to fetch line-level data; the target calls creatQmsInspectTaskDto per row. The structure is "one in, one out, flat at line level."

Source Field (Kingdee)Target Field (MES)Mapping TypeNotes
FBillNoinspectNoDIRECTStock-in number reused as inspection number for traceability
FBillNopurchaseOrderNoDIRECTReused into the PO field; needs business confirmation in non-PO scenarios
FMATERIALIDmaterialUuidDIRECTMaterial master key, usually resolved to MES UUID via lookup
FSTOCKIDreceiveInvDetailUuidDIRECTWarehouse ID, usually resolved to receiving-detail UUID via lookup
FQtyinspectNumDIRECT (int)Received quantity mapped to inspection quantity
FUnitIDweightUnitNameDIRECTUnit ID; may require lookup to obtain the unit name
FDEPTIDdeptNameDIRECTDepartment ID; may require lookup to obtain the name
FSUPPLIERIDsupplierUuidDIRECTSupplier ID; usually resolved via lookup
-companyCodeCONSTANTMulti-tenant identifier on the target side
-inspectWeight / processCode / orderNoEMPTYCurrently unmapped; reserved for future extension

For uniqueness, the source uses FBillNo + FEntity_FEntryID; the target relies on inspectNo combined with material and quantity to enforce business-level uniqueness.

How to Configure It on Qeasy

On the Qeasy integration platform, the strategy is typically configured as follows:

  1. Source action: pick Kingdee Cloud's executeBillQuery, define the field selection set, and include FEntity_FEntryID, FID, FBillNo, FDocumentStatus, FDate, FMATERIALID_FNumber, FSTOCKID_FNumber, FQty, FUnitID, FDEPTID, FSUPPLIERID, FLOT, etc. — enough for current mapping and future extension.
  2. Filter: set FilterString to FApproveDate>='{{LAST_SYNC_TIME|datetime}}' for incremental pull. Add FDocumentStatus='C' so that only approved documents are pushed.
  3. Target action: pick YSD MES's creatQmsInspectTaskDto WebAPI, POST method, idCheck=true to avoid duplicate creation for the same inspectNo.
  4. Centralized code mapping: do not scatter material, warehouse, and supplier ID-to-UUID mappings across strategies. A common Qeasy customer pattern is to maintain separate "Kingdee material → MES material" master-data strategies and use _findCollection or _mongoQuery from the inspection strategy to look up UUIDs. When the master key system changes, only one place needs to be updated.
  5. Phased header / body rollout: ship only line-level inspection tasks first; add header-level fields (document status, notes) in a later phase.

Implementation Steps

  1. Bootstrap the incremental anchor: pick a clear timestamp (e.g., the start of the month, go-live date) and set LAST_SYNC_TIME to it. Run a cold start to sync all approved documents within the window.
  2. Full-volume trigger: immediately after cold start, trigger one full re-run and reconcile document numbers and quantities on both sides. Missing records usually cluster near the boundary timestamp — re-pull by FApproveDate to fill the gap.
  3. Scheduling: set the crontab to * 7-22 * * *, hourly during working hours. This balances timeliness against load on the source system. Night-time idle hours are skipped to avoid a sudden burst when work starts the next morning.
  4. Validation and reconciliation: enable autoFillResponse so the MES-returned inspection number is written back to Qeasy logs as the basis for reconciliation. Run a weekly document-number-level reconciliation to confirm counts match.
  5. Extension and freezing: once the strategy runs stably, gradually enable inspectWeight, processCode, orderNo, FPrice/FAmount, FLOT, etc., in business-priority order. After each batch is enabled, freeze the prior mapping version to prevent silent rollbacks.

Lessons Learned

  1. Raw IDs bite back: pushing Kingdee master-key IDs straight into MES looks fine for two weeks — until MES cleans up or migrates its coding system, and the numbers stop matching. The safe approach is "centralized code mapping", maintained by dedicated master-data strategies.
  2. Missing status filter: relying solely on FApproveDate without FDocumentStatus='C' will push draft documents into MES, producing "ghost inspection tasks with no inspection number". A typical engineering lesson: incremental conditions should not rely on time alone; business status must be layered in.
  3. Mixing IDs and names: the MES API documentation shows examples like "KG", while Kingdee supplies FUnitID. Passing the ID directly is treated as invalid and silently dropped — a lookup against Kingdee's unit-of-measure table is required. Same for departments.
  4. 24x7 crontab: setting the schedule to * * * * * (every minute) seems more responsive but puts unnecessary pressure on Kingdee's executeBillQuery and produces many no-op runs at night. The 7-22 working-hours window is the experienced default.
  5. "Can-fill" fields: fields like inspectWeight, orderNo, processCode are currently empty mappings. Some engineers will fill them with whatever is at hand, breaking the target side's business semantics. Leave them empty until business explicitly confirms the source.

Where This Applies — and Where It Doesn't

Applies: multi-organization manufacturers that use Kingdee Cloud for accounting, treat miscellaneous stock-in as the primary QA entry point, and need line-level inspection tasks triggered in MES. It fits the "centralized code mapping + phased header/body + dual incremental/full-volume tracks" delivery cadence.

Does not apply: scenarios where production or sales orders drive inspection directly, bypassing the ERP stock-in document; or simple integrations where Kingdee and MES already share a unified material master key, with no ID-UUID mapping needed.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mes-api-kingdee-cloud-9955-mes-0026671f

Comments