Files
sam-manage/database/seeders/QuoteFormulaCategorySeeder.php
kent 541b59173b feat(seeder): quote_formulas 시스템 시딩 데이터 추가
- QuoteFormulaCategorySeeder: 카테고리 4개 (입력변수, 계산변수, 범위선택, 품목매핑)
- QuoteFormulaSeeder: 변수/계산식 19개 (W0, H0, W1, H1, M, K 등)
- QuoteFormulaRangeSeeder: 범위 조건 12개 (모터/가이드레일/케이스 선택)
- QuoteFormulaItemSeeder: 품목 매핑 24개 (FG-SCR-001, FG-STL-001 BOM)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-25 00:59:33 +09:00

78 lines
2.8 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
/**
* 견적 수식 카테고리 시더
*
* 수식 관리 UI에서 사용하는 카테고리 데이터 생성
* - 입력변수: 사용자 입력값 (W0, H0, PC, GT, MP, CT, QTY)
* - 계산변수: 파생 계산값 (W1, H1, M, K)
* - 범위선택: 조건부 품목 선택 (모터, 가이드레일 등)
* - 품목매핑: BOM 연동 품목 정의
*/
class QuoteFormulaCategorySeeder extends Seeder
{
public function run(): void
{
$tenantId = 1;
$categories = [
[
'tenant_id' => $tenantId,
'code' => 'input_variables',
'name' => '입력변수',
'description' => '사용자가 직접 입력하는 기본 변수 (오픈사이즈, 제품카테고리, 가이드유형, 모터전원, 연동제어, 수량)',
'sort_order' => 1,
'is_active' => true,
'created_by' => 1,
'updated_by' => 1,
],
[
'tenant_id' => $tenantId,
'code' => 'calculation_variables',
'name' => '계산변수',
'description' => '입력변수를 기반으로 자동 계산되는 파생 변수 (제작사이즈, 면적, 중량)',
'sort_order' => 2,
'is_active' => true,
'created_by' => 1,
'updated_by' => 1,
],
[
'tenant_id' => $tenantId,
'code' => 'range_selection',
'name' => '범위선택',
'description' => '조건(중량, 높이, 폭)에 따라 자동 선택되는 품목 (모터, 가이드레일, 케이스)',
'sort_order' => 3,
'is_active' => true,
'created_by' => 1,
'updated_by' => 1,
],
[
'tenant_id' => $tenantId,
'code' => 'item_mapping',
'name' => '품목매핑',
'description' => '견적 계산에 포함되는 품목과 수량/단가 수식 정의',
'sort_order' => 4,
'is_active' => true,
'created_by' => 1,
'updated_by' => 1,
],
];
foreach ($categories as $category) {
DB::table('quote_formula_categories')->updateOrInsert(
['tenant_id' => $category['tenant_id'], 'code' => $category['code']],
array_merge($category, [
'created_at' => now(),
'updated_at' => now(),
])
);
}
$this->command->info('QuoteFormulaCategorySeeder: ' . count($categories) . '개 카테고리 생성 완료');
}
}