npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chaobinchen/ees-cli

v1.0.8

Published

EES 数据库查询 CLI — 快速查询 wms_tasks、wms_inventory_record、psm_work_order

Readme

ees_cli

npm version Node.js

EES 数据库查询 CLI — 一键查询 wms_taskswms_inventory_recordpsm_work_order 最新记录,以及排产齐套分页查询与全量导出。


安装

npm install -g @chaobinchen/ees-cli

需要 Node.js ≥ 14,且网络可达目标 SQL Server


连接配置

连接参数支持三种方式(优先级从高到低):

| 方式 | 示例 / 路径 | |------|--------| | CLI 选项 | --server <host> --port <port> --user <user> --password <pass> --database <db> | | 环境变量 | EES_DB_SERVER / EES_DB_PORT / EES_DB_USER / EES_DB_PASSWORD / EES_DB_DATABASE | | 配置文件 | ./.ees.json~/.ees.json |

推荐:使用 ees init 创建配置文件

安装后第一步运行初始化向导:

# 写入当前目录(仅当前项目生效)
ees init

# 写入 HOME 目录(所有项目全局生效)
ees init --global

向导效果:

🔧  EES DB CLI — 数据库连接初始化向导
   配置将写入: /your/project/.ees.json

  服务器地址 (host)   [172.29.162.132]: 
  端口       (port)   [1433]: 1435
  数据库名   (database) [ees_master]: 
  用户名     (user)    [sa]: 
  密码       (password): 

✔  配置已写入: /your/project/.ees.json

.ees.json 已自动加入 .gitignore,密码不会被提交到 Git。

.ees.json 格式:

{
  "server": "172.29.162.132",
  "port": 1435,
  "user": "sa",
  "password": "YOUR_PASSWORD",
  "database": "ees_master"
}

安全提示:请勿手动将 .ees.json 提交到任何 Git 仓库。


使用

查看帮助

ees --help

命令列表

| 命令 | 别名 | 说明 | |------|------|------| | ees init | — | 交互式创建 .ees.json 连接配置文件 | | ees tasks | t | 查询仓储任务表 (wms_tasks) 最新数据 | | ees inventory | inv | 查询库存记录表 (wms_inventory_record) 最新数据 | | ees workorder | wo | 查询工单表 (psm_work_order) 最新数据 | | ees readiness | rd | 按时间区间查询排产齐套数据(需 --start / --end,支持分页) | | ees export | exp | 全量导出排产齐套数据到 CSV(不分页,支持正常/异常/全量三种模式) |

示例

# 查询仓储任务最新 10 条
ees tasks

# 查询库存记录最新 20 条
ees inventory --limit 20
ees inv -n 20

# 查询工单最新 5 条
ees workorder -n 5
ees wo -n 5

# 查询排产齐套(2026-04 全月,第 1 页,默认异常模式)
ees readiness --start 2026-04-01 --end 2026-04-30

# 异常模式 + 翻页
ees readiness --start 2026-04-01 --end 2026-04-30 --page 2 --page-size 20
ees rd --start 2026-04-01 --end 2026-04-30 -p 2 --page-size 20

# 正常模式(po状态 = 库存满足)
ees readiness --start 2026-04-01 --end 2026-04-30 --mode normal
ees rd --start 2026-04-01 --end 2026-04-30 -m normal

# 全量模式(不过滤)
ees readiness --start 2026-04-01 --end 2026-04-30 --mode all

# 导出异常数据(默认:未齐套 / 待跟进物料)
ees export --start 2026-04-01 --end 2026-04-30
ees exp --start 2026-04-01 --end 2026-04-30 --mode abnormal

# 导出正常数据(po状态 = 库存满足)
ees export --start 2026-04-01 --end 2026-04-30 --mode normal

# 导出全量数据(不进行任何过滤)
ees export --start 2026-04-01 --end 2026-04-30 --mode all

# 指定输出文件路径
ees export --start 2026-04-01 --end 2026-04-30 --mode normal -o D:\reports\apr-normal.csv
ees exp  --start 2026-04-01 --end 2026-04-30 -m normal -o D:\reports\apr-normal.csv

输出效果

普通查询(tasks / inventory / workorder):

⏳  正在执行查询: SELECT TOP 10 * FROM wms_tasks ORDER BY create_time DESC

📋  仓储任务 (wms_tasks) — 最新 10 条
共 10 条记录
┌─────────┬──────────────┬─────────────────────┬────────┐
│ task_id │ task_type    │ create_time         │ status │
├─────────┼──────────────┼─────────────────────┼────────┤
│ 1001    │ INBOUND      │ 2026-04-03 10:30:00 │ DONE   │
│ ...     │ ...          │ ...                 │ ...    │
└─────────┴──────────────┴─────────────────────┴────────┘

排产齐套查询(readiness):

⏳  Step 1 — 查询制令单号范围 [2026-04-01 ~ 2026-04-30]
   → 共找到 42 个制令单号
⏳  Step 2 — 查询物料齐套明细 (ERP_Sinno_MRP2_VIEW)
   → 共找到 318 条物料记录
⏳  Step 3 — 应用业务过滤规则并分页

📋  排产齐套 [2026-04-01 ~ 2026-04-30] — 过滤后共 156 条,第 1/16 页(每页 10 条)
共 10 条记录
┌───────────┬────────┬────────────┬────────────┬────────┬────────────────┬────────────┬────────────┐
│ MO_NO     │ 大类名称 │ 材料品号     │ 材料品名     │ po状态  │ 采购确认交期    │ 预开工日    │ 可用数量    │
├───────────┼────────┼────────────┼────────────┼────────┼────────────────┼────────────┼────────────┤
│ MO4807A01 │ 自购包材 │ P001234    │ 盒子 A     │ 待确认  │ 2026-04-20    │ 2026-04-15 │ 0          │
│ ...       │ ...    │ ...        │ ...        │ ...    │ ...            │ ...        │ ...        │
└───────────┴────────┴────────────┴────────────┴────────┴────────────────┴────────────┴────────────┘
  提示: 当前第 1 页,共 16 页。使用 --page <n> 翻页,--page-size <n> 调整每页条数。

Skills(大模型集成)

skills/SKILL.md 描述了本工具的完整接口规范,方便 AI Agent 自动调用。 skills/scripts/ees-query.ps1 为封装好连接参数的 PowerShell 助手脚本。

# Agent 可以直接 shell 调用:
ees tasks
ees inventory --limit 5
ees workorder
ees readiness --start 2026-04-01 --end 2026-04-30
ees export --start 2026-04-01 --end 2026-04-30 --mode abnormal
ees export --start 2026-04-01 --end 2026-04-30 --mode normal

readiness 排产齐套详解

业务背景

排产齐套查询用于判断指定排产期间内,各制令单的物料是否能按时到位。

执行流程

Step 1  MES_SCM_PLAN_CP    → 按日期区间查出制令单号
Step 2  格式化              → 制令单号 → SQL IN 字符串
Step 3  ERP_Sinno_MRP2_VIEW → 查询物料采购齐套明细
Step 4  过滤 + 分页         → 按业务规则过滤,按页返回

过滤规则

| 大类名称 | 规则 | |---------|------| | 客供包材 | 无条件输出 | | 半成品 / 自购包材 | 采购确认交期 ≥ 预开工日(或缺少任意日期)→ 输出;否则(已满足)→ 不输出 | | 其他 | 无条件输出 |

完整参数

ees readiness \
  --start <YYYY-MM-DD>   # 开始日期(必填)
  --end   <YYYY-MM-DD>   # 结束日期(必填)
  -m, --mode <mode>      # 过滤模式:abnormal(默认)| normal | all
  --page  <number>       # 页码,默认 1
  --page-size <number>   # 每页条数,默认 10

| 模式 | 说明 | |------|------| | abnormal(默认) | 异常数据:排除 po状态=库存满足,再应用业务规则,输出未齐套/待跟进物料 | | normal | 正常数据po状态 = 库存满足 的记录 | | all | 全量数据:不过滤,返回视图所有原始行 |


export 导出排产齐套详解

业务背景

readiness 用于分页展示,export 用于将全量数据一次导出为 CSV 文件,方便离线分析、发送邮件或导入 Excel。

导出模式

| 模式 | 说明 | |------|------| | abnormal(默认) | 异常数据:应用与 readiness 相同的业务过滤规则,输出未齐套 / 待跟进物料 | | normal | 正常数据:po状态 = 库存满足 的记录 | | all | 全量数据:不进行任何过滤,导出视图全部原始行 |

完整参数

ees export \
  --start <YYYY-MM-DD>   # 开始日期(必填)
  --end   <YYYY-MM-DD>   # 结束日期(必填)
  -m, --mode <mode>      # 导出模式:abnormal │ normal │ all(默认 abnormal)
  -o, --output <file>    # 输出 CSV 文件路径(默认自动生成)

当省略 --output 时,输出文件名自动生成于当前目录:

readiness-export-<start>_<end>-<mode>.csv
# 例:readiness-export-2026-04-01_2026-04-30-abnormal.csv

文件以 UTF-8 BOM 编码写入,Windows Excel 可直接正确识别中文列巴。

输出示例

📤  排产齐套导出 [2026-04-01 ~ 2026-04-30]
    模式: 异常数据(未齐套 / 待跟进物料)
    输出: /work/readiness-export-2026-04-01_2026-04-30-abnormal.csv

⏳  Step 1 — 查询制令单号范围 [2026-04-01 ~ 2026-04-30]
   → 共找到 42 个制令单号
⏳  Step 2 — 查询物料齐套明细 (ERP_Sinno_MRP2_VIEW)
   → 共找到 318 条原始物料记录
⏳  Step 3 — 应用过滤规则(模式: abnormal)
   → 过滤后剩余 156 条记录
⏳  Step 4 — 写出 CSV 文件

✔  导出成功!共 156 条 异常数据(未齐套 / 待跟进物料)记录
   文件路径: /work/readiness-export-2026-04-01_2026-04-30-abnormal.csv

常见问题

Windows CMD 中文乱码

CLI 已在启动时自动切换为 UTF-8(chcp 65001)。若仍出现乱码,请使用 PowerShell 运行命令,或在 CMD 中手动执行:

chcp 65001
ees tasks

发布到 npm

# 登录 npm
npm login

# 发布
npm publish --access public

开发 & 本地测试

# 克隆后安装依赖
npm install

# 本地链接(无需全局安装)
npm link

# 测试
ees tasks

License

MIT