Qeasy Cloud
Get Started

Assembly Order Sub-Items Sync from Kingdee Cosmos to Mabang: A Single-Strategy Deep-Dive Tutorial

· 卢剑航· Integration Solutions· 44 views· 3 min read
Kingdee Cloud马帮ERP组装单同步轻易云供应链集成父子单据

What This Strategy Solves (Scenario and Value)

In assembly-oriented businesses, assembly orders are high-frequency documents: Kingdee Cosmos carries the full parent–child structure, where the child lines are the items that actually leave the warehouse. The pain point is that the downstream fulfillment platform (Mabang) needs to generate outbound warehouse documents based on the assembly order's child items, so warehouse operations stay aligned with the ERP business events.

Our approach is to hand this single document-sync strategy over to the Qeasy data integration platform. On the source side, we use Kingdee's executeBillQuery to fetch the assembly order and its child items; on the target side, we call Mabang's warehouse-do-add-storage-out outbound API. The chain is short and the semantics are clear—synchronization starts only when the document status is "Approved", preventing orphan documents downstream.

Data Flow and Field Mapping

Data flow: Kingdee Cosmos (QUERY) → Qeasy middleware → Mabang (EXECUTE). The middleware handles parent–child expansion, child-line filtering, code mapping, and status write-back.

Key field mapping:

SemanticsKingdee Cosmos (Source)Mabang (Target)Processing Notes
Document No.FBillNoUsed as remark / traceability referenceNot written as the primary key
Document StatusFDocumentStatusFilter conditionOnly "Approved" passes through
Stock OrgFStockOrgId.FNumber—Used for warehouse mapping
WarehouseFStockIDSETY.FNumberwarehouseNameLook up warehouse name via _findCollection
RemarkFDescriptionSETYremarkPassed through directly
Child LinesFSubEntity_FDetailID etc.data.goods_listCarried as an array
Operator—employeeNameHard-coded as "Kingdee Doc Sync"

The tricky parts are "warehouse code → warehouse name" and "child-line array". The first is resolved in the mapping layer with Qeasy's _findCollection; the second is assembled into the goods_list structure that Mabang expects.

How to Configure in Qeasy

Three configuration hot spots:

  1. Source metadata: API = executeBillQuery, method = POST. Use FBillNo as the number field and FSubEntity_FDetailID as the idCheck field. Enable autoFillResponse so the platform automatically retrieves the entry details.

  2. Target metadata: API = warehouse-do-add-storage-out, method = POST. The warehouseName field uses the expression _findCollection find name from <warehouse resource> where finance_code={{FStockIDSETY_FNumber}} to translate Kingdee's finance/warehouse code into Mabang's warehouse name. The data field is declared as an array type goods_list.

  3. Filtering and mapping: Add a filter FDocumentStatus = 'Approved' in the strategy. Hard-code employeeName as "Kingdee Doc Sync" to avoid target-side errors caused by mandatory fields.

Implementation Steps

  • Phase 1: Increment Starting Point. During go-live, first run a one-time full sync to pull all historically approved assembly orders. The source crontab is set to 3-59/4 2-23 * * *, triggering every 4 minutes in off-peak hours.
  • Phase 2: Full Trigger. Manually run a full pull in Qeasy. After completion, switch to incremental mode, fetching only new changes by FBillNo and FSubEntity_FDetailID.
  • Phase 3: Stable Scheduling. The target crontab is */6 2-23 * * *, writing outbound documents every 6 minutes. Note that the source frequency is higher than the target—this creates a natural buffering effect, and Qeasy writes documents serially by order, avoiding concurrent document collisions.
  • Phase 4: Write-back and Reconciliation. Write the outbound document number returned by Mabang back into the Qeasy middleware for downstream sales order association.

Lessons Learned

  1. Pushing parent and child together causes duplicate outbound documents. A typical mistake is pushing the entire assembly order (including the parent line). The safe approach: filter out the parent line at the source and push only the child details.
  2. Passing warehouse code directly as the name. Kingdee's FStockIDSETY.FNumber is a code, but the target needs a Chinese name. This is a common pitfall: complete the translation in the mapping layer with _findCollection—do not hard-code it in scripts.
  3. Missing status filter. Without filtering FDocumentStatus, draft assembly orders will also be synced downstream and rejected.
  4. Errors assembling array fields. For structures like data.goods_list, a missing field on a single SKU (e.g., SKU itself) will fail the entire batch. We recommend adding a "required-field validation" step in Qeasy.
  5. employeeName is required. On the Mabang side this field cannot be empty, but Kingdee assembly orders have no outbound operator concept. The pattern we adopt: hard-code a header-level fallback value ("Kingdee Doc Sync") and put the source document number in the remark.

When to Use and When Not to Use

Use when: Your manufacturing or assembly business needs to push the child items of ERP-approved assembly orders to a downstream warehouse / e-commerce platform as the outbound basis, and the document structure with parent–child entries is clear.

Do not use when: You need parent–child linked inventory cost write-back or sub-second real-time synchronization. For those scenarios, we recommend running an instant-inventory strategy in parallel with this one and orchestrating them through dependency configuration.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-kingdee-cloud-p259ce0-3637-n8302010d-feb9891a

Comments