← 返回 Skills 市场
fxy-99

金蝶ERP销售订单执行情况查询

作者 fxy-99 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
84
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install kingdee-sold
功能描述
金蝶EAS Cloud ERP系统数据库SQL查询技能,支持采购、销售、库存、财务等模块的单据查询和数据分析。
使用说明 (SKILL.md)

金蝶ERP SOLD数据库查询技能

技能概述

本技能用于金蝶EAS Cloud ERP系统的PostgreSQL数据库查询,支持各类业务单据的SQL查询、数据分析、表结构探查等操作。

数据库连接信息

主机: 111.198.79.26
端口: 5432
用户: cosmic
密码: Kd1234567890!
数据库: yyzl202501

表命名规范

前缀/后缀 说明 示例
t_ 业务数据表前缀 t_ap_finapbill
_l 分录表后缀 t_ap_finapbill_l
_r3 R3视图后缀 t_im_purinbill_r3
_lk Link关联表 t_po_purorder_lk
_tc 临时表
_wb 工作流相关表
t_bos_ BOS平台表 t_bos_atomicincr_generator
t_gl_ 财务总账模块 t_gl_voucher
t_ap_ 应付模块 t_ap_paybill
t_ar_ 应收模块 t_ar_receivebill
t_im_ 库存模块 t_im_purinbill
t_po_ 采购模块 t_po_purorder
t_sal_ 销售模块 t_sal_saleorder
t_bd_ 基础资料 t_bd_material

常用标准字段

字段名 说明
fid 单据主键ID
fnumber 单据编号
fcreate_time 创建时间
fcreatorid 创建人ID
fmodify_time 修改时间
fmodifierid 修改人ID
fdocumentstatus 单据状态
fbilltype 单据类型
fdate 单据日期
famount 金额
famt_lc 本币金额

单据状态码说明

状态码 说明
0 草稿
1 已提交/审核中
2 已审核
3 已驳回
4 已关闭
5 作废/红冲

使用示例

1. 查询表结构

-- 查询表的列信息
SELECT column_name, data_type, is_nullable 
FROM information_schema.columns 
WHERE table_name = 't_po_purorder' 
ORDER BY ordinal_position;

2. 查询采购订单

-- 查询采购订单表头
SELECT fid, fnumber, fdate, famount_lc, fdocumentstatus
FROM t_po_purorder
WHERE fdate >= '2025-01-01'
LIMIT 100;

-- 查询采购订单分录
SELECT fid, fentryid, fmaterialid, fqty, fprice, famount
FROM t_po_purorder_l
WHERE fid = '订单fid';

3. 查询销售订单

SELECT fid, fnumber, fdate, fcustid, famount_lc, fdocumentstatus
FROM t_sal_saleorder
WHERE fdate >= '2025-01-01'
ORDER BY fdate DESC
LIMIT 100;

4. 查询应付付款单

SELECT fid, fnumber, fdate, famount_lc, fpaytype, fdocumentstatus
FROM t_ap_paybill
WHERE fdate >= '2025-01-01'
ORDER BY fdate DESC
LIMIT 100;

5. 查询应收收款单

SELECT fid, fnumber, fdate, famount_lc, fdocumentstatus
FROM t_ar_receivebill
WHERE fdate >= '2025-01-01'
ORDER BY fdate DESC
LIMIT 100;

6. 查询入库单

SELECT fid, fnumber, fdate, fstockorgid, fdocumentstatus
FROM t_im_purinbill
WHERE fdate >= '2025-01-01'
ORDER BY fdate DESC
LIMIT 100;

7. 查询编码规则

-- 查询所有单据编码规则
SELECT fnumber, fprefix, fformat, fcurrentvalue
FROM t_bos_atomicincr_generator
ORDER BY fnumber;

8. 模糊搜索表名

-- 搜索包含指定关键词的表
SELECT table_name 
FROM information_schema.tables 
WHERE table_schema = 'public'
AND table_name LIKE '%keyword%'
ORDER BY table_name;

常用SQL模板

关联查询表头和分录

SELECT 
    h.fnumber,
    h.fdate,
    h.famount_lc,
    l.fentryid,
    l.fmaterialid,
    l.fqty,
    l.fprice,
    l.famount
FROM t_po_purorder h
LEFT JOIN t_po_purorder_l l ON h.fid = l.fid
WHERE h.fdate >= '2025-01-01'
LIMIT 100;

按日期统计单据数量和金额

SELECT 
    DATE(fdate) as bill_date,
    COUNT(*) as bill_count,
    SUM(famount_lc) as total_amount
FROM t_po_purorder
WHERE fdate >= '2025-01-01'
GROUP BY DATE(fdate)
ORDER BY bill_date DESC;

按状态统计单据

SELECT 
    CASE fdocumentstatus
        WHEN 0 THEN '草稿'
        WHEN 1 THEN '已提交'
        WHEN 2 THEN '已审核'
        WHEN 3 THEN '已驳回'
        WHEN 4 THEN '已关闭'
        WHEN 5 THEN '作废'
        ELSE '未知'
    END as status_name,
    COUNT(*) as count,
    SUM(famount_lc) as total_amount
FROM t_po_purorder
WHERE fdate >= '2025-01-01'
GROUP BY fdocumentstatus
ORDER BY fdocumentstatus;

注意事项

  1. 大表查询限制: 生产环境数据量较大,查询时务必加上LIMIT和时间范围条件
  2. 避免全表扫描: 尽量使用fid、fnumber、fdate等有索引的字段作为查询条件
  3. 分录表关联: 分录表使用_l后缀,通过fid字段与主表关联
  4. 时间格式: PostgreSQL中日期比较使用标准ISO格式 'YYYY-MM-DD'
  5. 权限: 只有只读权限,请勿执行UPDATE/DELETE/DROP等写操作

故障排除

表不存在

  • 检查表名是否正确,是否遗漏了t_前缀
  • 确认是表头还是分录表(分录表需加_l后缀)
  • 使用模糊搜索查找正确的表名

字段不存在

  • 使用information_schema.columns查询表的实际列名
  • 注意字段大小写(PostgreSQL默认小写)

查询太慢

  • 增加LIMIT限制返回行数
  • 加上时间范围条件
  • 使用有索引的字段过滤
  • 避免在大表上使用ORDER BY无索引字段
安全使用建议
Do not install or use this skill with the embedded database password. Ask the publisher to remove and rotate the credential, declare credential requirements properly, and provide a scoped read-only setup with query safeguards before using it on real ERP data.
功能分析
Type: OpenClaw Skill Name: kingdee-sold Version: 1.0.0 The skill bundle contains hardcoded plaintext database credentials (host, port, username, and password) for a public IP address (111.198.79.26) within both SKILL.md and scripts/kingdee_query.py. While the script logic is functional and uses parameterized queries to prevent SQL injection, the exposure of sensitive credentials for a remote production-style database is a significant security risk and a major vulnerability.
能力评估
Purpose & Capability
The stated purpose of querying Kingdee ERP data is coherent, but the artifacts include live-looking database credentials and cover sales, purchasing, inventory, finance, customer, employee, user, and role data, which is high-impact and broadly scoped.
Instruction Scope
The documentation advises LIMITs and says not to run write operations, but the included helper accepts arbitrary SQL and the artifacts do not enforce read-only statements, schema bounds, row limits, or user approval for custom queries.
Install Mechanism
There is no install spec or auto-executing installer. A Python helper imports psycopg2, but dependency setup is not declared; this is a completeness issue rather than direct malicious behavior.
Credentials
The registry declares no required credentials or environment variables, yet the skill embeds a remote PostgreSQL host, username, password, and database name directly in SKILL.md and the Python script.
Persistence & Privilege
No local persistence is shown, but the skill relies on a shared database account. The artifacts claim read-only permission, but that boundary is not enforced by the skill artifacts themselves.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install kingdee-sold
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /kingdee-sold 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of kingdee-sold skill. - Provides SQL query and analysis capability for Kingdee EAS Cloud ERP PostgreSQL database. - Covers modules such as purchasing, sales, inventory, accounts payable/receivable, and finance. - Includes example queries for common ERP documents and table structure inspection. - Offers guidelines on table naming conventions, standard fields, and status codes. - Adds practical SQL templates for reporting, statistics, and troubleshooting tips.
元数据
Slug kingdee-sold
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

金蝶ERP销售订单执行情况查询 是什么?

金蝶EAS Cloud ERP系统数据库SQL查询技能,支持采购、销售、库存、财务等模块的单据查询和数据分析。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 84 次。

如何安装 金蝶ERP销售订单执行情况查询?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install kingdee-sold」即可一键安装,无需额外配置。

金蝶ERP销售订单执行情况查询 是免费的吗?

是的,金蝶ERP销售订单执行情况查询 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

金蝶ERP销售订单执行情况查询 支持哪些平台?

金蝶ERP销售订单执行情况查询 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 金蝶ERP销售订单执行情况查询?

由 fxy-99(@fxy-99)开发并维护,当前版本 v1.0.0。

💬 留言讨论