fix: MES 모델 및 서비스 개선
- WorkOrderItem 모델 관계 정의 추가 - InspectionService, WorkResultService 로직 개선 - ItemReceipt, Inspection 모델 수정 - work_order_items 테이블에 options 컬럼 추가 마이그레이션 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
103
.serena/memories/quote-bom-bulk-api-phase-1.2.md
Normal file
103
.serena/memories/quote-bom-bulk-api-phase-1.2.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# Phase 1.2: 다건 BOM 기반 자동산출 API
|
||||
|
||||
## 개요
|
||||
- **작업일**: 2026-01-02
|
||||
- **커밋**: `4e59bbf` feat: Phase 1.2 - 다건 BOM 기반 자동산출 API 구현
|
||||
- **목적**: React 견적등록 화면에서 여러 품목의 자동산출 일괄 요청
|
||||
|
||||
## API 엔드포인트
|
||||
```
|
||||
POST /api/v1/quotes/calculate/bom/bulk
|
||||
```
|
||||
|
||||
## 파일 목록
|
||||
|
||||
### 생성된 파일
|
||||
| 파일 | 설명 |
|
||||
|------|------|
|
||||
| `app/Http/Requests/Quote/QuoteBomBulkCalculateRequest.php` | 다건 BOM 산출 FormRequest |
|
||||
| `api/docs/changes/20260102_1300_quote_bom_bulk_calculation.md` | 변경 내용 문서 |
|
||||
|
||||
### 수정된 파일
|
||||
| 파일 | 설명 |
|
||||
|------|------|
|
||||
| `app/Services/Quote/QuoteCalculationService.php` | calculateBomBulk() 메서드 추가 |
|
||||
| `app/Http/Controllers/Api/V1/QuoteController.php` | calculateBomBulk 액션 추가 |
|
||||
| `routes/api.php` | /calculate/bom/bulk 라우트 추가 |
|
||||
| `app/Swagger/v1/QuoteApi.php` | 스키마 3개 + 엔드포인트 추가 |
|
||||
|
||||
## React → API 필드 매핑
|
||||
|
||||
| React 필드 (camelCase) | API 변수 (약어) | 설명 |
|
||||
|----------------------|----------------|------|
|
||||
| openWidth | W0 | 개구부 폭 (mm) |
|
||||
| openHeight | H0 | 개구부 높이 (mm) |
|
||||
| quantity | QTY | 수량 |
|
||||
| productCategory | PC | 제품 카테고리 |
|
||||
| guideRailType | GT | 가이드레일 타입 |
|
||||
| motorPower | MP | 모터 출력 |
|
||||
| controller | CT | 제어반 |
|
||||
| wingSize | WS | 날개 크기 |
|
||||
| inspectionFee | INSP | 검사비 |
|
||||
|
||||
## 요청/응답 예시
|
||||
|
||||
### 요청
|
||||
```json
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"finished_goods_code": "SC-1000",
|
||||
"openWidth": 3000,
|
||||
"openHeight": 2500,
|
||||
"quantity": 2
|
||||
},
|
||||
{
|
||||
"finished_goods_code": "SC-2000",
|
||||
"W0": 4000,
|
||||
"H0": 3000,
|
||||
"QTY": 1
|
||||
}
|
||||
],
|
||||
"debug": false
|
||||
}
|
||||
```
|
||||
|
||||
### 응답
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "견적 일괄 산출이 완료되었습니다.",
|
||||
"data": {
|
||||
"success": true,
|
||||
"summary": {
|
||||
"total_count": 2,
|
||||
"success_count": 2,
|
||||
"fail_count": 0,
|
||||
"grand_total": 2500000
|
||||
},
|
||||
"items": [...]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 핵심 로직
|
||||
|
||||
### QuoteBomBulkCalculateRequest::getInputItems()
|
||||
- React camelCase 필드명을 API 약어로 자동 변환
|
||||
- 양쪽 필드명 모두 지원 (하위 호환성)
|
||||
|
||||
### QuoteCalculationService::calculateBomBulk()
|
||||
- 각 품목에 대해 calculateBom() 순회 호출
|
||||
- 성공/실패 카운트 집계
|
||||
- 개별 품목 실패가 전체에 영향 없음 (예외 처리)
|
||||
|
||||
## 관련 문서
|
||||
- 계획 문서: `docs/plans/quote-calculation-api-plan.md`
|
||||
- Phase 1.1 문서: `docs/changes/20260102_quote_bom_calculation_api.md`
|
||||
- Phase 1.2 문서: `docs/changes/20260102_1300_quote_bom_bulk_calculation.md`
|
||||
|
||||
## 다음 단계
|
||||
- React 프론트엔드에서 `/calculate/bom/bulk` API 연동
|
||||
- 실제 품목 데이터로 테스트
|
||||
- 저장 플로우 연결 (`POST /quotes` store API)
|
||||
Reference in New Issue
Block a user