Qeasy Cloud
Get Started

Syncing Online Sales Return Orders from JikuYun to Kingdee Cosmos: A Single-Strategy Integration Guide

· 吕修远· Integration Solutions· 12 views· 5 min read

What This Strategy Solves

E-commerce channels (such as Tmall, JD, and Pinduoduo) generate a steady stream of online sales returns every day, and those returns need to land in the ERP as sales return documents so that inventory can be reversed and finance can close the loop. In one real rollout with a retail customer, the source side had already approved return orders, but the ERP never received matching sales return documents, which inflated on-hand inventory and broke the books. This strategy does one focused thing: it pulls online sales return orders from the source commerce system (filtering trade types 8 for sales returns and 12 for online exchanges and reships), uses the after-sales order number sourceAfterNo as the document number, and submits the result to the ERP sales return document (SAL_RETURNSTOCK) with auto-submit and auto-audit enabled.

Data Flow and Field Mapping

The end-to-end flow is: source commerce platform (QUERY) → Qeasy data integration platform (mapping layer) → Kingdee Cosmos (EXECUTE). On the source side, the strategy calls jackyun.tradenotsensitiveinfos.list.get and pulls incrementally by consignment time window. On the target side, it calls batchSave against the SAL_RETURNSTOCK form and lets the ERP auto-submit and auto-audit the result.

Core field mapping (full mapping lives in the source/target metadata files):

Source fieldTarget fieldMapping typeNotes
sourceAfterNoFBillNoDIRECTAfter-sales order number becomes the document number
consignTimeFDateDIRECTConsignment / return time becomes the business date
shopCodeFRetcustIdDIRECTShop code maps to the return customer
—FBillTypeIDCONSTANTFixed value XSTHD01_SYS
onlineTradeNoFHeadNoteDIRECTPlatform order number written into the header note
goodsDetail[]FEntity[]COLLECTIONGoods detail array maps row-by-row to return entries
goodsDetail.goodsNo / barcode / outerIdFMaterialIdTRANSFORMSKU / goods code / barcode → Kingdee material code
goodsDetail.actualSendCount / sellCountFQtyDIRECT / TRANSFORMReturn quantity
goodsDetail.sellPriceFPriceDIRECTUnit price
goodsDetail.sellTotalFAmountDIRECTAmount
goodsDetail.unitFUnitIDDIRECTUnit of measure
goodsDetail.taxRateFEntryTaxRateDIRECTEntry-level tax rate
goodsDelivery.batchNoFLOTDIRECTBatch number for batch-managed materials
goodsDelivery.productionDateFProduceDateDIRECTProduction date
goodsDelivery.expirationDateFEXPIRYDATEDIRECTExpiry date

How to Configure It on Qeasy

When this strategy is implemented on the Qeasy data integration platform, the configuration follows these typical points:

  1. Source metadata: Register the source commerce platform and wire jackyun.tradenotsensitiveinfos.list.get as a QUERY API, with tradeNo as the business key and idCheck=true. Set startConsignTime to {{DAYS_AGO_1|datetime}} and endConsignTime to {{CURRENT_TIME|datetime}}, filter with tradeTypeList=8,12 and isDelete=0, and list every required field in fields (including goodsDetail.*, goodsDelivery.*, shopcode, onlineTradeNo, and consignTime).
  2. Target metadata: Register the ERP and wire batchSave as an EXECUTE API against form SAL_RETURNSTOCK, with IsAutoSubmitAndAudit=true, IsVerifyBaseDataField=false, and SubSystemId=21.
  3. Centralized code mapping: Manage the shop-to-customer, SKU-to-material, and unit-to-UOM mappings in one place using _findCollection joins or _mongoQuery lookups, so that multiple strategies can reuse the same reference data. This is one of the common patterns we see on Qeasy customer projects.
  4. Entry-level mapping: Loop the goodsDetail array to generate FEntity entries one by one. When batch management is enabled, prefer goodsDelivery.sendCount as the return quantity and join the batch detail by subTradeId.
  5. Script logic: No custom script is required for this strategy; the platform's default mapping rules are sufficient.

Implementation Steps

The rollout cadence in a typical project looks like this:

  1. Stage 1 — Master data first. Confirm that materials, customers, units of measure, and warehouses already exist in the ERP, and that the shop-to-customer and SKU-to-material reference tables are loaded into the mapping center. Without that, return documents will fail even when the document itself is correct.
  2. Stage 2 — Set the incremental anchor. For the first cutover, set startConsignTime to the earliest business-required date (for example, seven days before go-live) and run a one-shot historical backfill; then switch back to incremental mode and roll forward by consignment time window.
  3. Stage 3 — Scheduling. Use a source cron of 1-59/45 7-22 * * * (every 45 minutes from 07:00 to 22:00) and a target cron of 3-59/25 7-22 * * * (every 25 minutes from 07:00 to 22:00). Staggering the two windows smooths out the return flow.
  4. Stage 4 — Post-go-live verification. Pull three to five sample documents and reconcile FBillNo, FDate, FRetcustId, entry count, and amount, then confirm that the ERP has auto-audited them.
  5. Stage 5 — Exception handling. Configure retries and alerts for failed documents, and triage errors by category (missing master data, missing code mapping, batch conflict, and so on).

Lessons Learned

  1. Missing material code mapping. The most common pitfall is a broken SKU-to-material mapping, which silently drops entire return entries. Keep the mapping centralized and trigger an alert when a code is missing instead of skipping the line.
  2. Wrong return quantity. When batch management is enabled, goodsDetail.sellCount and goodsDelivery.sendCount can diverge. A typical mistake is to take sellCount directly, which yields incorrect quantities for batch-managed materials. The safe approach is to take goodsDelivery.sendCount first and join by subTradeId.
  3. Incremental window drops data. With incremental pulls by consignment time, the endConsignTime must leave a buffer (for example, CURRENT_TIME rather than the previous day's 23:59) or the tail end of a busy return window will be missed.
  4. Duplicate document numbers. sourceAfterNo must be globally unique, otherwise the ERP will reject the save on a duplicate FBillNo. Enable idCheck=true on Qeasy and use sourceAfterNo as the idempotency key.
  5. Misidentified return customer. For online returns, the shop is the return party, so shopCode must map to a customer record already created in the ERP rather than to the end buyer's account, or finance will not reconcile.

Where This Fits and Where It Does Not

Good fit: e-commerce returns that need to land in the ERP as sales return documents for inventory reversal and finance posting, where the source supports incremental pulls by consignment time and exposes goods and batch detail. Not a good fit: offline store returns that are not online trade types, scenarios that require explicit approval routing instead of auto-audit, and return businesses that need special cost treatment beyond the standard sales return document — those need extra strategies or custom scripts.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p2ea595-kingdee-cloud-3711-nabe54c90-11870f77

Comments