Qeasy Cloud
Get Started

Practical Guide: Syncing Cancelled Shipments from a Marketplace OMS Sales Outbound to an On-Prem ERP Sales Delivery Note via Qeasy

· 何海波· Integration Solutions· 11 views· 4 min read

What This Strategy Solves

Cancelled shipments after a parcel has been dispatched are one of the most frequent exceptions in stall-style retail. We need this state change reflected from the marketplace-side sales outbound note to the on-prem ERP sales delivery note, otherwise the two ledgers drift, inventory rollbacks go wrong, and invoice/shipping references diverge. The source material describes exactly this strategy: sales outbound note (cancel-shipment path) from the e-commerce OMS to the on-prem ERP sales delivery note. On the Qeasy Data Integration Platform, we implement it as an observable, rerunnable, traceable strategy task — not as two polling scripts sitting in each system.

Data Flow and Field Mapping

The data flow is one-way: Source OMS → Qeasy middleware → Target ERP. The middleware handles three jobs: code mapping, field normalization, and state arbitration.

Reference mapping for key fields:

SemanticSource (OMS)Qeasy MiddlewareTarget (ERP)
Document no.jstSalesOutNodoc_no (unified)code
Document statestatus (incl. cancel/void)state (normalized enum)vchstate / cancel_flag
Warehousewarehousewhs_code (mapped)whcode
Item codeskuitem_idinvcode
Quantityqtyqty (sign preserved)quantity (negative on cancel)
Customer codeshop_idcust_idcustomercode
Cancel reasoncancel_reasonreason_textmemo
Change timemodifiedtsmodifytime

Two important conventions: a cancel-shipment is not a physical delete; on the target side it produces a reversing or negative record, and inventory flows back as a negative. This is the root cause behind most of the pitfalls below.

How to Configure on Qeasy

We use the Qeasy Data Integration Platform to host this strategy. There are four configuration blocks in order:

  1. Source connector: Pick the OMS sales outbound API and pull by modified-time incremental. The Qeasy source component already wraps the OMS auth and pagination; we just configure warehouse, shop, and state filters.

  2. Target writer: Write to the ERP sales delivery note. The Qeasy target component handles add and void by voucher state, calling the ERP's open API. A common pattern we see across Qeasy customers is "header and body in separate stages": commit the header first, confirm the document exists on the target side, then commit body quantities, then write back state.

  3. Mapping layer: Centralized code mapping is something almost every Qeasy customer adopts. Warehouse, item, and customer codes all live in a mapping table, not hard-coded in scripts. The day a new stall warehouse comes online, you change one row of mapping instead of releasing a new build.

  4. State arbitration: Add a branch in the Qeasy strategy orchestration: when the source state is "cancelled", go to the reversing branch and emit negative quantities; when it is "normal outbound", go to the normal branch. Both branches share the same field mapping to avoid duplicate maintenance.

Implementation Steps

We recommend pushing this strategy out in three stages:

Stage 1 — Incremental starting point. Run only the cancel-shipment incremental through Qeasy first. Use the last 7 days of real cancel documents as samples, and confirm the target-side reversing records are correct and the inventory direction is as expected. No scheduling in this stage — the engineer triggers manually so rollback is trivial.

Stage 2 — Full-volume trigger. Once incremental is stable, replay all historical documents in "cancelled" state in batches. Qeasy's batch component supports time-window slicing; after each batch, reconcile document states on both sides. The stable pattern here is incremental and full-volume running in parallel — incremental handles real-time, full-volume handles historical consistency.

Stage 3 — Schedule frequency. Cancel-shipment has moderate real-time requirements, so we suggest a 5–10 minute cycle. Configure it as a crontab in Qeasy, paired with a source-side modified-time watermark. If the business volume is low, hourly is also acceptable, but you must add an alert for cancel documents delayed more than 30 minutes so support tickets don't pile up.

Pitfall Review

  1. Treating cancel as delete. A typical mistake is to void the target document directly. The safe pattern is to emit a negative reversing record while preserving the original — otherwise the document simply disappears from the back office and finance cannot trace it.

  2. Code mapping scattered across scripts. This strategy touches three sets of codes: warehouse, item, customer. Once mapping is scattered across multiple scripts, the next new warehouse is guaranteed to be missed on one side. The Qeasy customer convention is to centralize mapping in the platform's mapping table with change audit.

  3. Wrong incremental starting point. If you incremental on document create time, cancel-shipment events will be missed — they happen after creation. The safe pattern is to incremental on modified time and only pick records whose state field has actually changed.

  4. Ignoring partial cancellation. Stall business often sees only some lines cancelled on a single outbound note. If you arbitrate only at the header level, you get dirty data where some lines are cancelled and others are not. You need per-line arbitration at the body level, not a header-level one-shot cut.

  5. No idempotency protection. On a rerun, the target side may produce duplicate negative records. In Qeasy orchestration, use the document number as the idempotency key and check whether a reversing record already exists on the target before replaying.

When to Use and When Not to Use

Use when: marketplace front-end and ERP back-end must stay consistent on sales delivery notes, and there are cancel-shipment, partial cancel, address-change amend scenarios — typical of retail and stall business. Do not use when: pure offline wholesale, pure domestic distribution with no marketplace front-end, or when the target ERP cannot reverse and can only void a whole document — the latter must be remediated on the ERP side before any integration goes in.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p9210a3-jushuitan-9687-g-f-f16e82df

Comments