test 72d8d981b1 feat(a11y): add focus management to UserSelectionDialog and ExecutionReportDialog
UserSelectionDialog:
- Add ARIA attributes (role, aria-modal, aria-labelledby)
- Integrate useDialogFocus hook with FocusLock
- Add Escape key handling (was missing)
- Initial focus on first user card

ExecutionReportDialog:
- Add ARIA attributes with dynamic aria-labelledby
- Add aria-live for progress updates
- Integrate useDialogFocus hook with FocusLock
- Escape key only closes when not executing
2026-03-08 17:16:53 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00
2026-02-28 20:36:59 +08:00

ERPAuto - ERP 数据自动化处理工具

一个基于 Electron 的桌面应用程序,用于自动化处理 ERP 系统中的数据提取和清理任务。

功能特性

  • 数据提取:从 ERP 系统批量下载物料计划数据
  • 物料清理:自动删除指定的物料代码,支持干运行模式
  • 数据库支持:支持 MySQL 和 SQL Server 数据存储
  • Excel 解析:自动解析下载的 Excel 文件

快速开始

环境要求

  • Node.js >= 18
  • npm >= 9
  • 可访问的 ERP 系统

安装

# 克隆项目
git clone <repository-url>
cd ERPAuto

# 安装依赖
npm install

配置

在项目根目录创建 config.yaml 文件(可参考 config.template.yaml

# ERP 配置(固定基础设施)
erp:
  url: https://your-erp-server.com

# 数据库配置
database:
  activeType: mysql # 或 sqlserver

  mysql:
    host: localhost
    port: 3306
    database: erpauto
    username: root
    password: your_password
    charset: utf8mb4

  sqlserver:
    server: localhost
    port: 1433
    database: erpauto
    username: sa
    password: your_password
    driver: 'ODBC Driver 18 for SQL Server'
    trustServerCertificate: true

# 路径配置
paths:
  dataDir: './data/'
  defaultOutput: 'output.xlsx'
  validationOutput: 'validation-result.xlsx'

注意ERP 用户名和密码在应用的设置界面中配置,存储在数据库中(按用户管理)。

运行开发环境

npm run dev

构建应用

# Windows
npm run build:win

# macOS
npm run build:mac

# Linux
npm run build:linux

使用指南

数据提取

  1. 启动应用后,点击主页的「数据提取」进入提取页面
  2. 在订单号输入框中输入订单号,每行一个
  3. 设置批量大小(默认 100
  4. 点击「开始提取」按钮
  5. 等待提取完成,查看结果

物料清理

  1. 点击主页的「物料清理」进入清理页面
  2. 输入订单号(每行一个)
  3. 输入要删除的物料代码(每行一个)
  4. 勾选「干运行模式」可预览删除结果(不实际删除)
  5. 点击「开始清理」按钮
  6. 查看清理结果和详细统计

测试

# 运行单元测试
npm run test

# 运行 E2E 测试
npm run test:e2e

# 查看测试报告
npm run test:e2e:report

项目结构

ERPAuto/
├── src/
│   ├── main/           # 主进程代码
│   │   ├── services/   # 业务服务
│   │   ├── ipc/        # IPC 处理器
│   │   └── types/      # TypeScript 类型
│   ├── preload/        # 预加载脚本
│   └── renderer/       # 渲染进程React UI
├── tests/
│   ├── unit/           # 单元测试
│   ├── integration/    # 集成测试
│   └── e2e/            # E2E 测试
└── docs/               # 文档

技术栈

  • 框架Electron 39
  • 前端React 19 + TypeScript
  • 构建工具electron-vite
  • 浏览器自动化Playwright
  • 数据库mysql2, mssql
  • Excel 处理ExcelJS
  • 测试Vitest, Playwright Test

常见问题

无法连接 ERP 系统

  1. 检查 config.yaml 中的 ERP URL 是否正确
  2. 确认网络连接正常
  3. 检查 ERP 系统是否可访问
  4. 在设置界面中确认 ERP 用户名和密码已配置

提取失败

  1. 确认订单号格式正确
  2. 检查 ERP 系统账号权限
  3. 查看应用日志获取详细错误信息

数据库连接失败

  1. 确认数据库服务已启动
  2. 检查 config.yaml 中的数据库配置
  3. 确认防火墙允许数据库端口访问

开发

# 安装依赖
npm install

# 启动开发服务器
npm run dev

# 类型检查
npm run typecheck

# 代码格式化
npm run format

# Lint 检查
npm run lint

许可证

MIT License

Description
No description provided
Readme 16 MiB
Languages
TypeScript 97.1%
JavaScript 2%
C# 0.4%
CSS 0.3%
TSQL 0.2%