Phase 5: 면적기반 단가 중복계산 수정 및 Design 마진 적용
- 면적/중량기반 단가: final_price 직접 사용 (multiplier 중복 적용 방지) - 마진값 Design 표준 적용: W+140, H+350 (스크린 기준) - 수량기반 단가: quantity × unit_price 유지
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user