refactor: 修改 seeder 数据以适配光束线场景

- DatabaseSeeder: 将分组改为十条光束线(BL02U1-BL16U1)
- 修改文档数据为光束线相关内容
- SopTemplateSeeder: 创建光束线操作相关的 SOP 模板
  - 光束线标准开机流程
  - 用户实验准备标准流程
  - 光束线日常维护流程(草稿)
- TerminalSeeder: 为每条光束线创建智慧屏终端
  - 每条光束线对应一个智慧屏终端
  - 配置光束线专用的 AI 助手提示词
  - 设置合理的在线/离线状态
This commit is contained in:
2026-03-12 17:54:51 +08:00
parent f89acbb2dc
commit 06cf30130d
3 changed files with 150 additions and 343 deletions

View File

@@ -21,17 +21,17 @@ class SopTemplateSeeder extends Seeder
return;
}
// 1. 设备启动操作规
$this->command->info('创建设备启动操作规程...');
// 1. 光束线开机流
$this->command->info('创建光束线开机流程...');
$template1 = SopTemplate::create([
'name' => '生产设备标准启动流程',
'description' => '本流程规定了生产设备启动前的检查项目、启动步骤和注意事项,确保设备安全、正常启动。',
'category' => '生产操作',
'tags' => ['标准作业', '设备操作', '安全'],
'name' => '光束线标准开机流程',
'description' => '本流程规定了光束线开机前的检查项目、开机步骤和注意事项,确保光束线安全、正常启动。',
'category' => '光束线操作',
'tags' => ['标准作业', '开机流程', '安全'],
'version' => '1.0.0',
'status' => 'published',
'applicable_departments' => ['生产部', '设备部'],
'applicable_positions' => ['操作员', '班组长'],
'applicable_departments' => ['BL02U1', 'BL07U', 'BL08U', 'BL13HB', 'BL13U', 'BL14B', 'BL14W', 'BL15U', 'BL16B', 'BL16U1'],
'applicable_positions' => ['操作员', '值班员'],
'published_at' => now()->subMonths(2),
'created_by' => $user->id,
]);
@@ -39,32 +39,39 @@ class SopTemplateSeeder extends Seeder
$steps1 = [
[
'step_number' => 1,
'title' => '启动前安全检查',
'content' => '<p>检查设备周围环境,确保无障碍物和安全隐患。</p><ul><li>检查设备外观是否完好</li><li>检查安全防护装置是否到位</li><li>检查急停按钮是否正常</li></ul>',
'title' => '开机前安全检查',
'content' => '<p>检查光束线周围环境,确保无障碍物和安全隐患。</p><ul><li>检查光束线外观是否完好</li><li>检查安全联锁装置是否正常</li><li>检查急停按钮是否正常</li><li>确认辐射防护门关闭</li></ul>',
'sort_order' => 1,
'is_required' => true,
],
[
'step_number' => 2,
'title' => '电源系统检查',
'content' => '<p>检查电源系统状态。</p><ul><li>确认电源开关处于关闭状态</li><li>检查电源线路连接</li><li>检查接地线</li></ul>',
'title' => '真空系统检查',
'content' => '<p>检查真空系统状态。</p><ul><li>确认真空泵运行正常</li><li>检查真空度读数</li><li>检查真空阀门状态</li></ul>',
'sort_order' => 2,
'is_required' => true,
],
[
'step_number' => 3,
'title' => '启动设备',
'content' => '<p>按照正确顺序启动设备。</p><ol><li>打开主电源开关</li><li>等待系统自检完成</li><li>按下启动按钮</li><li>观察设备运行状态</li></ol>',
'title' => '冷却水系统检查',
'content' => '<p>检查冷却水系统。</p><ul><li>确认冷却水流量正常</li><li>检查水温是否在正常范围</li><li>检查冷却水压力</li></ul>',
'sort_order' => 3,
'is_required' => true,
],
[
'step_number' => 4,
'title' => '运行状态确认',
'content' => '<p>确认设备正常运行。</p><ul><li>检查仪表显示</li><li>听设备运行声音</li><li>观察有无异常振动</li></ul>',
'title' => '启动光束线',
'content' => '<p>按照正确顺序启动光束线。</p><ol><li>打开控制系统</li><li>等待系统自检完成</li><li>启动束流</li><li>观察束流参数</li></ol>',
'sort_order' => 4,
'is_required' => true,
],
[
'step_number' => 5,
'title' => '运行状态确认',
'content' => '<p>确认光束线正常运行。</p><ul><li>检查束流强度</li><li>检查束流位置</li><li>检查各项参数是否在正常范围</li></ul>',
'sort_order' => 5,
'is_required' => true,
],
];
foreach ($steps1 as $stepData) {
@@ -85,14 +92,14 @@ class SopTemplateSeeder extends Seeder
]);
}
// 为第3步添加拍照任务
if ($stepData['step_number'] == 3) {
// 为第4步添加拍照任务
if ($stepData['step_number'] == 4) {
SopInteractiveTask::create([
'sop_step_id' => $step->id,
'task_type' => 'photo',
'task_config' => [
'title' => '拍摄设备启动状态',
'message' => '请拍摄设备仪表盘照片',
'title' => '拍摄控制系统状态',
'message' => '请拍摄控制系统界面照片',
'min_photos' => 1,
'max_photos' => 3,
],
@@ -103,17 +110,17 @@ class SopTemplateSeeder extends Seeder
}
}
// 2. 产品质检标准流程
$this->command->info('创建产品质检标准流程...');
// 2. 用户实验准备流程
$this->command->info('创建用户实验准备流程...');
$template2 = SopTemplate::create([
'name' => '成品出库质检流程',
'description' => '本流程规定了成品出库前的质量检验项目、检验方法和判定标准。',
'category' => '质量管理',
'tags' => ['质量控制', '标准作业', '检验'],
'name' => '用户实验准备标准流程',
'description' => '本流程规定了用户实验前的准备工作、样品安装和参数设置步骤。',
'category' => '实验操作',
'tags' => ['用户实验', '标准作业', '样品准备'],
'version' => '1.0.0',
'status' => 'published',
'applicable_departments' => ['质检部'],
'applicable_positions' => ['质检员', '质检组长'],
'applicable_departments' => ['BL02U1', 'BL07U', 'BL08U', 'BL13HB', 'BL13U', 'BL14B', 'BL14W', 'BL15U', 'BL16B', 'BL16U1'],
'applicable_positions' => ['操作员', '实验员'],
'published_at' => now()->subMonth(),
'created_by' => $user->id,
]);
@@ -121,29 +128,29 @@ class SopTemplateSeeder extends Seeder
$steps2 = [
[
'step_number' => 1,
'title' => '扫描产品条码',
'content' => '<p>使用扫码枪扫描产品条码,获取产品信息。</p>',
'title' => '扫描用户机时单',
'content' => '<p>使用扫码枪扫描用户机时单二维码,获取实验信息。</p>',
'sort_order' => 1,
'is_required' => true,
],
[
'step_number' => 2,
'title' => '外观检查',
'content' => '<p>检查产品外观质量。</p><ul><li>表面无划痕</li><li>颜色均匀</li><li>无变形</li></ul>',
'title' => '样品安全检查',
'content' => '<p>检查样品安全性。</p><ul><li>确认样品无放射性</li><li>确认样品无毒性</li><li>确认样品符合实验要求</li></ul>',
'sort_order' => 2,
'is_required' => true,
],
[
'step_number' => 3,
'title' => '尺寸测量',
'content' => '<p>使用量具测量关键尺寸。</p>',
'title' => '样品安装',
'content' => '<p>将样品安装到样品台。</p><ul><li>调整样品位置</li><li>固定样品</li><li>对准光束中心</li></ul>',
'sort_order' => 3,
'is_required' => true,
],
[
'step_number' => 4,
'title' => '质检结果录入',
'content' => '<p>在系统中录入质检结果。</p>',
'title' => '实验参数设置',
'content' => '<p>在控制系统中设置实验参数。</p>',
'sort_order' => 4,
'is_required' => true,
],
@@ -158,8 +165,8 @@ class SopTemplateSeeder extends Seeder
'sop_step_id' => $step->id,
'task_type' => 'scan',
'task_config' => [
'title' => '扫描产品条码',
'scan_type' => 'barcode',
'title' => '扫描机时单二维码',
'scan_type' => 'qrcode',
],
'validation_rules' => [
'pattern' => '^[A-Z0-9]{10,20}$',
@@ -175,8 +182,8 @@ class SopTemplateSeeder extends Seeder
'sop_step_id' => $step->id,
'task_type' => 'select',
'task_config' => [
'title' => '外观检查结果',
'options' => ['合格', '不合格'],
'title' => '样品安全检查结果',
'options' => ['通过', '不通过'],
],
'validation_rules' => [],
'timeout_seconds' => 120,
@@ -184,25 +191,19 @@ class SopTemplateSeeder extends Seeder
]);
}
// 为第3步添加输入任务
// 为第3步添加拍照任务
if ($stepData['step_number'] == 3) {
SopInteractiveTask::create([
'sop_step_id' => $step->id,
'task_type' => 'input',
'task_type' => 'photo',
'task_config' => [
'title' => '输入测量数据',
'fields' => [
['name' => 'length', 'label' => '长度(mm)', 'type' => 'number'],
['name' => 'width', 'label' => '宽度(mm)', 'type' => 'number'],
['name' => 'height', 'label' => '高度(mm)', 'type' => 'number'],
],
'title' => '拍摄样品安装照片',
'message' => '请拍摄样品安装完成后的照片',
'min_photos' => 1,
'max_photos' => 2,
],
'validation_rules' => [
'length' => ['required', 'numeric', 'min:0'],
'width' => ['required', 'numeric', 'min:0'],
'height' => ['required', 'numeric', 'min:0'],
],
'timeout_seconds' => 300,
'validation_rules' => [],
'timeout_seconds' => 180,
'is_required' => true,
]);
}
@@ -211,13 +212,13 @@ class SopTemplateSeeder extends Seeder
// 3. 创建一个草稿模板
$this->command->info('创建草稿模板...');
SopTemplate::create([
'name' => '设备维护保养流程(草稿)',
'description' => '设备日常维护保养操作流程,包括清洁、润滑、紧固等内容。',
'name' => '光束线日常维护流程(草稿)',
'description' => '光束线日常维护保养操作流程,包括清洁、检查、记录等内容。',
'category' => '设备维护',
'tags' => ['维护', '保养'],
'version' => '0.1.0',
'status' => 'draft',
'applicable_departments' => ['设备部'],
'applicable_departments' => ['BL02U1', 'BL07U', 'BL08U'],
'applicable_positions' => ['维修工', '技术员'],
'published_at' => null,
'created_by' => $user->id,