325 lines
9.1 KiB
Plaintext
325 lines
9.1 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"%>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ page import="java.util.*" %>
|
|
<%@include file= "/init.jsp" %>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title><%=Constants.SYSTEM_NAME%></title>
|
|
<style>
|
|
.ebom-select-container {
|
|
padding: 10px;
|
|
}
|
|
.header-section {
|
|
background: #f5f5f5;
|
|
padding: 15px;
|
|
margin-bottom: 10px;
|
|
border: 1px solid #ddd;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
.header-section h3 {
|
|
margin: 0;
|
|
color: #333;
|
|
}
|
|
.current-ebom-section {
|
|
background: #f9f9f9;
|
|
padding: 20px;
|
|
margin-bottom: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 5px;
|
|
}
|
|
.current-ebom-section h4 {
|
|
margin: 0 0 15px 0;
|
|
color: #333;
|
|
font-size: 16px;
|
|
}
|
|
.ebom-info-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
background: white;
|
|
margin-bottom: 15px;
|
|
}
|
|
.ebom-info-table th {
|
|
background: #f5f5f5;
|
|
padding: 10px;
|
|
text-align: left;
|
|
border: 1px solid #ddd;
|
|
width: 150px;
|
|
font-weight: bold;
|
|
}
|
|
.ebom-info-table td {
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
}
|
|
.ebom-list-section {
|
|
margin-bottom: 10px;
|
|
height: 400px !important;
|
|
}
|
|
.ebom-list-section .plm_tab_div {
|
|
height: 200px !important;
|
|
}
|
|
.ebom-list-section #mainGrid {
|
|
height: 200px !important;
|
|
}
|
|
.ebom-preview-section {
|
|
padding: 10px;
|
|
background: #fafafa;
|
|
}
|
|
.ebom-preview-section h4 {
|
|
margin: 0 0 10px 0;
|
|
color: #555;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
// 현재 할당된 E-BOM이 있는지 여부
|
|
var hasCurrentEbom = ${not empty currentEbom};
|
|
var currentEbomObjid = "${not empty currentEbom ? currentEbom.OBJID : ''}";
|
|
|
|
$(document).ready(function(){
|
|
$('.select2').select2();
|
|
|
|
// 날짜 선택기 초기화
|
|
fnc_datepick("search_fromDate", "search_toDate");
|
|
|
|
// Enter 키로 검색
|
|
$("input").keyup(function(e) {
|
|
if (e.keyCode == 13) {
|
|
fn_searchEbomList();
|
|
}
|
|
});
|
|
|
|
// 조회 버튼
|
|
$("#btnSearch").click(function(){
|
|
fn_searchEbomList();
|
|
});
|
|
|
|
// 변경 버튼
|
|
$("#btnChange").click(function(){
|
|
fn_showEbomList();
|
|
});
|
|
|
|
// 초기 상태 설정
|
|
if(hasCurrentEbom) {
|
|
// 할당된 E-BOM이 있으면 상세보기만 표시
|
|
fn_showCurrentEbom();
|
|
} else {
|
|
// 할당된 E-BOM이 없으면 목록 표시
|
|
fn_showEbomList();
|
|
}
|
|
});
|
|
|
|
// 현재 할당된 E-BOM 표시
|
|
function fn_showCurrentEbom() {
|
|
$("#currentEbomSection").show();
|
|
$("#ebomListSection").hide();
|
|
|
|
// 현재 E-BOM 미리보기 로드
|
|
$("#ebomPreviewFrame").attr("src", "/partMng/structurePopupLeft.do?readonly=readonly&objId=" + currentEbomObjid);
|
|
}
|
|
|
|
// E-BOM 목록 표시 (변경 모드)
|
|
function fn_showEbomList() {
|
|
$("#currentEbomSection").hide();
|
|
$("#ebomListSection").show();
|
|
|
|
// 목록 조회
|
|
fn_searchEbomList();
|
|
}
|
|
|
|
// 그리드 컬럼 정의
|
|
var columns = [
|
|
{headerHozAlign: 'center', hozAlign: 'center', width: 160, title: '제품구분', field: 'PRODUCT_NAME'},
|
|
{headerHozAlign: 'center', hozAlign: 'left', width: 210, title: '품번', field: 'PART_NO'},
|
|
{headerHozAlign: 'center', hozAlign: 'left', title: '품명', field: 'PART_NAME'},
|
|
{headerHozAlign: 'center', hozAlign: 'center', width: 130, title: '등록일', field: 'REG_DATE'},
|
|
{headerHozAlign: 'center', hozAlign: 'center', width: 110, title: 'Version', field: 'REVISION'},
|
|
{headerHozAlign: 'center', hozAlign: 'center', width: 110, title: '상태', field: 'STATUS'}
|
|
];
|
|
|
|
// E-BOM List 조회 (상태='Y'만)
|
|
function fn_searchEbomList() {
|
|
// 상태='Y' 조건 추가
|
|
$("#status").val("Y");
|
|
|
|
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/partMng/searchStructureGridList.do", columns, true);
|
|
|
|
// 행 클릭 이벤트 - 단일 선택만 가능
|
|
if(_tabulGrid) {
|
|
_tabulGrid.on("rowClick", function(e, row){
|
|
// 이전 선택 해제
|
|
_tabulGrid.deselectRow();
|
|
// 현재 행 선택
|
|
_tabulGrid.selectRow(row);
|
|
|
|
var data = row.getData();
|
|
fn_selectEbom(data.OBJID, data.PART_NO, data.PART_NAME);
|
|
});
|
|
}
|
|
}
|
|
|
|
// E-BOM 선택 시 미리보기
|
|
function fn_selectEbom(bomReportObjid, partNo, partName) {
|
|
$("#selectedBomObjid").val(bomReportObjid);
|
|
$("#selectedPartNo").text(partNo);
|
|
$("#selectedPartName").text(partName);
|
|
|
|
// 하단 iframe에 E-BOM 상세 로드
|
|
$("#ebomPreviewFrame").attr("src", "/partMng/structurePopupLeft.do?readonly=readonly&objId=" + bomReportObjid);
|
|
|
|
// 선택 표시
|
|
$("#selectedInfo").show();
|
|
}
|
|
|
|
// E-BOM 할당
|
|
function fn_assignEbom() {
|
|
var bomReportObjid = $("#selectedBomObjid").val();
|
|
var projectMgmtObjid = "${param.projectMgmtObjid}";
|
|
|
|
if(!bomReportObjid) {
|
|
alert("E-BOM을 선택해주세요.");
|
|
return;
|
|
}
|
|
|
|
var confirmMsg = hasCurrentEbom
|
|
? "선택한 E-BOM으로 변경하시겠습니까?"
|
|
: "선택한 E-BOM을 할당하시겠습니까?";
|
|
|
|
if(confirm(confirmMsg)) {
|
|
$.ajax({
|
|
url: "/productionplanning/assignEbomToMbom.do",
|
|
type: "POST",
|
|
data: {
|
|
projectMgmtObjid: projectMgmtObjid,
|
|
bomReportObjid: bomReportObjid
|
|
},
|
|
dataType: "json",
|
|
success: function(result) {
|
|
if(result.success) {
|
|
var successMsg = hasCurrentEbom
|
|
? "E-BOM이 변경되었습니다."
|
|
: "E-BOM이 할당되었습니다.";
|
|
alert(successMsg);
|
|
if(window.opener && window.opener.fn_search) {
|
|
window.opener.fn_search(); // 부모 창 새로고침
|
|
}
|
|
window.close();
|
|
} else {
|
|
alert(result.message || "할당에 실패했습니다.");
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
alert("오류가 발생했습니다: " + error);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form name="form1" id="form1" method="post">
|
|
<input type="hidden" name="status" id="status" value="Y">
|
|
<input type="hidden" id="selectedBomObjid">
|
|
|
|
<div class="ebom-select-container">
|
|
<!-- 상단: 정보 및 버튼 -->
|
|
<div class="header-section">
|
|
<h3>E-BOM ${not empty currentEbom ? '상세 및 변경' : '선택'} - 품번: ${param.partNo} / 품명: ${param.partName}</h3>
|
|
<div>
|
|
<c:if test="${not empty currentEbom}">
|
|
<input type="button" value="E-BOM 변경" class="plm_btns" id="btnChange" style="background-color: #FF9800; color: white;">
|
|
</c:if>
|
|
<input type="button" value="닫기" class="plm_btns" onclick="window.close()">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 현재 할당된 E-BOM 정보 (할당된 경우만 표시) -->
|
|
<c:if test="${not empty currentEbom}">
|
|
<div id="currentEbomSection" class="current-ebom-section">
|
|
<h4>📋 현재 할당된 E-BOM 정보</h4>
|
|
<table class="ebom-info-table">
|
|
<tr>
|
|
<th>제품구분</th>
|
|
<td>${currentEbom.PRODUCT_NAME}</td>
|
|
<th>품번</th>
|
|
<td>${currentEbom.PART_NO}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>품명</th>
|
|
<td>${currentEbom.PART_NAME}</td>
|
|
<th>Version</th>
|
|
<td>${currentEbom.REVISION}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>등록일</th>
|
|
<td>${currentEbom.REG_DATE}</td>
|
|
<th>작성자</th>
|
|
<td>${currentEbom.DEPT_NAME} / ${currentEbom.WRITER_NAME}</td>
|
|
</tr>
|
|
</table>
|
|
<div style="text-align: center;">
|
|
<p style="color: #666; margin: 10px 0;">다른 E-BOM으로 변경하려면 "E-BOM 변경" 버튼을 클릭하세요.</p>
|
|
</div>
|
|
</div>
|
|
</c:if>
|
|
|
|
<!-- 중간: E-BOM List (처음에는 숨김 또는 표시) -->
|
|
<div id="ebomListSection" class="ebom-list-section" style="display:none;">
|
|
<div class="content-box">
|
|
<div class="content-box-s">
|
|
<div class="plm_menu_name_gdnsi">
|
|
<h2><span>E-BOM List (상태: Y)</span></h2>
|
|
<div class="btnArea">
|
|
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
|
<input type="button" value="E-BOM 할당" class="plm_btns" onclick="fn_assignEbom()" style="background-color: #4CAF50; color: white;">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="plmSearchZon">
|
|
<table>
|
|
<tr>
|
|
<td><label for="product_cd">제품구분</label></td>
|
|
<td>
|
|
<select name="product_cd" id="product_cd" style="width:170px" class="select2" autocomplete="off">
|
|
<option value="">선택</option>
|
|
${code_map.product_cd}
|
|
</select>
|
|
</td>
|
|
|
|
<td class="label"><label for="">품번</label></td>
|
|
<td><input type="text" name="SEARCH_PART_NO" id="SEARCH_PART_NO"></td>
|
|
|
|
<td class="label"><label for="">품명</label></td>
|
|
<td><input type="text" name="SEARCH_PART_NAME" id="SEARCH_PART_NAME"></td>
|
|
|
|
<td class="align_r"><label>등록일</label></td>
|
|
<td>
|
|
<input type="text" name="search_fromDate" id="search_fromDate" style="width:90px;" autocomplete="off">~
|
|
<input type="text" name="search_toDate" id="search_toDate" style="width:90px;" autocomplete="off">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 하단: 미리보기 -->
|
|
<div class="ebom-preview-section">
|
|
<h4>E-BOM 미리보기 (읽기 전용)</h4>
|
|
<div style="width:100%; height:700px; border:1px solid #ddd; overflow: auto; background: white;">
|
|
<iframe id="ebomPreviewFrame" style="width:100%; height:100%; border:none; pointer-events: none;"></iframe>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html>
|