Qeasy Cloud
Get Started

WMS Purchase Return Confirmation to Kingdee Cloud Return Material Order: A Practical Integration Guide

· 卢剑航· Integration Solutions· 8 views· 4 min read

What This Strategy Solves

Syncing confirmed purchase returns from the warehouse system to the financial system looks like "writing the same document twice," but if codes, organizations, and return types are not aligned, after three months the numbers on both sides will not match and finance and warehousing will point fingers at each other. The goal of this strategy is: take the confirmed purchase return documents from the WMS side and, according to established code and organization rules, automatically create Kingdee Cloud's purchase return material documents, so both sides are traceable and reconcilable.

Data Flow and Field Mapping

The overall flow is "source system → middleware → target system." WMS acts as the source, pulling confirmed return documents (deliveryOrder) via WebAPI; Kingdee Cloud acts as the target, using the batchSave interface to write the return material documents. The middleware layer handles three things: code conversion, organization lookup, and field assembly.

Below is the comparison of key fields (only the parts that tend to cause trouble in practice):

Business MeaningWMS SourceKingdee Target FieldKey Points
Document NumberdeliveryOrder.deliveryOrderIdFBillNoUse the WMS return order number as the Kingdee document number for easy reverse lookup
Document Type—FBILLTYPEIDFixed value TLD01_SYS; return document type must not be confused
Return OrgdeliveryOrder.deliveryOrderCode lookupFStockOrgIdUse _findCollection to look up the upstream purchase org code in Kingdee
Return DatedeliveryOrder.orderConfirmTimeFDateUse the WMS confirmation time, not the document creation time
Return Type—FMRTYPEFixed value B (return material); distinguish from return to stock
Settlement Org—FSettleOrgIdKeep consistent with the return org, otherwise settlement will be affected

How to Configure on Qeasy

We use the Qeasy data integration platform to carry this link. The configuration is divided into three parts: source metadata, target metadata, and the strategy itself.

In the source metadata, select a query-type WebAPI such as sys.goods.owner.query, set effect to QUERY, and fix the query conditions like sid in the request body. One thing to note is to turn on autoFillResponse in Qeasy, which makes the debugging phase much smoother.

The target metadata corresponds to Kingdee's batchSave, with effect set to EXECUTE. A few points that easily cause trouble: first, lookup expressions like _findCollection should be written in Qeasy as "find a field from the intermediate storage" form, and it is recommended to make the source document number being looked up an intermediate variable; second, fields with default values (FBILLTYPEID, FMRTYPE) should be written as constant strings, not taken from the source, to avoid dirty source data skewing the target.

The key to the strategy itself is scheduling—the source side has a manual-style cron like "1 1 1 1 1", and the target side has "1-59/3 * * * *" every 3 minutes. The two should not be mixed. It is recommended to split this into two-stage scheduling in Qeasy: "source trigger → write intermediate storage → target reads on a rhythm."

Implementation Steps

Phase 1: Full sync to establish a reconciliation baseline. Before going live, run a full sync in the test environment, pushing all confirmed return documents from the WMS for the past N days, generating a batch of return material documents on the Kingdee side. Work with the customer to check the document number, return org, return type, and return date one by one to confirm the mapping is correct.

Phase 2: Switch to incremental. The incremental start point is based on the orderConfirmTime of the return document on the WMS side. In Qeasy, usually a combination of "last successful sync time + document status = confirmed" is used to avoid pushing unconfirmed documents over.

Phase 3: Steady-state scheduling. The target side runs every 3 minutes, and the source side triggers according to the business rhythm. After running for a week, do a review: how many differences in document count, status, and organization exist on both sides. After the differences converge, hand over to operations.

Pitfall Review

  1. Return org lookup fails. FStockOrgId uses _findCollection to look up the upstream purchase org code in Kingdee. If the upstream purchase inbound document has not been synced yet, the lookup will return empty. The safe approach is to make the return sync depend on the purchase inbound sync, so the upstream chain is connected first.

  2. Return date used creation time. A typical mistake seen at customer sites—the document's confirmation time was changed, but the creation time was not, resulting in the Kingdee return date being several days off from the actual business date. Always use orderConfirmTime.

  3. Document type was skewed by the source. If the source sends over a seemingly reasonable type value, the target will accept it as-is. For strongly business-semantic fields like FBILLTYPEID and FMRTYPE, it is recommended to hardcode them as constants in Qeasy and not do mapping.

  4. Code mapping not centrally managed. A common response pattern among Qeasy customers is to maintain all code mappings in a single mapping table, not scattered across strategies. If you step on this pitfall here, you'll rewrite it again on the next strategy, and three months later no one will remember where it was changed.

  5. Full sync and incremental run together. During the full data backfill, if the incremental is not stopped, the same document will be pushed twice, and Kingdee will either error out or generate duplicate documents. The safe approach is to stop the incremental during the full sync, and only turn it back on after the full sync is done and the differences are checked clearly.

Applicable and Non-Applicable Scenarios

Applicable: Retail or manufacturing enterprises where both WMS and Kingdee Cloud are already online, the purchase return process is confirmed on the WMS side, the return org and purchase org are in the same tree, and the return document volume is stable and can be scheduled on a rhythm.

Not applicable: Scenarios where the return org crosses organizations, where multi-level approval is needed before writing to Kingdee, or where the return document needs to be manually modified on the Kingdee side and then synced back to WMS. These cases require more complex two-stage sync and are not covered by this strategy.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-wms-kingdee-cloud-3149-wms-kd-05fa41cf

Comments