refactor: 修改 seeder 数据以适配光束线场景
- DatabaseSeeder: 将分组改为十条光束线(BL02U1-BL16U1) - 修改文档数据为光束线相关内容 - SopTemplateSeeder: 创建光束线操作相关的 SOP 模板 - 光束线标准开机流程 - 用户实验准备标准流程 - 光束线日常维护流程(草稿) - TerminalSeeder: 为每条光束线创建智慧屏终端 - 每条光束线对应一个智慧屏终端 - 配置光束线专用的 AI 助手提示词 - 设置合理的在线/离线状态
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user