From a41bf48dd8a43c1077e47fbf55e5721abb522f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Fri, 30 Jan 2026 19:52:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B0=80=EC=9D=B4=EB=93=9C=EB=A0=88?= =?UTF-8?q?=EC=9D=BC=20=EB=AA=A8=EB=8D=B8=EB=B3=84=20=EA=B7=9C=EA=B2=A9=20?= =?UTF-8?q?=EB=A7=A4=ED=95=91=20=EB=B0=8F=20finishing=5Ftype=20=EC=A0=95?= =?UTF-8?q?=EA=B7=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getGuideRailSpecs() 메서드 추가: 모델별 가이드레일 규격 매핑 - KTE01/KQTS01 → 130*75/130*125 - KDSS01 → 150*150/150*212 - 기본(KSS01/02, KSE01, KWE01) → 120*70/120*120 - 벽면형/측면형/혼합형 하드코딩 규격을 동적 변수로 교체 - finishing_type 정규화: 'SUS마감' → 'SUS' 변환 (DB 값 매칭) Co-Authored-By: Claude Opus 4.5 --- .../Handlers/KyungdongFormulaHandler.php | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php index 1d6fe4d..151daa9 100644 --- a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php +++ b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php @@ -336,7 +336,9 @@ public function calculateSteelItems(array $params): array $height = (float) ($params['H0'] ?? 0); $quantity = (int) ($params['QTY'] ?? 1); $modelName = $params['model_name'] ?? $params['product_model'] ?? 'KSS01'; - $finishingType = $params['finishing_type'] ?? 'SUS'; + $rawFinish = $params['finishing_type'] ?? 'SUS'; + // DB에는 'SUS', 'EGI'로 저장 → 'SUS마감' → 'SUS' 변환 + $finishingType = str_replace('마감', '', $rawFinish); // 절곡품 관련 파라미터 $caseSpec = $params['case_spec'] ?? '500*380'; @@ -515,6 +517,23 @@ public function calculateSteelItems(array $params): array * @param int $quantity 수량 * @return array 가이드레일 항목 배열 */ + /** + * 모델별 가이드레일 규격 매핑 + * + * BDmodels 테이블 기준: + * KSS01/02, KSE01, KWE01 → 120*70 / 120*120 + * KTE01, KQTS01 → 130*75 / 130*125 + * KDSS01 → 150*150 / 150*212 + */ + private function getGuideRailSpecs(string $modelName): array + { + return match ($modelName) { + 'KTE01', 'KQTS01' => ['wall' => '130*75', 'side' => '130*125'], + 'KDSS01' => ['wall' => '150*150', 'side' => '150*212'], + default => ['wall' => '120*70', 'side' => '120*120'], + }; + } + private function calculateGuideRails( string $modelName, string $finishingType, @@ -529,16 +548,19 @@ private function calculateGuideRails( return $items; } + $specs = $this->getGuideRailSpecs($modelName); + $wallSpec = $specs['wall']; + $sideSpec = $specs['side']; + switch ($guideType) { case '벽면형': - // 120*70 × 2개 - $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, '120*70'); + $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, $wallSpec); if ($price > 0) { $guideQty = 2 * $quantity; $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} 120*70 {$guideLength}m × 2", + 'specification' => "{$modelName} {$finishingType} {$wallSpec} {$guideLength}m × 2", 'unit' => 'm', 'quantity' => $guideLength * $guideQty, 'unit_price' => $price, @@ -548,14 +570,13 @@ private function calculateGuideRails( break; case '측면형': - // 120*100 × 2개 - $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, '120*100'); + $price = $this->priceService->getGuideRailPrice($modelName, $finishingType, $sideSpec); if ($price > 0) { $guideQty = 2 * $quantity; $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} 120*100 {$guideLength}m × 2", + 'specification' => "{$modelName} {$finishingType} {$sideSpec} {$guideLength}m × 2", 'unit' => 'm', 'quantity' => $guideLength * $guideQty, 'unit_price' => $price, @@ -565,30 +586,29 @@ private function calculateGuideRails( break; case '혼합형': - // 120*70 × 1개 + 120*100 × 1개 - $price70 = $this->priceService->getGuideRailPrice($modelName, $finishingType, '120*70'); - $price100 = $this->priceService->getGuideRailPrice($modelName, $finishingType, '120*100'); + $priceWall = $this->priceService->getGuideRailPrice($modelName, $finishingType, $wallSpec); + $priceSide = $this->priceService->getGuideRailPrice($modelName, $finishingType, $sideSpec); - if ($price70 > 0) { + if ($priceWall > 0) { $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} 120*70 {$guideLength}m", + 'specification' => "{$modelName} {$finishingType} {$wallSpec} {$guideLength}m", 'unit' => 'm', 'quantity' => $guideLength * $quantity, - 'unit_price' => $price70, - 'total_price' => round($price70 * $guideLength * $quantity), + 'unit_price' => $priceWall, + 'total_price' => round($priceWall * $guideLength * $quantity), ]; } - if ($price100 > 0) { + if ($priceSide > 0) { $items[] = [ 'category' => 'steel', 'item_name' => '가이드레일', - 'specification' => "{$modelName} {$finishingType} 120*100 {$guideLength}m", + 'specification' => "{$modelName} {$finishingType} {$sideSpec} {$guideLength}m", 'unit' => 'm', 'quantity' => $guideLength * $quantity, - 'unit_price' => $price100, - 'total_price' => round($price100 * $guideLength * $quantity), + 'unit_price' => $priceSide, + 'total_price' => round($priceSide * $guideLength * $quantity), ]; } break;