Files
sam-api/app/Http/Controllers/Api/V1/Schemas/BomResolverSchemas.php
kent bf8036a64b feat: DB 연결 오버라이딩 및 대시보드 통계 위젯 추가
- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env)
- 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget)
- 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget)
- 리소스 한국어화: Product, Material 모델 레이블 추가
- 대시보드: 위젯 등록 및 캐시 최적화

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 23:31:14 +09:00

314 lines
13 KiB
PHP

<?php
namespace App\Http\Controllers\Api\V1\Schemas;
use OpenApi\Attributes as OA;
/**
* BOM Resolver related Swagger schemas
*/
#[OA\Schema(
schema: 'ResolvePreviewRequest',
description: 'Request schema for BOM preview resolution',
required: ['input_parameters'],
properties: [
new OA\Property(
property: 'input_parameters',
type: 'object',
additionalProperties: new OA\Property(oneOf: [
new OA\Schema(type: 'number'),
new OA\Schema(type: 'string'),
new OA\Schema(type: 'boolean')
]),
example: [
'W0' => 1000,
'H0' => 800,
'installation_type' => 'A',
'power_source' => '220V'
],
description: 'Input parameter values for BOM resolution'
),
new OA\Property(property: 'bom_template_id', type: 'integer', minimum: 1, nullable: true, example: 1),
new OA\Property(property: 'include_calculated_values', type: 'boolean', example: true),
new OA\Property(property: 'include_bom_items', type: 'boolean', example: true)
]
)]
class ResolvePreviewRequest {}
#[OA\Schema(
schema: 'CreateProductFromModelRequest',
description: 'Request schema for creating product from model',
required: ['model_id', 'input_parameters', 'product_code', 'product_name'],
properties: [
new OA\Property(property: 'model_id', type: 'integer', minimum: 1, example: 1),
new OA\Property(
property: 'input_parameters',
type: 'object',
additionalProperties: new OA\Property(oneOf: [
new OA\Schema(type: 'number'),
new OA\Schema(type: 'string'),
new OA\Schema(type: 'boolean')
]),
example: [
'W0' => 1000,
'H0' => 800,
'installation_type' => 'A',
'power_source' => '220V'
],
description: 'Input parameter values for BOM resolution'
),
new OA\Property(property: 'bom_template_id', type: 'integer', minimum: 1, nullable: true, example: 1),
new OA\Property(
property: 'product_code',
type: 'string',
maxLength: 50,
example: 'KSS01-1000x800-A',
description: 'Product code (uppercase letters, numbers, underscore, hyphen only)'
),
new OA\Property(property: 'product_name', type: 'string', maxLength: 100, example: 'KSS01 스크린 1000x800 A타입'),
new OA\Property(property: 'category_id', type: 'integer', minimum: 1, nullable: true, example: 1),
new OA\Property(property: 'description', type: 'string', maxLength: 1000, nullable: true, example: '매개변수 기반으로 생성된 맞춤형 스크린'),
new OA\Property(property: 'unit', type: 'string', maxLength: 20, nullable: true, example: 'EA'),
new OA\Property(property: 'min_order_qty', type: 'number', minimum: 0, nullable: true, example: 1),
new OA\Property(property: 'lead_time_days', type: 'integer', minimum: 0, nullable: true, example: 7),
new OA\Property(property: 'is_active', type: 'boolean', example: true),
new OA\Property(property: 'create_bom_items', type: 'boolean', example: true),
new OA\Property(property: 'validate_bom', type: 'boolean', example: true)
]
)]
class CreateProductFromModelRequest {}
#[OA\Schema(
schema: 'BomPreviewResponse',
description: 'BOM preview resolution response',
properties: [
new OA\Property(
property: 'input_parameters',
type: 'object',
additionalProperties: new OA\Property(oneOf: [
new OA\Schema(type: 'number'),
new OA\Schema(type: 'string'),
new OA\Schema(type: 'boolean')
]),
example: [
'W0' => 1000,
'H0' => 800,
'installation_type' => 'A',
'power_source' => '220V'
]
),
new OA\Property(
property: 'calculated_values',
type: 'object',
additionalProperties: new OA\Property(type: 'number'),
example: [
'W1' => 1050,
'H1' => 850,
'area' => 892500,
'weight' => 25.5,
'motor_power' => 120
]
),
new OA\Property(
property: 'bom_items',
type: 'array',
items: new OA\Items(ref: '#/components/schemas/BomItemPreview')
),
new OA\Property(
property: 'summary',
type: 'object',
properties: [
new OA\Property(property: 'total_materials', type: 'integer', example: 15),
new OA\Property(property: 'total_cost', type: 'number', example: 125000.50),
new OA\Property(property: 'estimated_weight', type: 'number', example: 25.5)
]
),
new OA\Property(
property: 'validation_warnings',
type: 'array',
items: new OA\Items(
properties: [
new OA\Property(property: 'type', type: 'string', example: 'PARAMETER_OUT_OF_RANGE'),
new OA\Property(property: 'message', type: 'string', example: 'W0 값이 권장 범위를 벗어났습니다'),
new OA\Property(property: 'parameter', type: 'string', example: 'W0'),
new OA\Property(property: 'current_value', type: 'number', example: 1000),
new OA\Property(property: 'recommended_range', type: 'string', example: '600-900')
],
type: 'object'
)
)
]
)]
class BomPreviewResponse {}
#[OA\Schema(
schema: 'BomItemPreview',
description: 'BOM item preview',
properties: [
new OA\Property(property: 'ref_type', type: 'string', enum: ['MATERIAL', 'PRODUCT'], example: 'MATERIAL'),
new OA\Property(property: 'ref_id', type: 'integer', example: 101),
new OA\Property(property: 'ref_code', type: 'string', example: 'BR-001'),
new OA\Property(property: 'ref_name', type: 'string', example: '표준 브라켓'),
new OA\Property(property: 'quantity', type: 'number', example: 2.0),
new OA\Property(property: 'waste_rate', type: 'number', example: 0.05),
new OA\Property(property: 'total_quantity', type: 'number', example: 2.1),
new OA\Property(property: 'unit', type: 'string', example: 'EA'),
new OA\Property(property: 'unit_cost', type: 'number', nullable: true, example: 5000.0),
new OA\Property(property: 'total_cost', type: 'number', nullable: true, example: 10500.0),
new OA\Property(property: 'applied_rule', type: 'string', nullable: true, example: '브라켓 선택 규칙'),
new OA\Property(
property: 'calculation_details',
type: 'object',
properties: [
new OA\Property(property: 'condition_matched', type: 'boolean', example: true),
new OA\Property(property: 'quantity_expression', type: 'string', example: 'ceiling(W1 / 500)'),
new OA\Property(property: 'quantity_calculation', type: 'string', example: 'ceiling(1050 / 500) = 3')
]
)
]
)]
class BomItemPreview {}
#[OA\Schema(
schema: 'ProductWithBomResponse',
description: 'Product created with BOM response',
properties: [
new OA\Property(
property: 'product',
type: 'object',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 123),
new OA\Property(property: 'code', type: 'string', example: 'KSS01-1000x800-A'),
new OA\Property(property: 'name', type: 'string', example: 'KSS01 스크린 1000x800 A타입'),
new OA\Property(property: 'type', type: 'string', example: 'PRODUCT'),
new OA\Property(property: 'category_id', type: 'integer', nullable: true, example: 1),
new OA\Property(property: 'description', type: 'string', nullable: true, example: '매개변수 기반으로 생성된 맞춤형 스크린'),
new OA\Property(property: 'unit', type: 'string', nullable: true, example: 'EA'),
new OA\Property(property: 'min_order_qty', type: 'number', nullable: true, example: 1),
new OA\Property(property: 'lead_time_days', type: 'integer', nullable: true, example: 7),
new OA\Property(property: 'is_active', type: 'boolean', example: true),
new OA\Property(property: 'created_at', type: 'string', format: 'date-time', example: '2024-01-01T00:00:00Z')
]
),
new OA\Property(
property: 'input_parameters',
type: 'object',
additionalProperties: new OA\Property(oneOf: [
new OA\Schema(type: 'number'),
new OA\Schema(type: 'string'),
new OA\Schema(type: 'boolean')
]),
example: [
'W0' => 1000,
'H0' => 800,
'installation_type' => 'A',
'power_source' => '220V'
]
),
new OA\Property(
property: 'calculated_values',
type: 'object',
additionalProperties: new OA\Property(type: 'number'),
example: [
'W1' => 1050,
'H1' => 850,
'area' => 892500,
'weight' => 25.5
]
),
new OA\Property(
property: 'bom_items',
type: 'array',
items: new OA\Items(
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'ref_type', type: 'string', enum: ['MATERIAL', 'PRODUCT'], example: 'MATERIAL'),
new OA\Property(property: 'ref_id', type: 'integer', example: 101),
new OA\Property(property: 'ref_code', type: 'string', example: 'BR-001'),
new OA\Property(property: 'ref_name', type: 'string', example: '표준 브라켓'),
new OA\Property(property: 'quantity', type: 'number', example: 2.0),
new OA\Property(property: 'waste_rate', type: 'number', example: 0.05),
new OA\Property(property: 'unit', type: 'string', example: 'EA')
],
type: 'object'
)
),
new OA\Property(
property: 'summary',
type: 'object',
properties: [
new OA\Property(property: 'total_bom_items', type: 'integer', example: 15),
new OA\Property(property: 'model_id', type: 'integer', example: 1),
new OA\Property(property: 'bom_template_id', type: 'integer', nullable: true, example: 1)
]
)
]
)]
class ProductWithBomResponse {}
#[OA\Schema(
schema: 'ProductParametersResponse',
description: 'Product parameters response',
properties: [
new OA\Property(property: 'product_id', type: 'integer', example: 123),
new OA\Property(property: 'model_id', type: 'integer', example: 1),
new OA\Property(
property: 'input_parameters',
type: 'object',
additionalProperties: new OA\Property(oneOf: [
new OA\Schema(type: 'number'),
new OA\Schema(type: 'string'),
new OA\Schema(type: 'boolean')
]),
example: [
'W0' => 1000,
'H0' => 800,
'installation_type' => 'A',
'power_source' => '220V'
]
),
new OA\Property(
property: 'parameter_definitions',
type: 'array',
items: new OA\Items(ref: '#/components/schemas/ModelParameterResource')
)
]
)]
class ProductParametersResponse {}
#[OA\Schema(
schema: 'ProductCalculatedValuesResponse',
description: 'Product calculated values response',
properties: [
new OA\Property(property: 'product_id', type: 'integer', example: 123),
new OA\Property(property: 'model_id', type: 'integer', example: 1),
new OA\Property(
property: 'calculated_values',
type: 'object',
additionalProperties: new OA\Property(type: 'number'),
example: [
'W1' => 1050,
'H1' => 850,
'area' => 892500,
'weight' => 25.5,
'motor_power' => 120
]
),
new OA\Property(
property: 'formula_applications',
type: 'array',
items: new OA\Items(
properties: [
new OA\Property(property: 'formula_name', type: 'string', example: '최종 가로 크기 계산'),
new OA\Property(property: 'target_parameter', type: 'string', example: 'W1'),
new OA\Property(property: 'expression', type: 'string', example: 'W0 + (installation_type == "A" ? 50 : 30)'),
new OA\Property(property: 'calculated_value', type: 'number', example: 1050),
new OA\Property(property: 'execution_order', type: 'integer', example: 1)
],
type: 'object'
)
)
]
)]
class ProductCalculatedValuesResponse {}