- ItemsBomApi: {code} → {id} (10개 경로)
- BomCalculationApi: snake_case → camelCase 파라미터
- PermissionApi: {id} → 구체적 파라미터명 (dept_id, role_id, user_id)
- FieldProfileApi: opt-groups → settings/options, 중복 Fields 엔드포인트 제거
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
441 lines
14 KiB
PHP
441 lines
14 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="BOM Calculation", description="BOM 계산 시스템")
|
|
*
|
|
* @OA\Schema(
|
|
* schema="EstimateParametersResponse",
|
|
* type="object",
|
|
* required={"success","message","data"},
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="견적 파라미터를 성공적으로 조회했습니다."),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(
|
|
* property="model_info",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="name", type="string", example="스크린셔터 표준형"),
|
|
* @OA\Property(property="version", type="string", example="v1.0"),
|
|
* @OA\Property(property="bom_template_id", type="integer", example=1)
|
|
* ),
|
|
* @OA\Property(
|
|
* property="company_info",
|
|
* type="object",
|
|
* @OA\Property(property="company_type", type="string", example="경동기업"),
|
|
* @OA\Property(property="formula_version", type="string", example="v2.0"),
|
|
* @OA\Property(property="requested_company", type="string", example="경동기업")
|
|
* ),
|
|
* @OA\Property(
|
|
* property="parameters",
|
|
* type="object",
|
|
* @OA\Property(
|
|
* property="required_parameters",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="key", type="string", example="W0"),
|
|
* @OA\Property(property="label", type="string", example="오픈사이즈 가로(mm)"),
|
|
* @OA\Property(property="type", type="string", example="integer"),
|
|
* @OA\Property(property="required", type="boolean", example=true),
|
|
* @OA\Property(property="min", type="integer", example=500),
|
|
* @OA\Property(property="max", type="integer", example=15000)
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="CalculateBomRequest",
|
|
* type="object",
|
|
* required={"parameters"},
|
|
*
|
|
* @OA\Property(
|
|
* property="parameters",
|
|
* type="object",
|
|
* @OA\Property(property="W0", type="integer", example=3000),
|
|
* @OA\Property(property="H0", type="integer", example=2500),
|
|
* @OA\Property(property="product_type", type="string", example="screen")
|
|
* ),
|
|
* @OA\Property(property="company_name", type="string", example="경동기업")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="CalculateBomResponse",
|
|
* type="object",
|
|
* required={"success","message","data"},
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="BOM 계산이 완료되었습니다."),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(
|
|
* property="bom_template",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="name", type="string", example="Main"),
|
|
* @OA\Property(property="company_type", type="string", example="경동기업"),
|
|
* @OA\Property(property="formula_version", type="string", example="v2.0")
|
|
* ),
|
|
* @OA\Property(
|
|
* property="input_parameters",
|
|
* type="object",
|
|
* @OA\Property(property="W0", type="integer", example=3000),
|
|
* @OA\Property(property="H0", type="integer", example=2500),
|
|
* @OA\Property(property="product_type", type="string", example="screen")
|
|
* ),
|
|
* @OA\Property(
|
|
* property="calculated_values",
|
|
* type="object",
|
|
* @OA\Property(property="W1", type="integer", example=3160),
|
|
* @OA\Property(property="H1", type="integer", example=2850),
|
|
* @OA\Property(property="area", type="number", format="float", example=9.006),
|
|
* @OA\Property(property="weight", type="number", format="float", example=60.42)
|
|
* ),
|
|
* @OA\Property(
|
|
* property="bom_items",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="item_id", type="integer", example=1),
|
|
* @OA\Property(property="ref_type", type="string", example="MATERIAL"),
|
|
* @OA\Property(property="ref_id", type="integer", example=101),
|
|
* @OA\Property(property="original_qty", type="integer", example=1),
|
|
* @OA\Property(property="calculated_qty", type="integer", example=2),
|
|
* @OA\Property(property="is_calculated", type="boolean", example=true),
|
|
* @OA\Property(property="calculation_formula", type="string", example="bracket_quantity")
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="CompanyFormulasResponse",
|
|
* type="object",
|
|
* required={"success","message","data"},
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="업체 산출식 목록을 조회했습니다."),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(property="company_name", type="string", example="경동기업"),
|
|
* @OA\Property(property="total_formulas", type="integer", example=5),
|
|
* @OA\Property(
|
|
* property="formulas",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="type", type="string", example="manufacturing_size"),
|
|
* @OA\Property(property="version", type="string", example="v2.0"),
|
|
* @OA\Property(property="description", type="string", example="제작사이즈 계산식"),
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-09-22T15:30:00Z")
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="SaveFormulaRequest",
|
|
* type="object",
|
|
* required={"formula_expression","parameters"},
|
|
*
|
|
* @OA\Property(property="formula_expression", type="string", example="bracket_quantity"),
|
|
* @OA\Property(
|
|
* property="parameters",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(type="string"),
|
|
* example={"W1", "H1"}
|
|
* ),
|
|
*
|
|
* @OA\Property(
|
|
* property="conditions",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(type="string"),
|
|
* example={"product_type=screen"}
|
|
* ),
|
|
*
|
|
* @OA\Property(
|
|
* property="validation_rules",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(type="string"),
|
|
* example={"W1>0", "H1>0"}
|
|
* ),
|
|
*
|
|
* @OA\Property(property="description", type="string", example="브라켓 수량 계산식")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="FormulaTestRequest",
|
|
* type="object",
|
|
* required={"formula_expression","test_parameters"},
|
|
*
|
|
* @OA\Property(property="formula_expression", type="string", example="bracket_quantity"),
|
|
* @OA\Property(
|
|
* property="test_parameters",
|
|
* type="object",
|
|
* @OA\Property(property="W1", type="integer", example=3000)
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="FormulaTestResponse",
|
|
* type="object",
|
|
* required={"success","message","data"},
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="계산식 테스트가 완료되었습니다."),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(property="formula_expression", type="string", example="bracket_quantity"),
|
|
* @OA\Property(
|
|
* property="input_parameters",
|
|
* type="object",
|
|
* @OA\Property(property="W1", type="integer", example=3000)
|
|
* ),
|
|
* @OA\Property(
|
|
* property="result",
|
|
* type="object",
|
|
* @OA\Property(property="result", type="integer", example=2)
|
|
* ),
|
|
* @OA\Property(property="execution_time_ms", type="number", format="float", example=1.5)
|
|
* )
|
|
* )
|
|
*/
|
|
class BomCalculationApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/design/models/{modelId}/estimate-parameters",
|
|
* summary="견적 파라미터 조회",
|
|
* description="특정 모델의 견적 시 필요한 입력 파라미터 스키마를 조회합니다. BOM에 정의된 조건만 동적으로 추출하여 반환합니다.",
|
|
* tags={"BOM Calculation"},
|
|
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="modelId",
|
|
* in="path",
|
|
* required=true,
|
|
* description="모델 ID",
|
|
*
|
|
* @OA\Schema(type="integer", example=1)
|
|
* ),
|
|
*
|
|
* @OA\Parameter(
|
|
* name="company_name",
|
|
* in="query",
|
|
* required=false,
|
|
* description="업체명 (선택사항)",
|
|
*
|
|
* @OA\Schema(type="string", example="경동기업")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="견적 파라미터 조회 성공",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/EstimateParametersResponse")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=404,
|
|
* description="모델을 찾을 수 없음",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function getEstimateParameters() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/design/bom-templates/{bomTemplateId}/calculate-bom",
|
|
* summary="BOM 계산 실행",
|
|
* description="입력된 파라미터를 기반으로 BOM 수량을 동적으로 계산합니다. 업체별 산출식을 적용하여 실시간 견적을 생성합니다.",
|
|
* tags={"BOM Calculation"},
|
|
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="bomTemplateId",
|
|
* in="path",
|
|
* required=true,
|
|
* description="BOM 템플릿 ID",
|
|
*
|
|
* @OA\Schema(type="integer", example=1)
|
|
* ),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* description="계산 파라미터",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/CalculateBomRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="BOM 계산 성공",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/CalculateBomResponse")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=400,
|
|
* description="잘못된 파라미터",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function calculateBom() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/design/companies/{companyName}/formulas",
|
|
* summary="업체별 산출식 목록 조회",
|
|
* description="특정 업체의 등록된 산출식 목록을 조회합니다.",
|
|
* tags={"BOM Calculation"},
|
|
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="companyName",
|
|
* in="path",
|
|
* required=true,
|
|
* description="업체명",
|
|
*
|
|
* @OA\Schema(type="string", example="경동기업")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="업체 산출식 목록 조회 성공",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/CompanyFormulasResponse")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=404,
|
|
* description="업체를 찾을 수 없음",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function getCompanyFormulas() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/design/companies/{companyName}/formulas/{formulaType}",
|
|
* summary="업체별 산출식 등록/수정",
|
|
* description="특정 업체의 산출식을 등록하거나 수정합니다. 기존 산출식이 있으면 새 버전으로 업데이트됩니다.",
|
|
* tags={"BOM Calculation"},
|
|
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="companyName",
|
|
* in="path",
|
|
* required=true,
|
|
* description="업체명",
|
|
*
|
|
* @OA\Schema(type="string", example="경동기업")
|
|
* ),
|
|
*
|
|
* @OA\Parameter(
|
|
* name="formulaType",
|
|
* in="path",
|
|
* required=true,
|
|
* description="산출식 타입",
|
|
*
|
|
* @OA\Schema(type="string", example="manufacturing_size")
|
|
* ),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* description="산출식 데이터",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/SaveFormulaRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=201,
|
|
* description="업체 산출식 등록 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
*
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
*
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="company_name", type="string", example="경동기업"),
|
|
* @OA\Property(property="formula_type", type="string", example="manufacturing_size"),
|
|
* @OA\Property(property="version", type="string", example="v1.0"),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-09-22T15:30:00Z")
|
|
* )
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=400,
|
|
* description="잘못된 요청",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function saveCompanyFormula() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/design/formulas/test",
|
|
* summary="계산식 테스트 실행",
|
|
* description="산출식을 실제 적용하기 전에 테스트해볼 수 있습니다.",
|
|
* tags={"BOM Calculation"},
|
|
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* description="테스트할 계산식과 파라미터",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/FormulaTestRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="계산식 테스트 성공",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/FormulaTestResponse")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=400,
|
|
* description="잘못된 계산식",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function testFormula() {}
|
|
}
|