- BadDebt 컨트롤러/서비스 기능 확장
- StockService 재고 조회 로직 개선
- ProcessReceivingRequest 검증 규칙 수정
- Item, Order, CommonCode, Shipment 모델 업데이트
- TodayIssueObserverService 개선
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Quote 수식 모델 추가 (mng 패턴 적용)
- QuoteFormula: 수식 정의 (input/calculation/range/mapping)
- QuoteFormulaCategory: 카테고리 정의
- QuoteFormulaItem: 품목 출력 정의
- QuoteFormulaRange: 범위별 값 정의
- QuoteFormulaMapping: 매핑 값 정의
- FormulaEvaluatorService 확장
- executeAll(): 카테고리별 수식 실행
- evaluateRangeFormula/evaluateMappingFormula: QuoteFormula 기반 평가
- getItemPrice(): prices 테이블 연동
- QuoteCalculationService DB 기반으로 재작성
- 하드코딩된 품목 코드/로직 제거
- quote_formulas 테이블 기반 동적 계산
- getInputSchema(): DB 기반 입력 스키마 생성
- Price 모델 수정
- items 테이블 연동 (products/materials 대체)
- ITEM_TYPE 상수 업데이트 (FG/PT/RM/SM/CS)
- Price 모델에 getCurrentPrice(), getSalesPriceByItemCode() 메서드 추가
- Price 모델에 STATUS_*, ITEM_TYPE_* 상수 추가
- QuoteCalculationService에 setTenantId(), getUnitPrice() 메서드 추가
- 스크린 품목 단가: 원단, 케이스, 브라켓, 인건비 prices 조회로 변경
- 철재 품목 단가: 철판, 용접, 표면처리, 가공비 prices 조회로 변경
- 모터 용량별 단가: 50W~300W prices 조회로 변경
- 모든 단가는 prices 조회 실패 시 기존 하드코딩 값을 fallback으로 사용
- GET /items/{id} 응답에 BOM 확장 데이터 포함
- child_item_code, child_item_name, unit, specification 필드 추가
- expandBomData() 메서드 구현 (ItemsService)
- Product 모델 bom 캐스팅 추가
- products 테이블에 options JSON 컬럼 추가 (마이그레이션)
- Material/Product 모델에 options 필드 추가 (fillable, casts)
- SystemFields::PRODUCTS에 options 상수 추가
- MaterialService/ProductService에 동적 필드 자동 추출 로직:
- getKnownFields(): SystemFields + ItemField 기반 고정 필드 조회
- extractDynamicOptions(): 동적 필드 추출
- normalizeOptions(): [{label, value, unit}] 형태로 정규화
- material_code 중복 체크 시 soft delete 포함 (withTrashed)
- 사용 중인 자재 삭제 방지 (checkMaterialUsage)
- Material 모델에 category 관계 추가
- Price, PriceRevision 모델 추가 (PriceHistory 대체)
- PricingService: CRUD, 원가 조회, 확정 기능
- PricingController: statusCode 파라미터로 201 반환 지원
- NotFoundHttpException(404) 적용 (존재하지 않는 리소스)
- FormRequest 분리 (Store, Update, Index, Cost, ByItems)
- Swagger 문서 업데이트
- ApiResponse::handle()에 statusCode 옵션 추가
- prices/price_revisions 마이그레이션 및 데이터 이관
- is_active 컬럼 추가 마이그레이션 (default 1)
- Product 모델 fillable 및 casts 업데이트
- Material 모델 fillable 및 casts 업데이트
- Material 모델에 material_type fillable 추가
- ModelTrait의 scopeActive() 메서드 지원
- Products 테이블에 9개 파일 관련 필드 추가
- bending_diagram, bending_details (JSON)
- specification_file, specification_file_name
- certification_file, certification_file_name
- certification_number, certification_start_date, certification_end_date
- ItemsFileController 구현 (Code-based API)
- POST /items/{code}/files - 파일 업로드
- DELETE /items/{code}/files/{type} - 파일 삭제
- 파일 타입: bending_diagram, specification, certification
- ItemsFileUploadRequest 검증
- 파일 타입별 MIME 검증 (이미지/문서)
- 파일 크기 제한 (10MB/20MB)
- 인증 정보 및 절곡 상세 정보 검증
- Swagger 문서 작성 (ItemsFileApi.php)
- 업로드/삭제 API 스펙
- 스키마: ItemFileUploadResponse, ItemFileDeleteResponse
[모델 업데이트]
- 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 코드 포맷팅 검사 통과
- Material 모델
- fillable 속성 추가 (모든 필드 명시)
- User 모델
- BelongsToMany 관계 타입 힌트 추가
- Product 모델
- fillable에 unit 필드 추가
- casts 순서 정리 (boolean 그룹화)
- ProductComponent 모델
- quantity 캐스트 정밀도 변경 (decimal:4 → decimal:6)
- referencedItem() 메서드 추가 (동적 관계 로드)
- product(), material() 관계 메서드 수정 (where 조건 추가)
- is_default 캐스트 제거 (컬럼 없음)
- Tenant 모델
- options 캐스트 추가 (array)
- scopeActive() 추가 (trial, active 상태 필터링)
- isActive(), isTrial() 헬퍼 메서드 추가
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## 주요 변경사항
### BOM 시스템 통합 및 정리
- 기본 BOM 시스템 완전 제거 (미완성 3-tier 구조)
- app/Http/Controllers/Api/V1/BomController.php 삭제
- app/Services/BomService.php 삭제
- app/Models/Products/Bom.php 삭제
- app/Models/Products/BomItem.php 삭제
- BOM 역할 명확화: Product BOM (운영용) + Design BOM (설계용)
- Tag 모델에서 불필요한 BOM 참조 제거
### API 그룹핑 최적화
- Products & Materials 통합: /v1/products/materials/*
- Settings & Configuration 통합: /v1/settings/*
- 필드 설정: /v1/settings/fields/*
- 옵션 관리: /v1/settings/options/*
- 공통 코드: /v1/settings/common/*
- 기존 분산된 라우트 통합으로 일관성 향상
### 번역 완성도 향상
- 영어 에러 메시지 누락 항목 추가
- Settings, Materials, File 관련 메시지 보완
- 한국어/영어 번역 파일 동기화 완료
### 시스템 품질 개선
- API 구조 논리적 재구성으로 사용자 경험 향상
- 코드 복잡도 감소 및 유지보수성 개선
- 불필요한 컨트롤러/서비스 제거로 시스템 단순화
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>