Qeasy Cloud
Get Started

Refund Order Query Strategy in Practice: A Detailed Configuration Guide for Supply Chain Integration from JKEY to Kingdee Cloud Flagship Edition

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

What This Strategy Solves

In a private deployment environment, a certain retail enterprise uses JKEY to manage front-end e-commerce operations and Kingdee Cloud Flagship Edition for financial accounting and back-end supply chain. After refund documents are generated in JKEY, the refund details, amounts, and associated sales order information need to be stably synchronized to the Kingdee side to form corresponding red-letter business documents, serving as the basis for subsequent financial write-offs and inventory rollback. It may seem like merely "pulling the orders over," but if the query strategy is not designed well—for example, if the time window is inaccurate or status filtering is missing—refund data will either be lost or duplicated, and financial reconciliation will keep getting stuck.

Data Flow and Field Mapping

This strategy adopts a three-stage architecture: "source system pull → Qeasy middleware → target system landing." The source end pulls the refund order list through the JKEY open interface ass-business.refund.listRefundInfo, and the target end writes the corresponding refund business documents on the Kingdee Cloud Flagship Edition side. The middleware is responsible for advancing the time cursor, cleaning null values, and backfilling associated documents.

Key field mapping (source → middleware → target):

Business MeaningJKEY FieldMiddleware FieldKingdee Cloud Flagship Edition Field
Refund Order NumberrefundNorefund_noDocument Number (FBillNo)
Refund Primary KeyrefundIdrefund_idAssociated Source Document ID
Associated Sales Order NumbertradeNotrade_noSource Document Number
Modification Time (Incremental Cursor)startModified/endModifiedmodified_rangeQuery Interval
Refund StatusrefundStatusListrefund_statusDocument Status
Total Record Count SwitchhasGetTotalRecordsneed_totalPagination Basis

hasGetTotalRecords is critical in pagination scenarios: a common practice on the Qeasy platform is to set it to 1 in the first query to obtain the total, and set it to 0 in subsequent queries to reduce the source-end overhead.

How to Configure on Qeasy

On the Qeasy Data Integration Platform, this strategy is split into two core nodes: a "source query" and a "target writer."

  1. Source Query: Use the JKEY adapter, select the API ass-business.refund.listRefundInfo, with the request method as POST. Configure number as refundNo, id as refundId, and enable idCheck for deduplication. Select startModified/endModified as the incremental cursor fields.
  2. Middleware Processing: Complete encoding unification, time format standardization, and translate refundStatusList into business status codes recognizable by Kingdee through the field mapping and script nodes on Qeasy. A common practice among Qeasy customers is to consolidate all encoding mappings into a centralized "mapping table" for easier maintenance.
  3. Target Writer: Use the Kingdee Cloud Flagship Edition adapter and configure the write interface corresponding to the refund order. Since the target node in the material is actually a "write null operation," this is a very common pattern on Qeasy: first stably land the data in the middleware database (Qeasy datahub), and then have the downstream specific write strategy consume it again, thereby achieving the steady progress of "header and body phased" and "incremental and full dual-track."

Implementation Steps

We recommend advancing the scheduling in three stages:

  • Stage 1: Establishing the Incremental Starting Point. During the first run, manually specify a startModified timestamp (for example, the day before system launch) to ensure historical data is traceable; at the same time, enable hasGetTotalRecords=1 to verify whether the source-end total matches business expectations.
  • Stage 2: Full Trigger and Backfill. Run a full pull on the existing data, recommended during off-peak business hours; after the full pull is completed, switch the subsequent incremental cursor to the "last modification time" mode to avoid duplicate pulls.
  • Stage 3: Scheduling Frequency Going Live. The source-end crontab is configured as */30 * * * *, pulling every 30 minutes; the target-end crontab is configured as 23 2 * * *, landing centrally at 2:23 AM. The benefit of decoupling the two rhythms is: the source-end senses changes at high frequency, the target-end writes in batches during off-peak hours, and the pressure on the Kingdee account set is smaller.

Pitfall Review

  1. Time Window Reversed. Once startModified and endModified are reversed, the source end will return an empty set without reporting an error, and the link will fail silently. The steady approach is to add an assertion script on Qeasy to verify that start < end and the span does not exceed 7 days.
  2. Status Filter Too Broad. Leaving refundStatusList empty will pull documents in "draft" and "voided" statuses, causing errors when writing downstream. It is recommended to only pass the two enum values of "audited" and "completed."
  3. idCheck Not Enabled or Wrong Field Selected. idCheck is the idempotent key at the Qeasy level, and the material states it is refundId, but for some customers, refundNo is the invariant. Be sure to use the "field that will not change on the business side" as the idempotent key; otherwise, once the source end changes a certain field, the same document will be mistakenly treated as a new document and written repeatedly.
  4. hasGetTotalRecords Set to 1 for a Long Time. The total can be obtained in the first round for reconciliation, but setting it to 1 during daily scheduling will unnecessarily increase the source-end load. It is recommended on Qeasy to use variables to control setting it to 1 for the first time and to 0 thereafter.
  5. Target Node Using "Write Null Operation" Misunderstood. Some engineers think this step does nothing, but it actually stably lands the data in the datahub middleware layer; the actual Kingdee write downstream should be configured as a separate strategy that depends on this strategy, ensuring decoupling and re-runnability between upstream and downstream.

Applicable and Non-Applicable Scenarios

This strategy is applicable to scenarios where after-sales refund documents need to form a steady-state synchronization of "queryable at the source end, write-off capable at the target end" between heterogeneous systems, especially the typical private deployment form of e-commerce front-end + ERP back-end. It is not applicable for: refund status write-back with extremely high real-time requirements (second-level), scenarios where refunds and inventory are strongly coupled requiring transactional consistency, and one-time large-batch historical data migration—the latter is recommended to use a dedicated full initialization strategy rather than timed increment.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p2ea595-p4a143d-3954-nc686c151-014d304c

Comments