Kingdee Miscellaneous Stock-In to MES Inspection Sign-Off: A Single-Strategy Sync Walkthrough
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 Type | Notes |
|---|---|---|---|
| FBillNo | inspectNo | DIRECT | Stock-in number reused as inspection number for traceability |
| FBillNo | purchaseOrderNo | DIRECT | Reused into the PO field; needs business confirmation in non-PO scenarios |
| FMATERIALID | materialUuid | DIRECT | Material master key, usually resolved to MES UUID via lookup |
| FSTOCKID | receiveInvDetailUuid | DIRECT | Warehouse ID, usually resolved to receiving-detail UUID via lookup |
| FQty | inspectNum | DIRECT (int) | Received quantity mapped to inspection quantity |
| FUnitID | weightUnitName | DIRECT | Unit ID; may require lookup to obtain the unit name |
| FDEPTID | deptName | DIRECT | Department ID; may require lookup to obtain the name |
| FSUPPLIERID | supplierUuid | DIRECT | Supplier ID; usually resolved via lookup |
| - | companyCode | CONSTANT | Multi-tenant identifier on the target side |
| - | inspectWeight / processCode / orderNo | EMPTY | Currently 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:
- Source action: pick Kingdee Cloud's
executeBillQuery, define the field selection set, and includeFEntity_FEntryID,FID,FBillNo,FDocumentStatus,FDate,FMATERIALID_FNumber,FSTOCKID_FNumber,FQty,FUnitID,FDEPTID,FSUPPLIERID,FLOT, etc. — enough for current mapping and future extension. - Filter: set FilterString to
FApproveDate>='{{LAST_SYNC_TIME|datetime}}'for incremental pull. AddFDocumentStatus='C'so that only approved documents are pushed. - Target action: pick YSD MES's
creatQmsInspectTaskDtoWebAPI, POST method,idCheck=trueto avoid duplicate creation for the sameinspectNo. - 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
_findCollectionor_mongoQueryfrom the inspection strategy to look up UUIDs. When the master key system changes, only one place needs to be updated. - Phased header / body rollout: ship only line-level inspection tasks first; add header-level fields (document status, notes) in a later phase.
Implementation Steps
- Bootstrap the incremental anchor: pick a clear timestamp (e.g., the start of the month, go-live date) and set
LAST_SYNC_TIMEto it. Run a cold start to sync all approved documents within the window. - 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
FApproveDateto fill the gap. - 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. - Validation and reconciliation: enable
autoFillResponseso 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. - 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
- 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.
- Missing status filter: relying solely on
FApproveDatewithoutFDocumentStatus='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. - 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. - 24x7 crontab: setting the schedule to
* * * * *(every minute) seems more responsive but puts unnecessary pressure on Kingdee'sexecuteBillQueryand produces many no-op runs at night. The7-22working-hours window is the experienced default. - "Can-fill" fields: fields like
inspectWeight,orderNo,processCodeare 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.