From fc4278ba828ad22d8fa2d7707ccba78d6dcbcc5b Mon Sep 17 00:00:00 2001 From: hskwon Date: Wed, 24 Dec 2025 16:11:35 +0900 Subject: [PATCH] =?UTF-8?q?Phase=205:=20=EB=A9=B4=EC=A0=81=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EB=8B=A8=EA=B0=80=20=EC=A4=91=EB=B3=B5=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20Design=20=EB=A7=88?= =?UTF-8?q?=EC=A7=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 면적/중량기반 단가: final_price 직접 사용 (multiplier 중복 적용 방지) - 마진값 Design 표준 적용: W+140, H+350 (스크린 기준) - 수량기반 단가: quantity × unit_price 유지 --- .../Quote/FormulaEvaluatorService.php | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/app/Services/Quote/FormulaEvaluatorService.php b/app/Services/Quote/FormulaEvaluatorService.php index 5a33d7be..21857c93 100644 --- a/app/Services/Quote/FormulaEvaluatorService.php +++ b/app/Services/Quote/FormulaEvaluatorService.php @@ -801,10 +801,14 @@ public function calculateBomWithDebug( ]); // Step 2: 변수 계산 + // Design 기준 마진값 (스크린: W+140, H+350 / 철재: W+110, H+350) + // TODO: 완제품 유형에 따라 동적으로 결정 $W0 = $inputVariables['W0'] ?? 0; $H0 = $inputVariables['H0'] ?? 0; - $W1 = $W0 + 100; // 마진 포함 폭 - $H1 = $H0 + 100; // 마진 포함 높이 + $marginW = 140; // 스크린 기본 마진 + $marginH = 350; // 스크린 기본 마진 + $W1 = $W0 + $marginW; // 마진 포함 폭 + $H1 = $H0 + $marginH; // 마진 포함 높이 $M = ($W1 * $H1) / 1000000; // 면적 (㎡) $K = $M * 2.5; // 중량 추정 (kg) @@ -876,12 +880,23 @@ public function calculateBomWithDebug( $tenantId ); - $totalPrice = $quantity * $priceResult['final_price']; + // 면적/중량 기반: final_price에 이미 면적/중량이 곱해져 있음 + // 수량 기반: quantity × unit_price + $categoryGroup = $priceResult['category_group']; + if ($categoryGroup === 'area_based' || $categoryGroup === 'weight_based') { + // 면적/중량 기반: final_price = base_price × M or K (이미 계산됨) + $totalPrice = $priceResult['final_price']; + $displayQuantity = $priceResult['multiplier']; // 표시용 수량 = 면적 또는 중량 + } else { + // 수량 기반: total = quantity × unit_price + $totalPrice = $quantity * $priceResult['final_price']; + $displayQuantity = $quantity; + } $this->addDebugStep(7, '금액계산', [ 'item_code' => $bomItem['item_code'], - 'quantity' => $quantity, - 'unit_price' => $priceResult['final_price'], + 'quantity' => $displayQuantity, + 'unit_price' => $basePrice, 'total_price' => $totalPrice, 'calculation_note' => $priceResult['calculation_note'], ]); @@ -890,11 +905,11 @@ public function calculateBomWithDebug( 'item_code' => $bomItem['item_code'], 'item_name' => $bomItem['item_name'], 'item_category' => $itemCategory, - 'quantity' => $quantity, + 'quantity' => $displayQuantity, // 표시용 수량 (면적/중량/수량) 'quantity_formula' => $quantityFormula, 'base_price' => $basePrice, 'multiplier' => $priceResult['multiplier'], - 'unit_price' => $priceResult['final_price'], + 'unit_price' => $basePrice, // 기본 단가 (원/㎡, 원/kg, 원/EA) 'total_price' => $totalPrice, 'calculation_note' => $priceResult['calculation_note'], 'category_group' => $priceResult['category_group'],