← Back to Skills Marketplace
fxy-99

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

by fxy-99 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
84
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install kingdee-sold
Description
金蝶EAS Cloud ERP系统数据库SQL查询技能,支持采购、销售、库存、财务等模块的单据查询和数据分析。
README (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无索引字段
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install kingdee-sold
  3. After installation, invoke the skill by name or use /kingdee-sold
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug kingdee-sold
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

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

金蝶EAS Cloud ERP系统数据库SQL查询技能,支持采购、销售、库存、财务等模块的单据查询和数据分析。 It is an AI Agent Skill for Claude Code / OpenClaw, with 84 downloads so far.

How do I install 金蝶ERP销售订单执行情况查询?

Run "/install kingdee-sold" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

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

Yes, 金蝶ERP销售订单执行情况查询 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 金蝶ERP销售订单执行情况查询 support?

金蝶ERP销售订单执行情况查询 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

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

It is built and maintained by fxy-99 (@fxy-99); the current version is v1.0.0.

💬 Comments