'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; } ?>