Files
sam-api/database/seeders/DocumentTemplateFieldPresetSeeder.php
권혁성 e364239572 feat: 견적 참조 데이터 API, 수주 전환 로직 개선, 검사기준서 필드 통합
- 견적 참조 데이터(현장명, 부호) 조회 API 추가 (GET /quotes/reference-data)
- 수주 전환 시 floor_code/symbol_code를 quoteItem.note에서 파싱하도록 변경
- 수주 전환 시 note에 formula_category 저장
- 검사기준서 프리셋: standard + standard_criteria → text_with_criteria로 통합
- tolerance 컬럼 width 조정 (120px → 85px)
- LOGICAL_RELATIONSHIPS.md 문서 갱신

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 23:07:08 +09:00

146 lines
9.0 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DocumentTemplateFieldPresetSeeder extends Seeder
{
public function run(): void
{
$now = now();
DB::table('document_template_field_presets')->truncate();
// 수입검사 프리셋
DB::table('document_template_field_presets')->insert([
'name' => '수입검사 기본 필드 세트',
'category' => '수입검사',
'fields' => json_encode([
['field_key' => 'category', 'label' => '구분', 'field_type' => 'text', 'width' => '65px', 'is_required' => false],
['field_key' => 'item', 'label' => '검사항목', 'field_type' => 'text', 'width' => '130px', 'is_required' => true],
['field_key' => 'standard', 'label' => '검사 기준/범위', 'field_type' => 'text_with_criteria', 'width' => '220px', 'is_required' => false],
['field_key' => 'tolerance', 'label' => '공차/범위', 'field_type' => 'json_tolerance', 'width' => '85px', 'is_required' => false],
['field_key' => 'method', 'label' => '검사방식', 'field_type' => 'select_api', 'width' => '110px', 'is_required' => false, 'options' => [
'api_endpoint' => '/api/admin/common-codes/inspection_method',
'auto_map' => [
'target_field' => 'measurement_type',
'mapping' => [
'visual' => 'checkbox',
'check' => 'numeric',
'mill_sheet' => 'single_value',
'certified_agency' => 'single_value',
'substitute_cert' => 'substitute',
'other' => 'text',
],
],
]],
['field_key' => 'measurement_type', 'label' => '측정유형', 'field_type' => 'select', 'width' => '100px', 'is_required' => false, 'options' => [
'choices' => [
['code' => 'checkbox', 'name' => 'OK/NG 체크'],
['code' => 'numeric', 'name' => '수치입력(3)'],
['code' => 'single_value', 'name' => '단일값'],
['code' => 'substitute', 'name' => '성적서 대체'],
['code' => 'text', 'name' => '자유입력'],
],
]],
['field_key' => 'frequency', 'label' => '검사주기', 'field_type' => 'composite_frequency', 'width' => '120px', 'is_required' => false],
['field_key' => 'regulation', 'label' => '관련규정', 'field_type' => 'text', 'width' => '80px', 'is_required' => false],
], JSON_UNESCAPED_UNICODE),
'links' => json_encode([
['link_key' => 'items', 'label' => '연결 품목 (RM, SM)', 'link_type' => 'multiple', 'source_table' => 'items', 'search_params' => ['item_type' => 'RM,SM'], 'display_fields' => ['title' => 'name', 'subtitle' => 'code']],
], JSON_UNESCAPED_UNICODE),
'sort_order' => 0,
'created_at' => $now,
'updated_at' => $now,
]);
// 품질검사 프리셋
DB::table('document_template_field_presets')->insert([
'name' => '품질검사 기본 필드 세트',
'category' => '품질검사',
'fields' => json_encode([
['field_key' => 'category', 'label' => '구분', 'field_type' => 'text', 'width' => '65px', 'is_required' => false],
['field_key' => 'item', 'label' => '검사항목', 'field_type' => 'text', 'width' => '130px', 'is_required' => true],
['field_key' => 'standard', 'label' => '검사 기준/범위', 'field_type' => 'text_with_criteria', 'width' => '220px', 'is_required' => false],
['field_key' => 'tolerance', 'label' => '공차/범위', 'field_type' => 'json_tolerance', 'width' => '85px', 'is_required' => false],
['field_key' => 'method', 'label' => '검사방식', 'field_type' => 'select_api', 'width' => '110px', 'is_required' => false, 'options' => [
'api_endpoint' => '/api/admin/common-codes/inspection_method',
'auto_map' => [
'target_field' => 'measurement_type',
'mapping' => [
'visual' => 'checkbox',
'check' => 'numeric',
'mill_sheet' => 'single_value',
'certified_agency' => 'single_value',
'substitute_cert' => 'substitute',
'other' => 'text',
],
],
]],
['field_key' => 'measurement_type', 'label' => '측정유형', 'field_type' => 'select', 'width' => '100px', 'is_required' => false, 'options' => [
'choices' => [
['code' => 'checkbox', 'name' => 'OK/NG 체크'],
['code' => 'numeric', 'name' => '수치입력(3)'],
['code' => 'single_value', 'name' => '단일값'],
['code' => 'substitute', 'name' => '성적서 대체'],
['code' => 'text', 'name' => '자유입력'],
],
]],
['field_key' => 'frequency', 'label' => '검사주기', 'field_type' => 'composite_frequency', 'width' => '120px', 'is_required' => false],
['field_key' => 'regulation', 'label' => '관련규정', 'field_type' => 'text', 'width' => '80px', 'is_required' => false],
], JSON_UNESCAPED_UNICODE),
'links' => json_encode([
['link_key' => 'process', 'label' => '연결 공정', 'link_type' => 'single', 'source_table' => 'processes', 'search_params' => null, 'display_fields' => ['title' => 'process_name', 'subtitle' => 'process_code']],
], JSON_UNESCAPED_UNICODE),
'sort_order' => 1,
'created_at' => $now,
'updated_at' => $now,
]);
// 출하검사 프리셋
DB::table('document_template_field_presets')->insert([
'name' => '출하검사 기본 필드 세트',
'category' => '출하검사',
'fields' => json_encode([
['field_key' => 'category', 'label' => '구분', 'field_type' => 'text', 'width' => '65px', 'is_required' => false],
['field_key' => 'item', 'label' => '검사항목', 'field_type' => 'text', 'width' => '130px', 'is_required' => true],
['field_key' => 'standard', 'label' => '검사 기준/범위', 'field_type' => 'text_with_criteria', 'width' => '220px', 'is_required' => false],
['field_key' => 'tolerance', 'label' => '공차/범위', 'field_type' => 'json_tolerance', 'width' => '85px', 'is_required' => false],
['field_key' => 'method', 'label' => '검사방식', 'field_type' => 'select_api', 'width' => '110px', 'is_required' => false, 'options' => [
'api_endpoint' => '/api/admin/common-codes/inspection_method',
'auto_map' => [
'target_field' => 'measurement_type',
'mapping' => [
'visual' => 'checkbox',
'check' => 'numeric',
'mill_sheet' => 'single_value',
'certified_agency' => 'single_value',
'substitute_cert' => 'substitute',
'other' => 'text',
],
],
]],
['field_key' => 'measurement_type', 'label' => '측정유형', 'field_type' => 'select', 'width' => '100px', 'is_required' => false, 'options' => [
'choices' => [
['code' => 'checkbox', 'name' => 'OK/NG 체크'],
['code' => 'numeric', 'name' => '수치입력(3)'],
['code' => 'single_value', 'name' => '단일값'],
['code' => 'substitute', 'name' => '성적서 대체'],
['code' => 'text', 'name' => '자유입력'],
],
]],
['field_key' => 'frequency', 'label' => '검사주기', 'field_type' => 'composite_frequency', 'width' => '120px', 'is_required' => false],
['field_key' => 'regulation', 'label' => '관련규정', 'field_type' => 'text', 'width' => '80px', 'is_required' => false],
], JSON_UNESCAPED_UNICODE),
'links' => json_encode([
['link_key' => 'lot', 'label' => '로트번호', 'link_type' => 'single', 'source_table' => 'lots', 'search_params' => null, 'display_fields' => ['title' => 'lot_no', 'subtitle' => 'item_name']],
], JSON_UNESCAPED_UNICODE),
'sort_order' => 2,
'created_at' => $now,
'updated_at' => $now,
]);
}
}