Process Specification Intelligent Generation Platform (ProcessSpec Studio)
Current Foundation (Existing Capabilities)
| Capability | Existing Component | Path |
|---|---|---|
| Rule Engine | rule-engine.js (2314 lines) | server/core/ |
| Prompt Template | prompt-template-manager.js (611 lines) | server/core/ |
| LLM Integration | llm-proxy.js, digital-staff/llm-brain.js | server/ |
| Intelligent Search | AnySearchPanel.vue + useAnySearch.js | src/components/anysearch/ |
| SCSAI Object Model | aml-generator.js, aml-assembler.js | server/core/ |
| Object Creation | rule-engine CREATE scope + correction-learner | server/core/ |
| PPS Sample Data | 72 Procs + TechData + Column mapping | SCSAI/PPS |
Architecture Design
┌─────────────────────────────┐
│ ProcessSpec Studio │
│ (前端视图 + API层) │
└──────────┬──────────────────┘
│
┌──────────────────────┼──────────────────────┐
│ │ │
┌─────▼──────┐ ┌────────▼────────┐ ┌───────▼───────┐
│ 模板定义器 │ │ 生成引擎核心 │ │ 导出管理器 │
│ Template │ │ Generation │ │ Export │
│ Designer │ │ Engine │ │ Manager │
└─────┬──────┘ └──┬──┬──┬──┬─────┘ └───────┬───────┘
│ │ │ │ │ │
│ ┌──────────┘ │ │ └──────────┐ │
│ │ │ │ │ │
┌────▼────▼───┐ ┌─────▼──▼───┐ ┌─────▼───────▼───┐
│ 规则引擎 │ │ LLM 大脑 │ │ AnySearch │
│ (已有) │ │ (已有) │ │ 行业数据集成 │
└─────────────┘ └────────────┘ └─────────────────┘
│ │
┌────▼──────────────────────────────▼───┐
│ SCSAI PLM 对象模型 (已有基座) │
│ + 行业结构化数据库 (可扩展) │
└───────────────────────────────────────┘
Phase 1: 工艺模板定义引擎 (Template Designer)
目标: 让用户可以为任意行业定义工艺规程模板
Task 1.1: Process Template Data Model
Create new tables in SQLite (core_runtime.db):
-- 行业领域定义
CREATE TABLE IF NOT EXISTS process_industries (
id TEXT PRIMARY KEY,
name TEXT NOT NULL, -- 如"高端"、"磷化工"、"汽车制造"
code TEXT UNIQUE NOT NULL,
description TEXT,
icon TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- 工艺规程模板
CREATE TABLE IF NOT EXISTS process_templates (
id TEXT PRIMARY KEY,
industry_id TEXT REFERENCES process_industries(id),
name TEXT NOT NULL, -- 如"机械加工工艺过程卡片"
code TEXT NOT NULL,
category TEXT, -- 工艺类型:加工/装配/焊接/热处理/表面处理...
description TEXT,
version INTEGER DEFAULT 1,
status TEXT DEFAULT 'draft', -- draft/published/archived
-- 模板结构定义 (JSON)
schema_json TEXT NOT NULL, -- 字段定义:名称、类型、必填、默认值、验证规则
layout_json TEXT, -- 布局定义:分组、排列、卡片结构
rules_json TEXT, -- 校验规则:引用现有 rule-engine 规则ID
prompt_json TEXT, -- LLM提示词模板:Generate/补全/优化用的prompt
-- SCSAI 映射
SCSAI_item_type TEXT, -- 对应 SCSAI ItemType (如 PPS_Proc)
SCSAI_mapping_json TEXT, -- 模板字段 → SCSAI 属性映射
created_by TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- 模板字段定义(从 schema_json 展开,便于查询)
CREATE TABLE IF NOT EXISTS process_template_fields (
id TEXT PRIMARY KEY,
template_id TEXT REFERENCES process_templates(id),
field_key TEXT NOT NULL, -- 字段标识 (如 product_model, part_code)
field_label TEXT NOT NULL, -- 显示名 (如"产品型号")
field_type TEXT NOT NULL, -- string/number/enum/date/text/boolean
group_name TEXT, -- 所属分组 (如"基本信息"/"工艺参数"/"质量要求")
is_required INTEGER DEFAULT 0,
default_value TEXT,
enum_values TEXT, -- JSON数组:可选值列表
validation_json TEXT, -- 验证规则
order_index INTEGER,
source_type TEXT, -- manual/SCSAI_field/SCSAI_techdata/llm_generated
source_config_json TEXT -- 数据源配置
);
-- 生成的工艺规程实例
CREATE TABLE IF NOT EXISTS process_specs (
id TEXT PRIMARY KEY,
template_id TEXT REFERENCES process_templates(id),
name TEXT NOT NULL,
code TEXT,
industry_id TEXT,
status TEXT DEFAULT 'draft', -- draft/review/approved/published
-- 结构化数据
spec_data_json TEXT NOT NULL, -- 完整的工艺规程数据
parameters_json TEXT, -- 工艺参数
steps_json TEXT, -- 工序/工步列表
content_html TEXT, -- 渲染后的HTML内容
-- 溯源
source_type TEXT, -- manual/SCSAI_import/llm_generated/hybrid
source_ref_json TEXT, -- 数据来源引用
SCSAI_item_id TEXT, -- SCSAI中的对象ID
generated_by TEXT,
generated_at DATETIME,
approved_by TEXT,
approved_at DATETIME
);
Task 1.2: 工艺模板定义器 UI
新建 src/views/ProcessSpecStudio.vue,包含以下标签页:
- Industry Management: CRUD industry domains (high-end, phosphorus chemical, automotive manufacturing, etc.)
- Template Designer: Visually define the field structure, group layout, and validation rules for process specification templates
- Template Preview: Real-time preview of template rendering effects
- Field Library: Predefined common fields (product model, part number, process name, etc.), draggable into templates
Task 1.3: Automatically Extract Templates from PPS Sample Data
Script scripts/extract-pps-template.js:
- Analyze existing PPSSystem_Column (500 column definitions) and PPSSystem_FieldType1 (50 field types) in PPS
- Automatically generate the schema_json for the "Machining Process" template
- Map CL000xxx column names to template field definitions
- Output JSON ready for direct import into the process_templates table
Phase 2: Process Specification Generation Engine
Goal: Intelligently generate structured process specifications based on template + rules + LLM + industry data
Task 2.1: Generation Engine Core Service
Create new server/services/process-spec-generator.js:
class ProcessSpecGenerator {
// 核心生成流程
async generate(templateId, inputContext, options) {
// 1. 加载模板 schema + prompt
const template = await this.loadTemplate(templateId);
// 2. 收集上下文数据
const context = await this.gatherContext(template, inputContext);
// context 包括:
// - 用户输入(零件名称、材料、数量等基本信息)
// - AnySearch 行业数据(相似工艺、标准参数)
// - SCSAI 历史数据(同类零件的已有工艺规程)
// - 规则引擎约束(材料限制、设备能力等)
// 3. LLM 生成结构化数据
const specData = await this.generateWithLLM(template, context);
// 4. 规则校验 + 自动修复
const validated = await this.validateAndRepair(template, specData);
// 5. 返回结构化工艺规程
return validated;
}
}
关键设计:
- The template prompt_json contains three prompt templates: generate/complete/optimize
- generate: Generate a complete process specification from basic information
- complete: LLM completes the remaining fields after the user fills in partial fields
- optimize: Provide optimization suggestions for existing process specifications
Task 2.2: AnySearch Industry Data Integration
Add a "Process Data" search mode in AnySearch:
Modify src/components/anysearch/AnySearchPanel.vue:
- Add a process search mode (search for process standards, process parameters, industry standards)
- Search results can be referenced into the process specification generation context with one click
Create new server/services/process-data-search.js:
- Encapsulate AnySearch's process data search functionality
- Support filtering by industry, process type, material, etc.
- Structure search results and inject them into the LLM prompt context
Task 2.3: Engine REST API Generation
Create process-spec.router.js in server/routes/:
GET /api/process-spec/industries -- 列出行业领域
POST /api/process-spec/industries -- 创建行业领域
GET /api/process-spec/templates -- 列出模板
POST /api/process-spec/templates -- 创建模板
GET /api/process-spec/templates/:id -- 模板详情(含字段定义)
PUT /api/process-spec/templates/:id -- 更新模板
POST /api/process-spec/templates/:id/import -- 从PPS/SCSAI导入模板
POST /api/process-spec/generate -- 生成工艺规程
POST /api/process-spec/generate/preview -- 预览生成结果(不保存)
POST /api/process-spec/generate/complete -- 补全部分字段
POST /api/process-spec/generate/optimize -- 优化已有规程
GET /api/process-spec/specs -- 列出生成的工艺规程
GET /api/process-spec/specs/:id -- 工艺规程详情
PUT /api/process-spec/specs/:id -- 更新工艺规程
POST /api/process-spec/specs/:id/approve -- 审批工艺规程
GET /api/process-spec/specs/:id/export/:format -- 导出 (json/xml/pdf/html)
Phase 3: 多格式导出 (Export Manager)
Task 3.1: JSON/XML 导出
新建 server/services/process-spec-exporter.js:
- JSON: Directly serialize spec_data_json for clear structure
- XML/AML: Convert to SCSAI AML format for direct import into SCSAI
- Map template fields → SCSAI Property
- Generate AML structures like
- Utilize existing aml-generator.js capabilities
Task 3.2: PDF 2D Structured Process Specification
- Use puppeteer or html-pdf to convert rendered HTML to PDF
- PDF template supports company logo, approval/signature fields, headers/footers
- Format references high-end process specification standards (tables + operation cards)
Task 3.3: HTML Printable Version
- Extend the HTML template in the existing generate-process-files.js
- Support multi-industry template layouts (machining cards, welding cards, heat treatment cards, etc.)
- Responsive design, A4 print adaptation
Phase 4: LLM + Industry Knowledge Base (Intelligence Layer)
Task 4.1: Process Knowledge RAG
- Build a 10GB PPS structured data vector knowledge base
- Support retrieval of similar processes by process type, material, equipment
- Automatically inject relevant process knowledge as context during LLM generation
Task 4.2: Multi-Industry Knowledge Base Expansion
- Phosphorus Chemical: Chemical process parameter library (temperature, pressure, ratio, reaction time)
- Automotive Manufacturing: IATF 16949 process standard library
- General: Support importing process standard documents from any industry
Task 4.3: Prompt Engineering Optimization
Extend the generate scope of the existing prompt-template-manager.js:
generate: `你是{{industry_name}}行业的工艺规程专家。
【工艺类型】{{process_category}}
【模板要求】
{{#fields}}
- {{field_label}} ({{field_type}}){{#is_required}} [必填]{{/is_required}}: {{description}}
{{/fields}}
【输入信息】
{{user_input}}
【行业参考数据】
{{#similar_specs}}
参考工艺: {{name}} - {{summary}}
{{/similar_specs}}
【约束条件】
{{#constraints}}
- {{description}}
{{/constraints}}
输出严格的 JSON 格式...`
Phase 5: 三维工艺文件 (Future / 远期)
Task 5.1: 3D 模型集成
- 对接 3D XML / STEP / IGES 格式模型
- 在工艺规程中嵌入 3D 模型可视化组件
- 工序步骤关联 3D 视图标注
Task 5.2: 3D LLM Generate
- 基于 3D 模型自动识别加工特征
- 生成与 3D 模型关联的三维工艺规程
- 输出 3D PDF 或 WebGL 可视化工艺文件
Phase 6: 质量过程控制扩展 (Future / 远期)
Task 6.1: 质量模板扩展
- 复用 process_templates 表,新增"质量控制"模板类型
- 对接现有 QS 模块(NCR, Audit, DFMEA, PFMEA 等 SCSAI 对象类型)
- 高端质量过程控制 → 任意行业质量标准
Task 6.2: 质量数据采集
- 对接 MES/SCADA 系统采集过程质量数据
- 工艺参数实时监控 + SPC 统计过程控制
- 质量追溯链:工艺规程 → 生产批次 → 检验数据
实施优先级
| 优先级 | 任务 | 预计工作量 | 依赖 |
|--------|------|-----------|------|
| P0 | Task 1.1 Data Model | 1 day | None |
| P0 | Task 1.3 PPS Template Extraction | 1 day | Task 1.1 |
| P0 | Task 2.1 Core Generation Engine | 2 days | Task 1.1 |
| P1 | Task 2.3 REST API | 1 day | Task 2.1 |
| P1 | Task 3.1 JSON/XML Export | 1 day | Task 2.1 |
| P1 | Task 1.2 Template Designer UI | 2 days | Task 1.1 |
| P2 | Task 2.2 AnySearch Integration | 1 day | Task 2.1 |
| P2 | Task 3.2 PDF Export | 1 day | Task 3.1 |
| P2 | Task 3.3 HTML Template | 1 day | Task 3.1 |
| P2 | Task 4.3 Prompt Optimization | 1 day | Task 2.1 |
| P3 | Task 4.1 Process Knowledge RAG | 3 days | Task 4.3 |
| P3 | Task 4.2 Multi-Industry Extension | 2 days | Task 4.1 |
| P4 | Task 5.x 3D Process Planning | Long-term | Phase 1-4 |
| P4 | Task 6.x Quality Extension | Long-term | Phase 1-3 |
Recommended Starting Point
Begin with the 3 P0 Tasks to validate the core workflow:
- Create tables + PPS sample extraction template → Verify template definition feasibility
- Core generation engine → Use LLM to generate a machining process plan
- Output JSON format → Verify structured data integrity
This will establish a minimal viable loop: "Input basic part info → LLM generates process plan → Structured JSON output".
BossAgents