docs: 시뮬레이터 동기화 계획 Phase 6 추가

- Phase 6: prices 테이블 데이터 추가 완료
- DesignPriceSeeder로 85개 품목 마이그레이션
- 가격 우선순위 검증 완료 (prices > items.attributes.salesPrice)
- 날짜 업데이트 (2025-12-24 → 2025-12-29)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 21:43:28 +09:00
parent 60396356a1
commit 46369be515

View File

@@ -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 시뮬레이터 완전 동기화 계획을 상세히 기술합니다.*