Files
wace_plm/WebContent/WEB-INF/view/partMng/partMngList.jsp

593 lines
22 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<%
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
String connector = person.getUserId();
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<!-- //JSTL 페이징 변수선언 -->
<c:set var="totalCount" value="${empty TOTAL_COUNT?0:TOTAL_COUNT}" />
<c:set var="maxPage" value="${empty MAX_PAGE_SIZE?1:MAX_PAGE_SIZE}" />
<c:set var="nPage" value="${empty param.page?1:param.page}" />
<c:set var="pageIndex" value="${(nPage-1)/10}" />
<c:set var="nextPage" value="${empty NEXT_PAGE?1:NEXT_PAGE}" />
<c:set var="prevPage" value="${empty PREV_PAGE?1:PREV_PAGE}" />
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<c:set var="connector" value="<%=connector %>" />
<style type="text/css">
::-webkit-scrollbar-thumb {
background: linear-gradient(to bottom, #f5d78e, #f5d78e);
}
</style>
<script type="text/javascript">
$(function() {
$(document).ready(function() {
fnc_datepick();
$("input[type=text]").keyup(function(e) {
if (e.keyCode == 13)
fn_search();
});
$("#btnReg").click(function(){
openPartMngPopup("");
});
$("#btnDelete").click(function(){
fn_deletePartMng();
});
$("#btnDeploy").click(function(){
fn_partMngDeploy();
});
//image src encoding
$("img").each(function(i) {
var imgSrc = $(this).attr("data-SRC");
$(this).attr("src", encodeURI(imgSrc));
});
$("#btnSearch").click(function() {
/* if($("#product_code").val()==""){
Swal.fire('기종을 선택해주세요');
return;
} */
fn_search();
});
$("#btnConnectFile").click(function() {
var form = document.form1;
form.action = "/partMng/partConnectDrawingFile.do";
form.submit();
});
$("#btnExcel").click(function() {
fn_excel();
});
$("#product_code").change(function(){
fnc_productUPGNEWList(this.value,"","upg_no", "");
});
if("${param.product_code}"!=""){
fnc_productUPGNEWList("${param.product_code}","","upg_no", "");
$("#upg_no").val("${param.upg_no}");
}
fnc_getCodeListAppend("<%=Constants.PART_TYPE_CODE%>","SEARCH_PART_TYPE","${param.SEARCH_PART_TYPE}");
$("#SEARCH_REVISION_RELEASE").val("${param.SEARCH_REVISION_RELEASE}");
if("${param.SEARCH_REVISION_RELEASE}"==""){
$("#SEARCH_REVISION_RELEASE").val("0");
}
$('.select2').select2();
// 품번/품명 Select2 AJAX 초기화
initPartSelect2Ajax("#SEARCH_PART_NO", "#SEARCH_PART_NAME", "#SEARCH_PART_OBJID");
//첨부팝업
$(".File").click(function(){
var popup_width = 800;
var popup_height = 335;
var objId = $(this).attr("data-OBJID");
var docType =$(this).attr("data-docType");
var docTypeName = $(this).attr("data-docTypeName");
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName;
var url = "/projectConcept/FileRegistPopup.do"+params;
fn_centerPopup(popup_width, popup_height, url);
});
// 도면 다중 업로드 버튼 클릭
$("#btnDrawingUpload").click(function() {
$("#drawingFiles").click();
});
// 파일 선택 이벤트
$("#drawingFiles").change(function() {
fn_uploadDrawingFiles(this.files);
});
fn_search();
});
});
var columns = [
{title:'OBJID', field:'OBJID' ,visible:false },
//{headerHozAlign : 'center', hozAlign : 'center', width : '30', title : '순', field : 'NUM' , headersorting:false},
//{headerHozAlign : 'center', hozAlign : 'left ', width : '100', title : '프로젝트번호', field : 'PROJECT_NO' },
//{headerHozAlign : 'center', hozAlign : 'left', /* width : '200', */title : '유닛명', field : 'UNIT_NAME' },
/*
{headerHozAlign : 'center', hozAlign : 'left', width : '140', title : '고객사', field : 'CUSTOMER_NAME' },
{headerHozAlign : 'center', hozAlign : 'left', width : '200', title : '고객사프로젝트명', field : 'CUSTOMER_PROJECT_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'E-BOM', field : 'BOM_CNT',
formatter: fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objId = fnc_checkNull(cell.getData().OBJID);
//var bomReportObjId = fnc_checkNull(cell.getData().BOM_REPORMECHANICAL_TYPET_OBJID);
fn_openSetStructure(objId);
}
},
*/
//{headerHozAlign : 'center', hozAlign : 'left', width : '125', title : '모품번', field : 'PARENT_PART_INFO' },
{headerHozAlign : 'center', hozAlign : 'left', width : '250', title : '품번', field : 'PART_NO',
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
openPartMngPopup(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'left', /*width : '200',*/ title : '품명', field : 'PART_NAME' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '50', title : '수량', field : 'BOM_QTY' }, //Q_QTY QTY QTY_P
{headerHozAlign : 'center', hozAlign : 'center', width : '60', title : '3D', field : 'CU01_CNT',
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
var docType = '3D_CAD';
var docTypeName = '3D CAD 첨부파일';
fnc_fileDetailPopup(objid, docType, docTypeName);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '60', title : '2D', field : 'CU02_CNT',
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
var docType = '2D_DRAWING_CAD';
var docTypeName = '2D(Drawing) CAD 첨부파일';
fnc_fileDetailPopup(objid, docType, docTypeName);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '60', title : 'PDF', field : 'CU03_CNT',
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
var docType = '2D_PDF_CAD';
var docTypeName = '2D(PDF) CAD 첨부파일';
fnc_fileDetailPopup(objid, docType, docTypeName);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '재료', field : 'MATERIAL' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리경도', field : 'HEAT_TREATMENT_HARDNESS' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리방법', field : 'HEAT_TREATMENT_METHOD' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '표면처리', field : 'SURFACE_TREATMENT' },
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : '메이커', field : 'MAKER' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '범주 이름', field : 'PART_TYPE_TITLE' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '재질', field : 'MATERIAL' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '90', title : '사양(규격)', field : 'SPEC' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '후처리', field : 'POST_PROCESSING' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'MAKER', field : 'MAKER' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '대분류', field : 'MAJOR_CATEGORY' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '중분류', field : 'SUB_CATEGORY' },
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'Revision', field : 'REVISION' },
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO No', field : 'EO_NO' },
//{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'EO Date', field : 'EO_DATE' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '88', title : 'PART구분', field : 'PART_TYPE_TITLE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '비고', field : 'REMARK' }
];
//var grid;
function fn_search(){
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/partMng/partMngGridList.do", columns, true, null, null, null, true);
}
function fn_deletePartMng() {
var selectedPart = _tabulGrid.getSelectedData();
var targetObjIdList = [];
if(0 < selectedPart.length){
for(var i = 0; i < selectedPart.length;i++){
var OBJID = fnc_checkNull(selectedPart[i].OBJID);
targetObjIdList.push(OBJID);
}
//if(confirm("선택된 Part를 삭제하시겠습니까?")){
Swal.fire({
title: '선택된 Part를 삭제하시겠습니까?',
text: '',
icon: 'warning',
showCancelButton: true, // cancel버튼 보이기. 기본은 원래 없음
confirmButtonColor: '#3085d6', // confrim 버튼 색깔 지정
cancelButtonColor: '#d33', // cancel 버튼 색깔 지정
confirmButtonText: '확인', // confirm 버튼 텍스트 지정
cancelButtonText: '취소', // cancel 버튼 텍스트 지정
reverseButtons: false, // 버튼 순서 거꾸로
}).then(result => {
// 만약 Promise리턴을 받으면,
if (result.isConfirmed) { // 만약 모달창에서 confirm 버튼을 눌렀다면
$.ajax({
url:"/partMng/partMngDelete.do",
type:"POST",
data:{
"checkArr":targetObjIdList.join()
},
dataType:"json",
success:function(data){
Swal.fire(data.msg);
fn_search();
},
error: function(jqxhr, status, error){
}
});
}
});
}else{
Swal.fire("선택된 Part가 없습니다.");
return false;
}
}
function openPartMngPopup(objId){
var popup_width = 600;
var popup_height = 500;
var hiddenForm = document.hiddenForm;
var url = "/partMng/partMngFormPopUp.do";
if("" != objId){
url = "/partMng/partMngDetailPopUp.do";
}
var target = "partMngPopUp";
fn_centerPopup(popup_width, popup_height, url, target);
hiddenForm.action = url;
hiddenForm.OBJID.value = objId;
hiddenForm.target = target;
hiddenForm.submit();
}
function fn_excel() {
document.form1.actionType.value = "excel";
document.form1.action = "/partMng/partMngList.do";
document.form1.submit();
}
// function fn_excel() {
// document.form1.actionType.value = "excel";
// fn_search();
// }
function fn_FileRegist(objId, docType, docTypeName){
var popup_width = 800;
var popup_height = 335;
var objId = objId;
var docType = docType;
var docTypeName = docTypeName;
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName;
var url = "/projectConcept/FileRegistPopup.do"+params;
fn_centerPopup(popup_width, popup_height, url);
}
// 도면 다중 업로드 처리 함수
function fn_uploadDrawingFiles(files) {
if(!files || files.length === 0) {
Swal.fire('파일을 선택해주세요.');
return;
}
// 선택된 파트 확인 (필수 아님 - 전체 파트 대상)
var selectedParts = _tabulGrid.getSelectedData();
if(!selectedParts || selectedParts.length === 0) {
// 선택 없으면 전체 파트 대상으로 진행
var confirmMsg = '파트를 선택하지 않았습니다.\n';
confirmMsg += '전체 파트를 대상으로 파일명과 일치하는 품번에 업로드됩니다.\n';
confirmMsg += '계속하시겠습니까?';
if(!confirm(confirmMsg)) {
return;
}
}
// 파일 분류 및 처리
var filesByType = {
'3D': [], // stp 파일
'2D': [], // dwg, dxf 파일
'PDF': [] // pdf 파일
};
// 파일 확장자 확인 및 분류
for(var i = 0; i < files.length; i++) {
var file = files[i];
var fileName = file.name;
var lastDotIndex = fileName.lastIndexOf('.');
if(lastDotIndex === -1) {
continue; // 확장자가 없는 파일은 스킵
}
var ext = fileName.substring(lastDotIndex + 1).toLowerCase();
if(ext === 'stp' || ext === 'step') {
filesByType['3D'].push(file);
} else if(ext === 'dwg' || ext === 'dxf') {
filesByType['2D'].push(file);
} else if(ext === 'pdf') {
filesByType['PDF'].push(file);
}
}
// 업로드할 파일이 있는지 확인
var totalFiles = filesByType['3D'].length + filesByType['2D'].length + filesByType['PDF'].length;
if(totalFiles === 0) {
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, dxf, pdf만 가능)');
return;
}
// 확인 메시지
var msg = '총 ' + totalFiles + '개의 파일을 업로드하시겠습니까?\n';
msg += '- 3D (STP): ' + filesByType['3D'].length + '개\n';
msg += '- 2D (DWG/DXF): ' + filesByType['2D'].length + '개\n';
msg += '- PDF: ' + filesByType['PDF'].length + '개';
Swal.fire({
title: '도면 다중 업로드',
text: msg,
icon: 'question',
showCancelButton: true,
confirmButtonText: '업로드',
cancelButtonText: '취소'
}).then(function(result) {
if(result.isConfirmed) {
fn_processDrawingUpload(filesByType);
}
});
}
// 실제 업로드 처리
function fn_processDrawingUpload(filesByType) {
// 현재 그리드에 표시된 파트 데이터 가져오기
var gridData = _tabulGrid.getData();
if(!gridData || gridData.length === 0) {
Swal.fire('페이지에 표시된 파트가 없습니다.');
return;
}
// 품번 목록 생성 (현재 화면에 보이는 파트만)
var partNoList = [];
for(var i = 0; i < gridData.length; i++) {
var partNo = gridData[i].PART_NO;
if(partNo) {
partNoList.push(partNo);
}
}
// FormData 생성
var formData = new FormData();
// 현재 화면의 품번 목록 전송
formData.append('partNoList', JSON.stringify(partNoList));
// 모든 파일을 files 이름으로 추가
var allFiles = filesByType['3D'].concat(filesByType['2D']).concat(filesByType['PDF']);
for(var i = 0; i < allFiles.length; i++) {
formData.append('files', allFiles[i]);
}
// 로딩 표시
Swal.fire({
title: '업로드 중...',
text: '파일을 업로드하는 중입니다. 잠시만 기다려주세요.',
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
showConfirmButton: false,
onOpen: function() {
Swal.showLoading();
}
});
// AJAX 업로드
$.ajax({
url: '/partMng/uploadDrawingFilesForPartList.do',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
Swal.close();
if(response.result === 'success') {
var successMsg = '도면 업로드가 완료되었습니다.\n\n';
successMsg += '- 성공: ' + response.successCount + '개\n';
if(response.failCount > 0) {
successMsg += '- 실패: ' + response.failCount + '개\n';
}
if(response.notFoundCount > 0) {
successMsg += '- 품번 미존재: ' + response.notFoundCount + '개\n';
}
Swal.fire({
title: '업로드 완료',
text: successMsg,
icon: response.failCount > 0 ? 'warning' : 'success'
}).then(function() {
// 그리드 새로고침
fn_search();
// 파일 input 초기화
$("#drawingFiles").val('');
});
} else {
Swal.fire({
title: '업로드 실패',
text: response.message || '도면 업로드 중 오류가 발생했습니다.',
icon: 'error'
});
}
},
error: function(xhr, status, error) {
Swal.close();
console.error('Upload error:', error);
Swal.fire({
title: '업로드 실패',
text: '서버 오류가 발생했습니다: ' + error,
icon: 'error'
});
}
});
}
</script>
</head>
<body class="backcolor">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="OBJID" id="OBJID">
</form>
<form name="form1" id="form1" method="post">
<input type="hidden" name="search" id="search" value="Y">
<input type="hidden" name="actionType" id="actionType">
<div>
<div class="content-box">
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span>개발관리_PART 조회</span>
</h2>
<div class="btnArea">
<!-- <input type="button" value="파일연결" class="plm_btns" id="btnConnectFile"> -->
<!-- <input type="button" value="등록" class="plm_btns" id="btnReg"> -->
<!--
<input type="button" value="삭제" class="plm_btns" id="btnDelete">
-->
<input type="button" value="도면 다중 업로드" class="plm_btns" id="btnDrawingUpload">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="Excel Download" class="plm_btns" id="btnExcel">
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.dxf,.pdf">
</div>
</div>
<div id="plmSearchZon">
<table>
<tbody>
<tr>
<%-- <td><label for="product_code">기종(모델)명</label></td>
<td>
<select name="product_code" id="product_code" style="" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.product_code}
</select>
</td> --%>
<!-- <td><label for="">UPG_NO</label></td> -->
<!-- <td> -->
<!-- <select name="upg_no" id="upg_no" class="select2" style="width:250px;" autocomplete="off"></select> -->
<!-- </td> -->
<td><label for="">품번</label></td>
<td>
<select name="SEARCH_PART_NO" id="SEARCH_PART_NO" class="select2-part" style="width:150px;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="SEARCH_PART_OBJID" id="SEARCH_PART_OBJID" value="">
</td>
<td><label for="">품명</label></td>
<td>
<select name="SEARCH_PART_NAME" id="SEARCH_PART_NAME" class="select2-part" style="width:150px;">
<option value="">품명 선택</option>
</select>
</td>
<td><label for="">Revision</label></td>
<td>
<select name="SEARCH_REVISION_RELEASE" id="SEARCH_REVISION_RELEASE" style="width:100px;" autocomplete="off">
<option value="1">current</option>
<option value="0">all</option>
</select>
</td>
<td><label for="">재료</label></td>
<td>
<input type="text" name="SEARCH_MATERIAL" id="SEARCH_MATERIAL" style="width:110px;" autocomplete="off" value="${param.SEARCH_MATERIAL}">
</td>
<td><label for="">열처리경도</label></td>
<td>
<input type="text" name="SEARCH_HARDNESS" id="SEARCH_HARDNESS" style="width:110px;" autocomplete="off" value="${param.SEARCH_HARDNESS}">
</td>
<td><label for="">열처리방법</label></td>
<td>
<input type="text" name="SEARCH_METHOD" id="SEARCH_METHOD" style="width:110px;" autocomplete="off" value="${param.SEARCH_METHOD}">
</td>
<td><label for="">표면처리</label></td>
<td>
<input type="text" name="SEARCH_SURFACE" id="SEARCH_SURFACE" style="width:110px;" autocomplete="off" value="${param.SEARCH_SURFACE}">
</td>
<td><label for="customer_objid">공급업체</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
<!-- <td><label for="">EO No.</label></td> -->
<!-- <td> -->
<%-- <input type="text" name="SEARCH_EO" id="SEARCH_EO" style="width:150px;" autocomplete="off" value="${param.SEARCH_EO}"> --%>
<!-- </td> -->
<%-- <td><label for="">최초설계일</label></td>
<td>
<input type="text" name="SEARCH_DESIGN_DATE_FROM" id="SEARCH_DESIGN_DATE_FROM" style="width:90px;" autocomplete="off" value="${param.SEARCH_DESIGN_DATE_FROM}">~
<input type="text" name="SEARCH_DESIGN_DATE_TO" id="SEARCH_DESIGN_DATE_TO" style="width:90px;" autocomplete="off" value="${param.SEARCH_DESIGN_DATE_TO}">
</td> --%>
<td><label for="">범주 이름</label></td>
<td>
<select name="SEARCH_PART_TYPE" id="SEARCH_PART_TYPE" style="width:120px;" autocomplete="off"></select>
</td>
</tr>
</tbody>
</table>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</div>
</div>
</form>
</body>
</html>