Kingdee Cloud Galaxy Warehouse Query API Field Handbook: An Authoritative Tutorial from Query to Code Mapping
What This Interface Solves
In cross-border supply chain integration, warehouse codes are the "translator" that binds materials, customers, suppliers, and documents together. Kingdee Cloud Galaxy's warehouse query interface (using executeBillQuery on BD_Stock) is the mandatory precursor to opening up master data and all business documents. Without accurate warehouse mapping, downstream sales outbound, purchase inbound, assembly/disassembly, and transfer documents will fail due to mismatched organizations/warehouses. We have repeatedly verified in multiple customer projects: stabilize this mapping table first, and the subsequent 26 strategies can proceed smoothly.
Interface Capability Overview
- Authentication: Kingdee Cloud Galaxy Open Platform uses an OAuth signature mechanism combining appId + appSecret + acctId + tenantId. Qeasy's "Kingdee Cloud Galaxy Adapter" has encapsulated this signature into visual credentials.
- Request Structure: POST form submission to
/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.executeBillQuery, with core parametersformId=BD_Stock,fieldKeys,filterString,limit,startRow,orderString. - Response Structure: A JSON-wrapped 2D array
Result.Result, where each row corresponds to a warehouse. Pagination is controlled bylimit + startRow, with Kingdee's default page cap at 5000 rows. - Incremental Mode: Use
FModifyDate >= ${lastRunTime}as the incremental cursor; during full initialization, pull once with an empty filter.
Typical Field Mapping
| Field Name | Type | Meaning | Practical Notes |
|---|---|---|---|
| FStockId | int | Warehouse primary key | Do not pass through during cross-system sync; only for join queries |
| FNumber | string | Warehouse code | Business key, must establish bidirectional mapping with Mabang warehouse_id/wid |
| FName | string | Warehouse name | Trim Chinese names to avoid full-width spaces causing match failures |
| FStockOrgId.FNumber | string | Inventory organization code | Used with FStockOrgId for filtering in multi-org environments |
| FStockOrgId | int | Inventory organization internal ID | Must be returned in pairs with FNumber; explicitly specify in fieldKeys |
| FCreateOrgId.FNumber | string | Creation organization code | Used for permission verification and org-based filtering |
| FForbidStatus | string | Disable status (A=enabled, B=disabled) | Only sync enabled warehouses downstream |
| FUseOrgId.FNumber | string | Usage organization code | Used for cross-org transfers in some customer scenarios |
| FDescription | string | Description/remarks | Written to Mabang extension fields for bidirectional traceability |
How to Configure on Qeasy
In Qeasy, this interface is typically called using a combination of "Kingdee Cloud Galaxy Query Adapter + Field Mapper":
- Data Source Node: Select "Kingdee Cloud Galaxy Query", fill in appId, appSecret, acctId, tenantId, and choose BD_Stock as formId;
- Field Pulling: In the "Field Mapper", check FStockId, FNumber, FName, FStockOrgId.FNumber, FCreateOrgId.FNumber;
- Incremental Cursor: Qeasy's field mapper automatically recognizes FModifyDate and generates a filterString like
FModifyDate >= '2026-03-01 00:00:00'; - Mapping Storage: Query results are directly written to the "Mabang Warehouse Mapping Table" intermediate storage for subsequent strategies 7 and 8 (Mabang warehouse ↔ Kingdee warehouse);
- Scheduling Strategy: Recommend hourly increments; full initialization should be scheduled during off-peak hours.
Cross-Scenario Practical Points
- Master Data First: In all the scenarios we've encountered, warehouse queries must complete their first run before suppliers and materials, otherwise business documents will fail in bulk due to missing warehouse codes.
- Bidirectional Mapping Tables: Kingdee FNumber ↔ Mabang warehouse_id/wid must be stored bidirectionally; one-way mapping breaks in cross-org scenarios.
- Organization + Warehouse Dual-Key Binding: Cross-border retail enterprises often have multiple inventory organizations; FNumber must be unique under its FStockOrgId. Qeasy's field mapper supports secondary mapping based on organization context.
- Stable Incremental Cursor: Kingdee's FModifyDate is precise to the second, and Qeasy stores it in UTC by default. In cross-timezone scenarios, explicitly specify the +8 timezone to avoid missing records.
- Filter Disabled Warehouses: Append
FForbidStatus = 'A'in filterString to reduce invalid data sync and facilitate reconciliation. - Cache Query Results: Qeasy's intermediate storage diffs current results against previous results, pushing only changed rows, saving API quota.
Pitfall Review
- Pitfall 1: FNumber Duplicate Across Organizations. A retail enterprise shared the same code across multiple organizations, causing downstream to write to the wrong inventory. This is easy to flip; the safe approach is to force
FStockOrgId.FNumber = '${orgCode}'in the filterString. - Pitfall 2: Incorrect Field Path Writing.
FStockOrgId.FNumbermust have a capital F and be declared as a whole in fieldKeys, not split intoFStockOrgIdandFNumbercolumns. - Pitfall 3: Last Page Missing in Pagination. When the total number of warehouses is exactly a multiple of 5000, the last page returns an empty array. Need to enable "Empty Page Termination" in Qeasy and verify the total count.
- Pitfall 4: Timezone Drift. The incremental cursor is stored in UTC, but Kingdee's returned FModifyDate is a +8 timezone string; without conversion, data from the last 8 hours will be missed.
- Pitfall 5: Credential Expiry Without Retry. If OAuth token failure is not auto-refreshed, the entire mapping table will stall. Qeasy's adapter enables token refresh and 3 retries by default.
When to Use
This interface is suitable for all bidirectional integration scenarios where Kingdee Cloud Galaxy warehouse master data needs to be synced to third-party ERPs (WMS, cross-border ERP, e-commerce middle platforms); it is not suitable for lightweight integrations with a single organization, manually maintained warehouses, and no need for code mapping. In our view, as long as the downstream system has the concept of "warehouse code" and it differs from Kingdee, this interface is mandatory.