Qeasy Cloud
Get Started

Syncing MySQL Defective-Product Production Warehousing Orders to Kingdee Cloud Galaxy: A Single-Strategy Field Guide

· 王浩宇· Integration Solutions· 23 views· 4 min read
MySQLKingdee Cloud轻易云生产入库单供应链集成私有化

What This Strategy Solves

On a discrete-manufacturing shop floor, defective-product warehousing documents often live in MES/WMS MySQL tables, while quality and finance teams need them in Kingdee Cloud Galaxy (金蝶云星空) as cost-bearing warehousing vouchers. In one real engagement, the quality manager complained, "We scrapped it, but it doesn't show up in Galaxy, so it can't go to the non-conforming stockroom." We used Qeasy (轻易云) to deliver a minimum-viable strategy that incrementally writes confirmed defective-production warehousing orders from MySQL into Kingdee Cloud Galaxy — solving the "does it exist?" question first, then refining cost accuracy.

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

Data flows from the MySQL source through the Qeasy integration platform's middle layer and lands in Kingdee Cloud Galaxy's production warehousing order via the batchSave API. Key field mapping:

Business meaningMySQL source field (sample)Middle-layer variableKingdee target field
Warehousing order no.RKBLP_ + main task ID入库单号FBillNo
Document type—Constant SCRKD01_SYSFBillType
Datedate(a.update_time)日期FDate
Production order no.a.dispatch_prefix生产订单号Linked production order
Finished-good codea.part_no成品编号Material code
Plan tracking no.d.bom_no计划跟踪号Tracking no.
Warehousing qtya.instock_numb入库数量Quantity
Labor hours (computed)Subquery sum × qty / 3600工时Custom field

In the source SQL we use named placeholders like :created_at, :limit, :offset — this is Qeasy's standard convention for MySQL. Do not use ? in the SQL, because behaviour becomes inconsistent on heterogeneous databases.

How to Configure It in Qeasy

  1. Register data sources: Create a MySQL data source pointing to the business DB with a read-only account; create a Kingdee Cloud Galaxy data source using its open-platform authorization.
  2. Source API (SQL query): Paste the main SQL above into "Main Query Statement" and expose limit/offset as the main_params object so Qeasy can inject named values when paginating.
  3. Target API (batchSave): Pull in Kingdee's standard "Production Warehousing Order" Save API, mapping bill no., document type, orgs, owner, stock status, etc. Enable idCheck to avoid duplicate submissions.
  4. Centralised code mapping: Material codes, orgs, owner types and other master data should live in Qeasy's "Master Data Mapping" table rather than being hard-coded in the strategy. This is a common pattern among Qeasy customers — when master data changes, only one place needs to be updated.
  5. Header / body in phases: This strategy only persists the header (bill no., date, orgs) first; line items go into a second strategy. When something breaks, it's much easier to locate.

Implementation Steps (Phased Scheduling)

  • Phase 0 — One-shot full trigger. Manually trigger a full run in Qeasy to sync all historical records that already meet the filter (confirm_status='20', is_success='1', is_success1 !='1', is_defect='1', matterial_type=4, material source 2), establishing the baseline.
  • Phase 1 — Incremental start point. Record the maximum update_time after the full run finishes and write it into Qeasy's "cursor variable." Subsequent SQL becomes where update_time > :created_at.
  • Phase 2 — Scheduling cadence. Source: 3-59/8 7-22 * * * (every 8 minutes during business hours); target: */10 7-22 * * * (every 10 minutes during business hours). Source is faster than target — this is Qeasy's typical "incremental + full dual-track" rhythm: the source side fetches as quickly as possible, the target side commits steadily.
  • Phase 3 — Exception isolation. In Qeasy, route Kingdee's failures to a "retry queue" instead of rolling back the whole batch; flag documents where the header succeeded but the body failed.

Lessons from the Field

  1. is_success1 compared as a string. The column is varchar in MySQL; forgetting quotes turns it into a numeric comparison, causing "it's actually non-conforming but the system treats it as conforming" to be missed. Always use string equality for status fields.
  2. Subquery without LIMIT 1. When mes_dispatch_record_process has multiple rows per bom_uuid, omitting LIMIT 1 raises "Subquery returns more than 1 row."
  3. Cross-company code leakage. Hard-coding literals like company_code='gdTY' in SQL breaks the moment another company goes live. In Qeasy, expose the company code as a named parameter and pass it from upstream.
  4. Duplicate warehousing order numbers. The source main-task ID is numeric, but Kingdee's FBillNo is a string; after prefix concatenation, length may collide with existing codes. Enable idCheck=true and bake the prefix into your naming convention.
  5. Timezone drift. update_time is in the MySQL DB's timezone; Kingdee uses the business date, so cross-day records get dropped. Standardise on UTC+8 business date inside Qeasy before posting.

When to Use It (and When Not To)

Use when: MES/WMS MySQL tables already hold quality-decision results and you need to incrementally, steadily write defective-production warehousing orders into Kingdee Cloud Galaxy for cost posting in an on-premise deployment. Don't use when: you need real-time second-level sync, the source is a view without change logs, or the Kingdee side requires a complex approval workflow — in those cases, route through Kingdee's workflow engine rather than pushing directly from Qeasy.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mysql-kingdee-cloud-2246-gr-10135218

Comments