Syncing Online Sales Return Orders from JikuYun to Kingdee Cosmos: A Single-Strategy Integration Guide
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 field | Target field | Mapping type | Notes |
|---|---|---|---|
| sourceAfterNo | FBillNo | DIRECT | After-sales order number becomes the document number |
| consignTime | FDate | DIRECT | Consignment / return time becomes the business date |
| shopCode | FRetcustId | DIRECT | Shop code maps to the return customer |
| — | FBillTypeID | CONSTANT | Fixed value XSTHD01_SYS |
| onlineTradeNo | FHeadNote | DIRECT | Platform order number written into the header note |
| goodsDetail[] | FEntity[] | COLLECTION | Goods detail array maps row-by-row to return entries |
| goodsDetail.goodsNo / barcode / outerId | FMaterialId | TRANSFORM | SKU / goods code / barcode → Kingdee material code |
| goodsDetail.actualSendCount / sellCount | FQty | DIRECT / TRANSFORM | Return quantity |
| goodsDetail.sellPrice | FPrice | DIRECT | Unit price |
| goodsDetail.sellTotal | FAmount | DIRECT | Amount |
| goodsDetail.unit | FUnitID | DIRECT | Unit of measure |
| goodsDetail.taxRate | FEntryTaxRate | DIRECT | Entry-level tax rate |
| goodsDelivery.batchNo | FLOT | DIRECT | Batch number for batch-managed materials |
| goodsDelivery.productionDate | FProduceDate | DIRECT | Production date |
| goodsDelivery.expirationDate | FEXPIRYDATE | DIRECT | Expiry date |
How to Configure It on Qeasy
When this strategy is implemented on the Qeasy data integration platform, the configuration follows these typical points:
- Source metadata: Register the source commerce platform and wire
jackyun.tradenotsensitiveinfos.list.getas a QUERY API, withtradeNoas the business key andidCheck=true. SetstartConsignTimeto{{DAYS_AGO_1|datetime}}andendConsignTimeto{{CURRENT_TIME|datetime}}, filter withtradeTypeList=8,12andisDelete=0, and list every required field infields(includinggoodsDetail.*,goodsDelivery.*,shopcode,onlineTradeNo, andconsignTime). - Target metadata: Register the ERP and wire
batchSaveas an EXECUTE API against formSAL_RETURNSTOCK, withIsAutoSubmitAndAudit=true,IsVerifyBaseDataField=false, andSubSystemId=21. - Centralized code mapping: Manage the shop-to-customer, SKU-to-material, and unit-to-UOM mappings in one place using
_findCollectionjoins or_mongoQuerylookups, so that multiple strategies can reuse the same reference data. This is one of the common patterns we see on Qeasy customer projects. - Entry-level mapping: Loop the
goodsDetailarray to generateFEntityentries one by one. When batch management is enabled, prefergoodsDelivery.sendCountas the return quantity and join the batch detail bysubTradeId. - 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:
- 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.
- Stage 2 — Set the incremental anchor. For the first cutover, set
startConsignTimeto 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. - 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 of3-59/25 7-22 * * *(every 25 minutes from 07:00 to 22:00). Staggering the two windows smooths out the return flow. - 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. - 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
- 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.
- Wrong return quantity. When batch management is enabled,
goodsDetail.sellCountandgoodsDelivery.sendCountcan diverge. A typical mistake is to takesellCountdirectly, which yields incorrect quantities for batch-managed materials. The safe approach is to takegoodsDelivery.sendCountfirst and join bysubTradeId. - Incremental window drops data. With incremental pulls by consignment time, the
endConsignTimemust leave a buffer (for example,CURRENT_TIMErather than the previous day's 23:59) or the tail end of a busy return window will be missed. - Duplicate document numbers.
sourceAfterNomust be globally unique, otherwise the ERP will reject the save on a duplicateFBillNo. EnableidCheck=trueon Qeasy and usesourceAfterNoas the idempotency key. - Misidentified return customer. For online returns, the shop is the return party, so
shopCodemust 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.