Qeasy Cloud
Get Started

Practical Tutorial: Querying Kingdee Cloud Unit Master Data via ExecuteBillQuery on Qeasy

· 陈洁琳· Integration Solutions· 10 views· 5 min read
吉客云Kingdee CloudexecuteBillQuery单位主数据Incremental Sync轻易云供应链集成

What This Strategy Solves (Scenario & Value)

Unit master data is the "measurement backbone" of supply chain integration: piece counts on purchase orders, box counts on sales orders, and conversion ratios on inventory transfers all rely on a stable unit archive. In a real project, we faced a bi-directional supply chain integration between Jike Cloud and Kingdee Cloud for a retail enterprise—Kingdee held the group-wide unit archive as the source of truth, while the e-commerce side on Jike Cloud consumed that data. On the surface it looks like "just pull the units across," but if code mapping, incremental anchors, or filter conditions are not designed carefully, the numbers on both sides drift within three months and SKU conversions fall apart.

This strategy does exactly one thing: pull unit master data from Kingdee Cloud into the Qeasy Data Integration Platform's middle layer on an incremental time window, so that downstream strategies (such as "Jike Cloud Unit Sync") can read directly from it. The source system owns authority, the middle layer owns freshness, and the target system consumes on demand—this is the "centralized code mapping" pattern we commonly see among Qeasy customers, applied to the most basic query layer.

Data Flow & Field Mapping

The overall flow is Kingdee Cloud → Qeasy middle layer → downstream consumer strategies. This strategy only completes the first two legs.

The source side queries via Kingdee's ExecuteBillQuery interface (POST) with conditions; the target side writes into the Qeasy middle layer via the batchSave API. Key field mapping:

ConcernSource (Kingdee ExecuteBillQuery)Middle Layer (Qeasy datahub)
MethodPOST, type QUERYPOST, type EXECUTE (BatchSave)
Primary keyFNumberid
Uniqueness checkidCheck: trueidCheck: true
PaginationLimit, StartRow, TopRowCountNo pagination, batch write
Incremental filterFilterString: `FApproveDate>='{{LAST_SYNC_TIMEdateTime}}'`
Form identifierFormId (unit archive form ID)FormId passed through
Write behavior—IsAutoSubmitAndAudit=true, IsVerifyBaseDataField=false

One important note: the source FieldKeys is a required array that declares which fields to return. For a unit archive you generally need at least FNumber, FName, FUnitGroupId.FNumber, FMasterId.FNumber—miss one and downstream conversions are incomplete.

How to Configure on Qeasy

Step 1, in Qeasy create a new strategy: source platform Kingdee.Cloud, target platform datahub (the platform itself as the middle-layer landing). Set strategy type to QUERY_ONLY and sequence to A, marking it as an upstream strategy that downstream write strategies depend on.

Step 2, on the source side set api to ExecuteBillQuery, and both number and id to FNumber. Limit references {{PAGINATION_PAGE_SIZE}} and StartRow references {{PAGINATION_START_ROW}}—Qeasy's paginator handles iteration automatically; you do not need to write a loop. TopRowCount set to 0 so Kingdee returns the total row count and the paginator can compute total pages.

Step 3, the core part: write FilterString as FApproveDate>='{{LAST_SYNC_TIME|dateTime}}'. There are two common mistakes here—FApproveDate is the approval date, not the creation date, and the variable must carry the |dateTime formatter, otherwise Kingdee throws a type error.

Step 4, on the target side set api to batchSave, with Operation fixed to BatchSave. If you want query results to be immediately usable after landing, set IsAutoSubmitAndAudit=true; if the downstream still needs code mapping or cleansing, leave it false to keep an intermediate state. IsVerifyBaseDataField defaults to false—for basic data such as units we generally do not validate again on the Kingdee side.

Step 5, scheduling: the source cron is */6 7-23 * * *—every 6 minutes during business hours, leaving the early morning window for full reconciliation; the target cron's 23 2 1 1 1 (02:23 on January 1) looks odd, but it is actually a hook Qeasy reserves for "annual full reset"—it does not fire during normal operation, only at the start of each year to clear and rebuild the middle layer.

Implementation Steps

We split the rollout of this strategy into three phases.

Phase 1: Establish the incremental anchor. On go-live day, first use a full-volume filter (e.g. FCreateDate>='some historical date') to pull the entire unit archive into the middle layer once, and record this moment as the initial value of LAST_SYNC_TIME. After that, all daily schedules run on FApproveDate>=LAST_SYNC_TIME incrementally. This is the common "incremental + full dual-track" approach among Qeasy customers.

Phase 2: Daily incremental. During business hours (07:00–23:00), every 6 minutes Kingdee returns unit records that are new or changed within the approval time window, and the Qeasy middle layer upserts by primary key FNumber. Downstream write strategies (for example, sync to Jike Cloud) consume the middle layer at their own pace and stay decoupled from this query strategy.

Phase 3: Annual full reconciliation. At 02:23 on January 1, the middle layer is cleared, the source switches to a full filter and re-pulls everything—this is a "statement-style" full rebuild. The daily incremental window then takes this full-volume end time as its new anchor.

Pitfalls We Hit On-Site

Pitfall 1: Using creation date instead of approval date. An early version wrote FCreateDate for simplicity, but Kingdee unit archives are often created first and approved later—unapproved dirty data flowed downstream, producing a pile of "ghost units" on the Jike Cloud side. The safe approach is to use FApproveDate and only take data that has been approved and is effective.

Pitfall 2: Forgetting |dateTime in FilterString. LAST_SYNC_TIME is a string by default, and Kingdee's ExecuteBillQuery is type-sensitive—passing it without the formatter returns empty results or errors. The first time you troubleshoot this, you will think the filter is wrong, but it is actually a type conversion issue.

Pitfall 3: Declaring FieldKeys without the unit group field. We once declared only FNumber and FName, missing FUnitGroupId.FNumber, and all downstream conversion relations broke. Kingdee's interface explicitly requires "declare every field you want to use"—missing even one breaks things; this is a classic mistake.

Pitfall 4: Defaulting IsAutoSubmitAndAudit to true. Unit master data looks simple, but Kingdee unit archives often carry approval flows, and auto-submit-and-audit bypasses the approval node, which is hard to explain during an audit. The safe default for the middle layer is false; only enable it after you have confirmed there is no approval flow downstream.

Pitfall 5: Source cron and target cron mismatch went unnoticed. We once saw this on-site: the source pulled every 6 minutes, but the target only wrote once a year. The middle layer appeared "almost never updated," and operations misdiagnosed it as a sync failure. Always document the dual-cron semantics clearly in the strategy description: source is "continuous pull," target is "periodic land."

When to Use and When Not to Use

Use it for: Unidirectional queries of basic master data such as units, currencies, tax rates, and measurement rules; scenarios where a unified middle layer feeds multiple downstream write strategies; businesses that need minute-level freshness and can tolerate a 6-minute window.

Do not use it for: High-frequency bi-directional sync (this strategy is one-way QUERY_ONLY); transactional documents that require transactional consistency (use a write strategy with submit-and-audit instead); early pilot Kingdee environments without a stable approval flow, where the filter cannot get a valid incremental window.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p2ea595-kingdee-cloud-9948-n3d60f438-183399df

Comments