From e300062f327636eb1f519f003e004f726753a4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Thu, 29 Jan 2026 22:28:27 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B2=AC=EC=A0=81=20=EA=B3=84=EC=82=B0?= =?UTF-8?q?=20=EB=A7=88=EA=B5=AC=EB=A6=AC=20=EC=88=98=EB=9F=89=C2=B7?= =?UTF-8?q?=EA=B0=81=ED=8C=8C=EC=9D=B4=ED=94=84=20=EA=B5=AC=EC=A1=B0=20513?= =?UTF-8?q?0=20=EC=9D=BC=EC=B9=98=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 케이스 마구리: 수량 2 고정 → quantity 기반 (5130: maguriPrices × $su) - 각파이프: 하드코딩 1개 → pipe_3000_qty/pipe_6000_qty 2종 분리 (5130: col68+col69) - 기본값 fallback: 파이프 수량 미입력 시 W0 기준 자동 결정 유지 Co-Authored-By: Claude Opus 4.5 --- .../Handlers/KyungdongFormulaHandler.php | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php index 32aa24d..0cf544a 100644 --- a/app/Services/Quote/Handlers/KyungdongFormulaHandler.php +++ b/app/Services/Quote/Handlers/KyungdongFormulaHandler.php @@ -385,7 +385,7 @@ public function calculateSteelItems(array $params): array $caseCapSpec = $this->convertToCaseCapSpec($caseSpec); $caseCapPrice = $this->priceService->getCaseCapPrice($caseCapSpec); if ($caseCapPrice > 0) { - $capQty = 2 * $quantity; // 좌우 2개 + $capQty = $quantity; // 5130: maguriPrices × $su (수량) $items[] = [ 'category' => 'steel', 'item_name' => '케이스 마구리', @@ -618,20 +618,47 @@ public function calculatePartItems(array $params): array ]; } - // 2. 각파이프 + // 2. 각파이프 (5130: col68=3000mm 수량, col69=6000mm 수량) $pipeThickness = '1.4'; - $pipeLength = $width > 3000 ? 6000 : 3000; - $pipePrice = $this->getPipePrice($pipeThickness, $pipeLength); - if ($pipePrice > 0) { - $items[] = [ - 'category' => 'parts', - 'item_name' => '각파이프', - 'specification' => "{$pipeThickness}T {$pipeLength}mm", - 'unit' => 'EA', - 'quantity' => $quantity, - 'unit_price' => $pipePrice, - 'total_price' => $pipePrice * $quantity, - ]; + $pipe3000Qty = (int) ($params['pipe_3000_qty'] ?? 0); + $pipe6000Qty = (int) ($params['pipe_6000_qty'] ?? 0); + + // 기본값: 둘 다 0이면 레거시 로직 (W0 기준 자동 결정) + if ($pipe3000Qty === 0 && $pipe6000Qty === 0) { + if ($width > 3000) { + $pipe6000Qty = 1; + } else { + $pipe3000Qty = 1; + } + } + + if ($pipe3000Qty > 0) { + $pipe3000Price = $this->getPipePrice($pipeThickness, 3000); + if ($pipe3000Price > 0) { + $items[] = [ + 'category' => 'parts', + 'item_name' => '각파이프', + 'specification' => "{$pipeThickness}T 3000mm", + 'unit' => 'EA', + 'quantity' => $pipe3000Qty, + 'unit_price' => $pipe3000Price, + 'total_price' => $pipe3000Price * $pipe3000Qty, + ]; + } + } + if ($pipe6000Qty > 0) { + $pipe6000Price = $this->getPipePrice($pipeThickness, 6000); + if ($pipe6000Price > 0) { + $items[] = [ + 'category' => 'parts', + 'item_name' => '각파이프', + 'specification' => "{$pipeThickness}T 6000mm", + 'unit' => 'EA', + 'quantity' => $pipe6000Qty, + 'unit_price' => $pipe6000Price, + 'total_price' => $pipe6000Price * $pipe6000Qty, + ]; + } } // 3. 모터 받침용 앵글 (bracket angle)