fix: 환봉·각파이프 5130 자동계산 공식 적용
- 환봉: W0 기준 자동계산 (≤3000→1, ≤6000→2, ≤9000→3, ≤12000→4 × 수량) - 각파이프: col67(케이스길이+3000×연결수) 기준 3000mm/6000mm 수량 자동계산 - 기존 하드코딩(각파이프 1개, 환봉 0개) 제거 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -348,7 +348,22 @@ public function calculateSteelItems(array $params): array
|
||||
$lbarLength = (float) ($params['lbar_length'] ?? ($width + 220)) / 1000; // m 단위 (레거시: W0+220)
|
||||
$flatBarLength = (float) ($params['flatbar_length'] ?? ($width + 220)) / 1000; // m 단위 (레거시: W0+220)
|
||||
$weightPlateQty = (int) ($params['weight_plate_qty'] ?? 0); // 무게평철 수량
|
||||
$roundBarQty = (int) ($params['round_bar_qty'] ?? 0); // 환봉 수량
|
||||
// 환봉 수량: 5130 자동계산 (col10=폭 기준)
|
||||
// ≤3000→1, ≤6000→2, ≤9000→3, ≤12000→4 (× 수량)
|
||||
$roundBarQty = (int) ($params['round_bar_qty'] ?? -1);
|
||||
if ($roundBarQty < 0) {
|
||||
if ($width <= 3000) {
|
||||
$roundBarQty = 1 * $quantity;
|
||||
} elseif ($width <= 6000) {
|
||||
$roundBarQty = 2 * $quantity;
|
||||
} elseif ($width <= 9000) {
|
||||
$roundBarQty = 3 * $quantity;
|
||||
} elseif ($width <= 12000) {
|
||||
$roundBarQty = 4 * $quantity;
|
||||
} else {
|
||||
$roundBarQty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 1. 케이스 (단가/1000 × 길이mm × 수량)
|
||||
$casePrice = $this->priceService->getCasePrice($caseSpec);
|
||||
@@ -618,17 +633,39 @@ public function calculatePartItems(array $params): array
|
||||
];
|
||||
}
|
||||
|
||||
// 2. 각파이프 (5130: col68=3000mm 수량, col69=6000mm 수량)
|
||||
// 2. 각파이프 (5130: col67 = col37 + 3000 × col66, col68/col69 자동계산)
|
||||
$pipeThickness = '1.4';
|
||||
$caseLength = (float) ($params['case_length'] ?? ($width + 220)); // col37 (mm)
|
||||
$connectionCount = (int) ($params['connection_count'] ?? 0); // col66 (연결 수)
|
||||
$pipeBaseLength = $caseLength + 3000 * $connectionCount; // col67
|
||||
|
||||
// 5130 자동계산 공식: col67 기준
|
||||
$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;
|
||||
// col68: 3000mm 파이프 수량
|
||||
if ($pipeBaseLength <= 9000) {
|
||||
$pipe3000Qty = 3 * $quantity;
|
||||
} elseif ($pipeBaseLength <= 12000) {
|
||||
$pipe3000Qty = 4 * $quantity;
|
||||
} elseif ($pipeBaseLength <= 15000) {
|
||||
$pipe3000Qty = 5 * $quantity;
|
||||
} elseif ($pipeBaseLength <= 18000) {
|
||||
$pipe3000Qty = 6 * $quantity;
|
||||
}
|
||||
|
||||
// col69: 6000mm 파이프 수량 (18000 초과 시)
|
||||
if ($pipeBaseLength > 18000 && $pipeBaseLength <= 24000) {
|
||||
$pipe6000Qty = 4 * $quantity;
|
||||
} elseif ($pipeBaseLength > 24000 && $pipeBaseLength <= 30000) {
|
||||
$pipe6000Qty = 5 * $quantity;
|
||||
} elseif ($pipeBaseLength > 30000 && $pipeBaseLength <= 36000) {
|
||||
$pipe6000Qty = 6 * $quantity;
|
||||
} elseif ($pipeBaseLength > 36000 && $pipeBaseLength <= 42000) {
|
||||
$pipe6000Qty = 7 * $quantity;
|
||||
} elseif ($pipeBaseLength > 42000 && $pipeBaseLength <= 48000) {
|
||||
$pipe6000Qty = 8 * $quantity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user