Purchase Order Cancellation Sync: Incrementally Pushing Close-Status Triggers to the Target System
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.
| Dimension | Source (Kingdee Cloud) | Middle Layer (Qeasy) | Target (Wangdiantong Flagship Edition) |
|---|---|---|---|
| Document key | FBillNo (Bill No.) | Pass-through | purchase_no_list (Purchase No. list) |
| Operation type | — | Constant mapping | operate_type = 0 |
| Cancel-checked control | — | Constant mapping | allow_cancel_checked_order = 1 |
| Trigger condition | FCloseStatus='B' AND FCloseDate>=last sync time | Incremental cursor | — |
| Org scope | FPurchaseOrgId.FNumber fixed value | Condition 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:
- Source platform: Choose Kingdee Cloud, select the
executeBillQueryAPI, and request return fields such asFBillNo,FID,FPOOrderEntry_FEntryId, andFSourceBillNo. - Filter conditions: Hard-code
FPurchaseOrgId.FNumberas a constant for the organization filter, setFCloseStatus='B'for the status filter, and use{{LAST_SYNC_TIME|datetime}}for the incremental time window. - Field mapping: Map
FBillNo → purchase_no_listdirectly via the{{FBillNo}}variable; setoperate_typeas the constant0; setallow_cancel_checked_orderas the constant1. - Target platform: Choose Wangdiantong Flagship Edition, select the
purchase.PurchaseOrder.cancelByTypeAPI with a POST method. - Response handling: Use the
statusfield to judge success —status=0is treated as normal; when it is non-zero, push themessageto 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
FBillNoactually 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
- 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 includeFPurchaseOrgId.FNumberin the filter as well — better strict than loose. - Choosing the wrong field for the incremental cursor
Some people try to save time by using
FModifyDatefor 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 isFCloseDate. - Confusing it with "Cancel Parameter 1"
There is also a strategy with
operate_type=1in the same business module. The semantics of0and1differ 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. - 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. - Only checking HTTP success, not the business status
Wangdiantong returns HTTP 200 even when the business operation fails. You must parse the
statusfield. Whenstatus ≠ 0, push themessageto 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.