Qeasy Cloud
Get Started

Practical Tutorial: Sync MES Process Subcontracting Issue (Semi-finished Materials) to Kingdee Other Outbound

· 卢剑航· Integration Solutions· 85 views· 4 min read
四化智造MES(WEB)Kingdee CloudMESSupply ChainInventory Sync私有化轻易云

What This Strategy Solves (Scenario and Value)

In a real manufacturing plant, after MES issues a process subcontracting task, semi-finished materials must be moved from the raw material warehouse to the subcontractor. In MES this is a "process subcontracting issue"; in Kingdee Cloud Skylight it lands as an "Other Outbound" document. The two systems model the document differently—one is a sub-line of a process task, the other is a standard inventory outbound voucher. Manual re-entry causes latency, stock ledger drift, and broken subcontracting reconciliation.

Our approach on the customer site: push the issue document from MES to Kingdee as-is, using the Qeasy Data Integration Platform (Qeasy) for field translation and code mapping, so that issue equals outbound and stock stays in sync in real time. Below we break this strategy apart piece by piece.

Data Flow and Field Mapping (Source → Middle Layer → Target)

The overall flow is MES (Web API) → Qeasy Middle Layer → Kingdee Cloud Skylight (batchSave).

The source is MES's query endpoint (common/search, POST), pulling process subcontracting issue data by wsId + queryKey, with pageNum / pageSize defaulting to 100 records per page, business number field business_no, primary key id. The target is King's batchSave interface, a typical EXECUTE-type call.

Key field mapping:

Business MeaningMES Source FieldMiddle Layer HandlingKingdee Target Field
Document Numberbusiness_noPass-throughFBillNo ({{business_no}})
Document Type—Fixed valueFBillTypeID=QTCKD01_SYS (Standard Other Outbound)
Stock Org—Fixed valueFStockOrgId=100
Pick Org—Fixed valueFPickOrgId=100
DepartmentcreateNameMongo lookup → FPostDeptFDeptId
Stock Direction—Business-fixedFStockDirect
Body Material/QtyIssue detail linesSplit into rowsMaterial code & actual qty under FEntity

The middle layer's most important job is code mapping: MES material codes, departments, and subcontractor master data must be centrally mapped in Qeasy first—otherwise Kingdee will reject or misroute them.

How to Configure in Qeasy

This strategy is configured in Qeasy as a "source strategy + target strategy" pair.

Source strategy: Set API to common/search, effect to QUERY, method to POST. Set number to business_no, id to id, enable idCheck=true and autoFillResponse=true. Keep buildModel off—the MES response structure is stable and does not need automatic modeling. In the request body, params carries filter conditions, pageNum=1, pageSize=100, wsId is filled per customer environment, queryKey=2 (corresponding to the process subcontracting issue view).

Target strategy: Set API to batchSave, effect to EXECUTE. Set buildModel=true so Qeasy generates the request model from Kingdee metadata. Set idCheck=true to prevent duplicate pushes. For request fields, FBillTypeID is fixed to QTCKD01_SYS; FStockOrgId and FPickOrgId are filled per customer org code; FBillNo uses the variable {{business_no}} referencing the source document number; FDeptId uses Qeasy's _mongoQuery capability to reverse-lookup the department code by createName. This is the common "centralized code mapping" pattern among Qeasy customers—keeping cross-system master data mapping tables in Mongo for unified maintenance.

Implementation Steps (Phased Scheduling)

We recommend rolling out in three phases:

Phase 1: Align the incremental starting point. Pick a same-day process subcontracting issue document from MES, manually trigger a sync, and confirm that Kingdee can normally generate the Other Outbound document with matching document number and body quantities. This phase focuses on validating field mapping, especially department and material codes.

Phase 2: Full-volume trigger. Run a full backfill of all MES issue documents before 7:00 that day in business_no ascending order. During the full-volume phase, pageSize can be raised to 200 for speed, but each page must validate idCheck to avoid duplicates.

Phase 3: Operationalize scheduling. Configure crontab as * 7-22 * * *—running every minute from 07:00 to 22:00, covering a full production shift. Run incremental and full-volume in parallel: incremental relies on idCheck for auto-dedup, while full-volume serves as a safety net, manually triggered weekly. Stabilize the header first, then open up the body (material lines) a week later—this is the common "header-then-body phased rollout" rhythm among Qeasy customers, which lowers initial troubleshooting cost.

Lessons Learned (Pitfalls)

  1. wsId typo causes empty response with HTTP 200. MES queries are isolated by wsId; getting it wrong leads to silently empty data. We recommend extracting wsId as an environment variable in Qeasy and maintaining it independently per customer.

  2. pageSize set too high triggers MES throttling. Setting it to 500 once caused a direct timeout. The safe approach is a default of 100, only raising it to 200 for large customers—do not blindly copy other deployments.

  3. FDeptId reverse-lookup by createName collides on duplicate names. Mongo matching should combine FName + FOrgId, otherwise people get pushed to the wrong department. This is a classic trap—always include the org dimension in the filter.

  4. FBillNo directly passing business_no causes duplicates. MES allows reusing the same document number; Kingdee does not. Add an idCheck fallback in the middle layer: if the target already exists, skip that record.

  5. Subcontracting issue is canceled in MES, but King's outbound is not reversed. This is a typical bidirectional sync omission. The safe approach is to configure a separate "subcontracting return → Other Inbound" strategy, rather than posting negative quantities on the outbound document.

Applicable and Non-applicable Scenarios

Applicable: process subcontracting issue, real-time Kingdee posting, semi-finished material pushed directly from MES to Kingdee in a private deployment. Not applicable: cross-legal-entity transfers (use transfer documents instead), scenarios requiring approval workflows (Other Outbound does not carry approval nodes), and weak-network environments where MES and Kingdee are not in the same clock-sync window.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mes-web-kingdee-cloud-5568-mes-b36551f0

Comments