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), ];