fix: 가이드레일 모델별 규격 매핑 및 finishing_type 정규화
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user