feat: BOM 기반 견적 계산 API 엔드포인트 추가

- QuoteBomCalculateRequest.php 생성 (BOM 계산용 FormRequest)
- QuoteCalculationService.calculateBom() 메서드 추가
- QuoteController.calculateBom() 액션 추가
- POST /api/v1/quotes/calculate/bom 라우트 등록
- Swagger 문서 업데이트 (스키마 + 엔드포인트)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-02 11:24:22 +09:00
parent 561a4745e0
commit 660300cebf
6 changed files with 250 additions and 0 deletions

View File

@@ -251,6 +251,45 @@
* @OA\Property(property="product_category", type="string", example="SCREEN"),
* @OA\Property(property="generated_at", type="string", format="date-time")
* )
*
* @OA\Schema(
* schema="QuoteBomCalculateRequest",
* type="object",
* required={"finished_goods_code","W0","H0"},
*
* @OA\Property(property="finished_goods_code", type="string", example="SC-1000", description="완제품 코드"),
* @OA\Property(property="W0", type="number", format="float", example=3000, minimum=100, maximum=20000, description="개구부 폭(mm)"),
* @OA\Property(property="H0", type="number", format="float", example=2500, minimum=100, maximum=20000, description="개구부 높이(mm)"),
* @OA\Property(property="QTY", type="integer", example=1, minimum=1, description="수량"),
* @OA\Property(property="PC", type="string", enum={"SCREEN","STEEL"}, example="SCREEN", description="제품 카테고리"),
* @OA\Property(property="GT", type="string", enum={"wall","ceiling","floor"}, example="wall", description="가이드레일 타입"),
* @OA\Property(property="MP", type="string", enum={"single","three"}, example="single", description="모터 전원"),
* @OA\Property(property="CT", type="string", enum={"basic","smart","premium"}, example="basic", description="컨트롤러"),
* @OA\Property(property="WS", type="number", format="float", example=50, description="날개 크기"),
* @OA\Property(property="INSP", type="number", format="float", example=50000, description="검사비"),
* @OA\Property(property="debug", type="boolean", example=false, description="디버그 모드 (10단계 디버깅 정보 포함)")
* )
*
* @OA\Schema(
* schema="QuoteBomCalculationResult",
* type="object",
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="finished_goods", type="object", description="완제품 정보",
* @OA\Property(property="code", type="string", example="SC-1000"),
* @OA\Property(property="name", type="string", example="전동스크린 1000형")
* ),
* @OA\Property(property="variables", type="object", description="계산 변수 (W0, H0, W1, H1, M, K 등)"),
* @OA\Property(property="items", type="array", @OA\Items(ref="#/components/schemas/QuoteItem"), description="산출된 품목"),
* @OA\Property(property="grouped_items", type="object", description="카테고리별 품목 그룹"),
* @OA\Property(property="subtotals", type="object", description="카테고리별 소계",
* @OA\Property(property="material", type="number", format="float"),
* @OA\Property(property="labor", type="number", format="float"),
* @OA\Property(property="install", type="number", format="float")
* ),
* @OA\Property(property="grand_total", type="number", format="float", description="총계"),
* @OA\Property(property="debug_steps", type="array", nullable=true, @OA\Items(type="object"), description="디버그 모드시 10단계 디버깅 정보")
* )
*/
class QuoteApi
{
@@ -504,6 +543,39 @@ public function calculationSchema() {}
*/
public function calculate() {}
/**
* @OA\Post(
* path="/api/v1/quotes/calculate/bom",
* tags={"Quote"},
* summary="BOM 기반 자동산출 (10단계 디버깅)",
* description="완제품 코드와 입력 변수를 받아 BOM 기반으로 품목/단가/금액을 자동 계산합니다. MNG FormulaEvaluatorService와 동일한 10단계 디버깅을 지원합니다.",
* security={{"BearerAuth":{}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/QuoteBomCalculateRequest")
* ),
*
* @OA\Response(
* response=200,
* description="산출 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="견적이 산출되었습니다."),
* @OA\Property(property="data", ref="#/components/schemas/QuoteBomCalculationResult")
* )
* ),
*
* @OA\Response(response=400, description="유효성 검증 실패"),
* @OA\Response(response=401, description="인증 필요"),
* @OA\Response(response=404, description="완제품 코드 없음")
* )
*/
public function calculateBom() {}
/**
* @OA\Post(
* path="/api/v1/quotes/{id}/pdf",