- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
212 lines
7.4 KiB
PHP
212 lines
7.4 KiB
PHP
<?php
|
|
/**
|
|
* 하장바 (Bottombar) 제품 데이터 배열을 생성하는 함수
|
|
*
|
|
* @param string $model_name 제품 모델 (예: 'KSS01', 'KWE01', 'KSE01', 'SL60' 등)
|
|
* @param string $finishing_type 마감 형태 (예: 'SUS마감', 'EGI마감' 등)
|
|
* @param float|int $bar_height 레일 가로(너비)
|
|
* @param float|int $bar_width 레일 세로(폭)
|
|
* @return array 제품 데이터 배열
|
|
*/
|
|
function getBottombarData($model_name, $finishing_type, $bar_height, $bar_width) {
|
|
$productData = [];
|
|
|
|
if ($model_name === 'KSS01' || $model_name === 'KSS02' ) {
|
|
// 1번 (하장바)
|
|
$proditem1 = [
|
|
'label' => '1번(하장바)',
|
|
'material' => 'SUS 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [15 + ($bar_height - 60) / 2, 14, $bar_width, $bar_height, $bar_width, 14, 15 + ($bar_height - 60) / 2],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, true, false, false]
|
|
];
|
|
|
|
// 2번 (L-바)
|
|
$proditem2 = [
|
|
'label' => '2번(L-바)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 60],
|
|
'bendingRates' => [0, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false],
|
|
'aAngles' => [false, false]
|
|
];
|
|
|
|
// 3번 (평철)
|
|
$proditem3 = [
|
|
'label' => '3번(평철)',
|
|
'material' => 'EGI 1.15T',
|
|
'surang' => 1,
|
|
'inputValues' => [50],
|
|
'bendingRates' => [0],
|
|
'sums' => [],
|
|
'colors' => [false],
|
|
'aAngles' => [false]
|
|
];
|
|
$productData = [$proditem1, $proditem2, $proditem3];
|
|
}
|
|
|
|
if ($model_name === 'KDSS01') {
|
|
$proditem1 = [
|
|
'label' => '1번(하장바)',
|
|
'material' => 'SUS 1.2T',
|
|
'surang' => 1,
|
|
'inputValues' => [10,11,70,140,70,11,10],
|
|
'bendingRates' => [0, 0, 1, 1, 1, 0, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, false, false, false]
|
|
];
|
|
$proditem2 = [
|
|
'label' => '2번(보강)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 2,
|
|
'inputValues' => [18,67,67,67,30],
|
|
'bendingRates' => [0, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false ],
|
|
'aAngles' => [false, false, false, false, false]
|
|
];
|
|
$proditem3 = [
|
|
'label' => '3번(L-바)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 2,
|
|
'inputValues' => [17, 100],
|
|
'bendingRates' => [0, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false],
|
|
'aAngles' => [false, false]
|
|
];
|
|
$productData = [$proditem1, $proditem2, $proditem3];
|
|
}
|
|
|
|
if ($model_name === 'KWE01' || $model_name === 'KSE01') {
|
|
// 1번 (하장바)
|
|
$proditem1 = [
|
|
'label' => '1번(하장바)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [15 + ($bar_height - 60) / 2, 14, $bar_width, $bar_height, $bar_width, 14, 15 + ($bar_height - 60) / 2],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, true, false, false]
|
|
];
|
|
|
|
// 2번 (L-바)
|
|
$proditem2 = [
|
|
'label' => '2번(L-바)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 60],
|
|
'bendingRates' => [0, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false],
|
|
'aAngles' => [false, false]
|
|
];
|
|
|
|
// 3번 (평철)
|
|
$proditem3 = [
|
|
'label' => '3번(평철)',
|
|
'material' => 'EGI 1.15T',
|
|
'surang' => 1,
|
|
'inputValues' => [50],
|
|
'bendingRates' => [0],
|
|
'sums' => [],
|
|
'colors' => [false],
|
|
'aAngles' => [false]
|
|
];
|
|
|
|
$productData = [$proditem1, $proditem2, $proditem3];
|
|
|
|
if ($finishing_type === 'SUS마감') {
|
|
// 4번 (별도마감)
|
|
$proditem4 = [
|
|
'label' => '4번(별도마감)',
|
|
'material' => 'SUS 1.2T',
|
|
'surang' => 1,
|
|
'inputValues' => [13 + ($bar_height - 60) / 2 , 16, $bar_width + 3 , $bar_height + 5, $bar_width+ 3, 16, 13 + ($bar_height - 60) / 2],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, true, false, false]
|
|
];
|
|
|
|
$productData[] = $proditem4;
|
|
}
|
|
}
|
|
|
|
if ($model_name === 'SL60' || $model_name === 'KQTS01') {
|
|
// 1번 (하장바)
|
|
$proditem1 = [
|
|
'label' => '1번(하장바)',
|
|
'material' => 'SUS 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [20, 20 + ($bar_height - 60) / 2, 30 + ($bar_width - 30), $bar_height, 30 + ($bar_width - 30), 35 + ($bar_height - 60) / 2, 20],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, false, true, false],
|
|
'aAngles' => [false, false, false, true, false, false, false]
|
|
];
|
|
|
|
$productData = [$proditem1];
|
|
}
|
|
|
|
if ($model_name === 'KTE01') {
|
|
// 1번 (하장바)
|
|
$proditem1 = [
|
|
'label' => '1번(하장바)',
|
|
'material' => 'EGI 1.55T',
|
|
'surang' => 1,
|
|
'inputValues' => [20, 20 + ($bar_height - 60) / 2, 30 + ($bar_width - 30), $bar_height, 30 + ($bar_width - 30), 35 + ($bar_height - 60) / 2, 20],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, false, true, false],
|
|
'aAngles' => [false, false, false, true, false, false, false]
|
|
];
|
|
|
|
$productData = [$proditem1];
|
|
|
|
if ($finishing_type === 'SUS마감') {
|
|
// 2번 (별도마감)
|
|
$proditem2 = [
|
|
'label' => '2번(별도마감)',
|
|
'material' => 'SUS 1.2T',
|
|
'surang' => 1,
|
|
'inputValues' => [11, 34 + ($bar_width - 30) / 2, $bar_height + 4, 34 + ($bar_width - 30) / 2, 11],
|
|
'bendingRates' => [0, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false],
|
|
'aAngles' => [false, false, false, true, false]
|
|
];
|
|
|
|
$productData[] = $proditem2;
|
|
}
|
|
}
|
|
|
|
// sums 계산 함수
|
|
$calculateSums = function ($product) {
|
|
$accumulatedSum = 0;
|
|
$sums = [];
|
|
foreach ($product['inputValues'] as $index => $inputVal) {
|
|
$result = $inputVal - $product['bendingRates'][$index];
|
|
$accumulatedSum += $result;
|
|
$sums[] = $accumulatedSum;
|
|
}
|
|
return $sums;
|
|
};
|
|
|
|
// 각 제품에 대해 sums 계산 후 업데이트
|
|
foreach ($productData as &$product) {
|
|
$product['sums'] = $calculateSums($product);
|
|
}
|
|
unset($product);
|
|
|
|
return $productData;
|
|
}
|
|
?>
|