- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
2149 lines
82 KiB
PHP
2149 lines
82 KiB
PHP
<?php
|
|
include $_SERVER['DOCUMENT_ROOT'] . "/session.php" ;
|
|
// SUS 304 스테인리스 강의 비중은 일반적으로 약 7.93 g/cm³입니다.
|
|
// EGI(Electro Galvanized Iron) 1.2T의 비중은 일반적으로 7.85 g/cm³로 간주됩니다.
|
|
// 2025/01/13 KTE 마감 EGI 부분 이미지 변경 및 매칭변경
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
$title_message = '절곡 작업일지';
|
|
$tablename = 'output';
|
|
$item ='절곡 작업일지';
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
|
// 품질담당자 및 관리자인 경우 권한 부여
|
|
$QCadmin = false ;
|
|
if($user_name=='이세희' || $user_name=='개발자' || $user_name=='함신옥')
|
|
$QCadmin = true ;
|
|
?>
|
|
<title> <?=$title_message?> </title>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
</head>
|
|
<body>
|
|
|
|
<?php
|
|
// JavaScript에서 전달된 변수들 받기
|
|
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';
|
|
function calWeight($calItem, $calWidth, $calHeight) {
|
|
global $SUS_total, $EGI_total;
|
|
|
|
preg_match('/\d+(\.\d+)?/', $calItem, $matches);
|
|
$thickness = isset($matches[0]) ? $matches[0] : null;
|
|
$density = 0;
|
|
|
|
if (strpos($calItem, 'SUS') !== false) {
|
|
$density = 7.93;
|
|
} elseif (strpos($calItem, 'EGI') !== false) {
|
|
$density = 7.85;
|
|
} else {
|
|
return "지원되지 않는 소재입니다.";
|
|
}
|
|
|
|
$volume_cm3 = ($thickness * $calWidth * $calHeight) / 1000;
|
|
$weight_kg = ($volume_cm3 * $density) / 1000;
|
|
|
|
// 누적 합계
|
|
if (strpos($calItem, 'SUS') !== false) {
|
|
$SUS_total += $weight_kg;
|
|
} elseif (strpos($calItem, 'EGI') !== false) {
|
|
$EGI_total += $weight_kg;
|
|
}
|
|
|
|
return [
|
|
'current_weight' => number_format($weight_kg, 2)
|
|
];
|
|
}
|
|
function getSLengthCode($length, $category) {
|
|
switch ($category) {
|
|
case '연기차단재50':
|
|
switch ($length) {
|
|
case '3000':
|
|
return '53';
|
|
case '4000':
|
|
return '54';
|
|
default:
|
|
return null; // 해당하는 값이 없을 경우
|
|
}
|
|
case '연기차단재80':
|
|
switch ($length) {
|
|
case '3000':
|
|
return '83';
|
|
case '4000':
|
|
return '84';
|
|
default:
|
|
return null; // 해당하는 값이 없을 경우
|
|
}
|
|
case '기타':
|
|
switch ($length) {
|
|
case '1219':
|
|
return '12';
|
|
case '2438':
|
|
return '24';
|
|
case '3000':
|
|
return '30';
|
|
case '3500':
|
|
return '35';
|
|
case '4000':
|
|
return '40';
|
|
case '4150':
|
|
return '41';
|
|
case '4200':
|
|
return '42';
|
|
case '4300':
|
|
return '43';
|
|
default:
|
|
return null; // 해당하는 값이 없을 경우
|
|
}
|
|
default:
|
|
return null; // 카테고리가 없는 경우
|
|
}
|
|
}
|
|
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
//require_once($_SERVER['DOCUMENT_ROOT'] . "/estimate/fetch_unitprice.php");
|
|
$pdo = db_connect();
|
|
try {
|
|
$sql = "select * from {$DB}.{$tablename} where num = ? ";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh->execute();
|
|
$count = $stmh->rowCount();
|
|
if ($count < 1) {
|
|
print "검색결과가 없습니다.<br>";
|
|
} else {
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
include "_row.php";
|
|
$prodItem = "철재";
|
|
// output_extra 테이블에서 데이터 불러오기
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/output/load_output_extraTable.php';
|
|
}
|
|
} catch (PDOException $Exception) {
|
|
print "오류: " . $Exception->getMessage();
|
|
}
|
|
|
|
// JSON 문자열을 PHP 배열로 디코딩합니다.
|
|
//스크린발주서 읽기
|
|
$eList = json_decode($estimateSlatList, true);
|
|
|
|
// 행의 수는 배열의 크기와 동일하므로, count() 함수를 사용하여 구합니다.
|
|
$surang = count($eList);
|
|
|
|
// 데이터베이스에서 recordbending 컬럼 값을 가져온 후 디코딩
|
|
$recordbending = isset($recordbending) ? json_decode($recordbending, true) : [];
|
|
|
|
// print_r($recordbending);
|
|
|
|
// JSON 데이터를 JavaScript 변수로 변환
|
|
echo "<script>";
|
|
echo "var recordbendingData = " . json_encode($recordbending) . ";";
|
|
echo "</script>";
|
|
|
|
// 행의 수를 출력하거나 활용할 수 있습니다.
|
|
// echo "행의 수: " . $surang . "<br>";
|
|
|
|
$THscreenSu = $surang + 2 ;
|
|
|
|
// 디코딩된 데이터가 배열인지 확인합니다.
|
|
if (!is_array($eList)) {
|
|
echo "데이터가 정상적이지 않습니다. 확인바랍니다.";
|
|
exit;
|
|
}
|
|
else {
|
|
foreach ($eList as $item) {
|
|
$prodCode = $item['col4'];
|
|
$GuiderailType = $item['col6'];
|
|
$FinishMat = $item['col7'];
|
|
$prodname = '';
|
|
}
|
|
}
|
|
|
|
$indateStr = date("m/d", strtotime($indate));
|
|
$todayStr = date("m/d");
|
|
?>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/output/mymodal.php'; ?>
|
|
|
|
<div class="container mt-2">
|
|
<div class="d-flex align-items-center justify-content-end mt-1 m-2">
|
|
<button type="button" class="btn btn-dark btn-sm mx-3" onclick='location.reload();' title="새로고침"> <i class="bi bi-arrow-clockwise"></i> </button>
|
|
<?php if($QCadmin) { ?>
|
|
<button class="btn btn-primary btn-sm me-1 ms-1 approvalBtn" ><i class="bi bi-award-fill"></i> 품질 승인 </button>
|
|
<?php } ?>
|
|
<button class="btn btn-danger btn-sm me-1 ms-1 viewPlateBtn" > <i class="bi bi-textarea"></i> 절곡바라시 보기 </button>
|
|
<button type="button" class="btn btn-danger btn-sm me-1 ms-1 initialBtn" data-bs-toggle="tooltip" data-bs-placement="bottom" title="데이터 초기화"> R </button>
|
|
<button class="btn btn-dark btn-sm me-1 ms-1 saveData" > <i class="bi bi-floppy2-fill"></i> 서버 저장 </button>
|
|
<button class="btn btn-dark btn-sm me-1 ms-1" onclick="generatePDF()"> PDF 저장 </button>
|
|
<!-- <button class="btn btn-dark btn-sm me-1" onclick="sendmail();"> <i class="bi bi-envelope-arrow-up"></i> 전송 </button> -->
|
|
<button class="btn btn-secondary btn-sm me-1 ms-5" onclick="self.close();"> <i class="bi bi-x-lg"></i> 닫기 </button>
|
|
</div>
|
|
</div>
|
|
|
|
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data" onkeydown="return captureReturnKey(event)" >
|
|
|
|
<input type="hidden" id="mode" name="mode" value="<?= isset($mode) ? $mode : '' ?>">
|
|
<input type="hidden" id="num" name="num" value="<?= isset($num) ? $num : '' ?>">
|
|
<input type="hidden" id="user_name" name="user_name" value="<?= isset($user_name) ? $user_name : '' ?>">
|
|
<input type="hidden" id="update_log" name="update_log" value="<?= isset($update_log) ? $update_log : NULL ?>">
|
|
<input type="hidden" id="tablename" name="tablename" value="<?= isset($tablename) ? $tablename : '' ?>">
|
|
<input type="hidden" id="item_name" name="item_name" value="<?= isset($item_name) ? $item_name : '' ?>">
|
|
<input type="hidden" id="recordbending" name="recordbending">
|
|
|
|
<div id="content-to-print">
|
|
<br>
|
|
<div class="container mt-3">
|
|
<div class="row m-1">
|
|
<div class="d-flex align-items-center justify-content-center">
|
|
<table class="table" style="border-collapse: collapse;">
|
|
<thead>
|
|
<tr>
|
|
<th rowspan="3" class="text-center" style="width:70%;">
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<img src="../img/kdlogo.png" alt="경동기업" class="me-1" style="width:100%; height:auto;">
|
|
</div>
|
|
<div class="col-sm-10">
|
|
<div class="d-flex align-items-center justify-content-center m-1">
|
|
<span class="text-dark ms-2 me-2 fs-1" > 작 </span>
|
|
<span class="text-dark ms-2 me-2 fs-1" > 업 </span>
|
|
<span class="text-dark ms-2 me-2 fs-1" > 일 </span>
|
|
<span class="text-dark ms-2 fs-1" > 지 </span>
|
|
</div>
|
|
<br>
|
|
<div class="d-flex align-items-center justify-content-center mt-2">
|
|
<span class="badge bg-success ms-2 fs-6" > 절곡 생산부서 </span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</th>
|
|
<th rowspan="3" class="text-center fw-bold" style="height:100px;">결 재</th>
|
|
<th class="text-center p-1" style="width : 70px; height:22px; padding:2px;">작성</th>
|
|
<th class="text-center p-1" style="width : 70px; height:22px; padding:2px;">검토</th>
|
|
<th class="text-center p-1" style="width : 90px; height:22px; padding:2px;">승인</th>
|
|
</tr>
|
|
<tr style="height:40px;">
|
|
<th class="text-center"> <?=$orderman?> <br> <?=$indateStr ?></th>
|
|
<th class="text-center">
|
|
<div id="reviewDiv" style="display: none;">
|
|
<?=$user_name?> <br> <?=$todayStr ?>
|
|
</div>
|
|
</th>
|
|
<th class="text-center">
|
|
<div id="approvalDiv" style="display: none;">
|
|
<?=$user_name?> <br> <?=$todayStr ?>
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center" style="height:22px; padding:2px;">판매/<?=$orderman?></th>
|
|
<th class="text-center" style="height:22px; padding:2px;">생산</th>
|
|
<th class="text-center text-primary fw-bold" style="height:22px; padding:2px;">품질</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row m-1">
|
|
<div class="d-flex align-items-center justify-content-center">
|
|
<table class="table table-bordered" style="border-collapse: collapse;">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2" class="text-center align-middle lightgray" style="width:33%;">신 청 업 체</th>
|
|
<th colspan="2" class="text-center align-middle lightgray" style="width:33%;">신 청 내 용</th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">발주일</th>
|
|
<th class="text-center"><?=specialDate($orderdate)?></th>
|
|
<th class="text-center align-middle lightgray">현 장 명</th>
|
|
<th class="text-center text-primary fw-bold"><?=$outworkplace?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">업체명</th>
|
|
<th class="text-center">경동기업</th>
|
|
<th class="text-center align-middle lightgray">작업일자</th>
|
|
<th colspan="1" class="text-center text-primary fw-bold"> <span id="workdate"> </span> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">담당자</th>
|
|
<th class="text-center"><?=$orderman?></th>
|
|
<th class="text-center align-middle yellowBold">제품 LOT NO</th>
|
|
<th class="text-center fw-bold text-primary"><?=$lotNum?></th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">연락처</th>
|
|
<th class="text-center text-dark fw-bold"><?=$_SESSION['hp']?> </th>
|
|
<th class="text-center align-middle lightgray">생산담당자</th>
|
|
<th class="text-center">
|
|
<button type="button" id="editButton" class="btn btn-success btn-sm">담당자 입력</button>
|
|
<div id="inputContainer" style="display: none;">
|
|
<input type="text" id="userNameInput" class="form-control d-inline-block noborder-input text-center" autocomplete="off" style="width: 150px;" value="<?=$user_name?>">
|
|
<button type="button" id="cancelButton" class="btn btn-outline-danger btn-sm"> <i class="bi bi-x"> </i> </button>
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
<script>
|
|
$(document).ready(function() {
|
|
// '담당자 입력' 버튼 클릭 시 input 표시 및 버튼 숨김
|
|
$('#editButton').on('click', function() {
|
|
$('#editButton').hide();
|
|
$('#inputContainer').show();
|
|
$('#workdate').text('<?php echo $todayStr; ?>');
|
|
$('#reviewDiv').show();
|
|
});
|
|
|
|
// '취소' 버튼 클릭 시 원래 상태로 되돌림
|
|
$('#cancelButton').on('click', function() {
|
|
$('#inputContainer').hide();
|
|
$('#reviewDiv').hide();
|
|
$('#workdate').text('');
|
|
$('#editButton').show();
|
|
});
|
|
});
|
|
</script>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row m-1">
|
|
<div class="d-flex align-items-center justify-content-center">
|
|
<table class="table table-bordered mt-2" style="border-collapse: collapse;">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray" >제품명 </th>
|
|
<th class="text-center align-middle text-danger fw-bold"> <?=$prodCode?> </th>
|
|
<th class="text-center align-middle text-danger fw-bold "> <?=$prodItem?> </th>
|
|
<th class="text-center align-middle lightgray" >마감유형 </th>
|
|
<th colspan="2" class="text-center align-middle text-danger fw-bold "> <?=$FinishMat?> </th>
|
|
</tr>
|
|
</thead>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// KTE 마감이 SUS인경우는 마감재 표함된 이미지 불러오기
|
|
$prodCodeSuffix = '';
|
|
$BottombarExtraFinish = '없음';
|
|
|
|
// 마감 EGI, SUS 분리하기
|
|
foreach ($eList as $item) {
|
|
$prodCode = $item['col4'];
|
|
$GuiderailType = $item['col6'];
|
|
$FinishMat = $item['col7'];
|
|
$items1 = ['KQTS01'];
|
|
$items2 = ['KTE01'];
|
|
$SUSword = '';
|
|
|
|
// $prodcode가 $items1 배열에 있는 경우
|
|
if (in_array($prodCode, $items1)) {
|
|
$GuidrailFinish = 'SUS 1.2T';
|
|
$BottombarFinish = 'SUS 1.5T';
|
|
$bodyMaterial ="EGI 1.55T";
|
|
$GuidrailExtraFinish = ''; // 원래
|
|
$SUSword = '없음'; // sus 마감부분 문구 표현
|
|
}
|
|
|
|
// $prodcode가 $items2 배열에 있는 경우
|
|
elseif (in_array($prodCode, $items2)) {
|
|
$GuidrailFinish = 'EGI 1.55T';
|
|
$BottombarFinish = 'EGI 1.55T';
|
|
$bodyMaterial ="EGI 1.55T";
|
|
if($FinishMat == 'SUS마감')
|
|
{
|
|
$GuidrailExtraFinish = 'SUS 1.2T';
|
|
$BottombarExtraFinish = 'SUS 1.2T';
|
|
$prodCodeSuffix = '';
|
|
}
|
|
else
|
|
{
|
|
$GuidrailExtraFinish = '';
|
|
$BottombarExtraFinish = '없음';
|
|
$SUSword = '없음'; // sus 마감부분 문구 표현
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<!-- 절곡품 체크 되어 있으면 절곡품 출력 -->
|
|
<?php if(isset($steel) && $steel === '1') { ?>
|
|
|
|
<div class="row justify-content-start mt-2 ">
|
|
<div class="d-flex justify-content-start mt-2 ">
|
|
<span class="text-dark" > ■ 작업내역 - </span> <span class="text-primary fw-bold ms-1 " > 절곡 상세도면 참조 </span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 가이드 레일 계산 및 테이블 출력 -->
|
|
<div class="row m-1">
|
|
<?php
|
|
// 가이드 레일 계산 및 테이블 출력
|
|
if (True) {
|
|
$row3_data = [
|
|
['length' => 2438, 'wall_sum' => 0, 'side_sum' => 0, 'wall_basesize' => null , 'side_basesize' => null],
|
|
['length' => 3000, 'wall_sum' => 0, 'side_sum' => 0, 'wall_basesize' => null , 'side_basesize' => null],
|
|
['length' => 3500, 'wall_sum' => 0, 'side_sum' => 0, 'wall_basesize' => null , 'side_basesize' => null],
|
|
['length' => 4000, 'wall_sum' => 0, 'side_sum' => 0, 'wall_basesize' => null , 'side_basesize' => null],
|
|
['length' => 4300, 'wall_sum' => 0, 'side_sum' => 0, 'wall_basesize' => null , 'side_basesize' => null],
|
|
];
|
|
|
|
foreach ($eList as $item) {
|
|
$validLength = floatval($item['col24']); // 유효 길이
|
|
$railType = trim($item['col6']); // 레일 타입 (혼합형, 벽면형, 측면형)
|
|
|
|
foreach ($row3_data as &$row) {
|
|
if ($validLength <= $row['length']) {
|
|
if ($railType == '혼합형(130*75)(130*125)') {
|
|
$row['wall_sum'] += 1;
|
|
$row['side_sum'] += 1;
|
|
$row['wall_basesize'] = '135*80';
|
|
$row['side_basesize'] = '135*130';
|
|
} elseif ($railType == '벽면형(130*75)') {
|
|
$row['wall_sum'] += 2;
|
|
$row['wall_basesize'] = '135*130';
|
|
} elseif ($railType == '측면형(130*125)') {
|
|
$row['side_sum'] += 2;
|
|
$row['side_basesize'] = '135*130';
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
unset($row); // 참조 제거
|
|
|
|
// 벽면형 테이블 출력
|
|
if (array_sum(array_column($row3_data, 'wall_sum')) > 0) {
|
|
echo '<div class="col-sm-4">';
|
|
echo '<div class="d-flex align-items-center justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1" colspan="1" class="text-center align-middle lightgray">1.1 벽면형[130*75]</td>';
|
|
echo '<td rowspan="2" class="text-center yellowblackBold" style="width:250px;">입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1"><img src="../img/guiderail/guiderail_' . $prodCode . '_wall_130x75' . $prodCodeSuffix . '.jpg?v=' . time() . '" alt="벽면형" width="220"></td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="col-sm-8">';
|
|
echo '<div class="d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center lightgray">세부품명</td>';
|
|
echo '<td class="text-center lightgray">재질</td>';
|
|
echo '<td class="text-center lightgray">길이(규격) / 수량 / 입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
|
|
if ($prodCode == 'KTE01' and $FinishMat == 'EGI마감' or $prodCode == 'KQTS01')
|
|
{
|
|
$itemPrefixes = [
|
|
// 철재가이드레일 KTE, KQTS 기본형
|
|
'①②마감재' => 'XX',
|
|
'③본체' => 'RT',
|
|
'④C형' => 'RC',
|
|
'⑤D형' => 'RD',
|
|
];
|
|
}
|
|
else if ($prodCode == 'KTE01' and $FinishMat == 'SUS마감')
|
|
{
|
|
$itemPrefixes = [
|
|
// 별도마감부분 추가
|
|
'①②마감재' => 'XX',
|
|
'③본체' => 'RT',
|
|
'④C형' => 'RC',
|
|
'⑤D형' => 'RD',
|
|
'⑥별도마감' => 'RS',
|
|
];
|
|
}
|
|
|
|
foreach ($itemPrefixes as $key => $prefix) {
|
|
$material = ($key == '①②마감재' ) ? $GuidrailFinish : $bodyMaterial;
|
|
$material = ($key == '⑥별도마감' ) ? $GuidrailExtraFinish : $material;
|
|
echo '<tr>';
|
|
if($prefix =='RS') {
|
|
echo '<td class="text-center text-danger">' . $key . '</td>';
|
|
echo '<td class="text-center text-danger">' . $material . '</td>';
|
|
}
|
|
else
|
|
{
|
|
echo '<td class="text-center text-dark">' . $key . '</td>';
|
|
echo '<td class="text-center text-dark">' . $material . '</td>';
|
|
}
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
|
|
foreach ($row3_data as $row) {
|
|
if ($row['wall_sum'] > 0) {
|
|
$weightResult = calWeight($material, 412, intval($row['length']));
|
|
$weightText = (is_array($weightResult) && isset($weightResult['current_weight'])) ? $weightResult['current_weight'] : 'N/A';
|
|
$code = getSLengthCode($row['length'], '기타');
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $weightText . 'Kg">' . $row['length'] . '</td>';
|
|
echo '<td class="text-center w40px">' . $row['wall_sum'] . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $prefix . '-' . $code . '" data-usesurang="' . $row['wall_sum'] . '" name="lotnum_wall[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div> </div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
// 하부BASE 데이터 출력
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark">하부BASE</td>';
|
|
echo '<td class="text-center text-dark">EGI 1.55T</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
$weightResult_sum = 0;
|
|
$BaseCount = 0;
|
|
foreach ($row3_data as $row) {
|
|
if ($row['wall_sum'] > 0) {
|
|
$weightResult = calWeight('EGI 1.55T', 135, 80);
|
|
$weightResult_sum += $EGI_total ;
|
|
$BaseCount += $row['wall_sum'];
|
|
$code = $row['wall_basesize'];
|
|
$basesize = $row['wall_basesize'];
|
|
}
|
|
}
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $weightResult["current_weight"] . 'Kg">' . $basesize . '</td>';
|
|
echo '<td class="text-center w40px">' . $BaseCount . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="XX-' . $code . '" data-usesurang="' . $BaseCount . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
|
|
// 측면형 테이블 출력
|
|
if (array_sum(array_column($row3_data, 'side_sum')) > 0) {
|
|
echo '<div class="col-sm-4">';
|
|
echo '<div class="d-flex align-items-center justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1" colspan="1" class="text-center align-middle lightgray">1.2 측면형[130*125]</td>';
|
|
echo '<td rowspan="2" class="text-center yellowblackBold" style="width:250px;">입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1"><img src="../img/guiderail/guiderail_' . $prodCode . '_side_130x125' . $prodCodeSuffix . '.jpg?v=' . time() . '" alt="측면형" width="220"></td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="col-sm-8">';
|
|
echo '<div class="d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center lightgray">세부품명</td>';
|
|
echo '<td class="text-center lightgray">재질</td>';
|
|
echo '<td class="text-center lightgray">길이(규격) / 수량 / 입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
|
|
$itemPrefixes = [
|
|
'①②마감재' => 'SS',
|
|
'③본체' => 'ST',
|
|
'④C형' => 'SC',
|
|
'⑤D형' => 'SD',
|
|
];
|
|
|
|
foreach ($itemPrefixes as $key => $prefix) {
|
|
$material = ($key == '①②마감재') ? $GuidrailFinish : $bodyMaterial;
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark">' . $key . '</td>';
|
|
echo '<td class="text-center text-dark">' . $material . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
|
|
foreach ($row3_data as $row) {
|
|
if ($row['side_sum'] > 0) {
|
|
$weightResult = calWeight($material, 462, intval($row['length']));
|
|
$code = getSLengthCode($row['length'], '기타');
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $weightResult["current_weight"] . 'Kg">' . $row['length'] . '</td>';
|
|
echo '<td class="text-center w40px">' . $row['side_sum'] . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $prefix . '-' . $code . '" data-usesurang="' . $row['side_sum'] . '" name="lotnum_wall[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div> </div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
// 하부BASE 데이터 출력
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark">하부BASE</td>';
|
|
echo '<td class="text-center text-dark">EGI 1.55T</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
$BaseCount = 0;
|
|
foreach ($row3_data as $row) {
|
|
if ($row['side_sum'] > 0) {
|
|
$weightResult = calWeight('EGI 1.55T', 135, 130);
|
|
$weightResult_sum += $EGI_total ;
|
|
$BaseCount += $row['side_sum'];
|
|
$code = $row['side_basesize'];
|
|
$basesize = $row['side_basesize'];
|
|
}
|
|
}
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $weightResult["current_weight"] . 'Kg">' . $basesize . '</td>';
|
|
echo '<td class="text-center w40px">' . $BaseCount . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="XX-' . $code . '" data-usesurang="' . $BaseCount . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<!-- 하단 마감재 -->
|
|
<div class="row m-1 mt-3">
|
|
<?php
|
|
// 하단 마감재 계산 및 테이블 출력
|
|
if (True) {
|
|
// 하단 마감재, 하단 보강엘바, 하단 보강평철, 하단 무게평철의 데이터를 저장할 배열
|
|
$item_data = [
|
|
'하단마감재' => [
|
|
'size' => '(60*40)',
|
|
'length_3000' => 0,
|
|
'length_4000' => 0,
|
|
'sum' => 0,
|
|
]
|
|
];
|
|
|
|
if($BottombarFinish == 'EGI 1.55T')
|
|
$BTmat = 'TE';
|
|
else
|
|
$BTmat = 'TS';
|
|
|
|
// 데이터를 누적하여 합산
|
|
foreach ($eList as $item) {
|
|
$item_data['하단마감재']['length_3000'] += intval($item['col50']);
|
|
$item_data['하단마감재']['length_4000'] += intval($item['col51']);
|
|
}
|
|
|
|
echo '<div class="col-sm-4 ">';
|
|
echo '<div class="d-flex align-items-center justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1" colspan="1" class="text-center align-middle lightgray">2. 하단마감재</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="1"><img src="../img/bottombar/bottombar_' . $prodCode . '.jpg?v=' . time() . '" alt="하단마감재" width="220"></td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="col-sm-8">';
|
|
echo '<div class="d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center lightgray">세부품명</td>';
|
|
echo '<td class="text-center lightgray">재질</td>';
|
|
echo '<td class="text-center lightgray">길이(규격) / 수량 / 입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark">①하단마감재 </td>';
|
|
echo '<td class="text-center text-dark">' . $BottombarFinish . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
$side_sum = 0;
|
|
if( $item_data['하단마감재']['length_4000'] > 0) {
|
|
$length_4000 = 4000 ;
|
|
$side_sum += $item_data['하단마감재']['length_4000'];
|
|
if(intval($side_sum)>0)
|
|
$weightResult = calWeight($BottombarFinish, 184 , $length_4000 );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" > ' . $length_4000 . '</td>';
|
|
|
|
echo '<td class="text-center w40px">' . $item_data['하단마감재']['length_4000'] . '</td>';
|
|
$code = getSLengthCode(4000, '기타');
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $BTmat . '-' . $code . '" data-usesurang="' . $item_data['하단마감재']['length_4000'] . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
if( $item_data['하단마감재']['length_3000'] > 0) {
|
|
$length_3000 = 3000 ;
|
|
$side_sum += $item_data['하단마감재']['length_3000'];
|
|
if($side_sum>0)
|
|
$weightResult = calWeight($BottombarFinish, 184 , $length_3000 );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" > ' . $length_3000 . '</td>';
|
|
|
|
echo '<td class="text-center w40px">' . $item_data['하단마감재']['length_3000'] . '</td>';
|
|
$code = getSLengthCode(3000, '기타');
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $BTmat . '-' . $code . '" data-usesurang="' . $item_data['하단마감재']['length_3000'] . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-danger">④별도마감재 </td>';
|
|
echo '<td class="text-center text-danger">' . $BottombarExtraFinish . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
$side_sum = 0;
|
|
if( $item_data['하단마감재']['length_4000'] > 0 && $BottombarExtraFinish !== '없음' ) {
|
|
$length_4000 = 4000 ;
|
|
$side_sum += $item_data['하단마감재']['length_4000'];
|
|
if($side_sum>0)
|
|
$weightResult = calWeight($BottombarExtraFinish , 238 , $length_4000 );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" > ' . $length_4000 . '</td>';
|
|
echo '<td class="text-center w40px">' . $item_data['하단마감재']['length_4000'] . '</td>';
|
|
$code = getSLengthCode($row['length'], '기타');
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $BTmat . '-' . '" data-usesurang="' . $side_sum . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
if( $item_data['하단마감재']['length_3000'] > 0 && $BottombarExtraFinish !== '없음' ) {
|
|
$length_3000 = 3000 ;
|
|
$side_sum += $item_data['하단마감재']['length_3000'];
|
|
if($side_sum>0)
|
|
$weightResult = calWeight($BottombarExtraFinish , 238 , $length_3000 );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" > ' . $length_3000 . '</td>';
|
|
|
|
echo '<td class="text-center w40px">' . $item_data['하단마감재']['length_3000'] . '</td>';
|
|
$code = getSLengthCode($row['length'], '기타');
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $BTmat . '-' . '" data-usesurang="' . $side_sum . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
if(empty($BottombarExtraFinish ) )
|
|
{
|
|
echo '<tr><td> 없음 </td>';
|
|
echo '</tr>';
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<!-- 셔터박스 -->
|
|
<?php
|
|
|
|
/**
|
|
* 이미지에 여러 텍스트를 추가하고 저장하는 함수
|
|
*
|
|
* @param string $sourcePath 원본 이미지 경로
|
|
* @param string $savePath 저장할 이미지 경로
|
|
* @param array $textData 텍스트 배열 (각 항목은 ['text' => 문구, 'x' => X 좌표, 'y' => Y 좌표])
|
|
* @param int $fontSize 텍스트 폰트 크기 (모든 문구에 동일한 크기 적용)
|
|
* @return bool 성공 여부
|
|
*/
|
|
|
|
function drawImage($sourcePath, $savePath, $textData, $fontSize = 3) {
|
|
// 디버그 로그 파일 경로
|
|
$debugLog = './debug_log.txt';
|
|
|
|
// 로그 기록 함수
|
|
$log = function ($message) use ($debugLog) {
|
|
file_put_contents($debugLog, date('[Y-m-d H:i:s] ') . $message . "\n", FILE_APPEND);
|
|
};
|
|
|
|
try {
|
|
// GD 라이브러리 활성화 확인
|
|
if (!function_exists('imagecreatefromjpeg')) {
|
|
$log("GD 라이브러리가 활성화되지 않음");
|
|
return false;
|
|
}
|
|
|
|
// 원본 이미지 로드
|
|
$image = imagecreatefromjpeg($sourcePath);
|
|
if (!$image) {
|
|
$log("이미지 로드 실패: {$sourcePath}");
|
|
return false;
|
|
}
|
|
$log("이미지 로드 성공: {$sourcePath}");
|
|
|
|
// 텍스트 추가
|
|
$textColor = imagecolorallocate($image, 255, 0, 0); // 빨간색
|
|
foreach ($textData as $textItem) {
|
|
if (isset($textItem['text'], $textItem['x'], $textItem['y'])) {
|
|
imagestring(
|
|
$image,
|
|
$fontSize,
|
|
intval($textItem['x']),
|
|
intval($textItem['y']),
|
|
$textItem['text'],
|
|
$textColor
|
|
);
|
|
$log("텍스트 추가: '{$textItem['text']}' at ({$textItem['x']}, {$textItem['y']})");
|
|
} else {
|
|
$log("잘못된 텍스트 데이터: " . json_encode($textItem));
|
|
}
|
|
}
|
|
|
|
// 이미지 저장
|
|
$result = imagejpeg($image, $savePath);
|
|
if (!$result) {
|
|
$log("이미지 저장 실패: {$savePath}");
|
|
return false;
|
|
}
|
|
$log("이미지 저장 성공: {$savePath}");
|
|
|
|
// 메모리 해제
|
|
imagedestroy($image);
|
|
$log("메모리 해제 완료");
|
|
|
|
return true; // 성공
|
|
} catch (Exception $e) {
|
|
$log("예외 발생: " . $e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// $box_data = [
|
|
// ['size' => '500*350', 'sum' => 0, 'cover' => 0, 'fincover' => 0 ],
|
|
// ['size' => '500*380', 'sum' => 0, 'cover' => 0, 'fincover' => 0 ]
|
|
// ];
|
|
|
|
$box_data = [];
|
|
|
|
// $eList를 순회하며 데이터 생성
|
|
foreach ($eList as $item) {
|
|
$boxSize = trim($item['col37']); // `col37`에서 셔터박스 크기 추출
|
|
if ($boxSize == 'custom') {
|
|
$boxSize = trim($item['col37_custom']);
|
|
}
|
|
$railwidth = trim($item['col37_railwidth']);
|
|
$frontbottom = trim($item['col37_frontbottom']);
|
|
$boxdirection = trim($item['col37_boxdirection']); // 박스방향 양면 밑면 후면
|
|
$cover = intval($item['col45']); // `col45`에서 상부덮개 값 추출
|
|
$fincover = intval($item['col47']); // `col47`에서 마구리 수량 값 추출
|
|
$boxLengths = [
|
|
['length' => '1219', 'quantity' => intval($item['col39'])],
|
|
['length' => '2438', 'quantity' => intval($item['col40'])],
|
|
['length' => '3000', 'quantity' => intval($item['col41'])],
|
|
['length' => '3500', 'quantity' => intval($item['col42'])],
|
|
['length' => '4000', 'quantity' => intval($item['col43'])],
|
|
['length' => '4150', 'quantity' => intval($item['col44'])]
|
|
];
|
|
|
|
// `size`와 `boxdirection` 조합으로 기존 데이터 확인
|
|
$existingKey = array_search(true, array_map(function ($data) use ($boxSize, $boxdirection) {
|
|
return $data['size'] === $boxSize && $data['boxdirection'] === $boxdirection;
|
|
}, $box_data));
|
|
|
|
if ($existingKey === false) {
|
|
// 새로운 사이즈 및 박스 방향 추가
|
|
$box_data[] = [
|
|
'size' => $boxSize,
|
|
'sum' => 1, // 기본 값 설정
|
|
'cover' => $cover,
|
|
'fincover' => $fincover,
|
|
'railwidth' => $railwidth,
|
|
'frontbottom' => $frontbottom,
|
|
'boxdirection' => $boxdirection,
|
|
'length_data' => array_map(function ($length) {
|
|
return ['length' => $length['length'], 'sum' => $length['quantity']];
|
|
}, $boxLengths)
|
|
];
|
|
} else {
|
|
// 기존 데이터에 값 누적
|
|
$box_data[$existingKey]['sum'] += 1;
|
|
$box_data[$existingKey]['cover'] += $cover;
|
|
$box_data[$existingKey]['fincover'] += $fincover;
|
|
|
|
// 길이 데이터 누적
|
|
foreach ($boxLengths as $index => $length) {
|
|
$box_data[$existingKey]['length_data'][$index]['sum'] += $length['quantity'];
|
|
}
|
|
}
|
|
}
|
|
|
|
// 결과 확인
|
|
// print_r($box_data);
|
|
?>
|
|
|
|
<div class="row m-1 mt-3">
|
|
<?php
|
|
// 셔터박스 자재 계산 및 출력
|
|
if (isset($box_data) && !empty($box_data)) {
|
|
foreach ($box_data as $box) {
|
|
|
|
// echo '<pre>';
|
|
// print_r($box);
|
|
// echo '</pre>';
|
|
|
|
// 입력 데이터 설정
|
|
if ($box['boxdirection'] == '양면') {
|
|
$suffix = 'both';
|
|
} else if ($box['boxdirection'] == '밑면') {
|
|
$suffix = 'bottom';
|
|
} else if ($box['boxdirection'] == '후면') {
|
|
$suffix = 'rear';
|
|
}
|
|
|
|
// 주의 사항 : image생성시는 https:// 이것은 금지된다. 안된다. 그래서 폴더는 ../ 이렇게 상대적 주소를 사용해야 한다. 중요함
|
|
$sourcePath = '../img/box/source/box_' . $suffix . '.jpg';
|
|
$saveName = 'box_' . str_replace('*', 'x', $box['size']) . '_' . $suffix . '.jpg';
|
|
$savePath = '../img/box/' . $saveName;
|
|
list($boxwidth, $boxheight) = explode('*', $box['size']); // 셔터박스 크기 분리
|
|
$TopcoverSize = $boxwidth - 111; // 텍스트로 추가할 값
|
|
|
|
// 입력 데이터 설정
|
|
if ($box['boxdirection'] == '양면') {
|
|
$textData = [
|
|
['text' => $boxheight , 'x' => 15, 'y' => 85],
|
|
['text' => $TopcoverSize, 'x' => 100, 'y' => 5],
|
|
['text' => $box['frontbottom'] , 'x' => 25, 'y' => 170],
|
|
['text' => $box['railwidth'] , 'x' => 55, 'y' => 210],
|
|
['text' => ($boxwidth-$box['frontbottom']-$box['railwidth']-140) , 'x' => 120, 'y' => 175],
|
|
['text' => ($boxheight-140) , 'x' => 200, 'y' => 90],
|
|
['text' => ($boxwidth+5) , 'x' => 100, 'y' => 225],
|
|
['text' => ($boxheight+5) , 'x' => 135, 'y' => 250],
|
|
];
|
|
} else if ($box['boxdirection'] == '밑면') {
|
|
$textData = [
|
|
['text' => $boxheight , 'x' => 15, 'y' => 85],
|
|
['text' => $TopcoverSize, 'x' => 100, 'y' => 5],
|
|
['text' => $box['frontbottom'] , 'x' => 25, 'y' => 170],
|
|
['text' => $box['railwidth'] , 'x' => 55, 'y' => 210],
|
|
['text' => ($boxwidth-$box['frontbottom']-$box['railwidth']-140) , 'x' => 120, 'y' => 175], // 점검구 140 빼기
|
|
['text' => ($boxheight) , 'x' => 200, 'y' => 90],
|
|
['text' => ($boxwidth+5) , 'x' => 100, 'y' => 225],
|
|
['text' => ($boxheight+5) , 'x' => 135, 'y' => 250],
|
|
];
|
|
} else if ($box['boxdirection'] == '후면') {
|
|
$textData = [
|
|
['text' => $boxheight , 'x' => 15, 'y' => 85],
|
|
['text' => $TopcoverSize, 'x' => 100, 'y' => 5],
|
|
['text' => $box['frontbottom'] , 'x' => 25, 'y' => 170],
|
|
['text' => $box['railwidth'] , 'x' => 55, 'y' => 210],
|
|
['text' => ($boxwidth-$box['frontbottom']-$box['railwidth']) , 'x' => 120, 'y' => 175],
|
|
['text' => ($boxheight-140) , 'x' => 200, 'y' => 90],
|
|
['text' => ($boxwidth+5) , 'x' => 100, 'y' => 225],
|
|
['text' => ($boxheight+5) , 'x' => 135, 'y' => 250],
|
|
];
|
|
}
|
|
|
|
// 이미지 그리기 함수 호출
|
|
drawImage($sourcePath, $savePath, $textData, 3);
|
|
|
|
$BoxFinish = 'EGI 1.55T';
|
|
$boxCover = intval($box['cover']); // 상부덮개 수량
|
|
$boxFinCover = intval($box['fincover']); // 마구리 수량
|
|
|
|
echo '<div class="col-sm-4">';
|
|
echo '<div class="d-flex align-items-center justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center align-middle lightgray">3. 케이스 [' . $box['size'] . '] 점검구: ' . $box['boxdirection'] . '</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td><img src="../img/box/' . $saveName . '" width="220"></td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="col-sm-8">';
|
|
echo '<div class="d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center lightgray">세부품명</td>';
|
|
echo '<td class="text-center lightgray">재질</td>';
|
|
echo '<td class="text-center lightgray">길이(규격) / 수량 / 입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
|
|
// 로트번호 표준사이즈는 포밍기로 재고생성 구성 요소 정의
|
|
if($box['size'] == '500*380') {
|
|
$components = [
|
|
'①전면부' => ['prefix' => 'CF', 'dimension' => $boxheight + 122],
|
|
'②린텔부' => ['prefix' => 'CL', 'dimension' => $boxwidth - 330],
|
|
'③⑤점검구' => ['prefix' => 'CP', 'dimension' => $boxwidth - 200],
|
|
'④후면코너부' => ['prefix' => 'CB', 'dimension' => 170],
|
|
];
|
|
} else
|
|
{
|
|
if($box['boxdirection'] == '양면')
|
|
{
|
|
$components = [
|
|
'①전면부' => ['prefix' => 'XX', 'dimension' => $boxheight + 122],
|
|
'②린텔부' => ['prefix' => 'CL', 'dimension' => $boxwidth - 330],
|
|
'③점검구' => ['prefix' => 'XX', 'dimension' => $boxwidth - 200],
|
|
'④후면코너부' => ['prefix' => 'CB', 'dimension' => 170],
|
|
'⑤점검구' => ['prefix' => 'XX', 'dimension' => $boxheight - 100],
|
|
];
|
|
}
|
|
if($box['boxdirection'] == '밑면')
|
|
{
|
|
$components = [
|
|
'①전면부' => ['prefix' => 'XX', 'dimension' => $boxheight + 122],
|
|
'②린텔부' => ['prefix' => 'CL', 'dimension' => $boxwidth - 330],
|
|
'③점검구' => ['prefix' => 'XX', 'dimension' => $boxwidth - 200],
|
|
'④후면부' => ['prefix' => 'CB', 'dimension' => $boxheight + 85*2],
|
|
];
|
|
}
|
|
if($box['boxdirection'] == '후면')
|
|
{
|
|
$components = [
|
|
'①전면부' => ['prefix' => 'XX', 'dimension' => $boxheight + 122],
|
|
'②린텔부' => ['prefix' => 'CL', 'dimension' => $boxwidth + 85*2],
|
|
'③점검구' => ['prefix' => 'XX', 'dimension' => $boxheight - 200],
|
|
'④후면코너부' => ['prefix' => 'CB', 'dimension' => $boxheight + 85*2],
|
|
];
|
|
}
|
|
}
|
|
|
|
// 각 구성 요소 출력
|
|
foreach ($components as $name => $data) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark">' . $name . '</td>';
|
|
echo '<td class="text-center text-dark">' . $BoxFinish . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
|
|
foreach ($box['length_data'] as $row) {
|
|
if (intval($row['sum']) > 0) {
|
|
$weightResult = calWeight($BoxFinish, $data['dimension'], intval($row['length']));
|
|
$code = getSLengthCode($row['length'], '기타');
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $weightResult["current_weight"] . 'Kg">' . $row['length'] . '</td>';
|
|
echo '<td class="text-center w40px">' . $row['sum'] . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="' . $data['prefix'] . '-' . $code . '" data-usesurang="' . $row['sum'] . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
// 상부덮개 출력
|
|
echo '<tr>';
|
|
if($box['boxdirection'] == '양면')
|
|
echo '<td class="text-center text-dark">⑥상부덮개</td>';
|
|
else
|
|
echo '<td class="text-center text-dark">⑤상부덮개</td>';
|
|
echo '<td class="text-center text-dark">' . $BoxFinish . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
|
|
$calculateWidth = ($boxwidth-111) ;
|
|
$topSize = '1219*'. $calculateWidth ;
|
|
$topWeight = calWeight($BoxFinish, $calculateWidth, 1219);
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . ($topWeight["current_weight"] * $boxCover) . 'Kg">' . $topSize . '</td>';
|
|
echo '<td class="text-center w40px">' . $boxCover . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput"data-itemname="XX-' . $topSize . '" data-usesurang="' . $boxCover . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
// 측면부 (마구리) 출력
|
|
echo '<tr>';
|
|
if($box['boxdirection'] == '양면')
|
|
echo '<td class="text-center text-dark">⑦측면부<br>(마구리)</td>';
|
|
else
|
|
echo '<td class="text-center text-dark">⑥측면부<br>(마구리)</td>';
|
|
|
|
echo '<td class="text-center text-dark">' . $BoxFinish . '</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
list($boxwidthFin, $boxheightFin) = explode('*', $box['size']);
|
|
$sideWeight = calWeight($BoxFinish, $boxwidthFin, $boxheightFin);
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . ($sideWeight["current_weight"] * $boxFinCover) . 'Kg">' . ($boxwidthFin+5) . '*' . ($boxheightFin+5) . '</td>';
|
|
echo '<td class="text-center w40px">' . $boxFinCover . '</td>';
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput"data-itemname="XX-' . $box['size'] . '" data-usesurang="' . $boxFinCover . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 연기 차단재 -->
|
|
<div class="row m-1 mt-3">
|
|
<?php
|
|
$smoke_data = [
|
|
['length' => 2438, 'sum' => 0],
|
|
['length' => 3000, 'sum' => 0],
|
|
['length' => 3500, 'sum' => 0],
|
|
['length' => 4000, 'sum' => 0],
|
|
['length' => 4300, 'sum' => 0]
|
|
];
|
|
|
|
foreach ($eList as $item) {
|
|
$smoke_data[0]['sum'] += floatval($item['col32']); // length 2438
|
|
$smoke_data[1]['sum'] += floatval($item['col33']); // length 3000
|
|
$smoke_data[2]['sum'] += floatval($item['col34']); // length 3500
|
|
$smoke_data[3]['sum'] += floatval($item['col35']); // length 4000
|
|
$smoke_data[4]['sum'] += floatval($item['col36']); // length 4300
|
|
}
|
|
|
|
// 연기차단재 데이터가 있는 경우만 출력
|
|
$smoke_rows = [];
|
|
foreach ($smoke_data as $row) {
|
|
if ($row['sum'] > 0) {
|
|
$smoke_rows[] = [
|
|
'length' => $row['length'],
|
|
'sum' => $row['sum']
|
|
];
|
|
}
|
|
}
|
|
$smoke_rowspan = count($smoke_rows);
|
|
|
|
// W80 기준 숫자 찾기
|
|
$smokeban80 = 0;
|
|
foreach ($eList as $item) {
|
|
$smokeban80 += floatval($item['col48']);
|
|
}
|
|
|
|
echo '<div class="col-sm-4 ">';
|
|
echo '<div class="d-flex align-items-center justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center align-middle lightgray">4. 연기차단재 </td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td><img src="../img/part/smokeban.jpg" alt="연기차단재" width="220px"> </td>';
|
|
echo '</tr>';
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="col-sm-8">';
|
|
echo '<div class="d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center lightgray">재질</td>';
|
|
echo '<td class="text-center lightgray">세부품명</td>';
|
|
echo '<td class="text-center lightgray">길이(규격) / 수량 / 입고 & 생산 LOT NO.</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td rowspan="2" class="text-center text-dark">EGI 0.8T <br> + 화이바 <br> 글라스 <br> 코팅직물 </td>';
|
|
echo '<td class="text-center text-dark ">레일용 <br> [W50]</td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
$side_sum = 0;
|
|
foreach ($smoke_rows as $row) {
|
|
$side_sum += $row['sum'];
|
|
if(intval($row['sum'])>0)
|
|
{
|
|
$weightResult = calWeight('EGI 0.8T', 26 , intval($row['length']) );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" >' . $row['length'] . '</td>';
|
|
|
|
echo '<td class="text-center w40px">' . $row['sum'] . '</td>';
|
|
$code = getSLengthCode($row['length'], '기타'); // 연기차단재 80만 특별히 계산하고 50은 기타로 분류함
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="GI-' . $code . '" data-usesurang="' . $row['sum'] . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
$side_sum += $row['sum'];
|
|
}
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
echo '<tr>';
|
|
echo '<td class="text-center text-dark"> 케이스용 <br> [W80] </td>';
|
|
echo '<td class="text-center">';
|
|
echo '<div class="d-flex justify-content-start m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
if(intval($smokeban80)>0)
|
|
{
|
|
$length = 3000;
|
|
$weightResult = calWeight('EGI 0.8T', 26 , $length );
|
|
echo '<tr>';
|
|
echo '<td class="text-center w60px" data-bs-toggle="tooltip" data-bs-placement="bottom" title="'. $weightResult["current_weight"] . 'Kg" >' . $length . '</td>';
|
|
echo '<td class="text-center w40px">' . $smokeban80 . '</td>';
|
|
$code = getSLengthCode(3000, '연기차단재80');
|
|
echo '<td class="text-center w160px yellowblackBold">
|
|
<div class="d-flex justify-content-center align-items-center">
|
|
<input type="text" class="form-control noborder-input lotnumInput" data-itemname="GI-' . $code . '" data-usesurang="' . $row['sum'] . '" name="lotnum_side[]" autocomplete="off" placeholder="로트번호" />
|
|
<div class="info-btn" data-lotnum="" data-bs-toggle="tooltip" data-bs-placement="left" title="성적서"> <i class="bi bi-info-circle-fill"></i> </div>
|
|
</div>
|
|
</td>';
|
|
echo '</tr>';
|
|
}
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
?>
|
|
</div>
|
|
<!-- 절곡 합계 -->
|
|
<div class="row m-1 mt-3">
|
|
<?php
|
|
|
|
// echo "EGI 현재 무게: " . $result2['current_weight'] . " kg\n";
|
|
// echo "SUS 총 누적 무게: " . $result2['SUS_total'] . " kg\n";
|
|
// echo "EGI 총 누적 무게: " . $result2['EGI_total'] . " kg\n";
|
|
// $weightResult = calWeight('EGI', 0, 0);
|
|
// $weightResult = calWeight('SUS', 0, 0);
|
|
|
|
// 별도의 테이블로 면적 통계 출력
|
|
echo '<div class="d-flex align-items-top justify-content-center m-1">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<tbody>';
|
|
|
|
// 1180과 400 라인 출력
|
|
echo '<tr>';
|
|
echo '<td rowspan="3" class="text-center align-middle greenblackBold w120px"> 생산량 합계(KG) </td>';
|
|
echo '<td class="text-center greenblackBold w120px">SUS</td>';
|
|
echo '<td class="text-center greenblackBold w120px">EGI</td>';
|
|
echo '</tr>';
|
|
|
|
// 900과 300 라인 출력
|
|
echo '<tr>';
|
|
echo '<td class="text-center fw-bold"> ' . number_format($SUS_total, 2) . ' </td>';
|
|
echo '<td class="text-center fw-bold"> ' . number_format($EGI_total, 2) . ' </td>';
|
|
echo '</tr>';
|
|
|
|
// 600 라인 출력
|
|
echo '<tr>';
|
|
echo '<td colspan="2" class="text-center fw-bold"> ' . number_format($SUS_total + $EGI_total, 2) . ' </td>';
|
|
echo '</tr>';
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
?>
|
|
</div>
|
|
</tbody>
|
|
</table>
|
|
<?php } else { ?>
|
|
<div class="row justify-content-center text-danger fs-3 m-1 mt-5 ">
|
|
절곡품 체크 안됨.
|
|
</div>
|
|
<?php } ?>
|
|
</form>
|
|
</div>
|
|
</div> <!-- end of container -->
|
|
<div class="container mb-5 mt-2">
|
|
<div class="d-flex align-items-center justify-content-center mb-5">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 페이지로딩 -->
|
|
<script>
|
|
$(document).ready(function(){
|
|
var loader = document.getElementById('loadingOverlay');
|
|
if(loader)
|
|
loader.style.display = 'none';
|
|
});
|
|
|
|
function generatePDF() {
|
|
var workplace = '<?php echo $outworkplace; ?>';
|
|
var deadline = '<?php echo $indate; ?>';
|
|
var deadlineDate = new Date(deadline);
|
|
var formattedDate = "(" + String(deadlineDate.getFullYear()).slice(-2) + "." + ("0" + (deadlineDate.getMonth() + 1)).slice(-2) + "." + ("0" + deadlineDate.getDate()).slice(-2) + ")";
|
|
var result = 'KD절곡_작업일지(' + workplace +')' + formattedDate + '.pdf';
|
|
|
|
var element = document.getElementById('content-to-print');
|
|
var opt = {
|
|
margin: [10, 3, 12, 3], // Top, right, bottom, left margins
|
|
filename: result,
|
|
image: { type: 'jpeg', quality: 0.98 },
|
|
html2canvas: { scale: 1 },
|
|
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
|
|
pagebreak: { mode: [''] }
|
|
};
|
|
html2pdf().from(element).set(opt).save();
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var selectedItemName = ''; // itemName을 저장할 변수
|
|
var selectedusesurang = ''; // itemName을 저장할 변수
|
|
|
|
// lotnumInput 클릭 시 itemName을 저장
|
|
$(document).on('click', '.lotnumInput', function() {
|
|
var row = $(this).closest('tr');
|
|
selectedRow = row; // tr 요소 저장
|
|
|
|
selectedItemName = $(this).data('itemname'); // itemName 저장
|
|
selectedusesurang = $(this).data('usesurang'); // usesurang 저장
|
|
console.log('selectedItemName : ',selectedItemName);
|
|
if (selectedItemName) {
|
|
// 기본적으로 '생산품' 탭을 로드
|
|
if (selectedItemName.startsWith('XX'))
|
|
loadLotData('material', selectedItemName, selectedusesurang);
|
|
else
|
|
loadLotData('product', selectedItemName, selectedusesurang);
|
|
|
|
setTimeout(function() {
|
|
$('#lotModal_bending').modal('show');
|
|
}, 1000);
|
|
} else {
|
|
alert('품목명을 입력해주세요.');
|
|
}
|
|
});
|
|
|
|
// 모달 창이 닫힐 때 초기화 작업
|
|
$('#lotModal_bending').on('hidden.bs.modal', function() {
|
|
// 메모리 초기화
|
|
selectedRow = null;
|
|
selectedItemName = null;
|
|
selectedusesurang = null;
|
|
|
|
// 기본 탭(생산품 탭)으로 초기화
|
|
$('#product-tab').tab('show'); // Bootstrap 탭 전환 함수
|
|
|
|
// 기존 데이터 제거 (필요한 경우)
|
|
$('#product').html(''); // 생산품 탭 내용 초기화
|
|
$('#material').html(''); // 원자재 탭 내용 초기화
|
|
});
|
|
|
|
|
|
// 탭 전환 시 itemName과 함께 데이터 로드
|
|
$('#product-tab').on('shown.bs.tab', function() {
|
|
if (selectedItemName) {
|
|
loadLotData('product', selectedItemName, selectedusesurang);
|
|
}
|
|
});
|
|
|
|
$('#material-tab').on('shown.bs.tab', function() {
|
|
if (selectedItemName) {
|
|
loadLotData('material', selectedItemName, selectedusesurang);
|
|
}
|
|
});
|
|
|
|
// 모달을 열 때 기본적으로 '생산품' 탭을 로드
|
|
// $('#lotModal_bending').on('shown.bs.modal', function() {
|
|
// if (selectedItemName) {
|
|
// loadLotData('product', selectedItemName, selectedusesurang);
|
|
// }
|
|
// });
|
|
|
|
});
|
|
|
|
// 로트번호 데이터를 불러오는 함수
|
|
function loadLotData(type, itemName, usesurang) {
|
|
// itemName이 'XX'로 시작하면 type을 'material'로 설정
|
|
if (itemName.startsWith('XX')) {
|
|
type = 'material';
|
|
}
|
|
|
|
$.post('fetch_lot_bending.php', { lot_type: type, item_name: itemName, usesurang: usesurang })
|
|
.done(function(data) {
|
|
if (type === 'product') {
|
|
$('#product').html(data); // 생산품 탭에 데이터 로드
|
|
// 생산품 탭을 선택
|
|
$('#product-tab').parent().show(); // 생산품 탭 버튼
|
|
$('#product-tab').tab('show'); // Bootstrap 탭 전환
|
|
} else if (type === 'material') {
|
|
$('#material').html(data); // 원자재 탭에 데이터 로드
|
|
// 원자재 탭을 선택
|
|
$('#product-tab').parent().show(); // 생산품 탭 버튼
|
|
$('#material-tab').tab('show'); // Bootstrap 탭 전환
|
|
if (itemName.startsWith('XX')) {
|
|
$('#product-tab').parent().hide(); // 생산품 탭 버튼 숨기기
|
|
}
|
|
}
|
|
})
|
|
.fail(function(xhr, status, error) {
|
|
console.error("AJAX Request Failed:", status, error);
|
|
alert("로트 데이터를 불러오는 중 오류가 발생했습니다.");
|
|
});
|
|
}
|
|
|
|
// 선택한 로트 번호를 적용하는 함수
|
|
function selectLotNumber_prod(lotNumber) {
|
|
selectedRow.find('input.lotnumInput').val(lotNumber);
|
|
selectedRow.find('.info-btn').attr('data-lotnum', lotNumber); // 내부의 .info-btn 선택
|
|
$('#lotModal_bending').modal('hide');
|
|
}
|
|
// 절곡로트번호 공백 삽입
|
|
$(document).on('click', '.nullBtn_bending', function() {
|
|
selectLotNumber_prod('');
|
|
});
|
|
|
|
// 원자재 로트번호 선택
|
|
function selectLotNumber(lotNumber) {
|
|
selectedRow.find('input.lotnumInput').val(lotNumber);
|
|
selectedRow.find('.info-btn').attr('data-lotnum', lotNumber); // 내부의 .info-btn 선택
|
|
$('#lotModal_bending').modal('hide');
|
|
}
|
|
// 원자재 로트번호 선택공백 삽입
|
|
$(document).on('click', '.nullBtn', function() {
|
|
selectLotNumber('');
|
|
});
|
|
|
|
$(document).on('click', '.cancelBtn', function() {
|
|
$('#lotModal_bending').modal('hide');
|
|
});
|
|
|
|
$(document).on('click', '.saveData', function() {
|
|
saveData();
|
|
});
|
|
|
|
$(document).on('click', '.viewPlateBtn', function() {
|
|
event.preventDefault();
|
|
var tablename = '<?php echo $tablename; ?>';
|
|
var num = $('#num').val();
|
|
|
|
var url = "bendingview.php?mode=view&num=" + num + "&tablename=" + tablename;
|
|
customPopup(url, '절곡 바라시 보기', 1200, 850);
|
|
});
|
|
|
|
$(document).on('click', '.lot-done-btn', function() {
|
|
const num = $(this).data('num');
|
|
const tablename = $(this).data('tablename');
|
|
const rawitemname = $(this).data('rawitemname');
|
|
const lottype = $(this).data('lottype');
|
|
const usesurang = $(this).closest('tr').find('.usesurang').text(); // 사용 수량을 가져옴
|
|
const currentRow = $(this).closest('tr'); // 현재 tr 요소 저장
|
|
|
|
console.log('num:', num);
|
|
console.log('tablename:', tablename);
|
|
console.log('lottype:', lottype);
|
|
console.log('usesurang:', usesurang);
|
|
console.log('rawitemname:', rawitemname);
|
|
|
|
Swal.fire({
|
|
title: '로트 소진 처리',
|
|
text: '해당 로트를 소진 처리하시겠습니까?',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: '예, 처리합니다',
|
|
cancelButtonText: '취소'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$.ajax({
|
|
url: 'update_lotdone.php',
|
|
type: 'POST',
|
|
data: {
|
|
num: num,
|
|
tablename: tablename,
|
|
mode: 'update',
|
|
lotDone: '소진'
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
console.log(response);
|
|
if (response && response.success) {
|
|
Swal.fire({
|
|
title: '처리 완료',
|
|
text: '소진 처리되었습니다.',
|
|
icon: 'success',
|
|
confirmButtonText: '확인'
|
|
}).then(() => {
|
|
// 해당 tr 요소 제거
|
|
currentRow.remove();
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: '오류',
|
|
text: '소진 처리 중 오류가 발생했습니다.',
|
|
icon: 'error',
|
|
confirmButtonText: '확인'
|
|
});
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
Swal.fire({
|
|
title: 'AJAX 오류',
|
|
text: '요청 중 오류가 발생했습니다.',
|
|
icon: 'error',
|
|
confirmButtonText: '확인'
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).on('click', '.lotnumInput_wire', function() {
|
|
var row = $(this).closest('tr');
|
|
selectedRow = row; // tr 요소 저장
|
|
|
|
// var itemName = row.find('input[name="item_name[]"]').val(); // 품목명 가져오기
|
|
var itemName = '내화실';
|
|
|
|
if (itemName) {
|
|
$.post('fetch_lot_bending.php', { item_name: itemName })
|
|
.done(function(data) {
|
|
// alert(data);
|
|
$('#lotModal_wire .modal-body').html(data); // 모달 바디에 데이터 로드
|
|
setTimeout(function() {
|
|
$('#lotModal_wire').modal('show'); // 모달 띄우기
|
|
}, 500);
|
|
|
|
})
|
|
.fail(function(xhr, status, error) {
|
|
console.error("AJAX Request Failed:", status, error);
|
|
console.error("Response:", xhr.responseText);
|
|
});
|
|
} else {
|
|
alert('품목명을 입력해주세요.');
|
|
}
|
|
});
|
|
|
|
// 선택한 로트 번호를 적용하는 함수
|
|
function selectLotNumber_wire(lotNumber) {
|
|
selectedRow.find('input.lotnumInput_wire').val(lotNumber);
|
|
if ($('#lotModal_bending').hasClass('show')) {
|
|
$('#lotModal_bending').modal('hide');
|
|
}
|
|
if ($('#lotModal_wire').hasClass('show')) {
|
|
$('#lotModal_wire').modal('hide');
|
|
}
|
|
}
|
|
|
|
$(document).on('click', '.nullBtn_wire', function() {
|
|
selectLotNumber_wire('');
|
|
});
|
|
|
|
$(document).on('click', '.cancelBtn_wire', function() {
|
|
if ($('#lotModal_bending').hasClass('show')) {
|
|
$('#lotModal_bending').modal('hide');
|
|
}
|
|
if ($('#lotModal_wire').hasClass('show')) {
|
|
$('#lotModal_wire').modal('hide');
|
|
}
|
|
});
|
|
|
|
|
|
$(document).on('click', '.lot-done-wire-btn', function() {
|
|
const num = $(this).data('num');
|
|
const tablename = $(this).data('tablename');
|
|
|
|
console.log('num', num);
|
|
console.log('tablename', tablename);
|
|
|
|
// SweetAlert2를 사용한 확인 메시지
|
|
Swal.fire({
|
|
title: '로트 소진 처리',
|
|
text: '해당 로트를 소진 처리하시겠습니까?',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: '예, 처리합니다',
|
|
cancelButtonText: '취소'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// 사용자가 '예'를 선택한 경우에만 AJAX 요청 수행
|
|
$.ajax({
|
|
url: 'update_lotdone.php', // 서버에 요청을 보낼 PHP 파일 경로
|
|
type: 'POST',
|
|
data: {
|
|
num: num,
|
|
tablename: tablename,
|
|
mode: 'update',
|
|
lotDone: '소진'
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
console.log(response);
|
|
if (response && response.success) {
|
|
Swal.fire({
|
|
title: '처리 완료',
|
|
text: '소진 처리되었습니다.',
|
|
icon: 'success',
|
|
confirmButtonText: '확인'
|
|
}).then(() => {
|
|
// 성공적으로 처리된 후 모달을 닫고 내용 새로고침
|
|
// 모달이 존재할 때만 닫기
|
|
if ($('#lotModal_bending').hasClass('show')) {
|
|
$('#lotModal_bending').modal('hide');
|
|
}
|
|
if ($('#lotModal_wire').hasClass('show')) {
|
|
$('#lotModal_wire').modal('hide');
|
|
}
|
|
|
|
reloadModalContent_wire();
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: '오류',
|
|
text: '소진 처리 중 오류가 발생했습니다.',
|
|
icon: 'error',
|
|
confirmButtonText: '확인'
|
|
});
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error('AJAX Error:', status, error);
|
|
Swal.fire({
|
|
title: 'AJAX 오류',
|
|
text: '요청 중 오류가 발생했습니다.',
|
|
icon: 'error',
|
|
confirmButtonText: '확인'
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
// 모달 내용 새로고침 함수
|
|
function reloadModalContent(item_name, lot_type, usesurang) {
|
|
$.post('fetch_lot_bending.php', { item_name: item_name, lot_type: lot_type, usesurang: usesurang })
|
|
.done(function(data) {
|
|
$('#lotModal_bending .modal-body').html(data); // 모달의 내용 업데이트
|
|
setTimeout(function() {
|
|
$('#lotModal_bending').modal('show'); // 모달 다시 표시
|
|
}, 500);
|
|
})
|
|
.fail(function(xhr, status, error) {
|
|
console.error("AJAX Request Failed:", status, error);
|
|
alert("모달 데이터를 로드하는 중 오류가 발생했습니다.");
|
|
});
|
|
}
|
|
|
|
// 모달 내용 새로고침 함수
|
|
function reloadModalContent_wire() {
|
|
const itemName = '내화실'; // 예시로 사용한 품목명, 필요시 다른 값으로 변경
|
|
|
|
$.post('fetch_lot_bending.php', { item_name: itemName })
|
|
.done(function(data) {
|
|
$('#lotModal_wire .modal-body').html(data); // 모달의 내용 업데이트
|
|
setTimeout(function() {
|
|
$('#lotModal_wire').modal('show'); // 모달 다시 표시
|
|
}, 500);
|
|
})
|
|
.fail(function(xhr, status, error) {
|
|
console.error("AJAX Request Failed:", status, error);
|
|
alert("모달 데이터를 로드하는 중 오류가 발생했습니다.");
|
|
});
|
|
}
|
|
|
|
$(document).on('click', '.approvalBtn', function() {
|
|
// 승인자의 이름과 오늘 날짜 가져오기
|
|
const userName = '<?=$user_name?>'; // PHP로부터 가져온 사용자 이름
|
|
const todayStr = '<?=$todayStr?>'; // PHP로부터 가져온 오늘 날짜
|
|
|
|
// 승인 정보를 approvalDiv에 표시
|
|
$('#approvalDiv').html(
|
|
userName + '<br>' + todayStr +
|
|
' <i class="bi bi-x-circle remove-approval" style="cursor: pointer;"></i>'
|
|
);
|
|
$('#approvalDiv').show();
|
|
|
|
// 결재 정보를 업데이트하여 저장 로직에 반영
|
|
updateApprovalData(userName, todayStr);
|
|
|
|
saveData();
|
|
});
|
|
|
|
// 결재 정보 업데이트 함수
|
|
function updateApprovalData(userName, date) {
|
|
// 저장 로직을 위해 결재 정보 업데이트
|
|
let approvalData = {
|
|
writer: {
|
|
name: $('#orderman').text().trim(),
|
|
date: '<?=$indateStr?>'
|
|
},
|
|
reviewer: {
|
|
name: $('#reviewDiv').is(':visible') ? '<?=$user_name?>' : '',
|
|
date: '<?=$todayStr?>'
|
|
},
|
|
approver: {
|
|
name: userName,
|
|
date: date
|
|
}
|
|
};
|
|
|
|
// 저장할 JSON 데이터 업데이트
|
|
let formData = JSON.parse($('#recordscreen').val() || '[]');
|
|
const approvalIndex = formData.findIndex(item => item.approval);
|
|
|
|
if (approvalIndex !== -1) {
|
|
formData[approvalIndex].approval = approvalData;
|
|
} else {
|
|
formData.push({ approval: approvalData });
|
|
}
|
|
|
|
// JSON 문자열로 다시 저장
|
|
$('#recordscreen').val(JSON.stringify(formData));
|
|
}
|
|
|
|
// 결재 취소 기능
|
|
$(document).on('click', '.remove-approval', function() {
|
|
// 결재 정보를 지우고 화면에서 숨김
|
|
$('#approvalDiv').html('').hide();
|
|
|
|
// JSON 데이터에서 결재자의 정보 제거
|
|
let formData = JSON.parse($('#recordscreen').val() || '[]');
|
|
const approvalIndex = formData.findIndex(item => item.approval);
|
|
|
|
if (approvalIndex !== -1) {
|
|
formData[approvalIndex].approval.approver.name = '';
|
|
formData[approvalIndex].approval.approver.date = '';
|
|
}
|
|
|
|
// JSON 문자열로 다시 저장
|
|
$('#recordscreen').val(JSON.stringify(formData));
|
|
|
|
Toastify({
|
|
text: "결재 정보가 삭제되었습니다.",
|
|
duration: 2000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #ff5f6d, #ffc371)"
|
|
},
|
|
}).showToast();
|
|
|
|
saveData();
|
|
|
|
});
|
|
|
|
function captureReturnKey(e) {
|
|
if(e.keyCode==13 && e.srcElement.type != 'textarea')
|
|
return false;
|
|
}
|
|
|
|
function recaptureReturnKey(e) {
|
|
if(e.keyCode==13 && e.srcElement.type != 'textarea')
|
|
return false;
|
|
}
|
|
|
|
// 삽입/수정하는 모듈
|
|
function saveData() {
|
|
// json 형태로 form문에 저장하기
|
|
let formData = [];
|
|
|
|
// 결재 부분 정보 저장
|
|
let approvalData = {
|
|
writer: {
|
|
name: $('#orderman').text().trim(),
|
|
date: '<?=$indateStr?>'
|
|
},
|
|
reviewer: {
|
|
name: $('#reviewDiv').is(':visible') ? '<?=$user_name?>' : '',
|
|
date: '<?=$todayStr?>'
|
|
},
|
|
approver: {
|
|
name: $('#approvalDiv').is(':visible') ? '<?=$user_name?>' : '',
|
|
date: '<?=$todayStr?>'
|
|
}
|
|
|
|
};
|
|
formData.push({ approval: approvalData });
|
|
|
|
// 생산담당자 정보 저장
|
|
let productionManager = $('#userNameInput').val();
|
|
formData.push({ productionManager: productionManager });
|
|
|
|
// 입고 LOT NO 정보 저장 (행별)
|
|
let lotNums = [];
|
|
$('.lotnumInput').each(function() {
|
|
lotNums.push($(this).val());
|
|
});
|
|
formData.push({ lotNumbers: lotNums });
|
|
|
|
// 내화실 입고 LOT NO 정보 저장
|
|
let wireLotNums = [];
|
|
$('.lotnumInput_wire').each(function() {
|
|
wireLotNums.push($(this).val());
|
|
});
|
|
formData.push({ wireLotNumbers: wireLotNums });
|
|
|
|
// 추가 정보 저장
|
|
formData.push({ num: $('#num').val() });
|
|
formData.push({ tablename: $('#tablename').val() });
|
|
|
|
// JSON 문자열로 변환
|
|
let jsonString = JSON.stringify(formData);
|
|
|
|
// 숨겨진 필드에 JSON 데이터 설정
|
|
$('#recordbending').val(jsonString);
|
|
|
|
$("#overlay").show(); // 오버레이 표시
|
|
$("button").prop("disabled", true); // 모든 버튼 비활성화
|
|
|
|
showMsgModal(2); // 파일저장중
|
|
|
|
// 폼데이터 전송시 사용함 Get form
|
|
var form = $('#board_form')[0];
|
|
var datasource = new FormData(form);
|
|
|
|
$.ajax({
|
|
enctype: 'multipart/form-data',
|
|
processData: false,
|
|
contentType: false,
|
|
cache: false,
|
|
timeout: 600000,
|
|
url: "insert_recordbending.php",
|
|
type: "post",
|
|
data: datasource,
|
|
dataType: "json",
|
|
success: function(data) {
|
|
console.log('return data : ', data);
|
|
Toastify({
|
|
text: "저장완료",
|
|
duration: 3000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #00b09b, #96c93d)"
|
|
},
|
|
}).showToast();
|
|
|
|
setTimeout(function() {
|
|
$("button").prop("disabled", false); // 모든 버튼 활성화
|
|
hideMsgModal();
|
|
$("#overlay").hide(); // 오버레이 숨김
|
|
|
|
}, 1000);
|
|
|
|
|
|
},
|
|
error: function(jqxhr, status, error) {
|
|
console.log(jqxhr, status, error);
|
|
alert("An error occurred: " + error);
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
if (recordbendingData.length > 0) {
|
|
// 결재 부분 정보
|
|
const approval = recordbendingData.find(item => item.approval);
|
|
if (approval) {
|
|
$('#orderman').text(approval.approval.writer.name || '');
|
|
$('#indateStr').text(approval.approval.writer.date || '');
|
|
$('#reviewDiv').show();
|
|
$('#reviewDiv').html(approval.approval.reviewer.name + '<br>' + approval.approval.reviewer.date);
|
|
|
|
// 승인 정보가 있을 때만 승인 정보를 표시하고 x 마크를 추가
|
|
if (approval.approval.approver.name && approval.approval.approver.date) {
|
|
$('#approvalDiv').show();
|
|
$('#approvalDiv').html(
|
|
approval.approval.approver.name + '<br>' + approval.approval.approver.date +
|
|
' <i class="bi bi-x-circle remove-approval" style="cursor: pointer;"></i>'
|
|
);
|
|
} else {
|
|
// 승인 정보가 없을 때는 공백으로 처리
|
|
$('#approvalDiv').hide().html('');
|
|
}
|
|
|
|
$('#workdate').text(approval.approval.writer.date);
|
|
}
|
|
|
|
// 생산담당자 정보
|
|
const productionManager = recordbendingData.find(item => item.productionManager);
|
|
if (productionManager && productionManager.productionManager) {
|
|
$('#userNameInput').val(productionManager.productionManager).show();
|
|
$('#inputContainer').show(); // input 필드 컨테이너 표시
|
|
$('#editButton').hide(); // '생산자 입력' 버튼 숨김
|
|
} else {
|
|
$('#userNameInput').val('');
|
|
$('#inputContainer').hide();
|
|
$('#editButton').show();
|
|
}
|
|
|
|
// 입고 LOT NO 정보
|
|
const lotNumbers = recordbendingData.find(item => item.lotNumbers);
|
|
if (lotNumbers) {
|
|
$('.lotnumInput').each(function(index) {
|
|
$(this).val(lotNumbers.lotNumbers[index] || '');
|
|
});
|
|
$('.info-btn').each(function(index) {
|
|
$(this).attr('data-lotnum', lotNumbers.lotNumbers[index] || '');
|
|
});
|
|
}
|
|
|
|
// 내화실 입고 LOT NO 정보
|
|
const wireLotNumbers = recordbendingData.find(item => item.wireLotNumbers);
|
|
if (wireLotNumbers) {
|
|
$('.lotnumInput_wire').each(function(index) {
|
|
$(this).val(wireLotNumbers.wireLotNumbers[index] || '');
|
|
});
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
// 첫번째 요소를 클릭하면 전체 로트번호 적용하기
|
|
$(document).ready(function() {
|
|
// id가 mainTable인 테이블의 첫 번째 td를 클릭했을 때 이벤트를 등록합니다.
|
|
$('#mainTable').on('click', 'td:first-child', function() {
|
|
// 클릭한 첫 번째 td의 형제인 두 번째 td 요소의 값을 가져옵니다.
|
|
var secondTdValue = $(this).siblings().find('input').val();
|
|
|
|
// id가 mainTable인 테이블에서 두 번째 td 요소에 해당 값을 적용합니다.
|
|
$('#mainTable tbody tr').each(function() {
|
|
$(this).find('td:nth-child(2) input').val(secondTdValue);
|
|
});
|
|
});
|
|
});
|
|
|
|
// 부트스트랩 툴팁
|
|
$(document).ready(function() {
|
|
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
|
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
|
});
|
|
});
|
|
|
|
|
|
ajaxRequest1 = null;
|
|
|
|
$(document).ready(function () {
|
|
$(document).on('click', '.info-btn, .info-wire-btn', function () {
|
|
var lotnum = $(this).data('lotnum');
|
|
console.log('lotnum :', lotnum);
|
|
if (!lotnum) {
|
|
Swal.fire('알림', '로트번호를 입력하세요.', 'warning');
|
|
return;
|
|
}
|
|
|
|
if (ajaxRequest1 !== null) {
|
|
ajaxRequest1.abort();
|
|
}
|
|
ajaxRequest1 = $.ajax({
|
|
url: 'fetch_certificate.php',
|
|
type: 'POST',
|
|
data: { lotnum: lotnum },
|
|
dataType: 'json',
|
|
success: function (response) {
|
|
if (response.success) {
|
|
if (response.item === "offering") {
|
|
// 제공품 성적서
|
|
var url = "/lot/write_sheet.php?num=" + response.num;
|
|
customPopup(url, '제공품 성적서', 800, 900);
|
|
} else if (response.item === "regular") {
|
|
// 일반 성적서 데이터 처리
|
|
viewBoardInstock(
|
|
response.num,
|
|
response.itemname,
|
|
response.specification,
|
|
response.remarks
|
|
);
|
|
}
|
|
} else {
|
|
Swal.fire('오류', response.message, 'error');
|
|
}
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
console.error('AJAX Error:', textStatus, errorThrown);
|
|
console.error('Response Text:', jqXHR.responseText);
|
|
Swal.fire('오류', '서버 요청에 실패했습니다. <br> ' + textStatus + ': ' + errorThrown, 'error');
|
|
},
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 초기화 버튼 클릭 이벤트
|
|
$(document).ready(function() {
|
|
$('.initialBtn').on('click', function() {
|
|
// 초기화 확인 알림
|
|
Swal.fire({
|
|
title: '초기화',
|
|
text: "모든 데이터를 초기화하시겠습니까?",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: '예, 초기화합니다',
|
|
cancelButtonText: '취소'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// iList 값을 빈 배열로 초기화
|
|
const initialData = JSON.stringify([]); // 빈 배열로 초기화
|
|
|
|
// iList hidden input에 초기화된 데이터 설정
|
|
$('#iList').val(initialData);
|
|
|
|
// 초기화된 데이터 저장 요청
|
|
$.ajax({
|
|
url: "insert_recordbending.php",
|
|
type: 'POST',
|
|
data: {
|
|
num: $('#num').val() ,
|
|
tablename: $('#tablename').val() ,
|
|
update_log: $('#update_log').val() ,
|
|
iList: initialData },
|
|
success: function(response) {
|
|
Swal.fire({
|
|
title: '초기화 완료',
|
|
text: "모든 데이터가 초기화되었습니다.",
|
|
icon: 'success',
|
|
confirmButtonText: '확인'
|
|
}).then(() => {
|
|
// 페이지 새로고침
|
|
setTimeout(function () {
|
|
hideMsgModal();
|
|
location.reload();
|
|
}, 1000);
|
|
});
|
|
},
|
|
error: function(jqxhr, status, error) {
|
|
Swal.fire({
|
|
title: '오류',
|
|
text: "초기화 중 오류가 발생했습니다.",
|
|
icon: 'error',
|
|
confirmButtonText: '확인'
|
|
});
|
|
console.log("AJAX Error: ", status, error);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/instock/common/viewJS.php'; ?> <!--공통 JS -->
|
|
</body>
|
|
</html>
|