diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index b167e7f..39c1573 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -67,37 +67,43 @@ class DatabaseSeeder extends Seeder ]); $user4->assignRole('user'); - // 3. 创建分组 - $this->command->info('创建分组...'); - $techGroup = Group::factory()->create([ - 'name' => '技术部', - 'description' => '负责公司技术研发和系统维护工作', - ]); + // 3. 创建分组(按照光束线) + $this->command->info('创建光束线分组...'); + $beamlines = [ + 'BL02U1', + 'BL07U', + 'BL08U', + 'BL13HB', + 'BL13U', + 'BL14B', + 'BL14W', + 'BL15U', + 'BL16B', + 'BL16U1', + ]; - $marketGroup = Group::factory()->create([ - 'name' => '市场部', - 'description' => '负责市场推广和品牌建设工作', - ]); - - $hrGroup = Group::factory()->create([ - 'name' => '人力资源部', - 'description' => '负责人力资源管理和员工关系维护', - ]); + $groups = []; + foreach ($beamlines as $beamline) { + $groups[$beamline] = Group::factory()->create([ + 'name' => $beamline, + 'description' => null, + ]); + } // 4. 建立用户和分组的关联关系 $this->command->info('建立用户和分组的关联关系...'); - // 管理员属于所有分组 - $admin->groups()->attach([$techGroup->id, $marketGroup->id, $hrGroup->id]); + // 管理员属于所有光束线分组 + $admin->groups()->attach(array_column($groups, 'id')); - // 张三和李四属于技术部 - $user1->groups()->attach($techGroup->id); - $user2->groups()->attach($techGroup->id); + // 张三和李四属于 BL02U1 + $user1->groups()->attach($groups['BL02U1']->id); + $user2->groups()->attach($groups['BL02U1']->id); - // 王五属于市场部 - $user3->groups()->attach($marketGroup->id); + // 王五属于 BL07U + $user3->groups()->attach($groups['BL07U']->id); - // 赵六属于人力资源部 - $user4->groups()->attach($hrGroup->id); + // 赵六属于 BL08U + $user4->groups()->attach($groups['BL08U']->id); // 5. 创建全局文档(仅元数据,不创建实际文件) $this->command->info('创建全局文档...'); @@ -153,155 +159,64 @@ class DatabaseSeeder extends Seeder 'conversion_status' => 'pending', ]); - // 6. 创建技术部专用文档 - $this->command->info('创建技术部专用文档...'); + // 6. 创建 BL02U1 光束线专用文档 + $this->command->info('创建 BL02U1 光束线专用文档...'); Document::create([ - 'title' => '系统架构设计文档', - 'description' => '公司核心系统的架构设计和技术选型说明', + 'title' => 'BL02U1 操作手册', + 'description' => 'BL02U1 光束线设备操作规程和注意事项', 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '系统架构设计.docx', + 'file_name' => 'BL02U1_操作手册.docx', 'file_size' => fake()->numberBetween(100000, 500000), 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'type' => 'dedicated', - 'group_id' => $techGroup->id, + 'group_id' => $groups['BL02U1']->id, 'uploaded_by' => $user1->id, 'conversion_status' => 'pending', ]); Document::create([ - 'title' => '代码规范指南', - 'description' => '团队代码编写规范和最佳实践', + 'title' => 'BL02U1 维护记录', + 'description' => 'BL02U1 光束线设备维护和检修记录', 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '代码规范.docx', + 'file_name' => 'BL02U1_维护记录.docx', 'file_size' => fake()->numberBetween(100000, 500000), 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'type' => 'dedicated', - 'group_id' => $techGroup->id, - 'uploaded_by' => $admin->id, - 'conversion_status' => 'pending', - ]); - - Document::create([ - 'title' => '数据库设计文档', - 'description' => '数据库表结构设计和关系说明', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '数据库设计.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $techGroup->id, + 'group_id' => $groups['BL02U1']->id, 'uploaded_by' => $user2->id, 'conversion_status' => 'pending', ]); + // 7. 创建 BL07U 光束线专用文档 + $this->command->info('创建 BL07U 光束线专用文档...'); Document::create([ - 'title' => 'API 接口文档', - 'description' => '系统对外提供的 API 接口说明和使用示例', + 'title' => 'BL07U 操作手册', + 'description' => 'BL07U 光束线设备操作规程和注意事项', 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => 'API接口文档.docx', + 'file_name' => 'BL07U_操作手册.docx', 'file_size' => fake()->numberBetween(100000, 500000), 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'type' => 'dedicated', - 'group_id' => $techGroup->id, - 'uploaded_by' => $user1->id, - 'conversion_status' => 'pending', - ]); - - // 7. 创建市场部专用文档 - $this->command->info('创建市场部专用文档...'); - Document::create([ - 'title' => '市场推广方案', - 'description' => '2025年第一季度市场推广计划和预算', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '市场推广方案_Q1.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $marketGroup->id, + 'group_id' => $groups['BL07U']->id, 'uploaded_by' => $user3->id, 'conversion_status' => 'pending', ]); + // 8. 创建 BL08U 光束线专用文档 + $this->command->info('创建 BL08U 光束线专用文档...'); Document::create([ - 'title' => '品牌宣传策略', - 'description' => '品牌定位和宣传渠道策略', + 'title' => 'BL08U 操作手册', + 'description' => 'BL08U 光束线设备操作规程和注意事项', 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '品牌宣传策略.docx', + 'file_name' => 'BL08U_操作手册.docx', 'file_size' => fake()->numberBetween(100000, 500000), 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'type' => 'dedicated', - 'group_id' => $marketGroup->id, - 'uploaded_by' => $admin->id, - 'conversion_status' => 'pending', - ]); - - Document::create([ - 'title' => '客户调研报告', - 'description' => '目标客户群体调研分析报告', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '客户调研报告.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $marketGroup->id, - 'uploaded_by' => $user3->id, - 'conversion_status' => 'pending', - ]); - - // 8. 创建人力资源部专用文档 - $this->command->info('创建人力资源部专用文档...'); - Document::create([ - 'title' => '招聘流程指南', - 'description' => '公司招聘流程和面试评估标准', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '招聘流程指南.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $hrGroup->id, + 'group_id' => $groups['BL08U']->id, 'uploaded_by' => $user4->id, 'conversion_status' => 'pending', ]); - Document::create([ - 'title' => '员工培训计划', - 'description' => '2025年员工培训计划和课程安排', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '员工培训计划_2025.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $hrGroup->id, - 'uploaded_by' => $admin->id, - 'conversion_status' => 'pending', - ]); - - Document::create([ - 'title' => '薪酬福利制度', - 'description' => '公司薪酬结构和福利政策说明', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '薪酬福利制度.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $hrGroup->id, - 'uploaded_by' => $user4->id, - 'conversion_status' => 'pending', - ]); - - Document::create([ - 'title' => '绩效考核标准', - 'description' => '员工绩效考核指标和评估流程', - 'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx', - 'file_name' => '绩效考核标准.docx', - 'file_size' => fake()->numberBetween(100000, 500000), - 'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'type' => 'dedicated', - 'group_id' => $hrGroup->id, - 'uploaded_by' => $admin->id, - 'conversion_status' => 'pending', - ]); - $this->command->info('演示数据生成完成!'); // 9. 创建终端数据 @@ -320,9 +235,9 @@ class DatabaseSeeder extends Seeder $this->command->newLine(); $this->command->info('=== 测试账号信息 ==='); $this->command->info('超级管理员: admin@example.com / password (super-admin)'); - $this->command->info('张三(技术部): zhangsan@example.com / password (user)'); - $this->command->info('李四(技术部): lisi@example.com / password (user)'); - $this->command->info('王五(市场部): wangwu@example.com / password (admin)'); - $this->command->info('赵六(人力资源部): zhaoliu@example.com / password (user)'); + $this->command->info('张三(BL02U1): zhangsan@example.com / password (user)'); + $this->command->info('李四(BL02U1): lisi@example.com / password (user)'); + $this->command->info('王五(BL07U): wangwu@example.com / password (admin)'); + $this->command->info('赵六(BL08U): zhaoliu@example.com / password (user)'); } } diff --git a/database/seeders/SopTemplateSeeder.php b/database/seeders/SopTemplateSeeder.php index 15ef20c..a3e70db 100644 --- a/database/seeders/SopTemplateSeeder.php +++ b/database/seeders/SopTemplateSeeder.php @@ -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' => '

检查设备周围环境,确保无障碍物和安全隐患。

', + 'title' => '开机前安全检查', + 'content' => '

检查光束线周围环境,确保无障碍物和安全隐患。

', 'sort_order' => 1, 'is_required' => true, ], [ 'step_number' => 2, - 'title' => '电源系统检查', - 'content' => '

检查电源系统状态。

', + 'title' => '真空系统检查', + 'content' => '

检查真空系统状态。

', 'sort_order' => 2, 'is_required' => true, ], [ 'step_number' => 3, - 'title' => '启动设备', - 'content' => '

按照正确顺序启动设备。

  1. 打开主电源开关
  2. 等待系统自检完成
  3. 按下启动按钮
  4. 观察设备运行状态
', + 'title' => '冷却水系统检查', + 'content' => '

检查冷却水系统。

', 'sort_order' => 3, 'is_required' => true, ], [ 'step_number' => 4, - 'title' => '运行状态确认', - 'content' => '

确认设备正常运行。

', + 'title' => '启动光束线', + 'content' => '

按照正确顺序启动光束线。

  1. 打开控制系统
  2. 等待系统自检完成
  3. 启动束流
  4. 观察束流参数
', 'sort_order' => 4, 'is_required' => true, ], + [ + 'step_number' => 5, + 'title' => '运行状态确认', + 'content' => '

确认光束线正常运行。

', + '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' => '

使用扫码枪扫描产品条码,获取产品信息。

', + 'title' => '扫描用户机时单', + 'content' => '

使用扫码枪扫描用户机时单二维码,获取实验信息。

', 'sort_order' => 1, 'is_required' => true, ], [ 'step_number' => 2, - 'title' => '外观检查', - 'content' => '

检查产品外观质量。

', + 'title' => '样品安全检查', + 'content' => '

检查样品安全性。

', 'sort_order' => 2, 'is_required' => true, ], [ 'step_number' => 3, - 'title' => '尺寸测量', - 'content' => '

使用量具测量关键尺寸。

', + 'title' => '样品安装', + 'content' => '

将样品安装到样品台。

', 'sort_order' => 3, 'is_required' => true, ], [ 'step_number' => 4, - 'title' => '质检结果录入', - 'content' => '

在系统中录入质检结果。

', + 'title' => '实验参数设置', + 'content' => '

在控制系统中设置实验参数。

', '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, diff --git a/database/seeders/TerminalSeeder.php b/database/seeders/TerminalSeeder.php index 9becce2..c3b5b2e 100644 --- a/database/seeders/TerminalSeeder.php +++ b/database/seeders/TerminalSeeder.php @@ -15,167 +15,58 @@ class TerminalSeeder extends Seeder { $this->command->info('开始创建终端数据...'); - // 1. 创建生产线终端 - $this->command->info('创建生产线终端...'); - $productionTerminals = [ - [ - 'name' => '生产线A-工位1', - 'code' => 'PROD-A001', - 'ip_address' => '192.168.1.101', - 'diagram_url' => 'https://example.com/diagrams/prod-a-1.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 80, - ], - 'is_online' => true, - 'last_online_at' => now(), - ], - [ - 'name' => '生产线A-工位2', - 'code' => 'PROD-A002', - 'ip_address' => '192.168.1.102', - 'diagram_url' => 'https://example.com/diagrams/prod-a-2.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 80, - ], - 'is_online' => true, - 'last_online_at' => now(), - ], - [ - 'name' => '生产线B-工位1', - 'code' => 'PROD-B001', - 'ip_address' => '192.168.1.201', - 'diagram_url' => 'https://example.com/diagrams/prod-b-1.png', - 'display_config' => [ - 'resolution' => '2560x1440', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 75, - ], - 'is_online' => false, - 'last_online_at' => now()->subHours(2), - ], + // 光束线列表 + $beamlines = [ + 'BL02U1' => '192.168.1.21', + 'BL07U' => '192.168.1.27', + 'BL08U' => '192.168.1.28', + 'BL13HB' => '192.168.1.33', + 'BL13U' => '192.168.1.34', + 'BL14B' => '192.168.1.35', + 'BL14W' => '192.168.1.36', + 'BL15U' => '192.168.1.37', + 'BL16B' => '192.168.1.38', + 'BL16U1' => '192.168.1.39', ]; - foreach ($productionTerminals as $terminalData) { - $terminal = Terminal::create($terminalData); + // 为每条光束线创建智慧屏终端 + $this->command->info('创建光束线智慧屏终端...'); + foreach ($beamlines as $beamline => $ipAddress) { + $terminal = Terminal::create([ + 'name' => "{$beamline} 智慧屏", + 'code' => "SCREEN-{$beamline}", + 'ip_address' => $ipAddress, + 'station_id' => $beamline, + 'diagram_url' => "https://example.com/diagrams/{$beamline}.png", + 'display_config' => [ + 'resolution' => '3840x2160', + 'refresh_rate' => 60, + 'orientation' => 'landscape', + 'brightness' => 80, + 'touch_enabled' => true, + ], + 'is_online' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U']), + 'last_online_at' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U']) + ? now() + : now()->subHours(rand(1, 24)), + ]); - // 为每个终端创建默认提示词 + // 为每个终端创建提示词 TerminalPrompt::create([ 'terminal_id' => $terminal->id, - 'prompt_template' => "你是{station}的AI助手。当前时间是{time}。请根据用户{user}的问题,提供准确的技术支持和操作指导。", + 'prompt_template' => "你是{station}光束线的AI助手。当前时间是{time}。请根据用户{user}的问题,提供准确的光束线操作指导、实验支持和技术咨询。你可以回答关于光束线参数、实验流程、设备状态、安全规范等方面的问题。", 'variables' => [ - 'station' => $terminalData['name'], + 'station' => $beamline, 'time' => '{current_time}', 'user' => '{current_user}', ], ]); } - // 2. 创建质检站终端 - $this->command->info('创建质检站终端...'); - $qcTerminals = [ - [ - 'name' => '质检站-入库检-1', - 'code' => 'QC-IN001', - 'ip_address' => '192.168.2.101', - 'diagram_url' => 'https://example.com/diagrams/qc-in-1.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 85, - ], - 'is_online' => true, - 'last_online_at' => now(), - ], - [ - 'name' => '质检站-出库检-1', - 'code' => 'QC-OUT001', - 'ip_address' => '192.168.2.102', - 'diagram_url' => 'https://example.com/diagrams/qc-out-1.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 85, - ], - 'is_online' => true, - 'last_online_at' => now(), - ], - ]; - - foreach ($qcTerminals as $terminalData) { - $terminal = Terminal::create($terminalData); - - TerminalPrompt::create([ - 'terminal_id' => $terminal->id, - 'prompt_template' => "你是{station}的质检AI助手。请协助操作员{user}完成质检工作,提供质检标准、操作流程和异常处理建议。", - 'variables' => [ - 'station' => $terminalData['name'], - 'user' => '{current_user}', - ], - ]); - } - - // 3. 创建包装站终端 - $this->command->info('创建包装站终端...'); - $packagingTerminals = [ - [ - 'name' => '包装站-工位1', - 'code' => 'PKG-001', - 'ip_address' => '192.168.3.101', - 'diagram_url' => 'https://example.com/diagrams/pkg-1.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 80, - ], - 'is_online' => true, - 'last_online_at' => now(), - ], - [ - 'name' => '包装站-工位2', - 'code' => 'PKG-002', - 'ip_address' => '192.168.3.102', - 'diagram_url' => 'https://example.com/diagrams/pkg-2.png', - 'display_config' => [ - 'resolution' => '1920x1080', - 'refresh_rate' => 60, - 'orientation' => 'landscape', - 'brightness' => 80, - ], - 'is_online' => false, - 'last_online_at' => now()->subDays(1), - ], - ]; - - foreach ($packagingTerminals as $terminalData) { - $terminal = Terminal::create($terminalData); - - TerminalPrompt::create([ - 'terminal_id' => $terminal->id, - 'prompt_template' => "你是{station}的包装AI助手。请协助操作员{user}完成包装作业,提供包装规范、材料使用和质量要求指导。", - 'variables' => [ - 'station' => $terminalData['name'], - 'user' => '{current_user}', - ], - ]); - } - $this->command->info('终端数据创建完成!'); $this->command->newLine(); $this->command->info('=== 生成的终端摘要 ==='); $this->command->info('总终端数量: ' . Terminal::count()); - $this->command->info(' - 生产线终端: ' . Terminal::where('code', 'like', 'PROD-%')->count()); - $this->command->info(' - 质检站终端: ' . Terminal::where('code', 'like', 'QC-%')->count()); - $this->command->info(' - 包装站终端: ' . Terminal::where('code', 'like', 'PKG-%')->count()); $this->command->info(' - 在线终端: ' . Terminal::where('is_online', true)->count()); $this->command->info(' - 离线终端: ' . Terminal::where('is_online', false)->count()); $this->command->info(' - 配置提示词的终端: ' . TerminalPrompt::count());