design.md 8.8 KB

Design Document

Overview

本设计文档描述了将原始建模管理前端模块(s0-operating-modeling)完整整合到芋道管理系统的技术方案。整合工作包括:

  1. 删除重复的"建模管理"菜单,创建5个独立的一级菜单
  2. 迁移所有Vue组件到正确的目录结构
  3. 配置Vue Router路由
  4. 更新数据库菜单配置SQL

Architecture

整合后的模块将遵循芋道系统的标准架构,拆分为5个独立的一级菜单:

yudao-ui-admin-vue3/
├── src/
│   ├── views/
│   │   └── jianmo/
│   │       └── views/           # 所有建模管理组件
│   │           ├── CustomerManagement.vue
│   │           ├── MaterialManagement.vue
│   │           ├── OrderPriorityConfig.vue
│   │           ├── device/      # 设备管理
│   │           ├── warehouse/   # 仓储管理
│   │           ├── supply/      # 供应建模
│   │           ├── manufacturing/ # 制造建模
│   │           ├── quality/     # 质量建模
│   │           ├── inventory/   # 库存数据
│   │           ├── wms/         # WMS相关
│   │           └── s7/          # 成品仓储
│   └── router/
│       └── modules/
│           └── remaining.ts     # 路由配置
└── sql/
    └── mysql/
        └── custom_modules_menu.sql  # 菜单SQL

Components and Interfaces

1. 菜单结构设计

按照用户要求,拆分为5个一级菜单:

一、运营建模 (ID: 6400, parent_id: 0, sort: 140, icon: ep:data-analysis)
├── 产销建模 (ID: 6410, 二级目录)
│   ├── 客户管理 (ID: 6411)
│   ├── 物料管理 (ID: 6412)
│   └── 订单优先级 (ID: 6413)
├── 制造建模 (ID: 6420, 二级目录)
│   ├── 标准BOM (ID: 6421)
│   ├── 标准工序 (ID: 6422)
│   ├── 生产线维护 (ID: 6423)
│   ├── 工艺流程 (ID: 6424)
│   ├── 物料替代 (ID: 6425)
│   ├── 工单控制参数 (ID: 6426)
│   ├── 人员技能 (ID: 6427)
│   ├── 产线岗位 (ID: 6428)
│   ├── 工作中心 (ID: 6429)
│   ├── 生产线物料 (ID: 6430)
│   ├── 生产要素参数 (ID: 6431)
│   ├── 物料工序要素 (ID: 6432)
│   ├── 前处理要素 (ID: 6433)
│   ├── 前处理要素参数 (ID: 6434)
│   ├── SOP文件类型 (ID: 6435)
│   └── SOP维护 (ID: 6436)
├── 仓储建模 (ID: 6440, 二级目录)
│   ├── 库位维护 (ID: 6441)
│   ├── 货架列表 (ID: 6442)
│   ├── 部门维护 (ID: 6443)
│   ├── 雇员列表 (ID: 6444)
│   ├── 条码规则 (ID: 6445)
│   ├── 标签格式 (ID: 6446)
│   ├── 成本中心 (ID: 6447)
│   ├── 物料职责 (ID: 6448)
│   ├── 单号类型 (ID: 6449)
│   ├── 单号规则 (ID: 6450)
│   ├── 包装规格 (ID: 6451)
│   └── 物料状态任务 (ID: 6452)
├── 质量建模 (ID: 6460, 二级目录)
│   ├── 单据类型 (ID: 6461)
│   ├── 业务类型 (ID: 6462)
│   ├── 客诉类别 (ID: 6463)
│   ├── 检验优先级 (ID: 6464)
│   ├── 不合格联络单模板 (ID: 6465)
│   ├── 8D模板 (ID: 6466)
│   ├── NCR处置类型 (ID: 6467)
│   ├── 质量项目 (ID: 6468)
│   ├── CAPA类型 (ID: 6469)
│   ├── 检验状态 (ID: 6470)
│   ├── AQL检验水平 (ID: 6471)
│   ├── AQL值 (ID: 6472)
│   ├── 抽样方案 (ID: 6473)
│   ├── 检验方法 (ID: 6474)
│   ├── 检验依据 (ID: 6475)
│   ├── 检验仪器 (ID: 6476)
│   ├── 检验频率 (ID: 6477)
│   ├── 检验项目 (ID: 6478)
│   ├── 检验标准 (ID: 6479)
│   ├── 检验方案 (ID: 6480)
│   └── 原材料免检 (ID: 6481)
└── 供应建模 (ID: 6490, 二级目录)
    ├── 供应商维护 (ID: 6491)
    └── 货源清单 (ID: 6492)

二、设备管理 (ID: 6500, parent_id: 0, sort: 141, icon: ep:cpu)
├── 设备列表 (ID: 6501)
└── 模工具列表 (ID: 6502)

三、仓储管理 (ID: 6600, parent_id: 0, sort: 142, icon: ep:house)
├── 委外交料单 (ID: 6601)
├── 采购收货单 (ID: 6602)
├── 生产领料单 (ID: 6603)
└── 生产退料单 (ID: 6604)

四、仓库数据 (ID: 6700, parent_id: 0, sort: 143, icon: ep:document)
├── 标签查询 (ID: 6701)
├── 标签历史记录 (ID: 6702)
├── 暂收在检列表 (ID: 6703)
├── 库存查询 (ID: 6704)
└── 进出存查询 (ID: 6705)

五、成品仓库 (ID: 6800, parent_id: 0, sort: 144, icon: ep:box)
├── 生产入库单列表 (ID: 6801)
└── 销售发货通知 (ID: 6802)

2. 路由配置接口

路由将在 remaining.ts 中配置,按5个一级菜单分组:

// 运营建模路由
{
  path: '/yunying',
  component: Layout,
  name: 'YunyingCenter',
  meta: { hidden: true },
  children: [/* 销售建模、供应建模、制造建模、质量建模子路由 */]
}

// 设备管理路由
{
  path: '/shebei',
  component: Layout,
  name: 'ShebeiCenter',
  meta: { hidden: true },
  children: [/* 设备列表、模工具列表 */]
}

// 仓储管理路由
{
  path: '/cangchu',
  component: Layout,
  name: 'CangchuCenter',
  meta: { hidden: true },
  children: [/* 仓储相关子路由 */]
}

// 库存数据路由
{
  path: '/kucun',
  component: Layout,
  name: 'KucunCenter',
  meta: { hidden: true },
  children: [/* 库存查询相关子路由 */]
}

// 成品仓储路由
{
  path: '/chengpin',
  component: Layout,
  name: 'ChengpinCenter',
  meta: { hidden: true },
  children: [/* 成品入库、发货相关子路由 */]
}

3. 组件迁移映射

原始路径 目标路径
s0-operating-modeling/src/views/*.vue src/views/jianmo/views/*.vue
s0-operating-modeling/src/views/device/*.vue src/views/jianmo/views/device/*.vue
s0-operating-modeling/src/views/warehouse/*.vue src/views/jianmo/views/warehouse/*.vue
s0-operating-modeling/src/views/supply/*.vue src/views/jianmo/views/supply/*.vue
s0-operating-modeling/src/views/manufacturing/*.vue src/views/jianmo/views/manufacturing/*.vue
s0-operating-modeling/src/views/quality/*.vue src/views/jianmo/views/quality/*.vue
s0-operating-modeling/src/views/inventory/*.vue src/views/jianmo/views/inventory/*.vue
s0-operating-modeling/src/views/wms/*.vue src/views/jianmo/views/wms/*.vue
s0-operating-modeling/src/views/s7/*.vue src/views/jianmo/views/s7/*.vue

Data Models

菜单数据模型 (system_menu)

字段 类型 说明
id bigint 菜单ID
name varchar(50) 菜单名称
permission varchar(100) 权限标识
type tinyint 菜单类型(1=目录,2=菜单)
sort int 排序
parent_id bigint 父菜单ID
path varchar(200) 路由路径
icon varchar(100) 图标
component varchar(255) 组件路径
component_name varchar(100) 组件名称
status tinyint 状态

Correctness Properties

A property is a characteristic or behavior that should hold true across all valid executions of a system-essentially, a formal statement about what the system should do. Properties serve as the bridge between human-readable specifications and machine-verifiable correctness guarantees.

由于本次整合主要是前端UI组件迁移和配置工作,大部分验收标准属于UI导航测试和配置验证,不适合使用属性测试。以下是可验证的关键属性:

Property 1: Menu uniqueness For any menu name at the root level (parent_id=0), there SHALL be at most one menu entry with that name in the system_menu table. Validates: Requirements 1.1, 1.2

Property 2: Route-component consistency For any configured route in the jianmo module, the referenced component file SHALL exist at the specified path. Validates: Requirements 10.1, 10.2

Property 3: Build integrity For any valid build configuration, the application SHALL compile without errors related to jianmo module imports. Validates: Requirements 10.3

Error Handling

  1. 组件加载失败: 使用Vue的异步组件加载机制,配合错误边界处理
  2. 路由不存在: 配置404回退路由
  3. 菜单权限不足: 依赖芋道系统现有的权限控制机制

Testing Strategy

单元测试

  • 验证路由配置的完整性
  • 验证组件文件存在性

集成测试

  • 验证菜单SQL执行后数据库状态正确
  • 验证前端构建成功

手动测试

  • 验证所有菜单导航功能正常
  • 验证各组件页面渲染正确

测试框架

  • 使用项目现有的测试框架(如有)
  • SQL验证通过数据库查询确认
  • 构建验证通过 pnpm build:prod 命令确认