diff --git a/plans/simulator-calculation-logic-mapping.md b/plans/simulator-calculation-logic-mapping.md index 77defda..c29dbb1 100644 --- a/plans/simulator-calculation-logic-mapping.md +++ b/plans/simulator-calculation-logic-mapping.md @@ -1,6 +1,6 @@ # 견적 시뮬레이터 완전 동기화 계획 -> **작성일**: 2025-12-23 (업데이트: 2025-12-24) +> **작성일**: 2025-12-23 (업데이트: 2025-12-29) > **목표**: design.sam.kr 시뮬레이터와 mng 시뮬레이터가 **동일한 결과**를 출력하도록 완전 동기화 --- @@ -828,7 +828,7 @@ write_memory("simulator-progress.md", 현재 진행 상황) | SF-SCR-M01 | items.salesPrice | ✅ | | SM-B002 | items.salesPrice | ✅ | -> **참고**: prices 테이블에 active 데이터 없음 → items.attributes.salesPrice에서 조회 +> **참고**: ~~prices 테이블에 active 데이터 없음~~ → **2025-12-29 prices 데이터 85개 추가 완료** ### 9.5 성공 기준 달성 현황 @@ -852,4 +852,71 @@ write_memory("simulator-progress.md", 현재 진행 상황) --- +## 10. Phase 6: prices 테이블 데이터 추가 (2025-12-29) + +### 10.1 작업 내용 + +| 항목 | 내용 | +|------|------| +| 작업일 | 2025-12-29 | +| 목적 | prices 테이블에 시뮬레이터용 단가 데이터 추가 | +| Seeder | `DesignPriceSeeder.php` | +| 대상 품목 | 85개 (RM, SM, SF-SCR, SF-STL, SF-BND) | + +### 10.2 생성된 Seeder + +**파일**: `mng/database/seeders/DesignPriceSeeder.php` + +```php +// items.attributes.salesPrice → prices 테이블 이전 +// 단가 우선순위: prices (1순위) → items.attributes (2순위) +``` + +**실행 명령**: +```bash +php artisan db:seed --class=DesignPriceSeeder +``` + +### 10.3 추가된 데이터 + +| 품목 유형 | 코드 패턴 | 수량 | +|----------|----------|------| +| 원자재 | RM-* | 20개 | +| 부자재 | SM-* | 25개 | +| 스크린 반제품 | SF-SCR-* | 20개 | +| 철재 반제품 | SF-STL-* | 16개 | +| 절곡 반제품 | SF-BND-* | 4개 | +| **합계** | | **85개** | + +### 10.4 단가 우선순위 검증 결과 + +``` +=== prices 우선순위 테스트 === +prices 테이블: 99,999원 (테스트용 변경) +items.attributes: 35,000원 (그대로) +getSalesPriceByItemCode(): 99,999원 + +✓ prices 테이블 우선 적용 확인! +``` + +### 10.5 FormulaEvaluatorService 단가 조회 로직 + +```php +// mng/app/Services/Quote/FormulaEvaluatorService.php:379-410 +private function getItemPrice(string $itemCode): float +{ + // 1순위: Price 모델에서 조회 + $price = Price::getSalesPriceByItemCode($tenantId, $itemCode); + if ($price > 0) { + return $price; + } + + // 2순위: Fallback - items.attributes.salesPrice + $item = DB::table('items')->where('code', $itemCode)->first(); + return (float) ($attributes['salesPrice'] ?? 0); +} +``` + +--- + *이 문서는 design.sam.kr 완전 분석을 바탕으로 mng 시뮬레이터 완전 동기화 계획을 상세히 기술합니다.* \ No newline at end of file