feat:검사기준서 탭 개선 - tolerance, measurement_type 컬럼 및 inspection_method 공통코드 추가

- document_template_section_items에 tolerance(공차), measurement_type(측정유형) 컬럼 추가
- common_codes에 inspection_method 그룹 6개 코드 삽입
- DocumentTemplateSectionItem 모델 $fillable 업데이트

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 16:29:39 +09:00
parent c90077bd51
commit f701e0636e
3 changed files with 69 additions and 0 deletions

View File

@@ -27,7 +27,9 @@ class DocumentTemplateSectionItem extends Model
'category',
'item',
'standard',
'tolerance',
'method',
'measurement_type',
'frequency',
'regulation',
'sort_order',

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('document_template_section_items', function (Blueprint $table) {
$table->string('tolerance', 100)->nullable()->after('standard')->comment('공차/허용범위');
$table->string('measurement_type', 30)->nullable()->after('method')->comment('측정치 입력 유형: checkbox, numeric, single_value, substitute, text');
});
}
public function down(): void
{
Schema::table('document_template_section_items', function (Blueprint $table) {
$table->dropColumn(['tolerance', 'measurement_type']);
});
}
};

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
$now = now();
$methods = [
['code' => 'visual', 'name' => '육안검사', 'sort_order' => 1],
['code' => 'check', 'name' => '체크검사', 'sort_order' => 2],
['code' => 'mill_sheet', 'name' => '공급업체 밀시트', 'sort_order' => 3],
['code' => 'certified_agency', 'name' => '공인시험기관', 'sort_order' => 4],
['code' => 'substitute_cert', 'name' => '공급업체 성적서 대체', 'sort_order' => 5],
['code' => 'other', 'name' => '기타', 'sort_order' => 6],
];
foreach ($methods as $item) {
DB::table('common_codes')->updateOrInsert(
['code_group' => 'inspection_method', 'code' => $item['code'], 'tenant_id' => null],
[
'code_group' => 'inspection_method',
'code' => $item['code'],
'name' => $item['name'],
'sort_order' => $item['sort_order'],
'is_active' => true,
'created_at' => $now,
'updated_at' => $now,
]
);
}
}
public function down(): void
{
DB::table('common_codes')
->where('code_group', 'inspection_method')
->whereNull('tenant_id')
->delete();
}
};