Qeasy Cloud
Get Started

Practical Guide: Syncing MES Production Replenishment to Kingdee Cloud

· 许创贵· Integration Solutions· 21 views· 5 min read
四化智造MES(WEB)Kingdee Cloud供应链集成生产补料同步MES轻易云私有化部署

What This Strategy Solves

On the shop floor of a discrete manufacturing enterprise, MES is the source of truth for production execution: workers scan codes to report work, shift leaders replenish materials, and production lines trace anomalies — every action lands as a production replenishment document in MES. But Kingdee Cloud, acting as the ERP-side financial and cost center, needs to consolidate actual material consumption against production orders to calculate work order cost, replenishment variance, and inventory issues.

If the two ends are not connected, the typical dispute is: "MES clearly shows the material was replenished, but Kingdee inventory was not deducted; the shop floor says 50 units were used, but finance only recognizes 30." What we are building here is a pipeline that pushes MES internal production replenishment documents into Kingdee's production replenishment form, associated with the originating production order, so the shop floor and finance share a single ledger.

Data Flow and Field Mapping

The overall flow is one-way: MES (WEB) → Qeasy Data Integration Platform → Kingdee Cloud.

The MES source pulls replenishment data through the common/search WebAPI endpoint with paging, and the Kingdee Cloud target writes production replenishment documents through the batchSave endpoint. The middle layer in Qeasy handles field conversion, code mapping, and association completion.

Key field mapping (source → middle layer → target):

Business MeaningMES Source FieldMiddle Layer HandlingKingdee Target Field
Document NumberorderNoPass-through as idempotency keyFBillNo
Creation TimecreateTimeFormat to target-acceptable dateFDate
Production OrgorgIdCode mapping to target orgFPrdOrgId
Stock OrgstockOrgCode mappingFStockOrgId
Owner TypeownerTypeFixed-value completionFOwnerTypeId0
Document TypebillTypeConstant mappingFBillType (SCBLD01_SYS)
Source Production OrderprodOrderNoKey association field for target lookupFSourceBillNo
Line Itemsitems[]Split lines + unit conversion + validationFEntity / FMaterialId / FQty

Here is a useful habit — centralized code mapping management: org, warehouse, and owner-type master data are maintained as a separate mapping table in Qeasy. When either MES or Kingdee adjusts, only this one table changes, no changes to the strategy's main flow.

How to Configure in Qeasy

We use the Qeasy Data Integration Platform. The strategy type is SYNC. Register the MES WebAPI credentials on the source side and the Kingdee Cloud execution credentials on the target side.

Key configuration points:

  1. Source pull: API is common/search, POST, with paging params pageNum/pageSize hard-coded to 1 and 100 (do not exceed 100 when there are many line items, or the target batchSave will overflow). wsId and queryKey follow the MES conventions and act as business filters.
  2. Incremental start: set number to orderNo and turn idCheck to true. Qeasy will dedupe by document number, so the same replenishment document will not be pushed twice.
  3. Target write: Kingdee's batchSave is an EXECUTE endpoint, no need to build a model (buildModel: false). FBillType uses the constant SCBLD01_SYS; org-type fields come from the mapping table.
  4. Response parsing: turn autoFillResponse to true, so the target-returned document internal code is automatically written back to the source record, making it easy to trace the push result in Qeasy.
  5. Header and body in phases: this time we did not split — the production replenishment document's header and body are written in one call. But for more complex documents, the safer pattern is to split into two strategies: write the header first to obtain the internal code, then write the body with that internal code as the link.

Implementation Steps

We generally proceed in three steps:

Step 1: Full-volume trigger to validate the path. Manually trigger a full-volume run in Qeasy to push all replenishment documents from a recent period. The goal is to verify field mapping, organization codes, and production order association. This step does not require huge data volume, but should cover typical scenarios: normal replenishment, over-replenishment, cross-org replenishment, and replenishment against already-closed orders (the last one needs special handling).

Step 2: Configure the incremental start point and switch to scheduled runs. After full-volume validation passes, configure the "incremental start field" on the source side as createTime, and Qeasy will record the waterline. Schedule frequency depends on business volume. This factory's shop floor replenishment concentrates in the day shift, so running once per hour from 07:00 to 22:00 is sufficient — matching the crontab * 7-22 * * * in the source material. Night output is low and manual replenishment is rare, so empty runs do not matter.

Step 3: Trial run and exception handling. After switching to scheduled runs, first enable "trial run" mode — Qeasy pulls data but does not actually write. Observe weekly run logs, field hit rates, and interface latency. Then switch to formal writing. For the first three days, have an engineer check Kingdee-side document status and MES-side push markers every day to confirm there is no "missed push" or "duplicate push".

Pitfall Retrospective

Pitfall 1: Source production order cannot be found on the Kingdee side. MES production order numbers and Kingdee numbers are not fully consistent — some have prefixes, some do not. The middle layer must perform "order number normalization", otherwise the Kingdee lookup fails and the replenishment document becomes an orphan. The safer pattern is to depend on another "production order sync" strategy to build the MES-to-Kingdee order number mapping table first, then this strategy queries that table directly.

Pitfall 2: pageSize is too large and the target batchSave errors out. Pushing 200 line items at once causes HTTP 413 or JSON-overflow on the Kingdee side. We hit this. The fix is to cap at 100, and split extreme documents manually.

Pitfall 3: Code mapping is scattered across strategies, one change touches everything. A typical mistake is hard-coding FStockOrgId directly in the strategy config. Later, when the customer switches orgs or goes multi-org live, every strategy must be updated. Centralized mapping tables are the most common Qeasy customer pattern — all org/warehouse/owner-type codes live in one table, and strategies only reference variables.

Pitfall 4: Wrong incremental start field causes historical data to re-run. If you pick updateTime, when MES backfills historical data in bulk, the waterline jumps and Qeasy pulls old documents. The safer choice is createTime, and mark the waterline immediately after the first full run.

Pitfall 5: Target returns failure but source is already marked success. Kingdee's batchSave returns a Result field that must be inspected line by line. When some lines succeed and some fail, Qeasy defaults to "all success", which silently loses data. We added a "look up Kingdee status by document number" verification node after the strategy, so failed lines re-enter the queue.

Applicable and Non-applicable Scenarios

Applicable: scenarios where MES is the execution layer and Kingdee is the ERP layer, where production replenishment must be consolidated against production orders for costing, and where the shop floor and finance need daily reconciliation — especially in multi-org, multi-plant private deployment environments for discrete manufacturers.

Not applicable: pure process manufacturing where MES itself handles cost accounting; replenishment volume is extremely small (fewer than 10 documents per day), where manual entry is more cost-effective; or when MES and Kingdee share the same platform or database and interface integration is unnecessary.

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

Comments