JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 39
  • Score
    100M100P100Q55468F

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package () to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ees_cli

    npm version Node.js

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


    安装

    npm install -g 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,支持分页)

    示例

    # 查询仓储任务最新 10 条
    ees tasks
    
    # 查询库存记录最新 20 条
    ees inventory --limit 20
    ees inv -n 20
    
    # 查询工单最新 5 条
    ees workorder -n 5
    ees wo -n 5
    
    # 查询排产齐套(2026-04 全月,第 1 页,每页 10 条)
    ees readiness --start 2026-04-01 --end 2026-04-30
    
    # 翻页查看,每页 20 条
    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

    输出效果

    普通查询(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

    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>   # 结束日期(必填)
      --page  <number>       # 页码,默认 1
      --page-size <number>   # 每页条数,默认 10

    常见问题

    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