- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
259 lines
9.2 KiB
PHP
259 lines
9.2 KiB
PHP
<?php
|
|
/**
|
|
* 셔터박스 케이스 플레이트 데이터 생성 함수
|
|
*
|
|
* @param string $selected_exit_directionFlat 선택된 체크 타입 ('양면 점검구', '후면 점검구', '밑면 점검구')
|
|
* @param float|int $box_width 박스 너비
|
|
* @param float|int $box_height 박스 높이
|
|
* @param float|int $rail_width 레일 폭
|
|
* @param float|int $front_bottom_width 전면 하단 너비
|
|
* @return array 케이스 플레이트 데이터 배열
|
|
*/
|
|
function getCasePlate($selected_exit_directionFlat, $box_width, $box_height, $rail_width, $front_bottom_width) {
|
|
$productData = [];
|
|
|
|
// 박스폭이 590 이상이면 철재형태인데, 전면부 절곡 첫 치수 변경 17 -> 47로 수정
|
|
if( $box_width > 590)
|
|
$frontFirstBending = 48;
|
|
else
|
|
$frontFirstBending = 17;
|
|
|
|
// 1번 전면부 데이터 생성
|
|
$frontSectionData = [
|
|
'label' => '1번 전면부',
|
|
'surang' => 1,
|
|
'inputValues' => [$frontFirstBending , 55, $front_bottom_width, $box_height, 55, 15, 20],
|
|
'bendingRates' => [0, 1, 1, 1, 1, 0, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false, false, false, true, false],
|
|
'aAngles' => [false, true, false, false, false, false, false]
|
|
];
|
|
|
|
if ($selected_exit_directionFlat === '양면 점검구') {
|
|
$calWidth = $box_width - $rail_width - $front_bottom_width - 50 - 50 - 17*2 - 6;
|
|
$calHeight = $box_height - 50*2 - 17*2 - 6;
|
|
|
|
$productData = [
|
|
$frontSectionData,
|
|
[
|
|
'label' => '2번 린텔부',
|
|
'surang' => 1,
|
|
'inputValues' => [20, 15, 50, 55, 30],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '3번 하부 점검구',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 13, $calWidth, 13, 17],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '4번 후면 코너부',
|
|
'surang' => 2,
|
|
'inputValues' => [20, 15, 50, 50, 15, 20],
|
|
'bendingRates' => [0, 0, 1, 1, 0, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '5번 후면 점검구',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 13, $calHeight, 13, 17],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '6번 상부덮개',
|
|
'surang' => 1,
|
|
'inputValues' => [$box_width - 111],
|
|
'bendingRates' => [0],
|
|
'sums' => [],
|
|
'colors' => [false],
|
|
'aAngles' => [false]
|
|
],
|
|
[
|
|
'label' => '7번 마구리(가로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $box_width + 5, 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false],
|
|
'aAngles' => [false, false, false]
|
|
],
|
|
[
|
|
'label' => '7번 마구리(세로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $box_height + 5, 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false],
|
|
'aAngles' => [false, false, false]
|
|
]
|
|
];
|
|
}
|
|
|
|
if ($selected_exit_directionFlat === '후면 점검구') {
|
|
$calWidth = $box_width - $front_bottom_width - $rail_width;
|
|
$calHeight = $box_height - 50*2 - 17*2 - 6;
|
|
|
|
$productData = [
|
|
$frontSectionData,
|
|
[
|
|
'label' => '2번 린텔부',
|
|
'surang' => 1,
|
|
'inputValues' => [25, 15, 50, $calWidth, 55, 30],
|
|
'bendingRates' => [0, 0, 1, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '3번 후면 점검구',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 13, $calHeight, 13, 17],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '4번 후면 코너부',
|
|
'surang' => 1,
|
|
'inputValues' => [20, 15, 50, 50, 15, 20],
|
|
'bendingRates' => [0, 0, 1, 1, 0, 0],
|
|
'sums' => [],
|
|
'colors' => [true, false, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false, false]
|
|
],
|
|
[
|
|
'label' => '5번 상부덮개',
|
|
'surang' => 1,
|
|
'inputValues' => [$box_width - 111],
|
|
'bendingRates' => [0],
|
|
'sums' => [],
|
|
'colors' => [false],
|
|
'aAngles' => [false]
|
|
],
|
|
[
|
|
'label' => '6번 마구리(가로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $box_width + 5, 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false],
|
|
'aAngles' => [false, false, false]
|
|
],
|
|
[
|
|
'label' => '6번 마구리(세로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $box_height + 5, 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [],
|
|
'colors' => [false, false, false],
|
|
'aAngles' => [false, false, false]
|
|
]
|
|
];
|
|
}
|
|
|
|
if($selected_exit_directionFlat === '밑면 점검구')
|
|
{
|
|
// 2번 린텔부 데이터 생성 (고정치수)
|
|
$lintelSectionData = [
|
|
'label' => '2번 린텔부',
|
|
'surang' => 1,
|
|
'inputValues' => [20,15,50,55,30],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [true, false, false, false, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
];
|
|
// 3번 하부 점검구
|
|
$calWidth = $box_width - $rail_width - $front_bottom_width - 50 - 50 - 17*2 -6 ;
|
|
$bottomExitSectionData = [
|
|
'label' => '3번 하부 점검구',
|
|
'surang' => 1,
|
|
'inputValues' => [17, 13, $calWidth , 13, 17],
|
|
'bendingRates' => [0, 0, 1, 1, 0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [true, false, false, true, false],
|
|
'aAngles' => [false, false, false, false, false]
|
|
];
|
|
|
|
// 4번 후면부
|
|
$cornerSectionData = [
|
|
'label' => '4번 후면부',
|
|
'surang' => 1,
|
|
'inputValues' => [20,15,50,$box_height,50,15,20],
|
|
'bendingRates' => [0, 0, 1, 1, 1, 0, 0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [true, false, false, false, false, true, false ],
|
|
'aAngles' => [false, false, false, false, false, false, false]
|
|
];
|
|
// 5번 상부덮개
|
|
$topCoverSectionData = [
|
|
'label' => '5번 상부덮개',
|
|
'surang' => 1,
|
|
'inputValues' => [$box_width - 111],
|
|
'bendingRates' => [0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [false],
|
|
'aAngles' => [false]
|
|
];
|
|
// 6번 마구리(가로)
|
|
$calWidth = $box_width+5;
|
|
$finishBox_width = [
|
|
'label' => '6번 마구리(가로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $calWidth , 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [false, false, false ],
|
|
'aAngles' => [false, false, false ]
|
|
];
|
|
// 6번 마구리(세로)
|
|
$calHeight = $box_height + 5;
|
|
$finishBox_height = [
|
|
'label' => '6번 마구리(세로)',
|
|
'surang' => 1,
|
|
'inputValues' => [50, $calHeight , 50],
|
|
'bendingRates' => [0, 1, 0],
|
|
'sums' => [], // 나중에 계산됨
|
|
'colors' => [false, false, false ],
|
|
'aAngles' => [false, false, false ]
|
|
];
|
|
// 테이블에 출력할 데이터를 배열로 정리
|
|
$productData = [$frontSectionData, $lintelSectionData,$bottomExitSectionData, $cornerSectionData, $topCoverSectionData, $finishBox_width, $finishBox_height ];
|
|
}
|
|
|
|
// sums 계산 함수
|
|
$calculateSums = function($product) {
|
|
$accumulatedSum = 0;
|
|
$sums = [];
|
|
foreach ($product['inputValues'] as $index => $inputVal) {
|
|
$bendingRateVal = $product['bendingRates'][$index];
|
|
$result = $inputVal - $bendingRateVal;
|
|
$accumulatedSum += $result;
|
|
$sums[] = $accumulatedSum;
|
|
}
|
|
return $sums;
|
|
};
|
|
|
|
// 각 제품의 sums 계산
|
|
foreach ($productData as &$product) {
|
|
$product['sums'] = $calculateSums($product);
|
|
}
|
|
unset($product);
|
|
|
|
return $productData;
|
|
}
|
|
?>
|