Qeasy Cloud
Get Started

Purchase Order Cancellation Sync: Incrementally Pushing Close-Status Triggers to the Target System

· 吕修远· Integration Solutions· 10 views· 4 min read
WDTKingdee Cloud采购订单同步供应链集成轻易云轻易云Qeasy

What This Strategy Solves

In retail and distribution scenarios, purchase orders are typically created and approved in the ERP (Kingdee Cloud) first, then handed off to the e-commerce fulfillment system (Wangdiantong Flagship Edition). If an already-approved purchase order is manually closed on the ERP side, the downstream system will keep moving forward with receiving, warehousing, and even payment unless it is notified — leading to inflated inventory and capital risk.

The "Purchase Order Cancel – Cancel Parameter 0" strategy does exactly this: it pushes Kingdee Cloud purchase orders whose FCloseStatus='B' (closed) to Wangdiantong, which then executes the cancellation with operate_type=0. It is a one-way, lightweight, status-triggered pipeline, designed to keep cancellation actions as real-time and traceable as possible without relying on a human clicking twice across both systems.

Data Flow and Field Mapping

The overall flow is Kingdee Cloud → Wangdiantong Flagship Edition, handled at the document level without splitting into line items.

DimensionSource (Kingdee Cloud)Middle Layer (Qeasy)Target (Wangdiantong Flagship Edition)
Document keyFBillNo (Bill No.)Pass-throughpurchase_no_list (Purchase No. list)
Operation type—Constant mappingoperate_type = 0
Cancel-checked control—Constant mappingallow_cancel_checked_order = 1
Trigger conditionFCloseStatus='B' AND FCloseDate>=last sync timeIncremental cursor—
Org scopeFPurchaseOrgId.FNumber fixed valueCondition filter—

The source API is Kingdee's executeBillQuery (QUERY), and the target API is Wangdiantong's purchase.PurchaseOrder.cancelByType (EXECUTE). This pair is a classic "QUERY pull + EXECUTE push" pattern.

How to Configure on Qeasy

On the Qeasy data integration platform, this kind of strategy is usually implemented as a data integration task, with these key configuration points:

  1. Source platform: Choose Kingdee Cloud, select the executeBillQuery API, and request return fields such as FBillNo, FID, FPOOrderEntry_FEntryId, and FSourceBillNo.
  2. Filter conditions: Hard-code FPurchaseOrgId.FNumber as a constant for the organization filter, set FCloseStatus='B' for the status filter, and use {{LAST_SYNC_TIME|datetime}} for the incremental time window.
  3. Field mapping: Map FBillNo → purchase_no_list directly via the {{FBillNo}} variable; set operate_type as the constant 0; set allow_cancel_checked_order as the constant 1.
  4. Target platform: Choose Wangdiantong Flagship Edition, select the purchase.PurchaseOrder.cancelByType API with a POST method.
  5. Response handling: Use the status field to judge success — status=0 is treated as normal; when it is non-zero, push the message to logs and alerts for troubleshooting.

One thing worth mentioning: a common pattern among Qeasy customers for handling "code mapping" is centralized management + per-strategy reference. Cancellation strategies themselves do not maintain supplier or material code mappings. Instead, the purchase order create/modify strategies are responsible for laying down the base archive mappings first, while this strategy only takes on the lightweight responsibility of "document number association" — keeping the pipeline clean.

Implementation Steps

  • Step 1: Confirm the upstream "closed" semantics Align with the business owner on whether FCloseStatus='B' truly represents the business meaning of "closed." If not, the downstream cancellation timing will be wrong.
  • Step 2: Run a full-volume probe Trigger the QUERY manually in Qeasy once, pull all closed documents from the recent N days, and verify that the FBillNo actually exists in Wangdiantong before enabling the schedule.
  • Step 3: Set the incremental starting point Use FCloseDate >= {{LAST_SYNC_TIME|datetime}} as the incremental cursor. For the first run, manually specify a clear start time to avoid replaying historical baggage all at once.
  • Step 4: Configure the scheduling cadence The source is recommended at */14 7-20 * * * (every 14 minutes between 7:00–20:00 daily), and the target at */15 7-20 * * *. The two sides are staggered by 1 minute to avoid duplicate processing caused by concurrent runs in the same second.
  • Step 5: Watch the logs for three days after go-live Focus on cases where status ≠ 0, especially errors like "the purchase order number cannot be found in Wangdiantong" — this typically happens when the upstream cancels before the downstream creates, leading to mismatched document numbers.

Lessons Learned

  1. Forgetting the organization filter A common mistake is to filter only by FCloseStatus='B', which ends up pushing closed documents from other purchase organizations. The safer approach is to include FPurchaseOrgId.FNumber in the filter as well — better strict than loose.
  2. Choosing the wrong field for the incremental cursor Some people try to save time by using FModifyDate for the increment, but when the modification date is later than the close date, newly closed documents get missed. Use the business event field: for cancellation scenarios, that is FCloseDate.
  3. Confusing it with "Cancel Parameter 1" There is also a strategy with operate_type=1 in the same business module. The semantics of 0 and 1 differ on the Wangdiantong side, so in Qeasy they must be distinguished clearly by strategy name. Do not share a single task — otherwise one wrong constant breaks both.
  4. Assuming idempotency Although the incremental condition prevents duplicate processing, the same document can still be pulled across day or timezone boundaries. The safer approach is to enable a dedup key in the Qeasy task (usually FBillNo), and then confirm on the target side whether Wangdiantong returns idempotently for already-cancelled orders.
  5. Only checking HTTP success, not the business status Wangdiantong returns HTTP 200 even when the business operation fails. You must parse the status field. When status ≠ 0, push the message to alerts — do not rely solely on the HTTP layer.

Applicable vs. Non-Applicable Scenarios

Applicable: Pipelines where the ERP "close" semantics equal "cancel" and the downstream has a dedicated cancel API; lightweight scenarios where cancellation happens at the document level without per-line re-approval.

Not applicable: Line-level scenarios requiring partial cancellation of individual entries; pipelines where the upstream close status is unreliable or where upstream and downstream document numbers do not correspond one-to-one; or middle-platform architectures requiring bi-directional sync and strong reconciliation consistency.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-wdt-kingdee-cloud-2161-nd67434b4-6716511a

Comments