Qeasy Cloud
Get Started

Syncing Kingdee Cloud Process Plan Queries to MySQL: A Single-Strategy Hands-On Guide

· 王浩宇· Integration Solutions· 14 views· 4 min read

What This Strategy Solves

Process plans are the "production instructions" on the shop floor — workers pull materials, report progress, and close out operations against them. In one manufacturing project, Kingdee Cloud held the process plans while the workshop dashboards ran on MySQL. The two sides were reconciled by manual export/import, often lagging by half a day. We built a "Kingdee – Process Plan Query" strategy on the Qeasy integration platform that pulls process plan documents from Kingdee into MySQL on a schedule, cutting dashboard latency from hours to minutes.

Data Flow and Field Mapping

Data flows one-way from Kingdee Cloud (system B) to MySQL (system A), direction B_TO_A, strategy type QUERY_ONLY, sequence A — the first link in the chain that other strategies (such as real-time inventory) can depend on.

On the source side, Kingdee's executeBillQuery endpoint (POST) returns process plan documents matching the query. On the target side, an idempotent REPLACE INTO SQL writes into MySQL. The natural key is FSubEntity_FDetailID; the surrogate primary key id is configured with idCheck=true in Qeasy so repeated pulls don't bloat the table.

Key field mapping:

Business meaningKingdee Cloud fieldMySQL column
Detail primary keyFSubEntity_FDetailIDFSubEntity_FDetailID
Bill numberFBillNoFBillNo
Production order no.FMONumberFMONumber
Customer short nameF_QOQG_Text2F_QOQG_Text2
Header quantityFMOQtyFMOQty
Entry sequenceFMOEntrySeqFMOEntrySeq
ApproverFAPPROVERIDFAPPROVERID
Creation dateFCREATEDATEFCREATEDATE
Approval dateFApproveDateFApproveDate
Operation statusFOperStatusFOperStatus
Process nameFProcessId_FNameFProcessId_FName
Operation descriptionFOperDescriptionFOperDescription
UnitFOperUnitId_FNameFOperUnitId_FName
Product codeFProductId_FNumberFProductId_FNumber
Product nameFProductId_FNameFProductId_FName
Production orgFProcessOrgId_FNumberFProcessOrgId_FNumber
Work centerFWorkCenterId_FNumberFWorkCenterId_FNumber
Qualified qtyFQualifiedQtyFQualifiedQty
Sales order no.FSaleOrderNumberFSaleOrderNumber

The source request array defines the columns returned by the query; the target otherRequest.main_sql is a parameterised REPLACE INTO that Qeasy binds at runtime by column name. A common Qeasy pattern is to centralise code mapping in the source request columns so later strategies reuse the same set.

Configuring It on Qeasy

Source side: pick API executeBillQuery, method POST, number = FBillNo, id = FSubEntity_FDetailID, turn off autoFillResponse and buildModel. Tick the columns from the table above — and don't forget custom fields prefixed with F_QOQG_, or the dashboard won't see the customer.

Target side: type = SQL, effect = EXECUTE. Use REPLACE INTO process_plan_detail ... in main_sql with named placeholders like :FID, :FBillNo. Qeasy binds query results by column name automatically. Keep idCheck=true so repeated runs overwrite rather than append — that's what makes it idempotent.

Scheduling: source crontab */16 7-22 * * *, target crontab */17 7-22 * * *. Stagger the two by one minute so they don't hit Kingdee's API quota at the same instant. A common Qeasy pattern — header-then-detail phased rollout — fits here: ship header fields first, add long text and quantity fields like FOperDescription and FQualifiedQty in phase two.

Implementation Steps

Phase 1 — incremental anchor. Use FCREATEDATE or FApproveDate as the incremental cursor; Qeasy records the last successful timestamp and only pulls new and changed rows on the next run. Cold start with a fixed past timestamp to backfill history.

Phase 2 — full trigger. Manually trigger a full pull in Qeasy, run REPLACE INTO once, verify the row count matches the source, then enable the schedule.

Phase 3 — frequency. During working hours (07:00–22:00) one round every 16–17 minutes; stop at night to save Kingdee API quota. For 24×7 workshops, extend the window and add a low-frequency hourly run overnight.

Phase 4 — downstream consumption. Dashboards query the target table directly. For near-real-time needs, add a materialised view or Redis cache on top of MySQL — no change needed on the Qeasy side.

Pitfalls We've Hit

Pitfall 1: forgetting F_QOQG_ custom fields. Kingdee's "customer short name" is a user-added field, not in the default query template. First sync ran with NULLs everywhere. Fix: list custom fields explicitly in the source request array; never rely on *.

Pitfall 2: REPLACE INTO without idCheck. Qeasy checks primary keys by default, but SQL writes must enable idCheck in the configuration — otherwise the same FSubEntity_FDetailID turns into multiple rows and dashboard totals go wrong.

Pitfall 3: source and target crontab collide. Setting both to */15 means the target starts writing before the source finishes reading, which can trigger MySQL deadlocks. Stagger by one minute.

Pitfall 4: no pagination on executeBillQuery. A month of process plans easily runs into tens of thousands of rows. Add pagination parameters (Limit / StartRow) in the source request, or the Kingdee API will time out.

Pitfall 5: using creation date as the cursor. FCREATEDATE is the bill creation time; FApproveDate is the approval time. Only approved bills are actually executable, so use FApproveDate as the incremental cursor to avoid missing them.

When It Fits and When It Doesn't

Fits: manufacturers running Kingdee Cloud as ERP with MySQL-powered downstream reporting or dashboards, where the shop floor needs near-real-time process plan status, and where one query can return the day's volume. Doesn't fit: scenarios that require bidirectional sync (e.g. shop-floor reporting back into Kingdee); scenarios with massive Kingdee data volumes that call for BI incremental CDC; or sub-second real-time needs, which belong on a message queue, not a scheduled poll.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mysql-kingdee-cloud-4210-n5b11d867-f003ca50

Comments