From 4fde8c0221ec0fec6efb04f1111d07dd202d10f3 Mon Sep 17 00:00:00 2001 From: hskwon Date: Fri, 14 Nov 2025 11:11:55 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20BP-MES=20Phase=201=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=B0=8F=20Seeder=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [모델 업데이트] - Product 모델: 하이브리드 구조 필드로 fillable/casts 간소화 - 고정 필드: safety_stock, lead_time, is_variable_size, product_category, part_type, attributes_archive - 동적 필드: attributes JSON (category_fields로 관리) - 제거: BP-MES 전용 33개 필드 (이제 attributes에 저장) - ProductComponent 모델: BOM 계산 필드 + 동적 필드 - 고정 필드: quantity_formula, condition - 동적 필드: attributes JSON - 제거: is_bending, bending_diagram, bending_details (이제 attributes에 저장) [Seeder 실행] - BpMesCategoryFieldsSeeder: FG/PT/절곡품 카테고리 및 필드 생성 - BpMesTenantStatFieldsSeeder: 통계 필드 설정 (마진율, 가공비, 인건비, 설치비 등) [검증 완료] - Tinker 모델 테스트 통과 - Pint 코드 포맷팅 검사 통과 --- app/Models/Products/Product.php | 30 ++++-------------------- app/Models/Products/ProductComponent.php | 12 ++++------ 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/app/Models/Products/Product.php b/app/Models/Products/Product.php index 29b5c77..9f8d74e 100644 --- a/app/Models/Products/Product.php +++ b/app/Models/Products/Product.php @@ -18,41 +18,21 @@ class Product extends Model 'tenant_id', 'code', 'name', 'unit', 'category_id', 'product_type', // 라벨/분류용 'attributes', 'description', - 'is_sellable', 'is_purchasable', 'is_producible', 'is_active', - // BP-MES: 공통 필드 - 'margin_rate', 'processing_cost', 'labor_cost', 'install_cost', + 'is_sellable', 'is_purchasable', 'is_producible', + // 하이브리드 구조: 최소 고정 필드 'safety_stock', 'lead_time', 'is_variable_size', - // BP-MES: FG 전용 - 'product_category', 'lot_abbreviation', 'note', - // BP-MES: PT 전용 - 'part_type', 'part_usage', 'installation_type', 'assembly_type', - 'side_spec_width', 'side_spec_height', 'assembly_length', - 'guide_rail_model_type', 'guide_rail_model', - // BP-MES: 절곡품 - 'bending_diagram', 'bending_details', 'material', 'length', 'bending_length', - // BP-MES: 인증 - 'certification_number', 'certification_start_date', 'certification_end_date', - 'specification_file', 'specification_file_name', - 'certification_file', 'certification_file_name', - // BP-MES: 동적 확장 - 'options', + 'product_category', 'part_type', + 'attributes_archive', 'created_by', 'updated_by', ]; protected $casts = [ 'attributes' => 'array', + 'attributes_archive' => 'array', 'is_sellable' => 'boolean', 'is_purchasable' => 'boolean', 'is_producible' => 'boolean', - 'is_active' => 'boolean', - // BP-MES: 추가 boolean 필드 'is_variable_size' => 'boolean', - // BP-MES: JSON 필드 - 'bending_details' => 'array', - 'options' => 'array', - // BP-MES: Date 필드 - 'certification_start_date' => 'date', - 'certification_end_date' => 'date', ]; protected $hidden = [ diff --git a/app/Models/Products/ProductComponent.php b/app/Models/Products/ProductComponent.php index 45bff08..f6f6fd1 100644 --- a/app/Models/Products/ProductComponent.php +++ b/app/Models/Products/ProductComponent.php @@ -23,25 +23,21 @@ class ProductComponent extends Model 'ref_id', 'quantity', 'sort_order', - // BP-MES: 수식 계산 및 조건부 BOM + // 하이브리드 구조: 고정 필드 (범용 BOM 계산) 'quantity_formula', 'condition', - // BP-MES: 절곡품 - 'is_bending', - 'bending_diagram', - 'bending_details', + // 동적 필드 (테넌트별 커스텀) + 'attributes', 'created_by', 'updated_by', ]; protected $casts = [ 'quantity' => 'decimal:6', + 'attributes' => 'array', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', - // BP-MES: 추가 타입 캐스팅 - 'is_bending' => 'boolean', - 'bending_details' => 'array', ]; protected $hidden = [