ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

kingdee-k3cloud

Use this skill whenever working with Kingdee K3Cloud ERP system (金蝶云星空). Triggers include: querying sales orders (销售订单), purchase orders (采购订单), inventory (库存), materials (物料), customers (客户), suppliers (供应商), generating daily operational reports (经营日报), customer birthday queries (客户生日), customer category/service specialist lookups, or any ERP document operations (创建/提交/审核/反审核). Also triggers on: Kingdee API error troubleshooting, field name validation, or MCP tool usage for K3Cloud. Keywords: 金蝶, 金蝶云星空, K3Cloud, ERP, 单据, 审核, 提交, 日报, 客户查询, 库存预警.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/adamzhang1987/kingdee-k3cloud
Or

金蝶云星空 ERP 操作技能

通过 MCP 工具与金蝶云星空 API 交互的核心指南。查询前务必先查阅本文件确认表单ID和字段命名规则,避免 500 错误。

前提条件:本 Skill 需配合金蝶云星空 MCP Server 使用,推荐 kingdee-k3cloud-mcp。确保 Claude Code 已配置好 MCP Server 并可访问 query_bill_jsonview_bill 等工具。


核心原则

  1. 分步查询:先用 query_bill_json 查列表(关键字段),再用 view_bill 看单条详情
  2. 日期过滤:半开区间 FDate >= 'YYYY-MM-DD' AND FDate < 'YYYY-MM-DD+1'
  3. FDate vs FCreateDateFDate 是业务日期(手填),FCreateDate 是系统创建时间。按"今天开的单"统计用 FCreateDate
  4. 单据状态码Z = 暂存草稿,A = 创建,B = 审核中,C = 已审核,D = 重新审核
  5. 控制数据量top_count 限制行数,只查必要字段,超过20行数据考虑创建 Excel
  6. 字段不确定时:先调用 query_metadata(form_id) 验证字段是否存在,避免试错浪费 token

大数据量查询流程(跨周/跨月/跨年必读)

关键限制:金蝶 ExecuteBillQuery 单次最多返回约 2000 行;MCP tool-result 上限 1MB。
查询结果中带有 "truncated": true 则说明数据被截断,必须继续翻页或分片

决策树

① 时间跨度 > 1 周,或不确定数据量
   → 先 count_bill(form_id, filter_string) 估算行数

② estimated_rows ≤ 500(is_exact=true)
   → 一次性 query_bill_json,top_count=500

③ estimated_rows ≤ 2000(is_exact=true)
   → 一次性 query_bill_json,top_count=2000

④ estimated_rows > 2000 或 is_exact=false(≥ 5000)
   → 优先调用(mcp ≥ 1.2.0):
       query_bill_range(
           form_id, field_keys,
           date_field="FDate", date_from="YYYY-01-01", date_to="YYYY+1-01-01",
           chunk="month", output_path="/tmp/output.ndjson"
       )
   → 兜底做法(mcp < 1.2.0):
       for month in 月份范围:
           query_bill_json(filter="FDate >= 'YYYY-MM-01' AND FDate < 'YYYY-MM+1-01'", top_count=2000)
           若返回 truncated=true → 在该月内继续翻页(start_row=next_start_row)

⑤ 累计行数 > 20 行
   → 必须写入 Excel / CSV 文件,不要把大量数据倾倒进对话
   → 使用 query_bill_to_file 或 query_bill_range(output_path=...) 直接落盘

⑥ 查询中途出 SESSION_EXPIRED
   → 只重试当前片,已翻过的月份无需重跑

推荐做法(mcp ≥ 1.2.0)— 直接落盘,无需手动循环

# 跨年查询,按月自动分片,流式写入本地文件
query_bill_range(
    form_id="SAL_SaleOrder",
    field_keys="FBillNo,FDate,FCustId.FName,FAllAmount",
    date_field="FDate",
    date_from="2025-01-01",
    date_to="2026-01-01",
    chunk="month",
    output_path="/tmp/sales_2025.ndjson"
)
# 返回:{"path": "/tmp/sales_2025.ndjson", "row_count": N, "bytes": M, "chunks": 12}

兜底翻页示例(mcp < 1.2.0 或单月数据超过 2000 行)

start = 0
while True:
    result = query_bill_json(form_id, field_keys, filter_string="FDate >= '2025-03-01' AND FDate < '2025-04-01'",
                              top_count=2000, start_row=start)
    # result["rows"] → 本页数据
    if not result["truncated"]:
        break
    start = result["next_start_row"]

时间跨度 vs 推荐策略速查

时间跨度count_bill 估算推荐做法
当日≤ 200 行直接 top_count=200
当周≤ 1000 行直接 top_count=1000
当月可能 > 2000count_bill 探测,按需翻页
跨季度大概率 > 2000query_bill_range(chunk="month", output_path=...) 落盘(mcp ≥ 1.2.0),兜底:按月手动循环
跨年必然 > 2000query_bill_range(chunk="month", output_path=...) 落盘(mcp ≥ 1.2.0),兜底:按月手动循环

表单ID速查表

Metadata

Stars4473
Views1
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-adamzhang1987-kingdee-k3cloud": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.