From b55cbc2ec45e81ddab890d3558915994e117b3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Wed, 11 Mar 2026 16:54:40 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[=EA=B2=AC=EC=A0=81]=20=EC=A0=9C?= =?UTF-8?q?=EC=96=B4=EA=B8=B0=20=ED=83=80=EC=9E=85=20=EC=B2=B4=EA=B3=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(basic/smart/premium=20=E2=86=92=20exposed?= =?UTF-8?q?/embedded/embedded=5Fno=5Fbox)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QuoteBomBulkCalculateRequest: controller validation 값 변경, 기본값 exposed - QuoteBomCalculateRequest: 동일 변경 - FormulaEvaluatorService: CT → controller_type 매핑 추가 (exposed→노출형, embedded→매립형) - FormulaEvaluatorService: CT 값에 따라 backbox_qty 자동 설정 (embedded만 뒷박스 포함) - QuoteService: CT 기본값 exposed로 변경 Co-Authored-By: Claude Opus 4.6 --- .../Quote/QuoteBomBulkCalculateRequest.php | 6 +++--- .../Quote/QuoteBomCalculateRequest.php | 4 ++-- .../Quote/FormulaEvaluatorService.php | 20 ++++++++++++++++++- app/Services/Quote/QuoteService.php | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/Http/Requests/Quote/QuoteBomBulkCalculateRequest.php b/app/Http/Requests/Quote/QuoteBomBulkCalculateRequest.php index a4daae7..6742b7e 100644 --- a/app/Http/Requests/Quote/QuoteBomBulkCalculateRequest.php +++ b/app/Http/Requests/Quote/QuoteBomBulkCalculateRequest.php @@ -34,7 +34,7 @@ public function rules(): array 'items.*.productCategory' => 'nullable|string|in:SCREEN,STEEL', 'items.*.guideRailType' => 'nullable|string|in:wall,ceiling,floor,mixed', 'items.*.motorPower' => 'nullable|string|in:single,three', - 'items.*.controller' => 'nullable|string|in:basic,smart,premium', + 'items.*.controller' => 'nullable|string|in:exposed,embedded,embedded_no_box', 'items.*.wingSize' => 'nullable|numeric|min:0|max:500', 'items.*.inspectionFee' => 'nullable|numeric|min:0', @@ -45,7 +45,7 @@ public function rules(): array 'items.*.PC' => 'nullable|string|in:SCREEN,STEEL', 'items.*.GT' => 'nullable|string|in:wall,ceiling,floor,mixed', 'items.*.MP' => 'nullable|string|in:single,three', - 'items.*.CT' => 'nullable|string|in:basic,smart,premium', + 'items.*.CT' => 'nullable|string|in:exposed,embedded,embedded_no_box', 'items.*.WS' => 'nullable|numeric|min:0|max:500', 'items.*.INSP' => 'nullable|numeric|min:0', @@ -128,7 +128,7 @@ private function normalizeInputVariables(array $item): array 'PC' => $item['productCategory'] ?? $item['PC'] ?? 'SCREEN', 'GT' => $item['guideRailType'] ?? $item['GT'] ?? 'wall', 'MP' => $item['motorPower'] ?? $item['MP'] ?? 'single', - 'CT' => $item['controller'] ?? $item['CT'] ?? 'basic', + 'CT' => $item['controller'] ?? $item['CT'] ?? 'exposed', 'WS' => (float) ($item['wingSize'] ?? $item['WS'] ?? 50), 'INSP' => (float) ($item['inspectionFee'] ?? $item['INSP'] ?? 50000), ]; diff --git a/app/Http/Requests/Quote/QuoteBomCalculateRequest.php b/app/Http/Requests/Quote/QuoteBomCalculateRequest.php index 5aa1b99..24790e7 100644 --- a/app/Http/Requests/Quote/QuoteBomCalculateRequest.php +++ b/app/Http/Requests/Quote/QuoteBomCalculateRequest.php @@ -30,7 +30,7 @@ public function rules(): array 'PC' => 'nullable|string|in:SCREEN,STEEL', 'GT' => 'nullable|string|in:wall,ceiling,floor,mixed', 'MP' => 'nullable|string|in:single,three', - 'CT' => 'nullable|string|in:basic,smart,premium', + 'CT' => 'nullable|string|in:exposed,embedded,embedded_no_box', 'WS' => 'nullable|numeric|min:0|max:500', 'INSP' => 'nullable|numeric|min:0', @@ -82,7 +82,7 @@ public function getInputVariables(): array 'PC' => $validated['PC'] ?? 'SCREEN', 'GT' => $validated['GT'] ?? 'wall', 'MP' => $validated['MP'] ?? 'single', - 'CT' => $validated['CT'] ?? 'basic', + 'CT' => $validated['CT'] ?? 'exposed', 'WS' => (float) ($validated['WS'] ?? 50), 'INSP' => (float) ($validated['INSP'] ?? 50000), ]; diff --git a/app/Services/Quote/FormulaEvaluatorService.php b/app/Services/Quote/FormulaEvaluatorService.php index 3720f3a..0659156 100644 --- a/app/Services/Quote/FormulaEvaluatorService.php +++ b/app/Services/Quote/FormulaEvaluatorService.php @@ -633,7 +633,7 @@ public function calculateBomWithDebug( 'PC' => $inputVariables['PC'] ?? '', 'GT' => $inputVariables['GT'] ?? 'wall', 'MP' => $inputVariables['MP'] ?? 'single', - 'CT' => $inputVariables['CT'] ?? 'basic', + 'CT' => $inputVariables['CT'] ?? 'exposed', 'WS' => $inputVariables['WS'] ?? 50, 'INSP' => $inputVariables['INSP'] ?? 50000, 'finished_goods' => $finishedGoodsCode, @@ -1708,6 +1708,22 @@ private function calculateTenantBom( default => '220V', }; + // 제어기 타입: 프론트 CT(exposed/embedded/embedded_no_box) → controller_type(노출형/매립형) 매핑 + // - exposed: 노출형 (뒷박스 불필요) + // - embedded: 매립형 (뒷박스 포함) + // - embedded_no_box: 매립형 (뒷박스 제외 — 업체 자체 보유) + $ctValue = $inputVariables['CT'] ?? 'exposed'; + $controllerType = $inputVariables['controller_type'] ?? match ($ctValue) { + 'embedded', 'embedded_no_box' => '매립형', + 'exposed' => '노출형', + default => '노출형', + }; + // 뒷박스: embedded만 포함, exposed/embedded_no_box는 제외 + $backboxQty = (int) ($inputVariables['backbox_qty'] ?? match ($ctValue) { + 'embedded' => 1, + default => 0, + }); + $calculatedVariables = array_merge($inputVariables, [ 'W0' => $W0, 'H0' => $H0, @@ -1724,6 +1740,8 @@ private function calculateTenantBom( 'finishing_type' => $finishingType, 'installation_type' => $installationType, 'motor_voltage' => $motorVoltage, + 'controller_type' => $controllerType, + 'backbox_qty' => $backboxQty, ]); $this->addDebugStep(3, '변수계산', [ diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index b42cc01..9dc55bb 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -237,7 +237,7 @@ private function calculateBomMaterials(Quote $quote): array 'PC' => $input['productCategory'] ?? 'SCREEN', 'GT' => $input['guideRailType'] ?? 'wall', 'MP' => $input['motorPower'] ?? 'single', - 'CT' => $input['controller'] ?? 'basic', + 'CT' => $input['controller'] ?? 'exposed', 'WS' => (float) ($input['wingSize'] ?? 50), 'INSP' => (float) ($input['inspectionFee'] ?? 50000), ];