봄 복사 기능 러프하게 구현(테스트 아직 못함) 결과 일단 저장

This commit is contained in:
leeheejin
2025-11-17 10:03:29 +09:00
parent eff22bbc4c
commit c1921855e6
8 changed files with 859 additions and 242 deletions

View File

@@ -7,212 +7,611 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<link href="/css/tabulator/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="/js/tabulator/tabulator.min.js"></script>
<style>
::-webkit-scrollbar {
width: 10px;
height: 15px;
}
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
/* 상단 입력 영역 */
.top-input-section {
padding: 15px 20px;
background: #f9f9f9;
border-bottom: 2px solid #ddd;
}
.input-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.input-table td {
padding: 5px 8px;
vertical-align: middle;
}
.input-table label {
font-weight: bold;
display: block;
white-space: nowrap;
}
.input-table input[type="text"] {
padding: 6px 8px;
border: 1px solid #ddd;
border-radius: 3px;
width: 100%;
box-sizing: border-box;
}
.bom-select-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
table-layout: fixed;
}
.bom-select-table td {
padding: 5px 8px;
vertical-align: middle;
}
.bom-select-table label {
font-weight: bold;
display: block;
white-space: nowrap;
}
.bom-select-table input[type="text"] {
padding: 6px 8px;
border: 1px solid #ddd;
border-radius: 3px;
width: 100%;
box-sizing: border-box;
}
/* 하단 버튼 영역 */
.bottom-button-section {
padding: 15px 20px;
background: #f9f9f9;
border-top: 2px solid #ddd;
text-align: center;
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 100;
}
/* 그리드 영역 */
#structureTableWrap1 {
padding: 15px 20px;
height: calc(100vh - 260px);
overflow: auto;
padding-bottom: 80px;
}
#structureName {
margin-bottom: 10px;
font-weight: bold;
padding: 8px 0;
border-bottom: 1px solid #eee;
}
#structureName2 {
margin-bottom: 10px;
font-size: 12px;
color: #666;
}
/* Tabulator 커스텀 스타일 */
.tabulator-row.level-1 { background-color: #fde9d9 !important; }
.tabulator-row.level-2 { background-color: #daeef3 !important; }
.tabulator-row.level-3 { background-color: #e4dfec !important; }
.tabulator-row.level-4 { background-color: #ebf1de !important; }
.tabulator-row.level-5 { background-color: #f2f2f2 !important; }
.tabulator-row.level-6 { background-color: #f2dcdb !important; }
.tabulator-row.level-7 { background-color: #eeece1 !important; }
.tabulator-row.level-8 { background-color: #dce6f1 !important; }
.tabulator-row.level-9 { background-color: #FFFFEB !important; }
.tabulator-row.level-10 { background-color: #ffffff !important; }
</style>
<script>
var _tabulGrid;
var selectedRowData = null;
var selectedBomObjId = null; // 선택된 BOM의 OBJID
var selectedBomType = null; // 'EBOM' 또는 'MBOM'
var bomGridData = []; // BOM 그리드 데이터
$(function(){
$(document).ready(function(){
// 담기 버튼 - 선택한 BOM을 복사 대상으로 설정
$("#btnAddItem").click(function(){
var partNo = $("#COPY_PART_NO").val().trim();
var partName = $("#COPY_PART_NAME").val().trim();
if(""!="${product_code}"){
$("#TARGET_PRODUCT_MGMT_OBJID").val("${product_code}");
fnc_getProductRevtList("TARGET_REV","${product_code}");
if(!partNo || !partName) {
Swal.fire('품번과 품명을 입력해주세요.');
return;
}
// 선택된 BOM이 있는지 확인
if(!selectedBomObjId) {
Swal.fire('E-BOM 또는 M-BOM을 먼저 선택해주세요.');
return;
}
$("#btnConfirm").click(function(){
if(fnc_validate("form1")){
if($("#REV").val()==""){
Swal.fire('Source Rev를 선택해 주세요');
return;
}
if($("#TARGET_PRODUCT_MGMT_OBJID").val()==""){
Swal.fire('대상 기종명을 선택해 주세요');
return;
}
if($("#PRODUCT_MGMT_OBJID").val() == $("#TARGET_PRODUCT_MGMT_OBJID").val() && $("#REV").val() == $("#TARGET_REV").val()){
Swal.fire("같은 기종 같은 REV로 복사 할수 없습니다.");
return;
}
if(confirm("복사하시겠습니까?")){
$.ajax({
url:"/partMng/saveBomCopy.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
if(data=="SUCCESS"){
Swal.fire('복사되었습니다');
}else{
Swal.fire('복사에 실패하였습니다.');
}
opener.fn_search();
self.close();
},
error: function(jqxhr, status, error){
}
});
}
}
Swal.fire({
title: '담기 완료',
text: '선택한 BOM이 복사 대상으로 설정되었습니다.',
icon: 'success'
});
$("#btnClose").click(function(){
self.close(0);
});
/* $("#PRODUCT_MGMT_OBJID").change(function(){
fn_productSpecList(this.value, "PRODUCT_MGMT_SPEC", "");
}); */
$("#REV").change(function(){
$("#SPEC_NAME").val("");
var spec_name = $("#REV").find("option:selected").attr("id");
$("#SPEC_NAME").val(spec_name);
});
$("#TARGET_REV").change(function(){
$("#TARGET_SPEC_NAME").val("");
var spec_name = $("#TARGET_REV").find("option:selected").attr("ids");
$("#TARGET_SPEC_NAME").val(spec_name);
if(this.value!=""){
$("#TARGET_SPEC_NAME").attr("readonly",true);
}else{
$("#TARGET_SPEC_NAME").attr("readonly",false);
}
});
$("#TARGET_PRODUCT_MGMT_OBJID").change(function(){
fnc_getProductRevtList("TARGET_REV",this.value);
});
fnc_getProductMgmtList("PRODUCT_MGMT_OBJID", "${product_code}");
//fn_productSpecList("${product_code}", "PRODUCT_MGMT_SPEC", "${product_mgmt_spec}");
//fnc_productUPGNEWList("","${product_mgmt_spec}","PRODUCT_MGMT_UPG", "${upg_no}");
$("#PRODUCT_MGMT_SPEC").change(function(){
fnc_productUPGList("",this.value,"PRODUCT_MGMT_UPG", "${resultMap.PRODUCT_MGMT_UPG}");
});
$('.select2').select2();
});
// 저장 버튼 - E-BOM을 M-BOM으로 복사
$("#btnSaveItem").click(function(){
fn_saveBomCopy();
});
// E-BOM 선택 버튼
$("#btnSelectEbom").click(function(){
var ebomPartNo = $("#EBOM_PART_NO").val().trim();
if(!ebomPartNo) {
Swal.fire('E-BOM 품번을 입력해주세요.');
return;
}
// E-BOM 조회 후 미리보기 로드
fn_loadBomPreview(ebomPartNo, 'EBOM');
});
// M-BOM 선택 버튼
$("#btnSelectMbom").click(function(){
var mbomPartNo = $("#MBOM_PART_NO").val().trim();
if(!mbomPartNo) {
Swal.fire('M-BOM 품번을 입력해주세요.');
return;
}
// M-BOM 조회 후 미리보기 로드
fn_loadBomPreview(mbomPartNo, 'MBOM');
});
// Excel 다운로드 버튼
$("#btnExcel").click(function() {
fn_excel();
});
// 도면 업로드 버튼 클릭
$("#btnDrawingUpload").click(function() {
$("#drawingFiles").click();
});
// 파일 선택 이벤트
$("#drawingFiles").change(function() {
fn_uploadDrawingFiles(this.files);
});
// 초기 그리드 생성 (빈 그리드)
fn_initGrid([], 3);
});
// BOM 미리보기 로드
function fn_loadBomPreview(partNo, bomType) {
// 먼저 품번으로 BOM OBJID 조회
$.ajax({
url: "/partMng/getBomObjIdByPartNo.do",
type: "POST",
data: { partNo: partNo },
dataType: "json",
success: function(response) {
if(response && response.OBJID) {
$("#bomPartName").text(partNo);
// 전역 변수에 저장
selectedBomObjId = response.OBJID;
selectedBomType = bomType;
// BOM 트리 데이터 로드
fn_loadBomTree(response.OBJID);
} else {
Swal.fire('해당 품번의 BOM을 찾을 수 없습니다.');
}
},
error: function() {
Swal.fire('BOM 조회 중 오류가 발생했습니다.');
}
});
}
// BOM 트리 데이터 로드
function fn_loadBomTree(bomObjId) {
$.ajax({
url: "/partMng/getStructureTreeJson.do",
type: "POST",
data: {
objId: bomObjId,
bomReportObjid: bomObjId,
search_type: "working"
},
dataType: "json",
success: function(response) {
if(response && response.length > 0) {
var maxLevel = response[0].MAX_LEVEL || 3;
// Level 필드 생성
var processedData = [];
response.forEach(function(item) {
for(var i = 1; i <= maxLevel; i++) {
item['LEVEL_' + i] = (item.LEVEL == i) ? '*' : '';
}
processedData.push(item);
});
// 전역 변수에 저장
bomGridData = processedData;
fn_initGrid(processedData, maxLevel);
} else {
bomGridData = [];
fn_initGrid([], 3);
}
},
error: function() {
Swal.fire('BOM 트리 조회 중 오류가 발생했습니다.');
}
});
}
// 도면 파일 업로드
function fn_uploadDrawingFiles(files) {
if(!files || files.length === 0) {
Swal.fire('파일을 선택해주세요.');
return;
}
Swal.fire('도면 다중 업로드 기능은 구현 예정입니다.');
}
// Tabulator 그리드 초기화
function fn_initGrid(data, maxLevel) {
maxLevel = maxLevel || 3; // 기본 3레벨
// 데이터에서 최대 레벨 계산
if(data && data.length > 0) {
data.forEach(function(row) {
if(row.LEVEL && row.LEVEL > maxLevel) {
maxLevel = row.LEVEL;
}
});
}
// 컬럼 정의
var columns = [
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
title: '선택',
field: 'RADIO',
formatter: function(cell) {
var rowData = cell.getData();
return '<input type="radio" name="checkedPartNo" value="' + (rowData.CHILD_OBJID || '') + '">';
},
cellClick: function(e, cell) {
var radio = $(e.target);
if(radio.is(':radio')) {
selectedRowData = cell.getData();
$('input[name=checkedPartNo]').not(radio).prop('checked', false);
}
}
}
];
// 수준 컬럼 그룹
var levelColumns = [];
for(var i = 1; i <= maxLevel; i++) {
levelColumns.push({
headerHozAlign: 'center',
hozAlign: 'center',
width: 30,
title: i,
field: 'LEVEL_' + i,
formatter: function(cell) {
return cell.getValue() === '*' ? '*' : '';
}
});
}
columns.push({
title: '수준',
headerHozAlign: 'center',
columns: levelColumns
});
// 나머지 컬럼 추가
columns.push(
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 150,
title: '품번',
field: 'PART_NO'
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 200,
title: '품명',
field: 'PART_NAME'
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
title: '수량',
field: 'QTY_TEMP'
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 100,
title: '항목 수량',
field: 'ITEM_QTY'
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
title: '3D',
field: 'CU01_CNT',
formatter: function(cell) {
var rowData = cell.getData();
var iconClass = (rowData.CU01_CNT && rowData.CU01_CNT > 0) ? 'file_icon' : 'file_empty_icon';
return '<a href="#" class="File ' + iconClass + '"></a>';
}
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
title: '2D',
field: 'CU02_CNT',
formatter: function(cell) {
var rowData = cell.getData();
var iconClass = (rowData.CU02_CNT && rowData.CU02_CNT > 0) ? 'file_icon' : 'file_empty_icon';
return '<a href="#" class="File ' + iconClass + '"></a>';
}
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
title: 'PDF',
field: 'CU03_CNT',
formatter: function(cell) {
var rowData = cell.getData();
var iconClass = (rowData.CU03_CNT && rowData.CU03_CNT > 0) ? 'file_icon' : 'file_empty_icon';
return '<a href="#" class="File ' + iconClass + '"></a>';
}
},
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 100,
title: '재료',
field: 'MATERIAL'
},
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 120,
title: '열처리경도',
field: 'HEAT_TREATMENT_HARDNESS'
}
);
// 기존 그리드 제거
if(_tabulGrid) {
_tabulGrid.destroy();
}
// Tabulator 생성
_tabulGrid = new Tabulator("#structureGrid", {
data: data,
layout: "fitColumns",
height: "calc(100vh - 360px)",
columns: columns,
rowFormatter: function(row) {
var data = row.getData();
if(data.LEVEL) {
$(row.getElement()).addClass('level-' + data.LEVEL);
}
},
placeholder: "BOM 데이터를 조회하려면 E-BOM 또는 M-BOM 품번을 입력하고 선택 버튼을 클릭하세요."
});
}
// BOM 복사 저장
function fn_saveBomCopy() {
var copyPartNo = $("#COPY_PART_NO").val().trim();
var copyPartName = $("#COPY_PART_NAME").val().trim();
var targetObjId = $("#TARGET_OBJID").val();
// 유효성 검사
if(!copyPartNo || !copyPartName) {
Swal.fire('품번과 품명을 입력해주세요.');
return;
}
if(!selectedBomObjId) {
Swal.fire('복사할 BOM을 선택해주세요.');
return;
}
if(bomGridData.length === 0) {
Swal.fire('복사할 BOM 데이터가 없습니다.');
return;
}
// 확인 메시지
var confirmMessage = targetObjId
? '선택한 ' + selectedBomType + '을(를) M-BOM으로 복사하시겠습니까?\n기존 M-BOM이 있다면 초기화됩니다.'
: '선택한 ' + selectedBomType + '을(를) 새로운 품번(' + copyPartNo + ')으로 복사하시겠습니까?';
Swal.fire({
title: 'BOM 복사',
text: confirmMessage,
icon: 'question',
showCancelButton: true,
confirmButtonText: '복사',
cancelButtonText: '취소'
}).then((result) => {
if(result.isConfirmed) {
// 저장 처리
Swal.fire({
title: '저장 중...',
text: 'BOM을 복사하고 있습니다.',
allowOutsideClick: false,
didOpen: () => {
Swal.showLoading();
}
});
$.ajax({
url: "/partMng/saveBomCopy.do",
type: "POST",
data: JSON.stringify({
targetObjId: targetObjId, // M-BOM 관리에서 선택한 프로젝트 OBJID
sourceBomObjId: selectedBomObjId,
sourceBomType: selectedBomType,
targetPartNo: copyPartNo,
targetPartName: copyPartName,
bomData: bomGridData
}),
contentType: "application/json",
dataType: "json",
success: function(response) {
Swal.close();
if(response && response.result === 'success') {
Swal.fire({
title: '저장 완료',
text: 'M-BOM이 성공적으로 생성되었습니다.',
icon: 'success'
}).then(() => {
window.close();
});
} else {
Swal.fire({
title: '저장 실패',
text: response.message || 'BOM 복사 중 오류가 발생했습니다.',
icon: 'error'
});
}
},
error: function(xhr, status, error) {
Swal.close();
console.error('Save error:', error);
Swal.fire({
title: '저장 실패',
text: '서버 오류가 발생했습니다: ' + error,
icon: 'error'
});
}
});
}
});
}
// 닫기
function fn_close() {
window.close();
}
// Excel 다운로드
function fn_excel() {
if(_tabulGrid) {
_tabulGrid.download("xlsx", "BOM_Copy.xlsx", {sheetName: "BOM"});
}
}
</script>
</head>
<body class="backcolor">
<form name="form1" id="form1" action="" method="post">
<div class="plm_menu_name">
<h2>
<span>BOM COPY</span>
</h2>
</div>
<div id="businessPopupFormWrap">
<table class="pmsPopupForm">
<colgroup>
<col width="48%;">
<col width="*">
<col width="48%;">
</colgroup>
<tr>
<td>
<h3>SOURCE</h3>
<br>
<font color="red">※복사할 Version 을 선택하세요.</font>
<table width="100%">
<tr >
<td class="input_title"><label for="">기종(모델)명</label></td>
<td class="input_sub_title" >
<select style="width:100%;" name="PRODUCT_MGMT_OBJID" id="PRODUCT_MGMT_OBJID" class="select2" disabled="disabled"></select>
</td>
</tr>
<tr>
<td class="input_title"><label for="">Source Version</label></td>
<td class="input_sub_title" >
<select style="width:100%;" name="REV" id="REV" class="select2" autocomplete="off" required reqTitle="원본Version">
<option value="">선택</option>
${code_map.rev}
</select>
</td>
</tr>
<tr>
<td class="input_title"><label for="">사양명</label></td>
<td class="input_sub_title" >
<input type="text" id="SPEC_NAME" name="SPEC_NAME" disabled="disabled" readonly>
</td>
</tr>
</table>
</td>
<td>
<table width="100%">
<tr>
</tr>
</table>
</td>
<td>
<h3>TARGET</h3>
<br>
<font color="red">※Version 미선택시 새로운 Version으로 신규 생성 되며 기등록된 BOM구조는 삭제 됩니다.</font>
<table width="100%">
<tr>
<td class="input_title"><label for="">대상 기종명</label></td>
<td class="input_sub_title" >
<select style="width:100%;" name="TARGET_PRODUCT_MGMT_OBJID" id="TARGET_PRODUCT_MGMT_OBJID" class="select2" autocomplete="off" required reqTitle="대상기종">
<option value="">선택</option>
${code_map.product_code}
</select>
</td>
</tr>
<tr>
<td class="input_title"><label for="">Target Version</label></td>
<td class="input_sub_title" >
<select style="width:100%;" name="TARGET_REV" id="TARGET_REV" class="select2"></select>
</td>
</tr>
<tr>
<td class="input_title"><label for="">대상 사양명</label></td>
<td class="input_sub_title" >
<input type="text" id="TARGET_SPEC_NAME" name="TARGET_SPEC_NAME" required reqTitle="대상사양명">
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="btn_wrap" style="clear:both;">
<div class="plm_btn_wrap_center">
<input type="button" value="복사" class="plm_btns" id="btnConfirm">
<input type="button" value="닫기" class="plm_btns" id="btnClose">
</div>
</div>
</div>
<form name="form1" id="form1" action="" method="post">
<!-- Hidden fields -->
<input type="hidden" id="TARGET_OBJID" name="TARGET_OBJID" value="${param.objId}">
<!-- 상단: 품번/품명 입력 및 BOM 선택 영역 -->
<div class="top-input-section">
<table class="pmsPopuptable" style="margin-bottom: 10px;">
<colgroup>
<col width="10%">
<col width="25%">
<col width="10%">
<col width="25%">
<col width="30%">
</colgroup>
<tr>
<td class="input_title"><label for="COPY_PART_NO">품번</label></td>
<td>
<input type="text" id="COPY_PART_NO" name="COPY_PART_NO" style="width: 100%;">
</td>
<td class="input_title"><label for="COPY_PART_NAME">품명</label></td>
<td>
<input type="text" id="COPY_PART_NAME" name="COPY_PART_NAME" style="width: 100%;">
</td>
<td style="text-align: center;">
<input type="button" value="담기" class="plm_btns" id="btnAddItem">
<input type="button" value="저장" class="plm_btns" id="btnSaveItem">
</td>
</tr>
</table>
<table class="pmsPopuptable">
<colgroup>
<col width="15%">
<col width="85%">
</colgroup>
<tr>
<td class="input_title"><label for="EBOM_PART_NO">E-BOM 품번</label></td>
<td>
<input type="text" id="EBOM_PART_NO" name="EBOM_PART_NO" style="width: 400px; margin-right: 10px;">
<input type="button" value="E-BOM 선택" class="plm_btns" id="btnSelectEbom">
</td>
</tr>
<tr>
<td class="input_title"><label for="MBOM_PART_NO">M-BOM 품번</label></td>
<td>
<input type="text" id="MBOM_PART_NO" name="MBOM_PART_NO" style="width: 400px; margin-right: 10px;">
<input type="button" value="M-BOM 선택" class="plm_btns" id="btnSelectMbom">
</td>
</tr>
</table>
</div>
<!-- 중간: BOM 미리보기 그리드 -->
<div id="structureTableWrap1">
<div id="structureName">
<span id="bomPartName" style="font-weight: bold; color: #333;"></span>
<input type="button" value="Excel Download" class="plm_btns structure_btn" id="btnExcel" style="float:right;">
<input type="button" value="도면 다중 업로드" class="plm_btns structure_btn" id="btnDrawingUpload" style="float:right; margin-right:5px;">
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.dxf,.pdf">
</div>
<div id="structureGrid"></div>
</div>
<!-- 하단: 저장/닫기 버튼 -->
<div class="bottom-button-section">
<input type="button" value="저장" class="plm_btns" id="btnSaveItem" style="margin-right: 5px;">
<input type="button" value="닫기" class="plm_btns" id="btnClose" onclick="fn_close();">
</div>
</form>
</body>
</html>
</html>

View File

@@ -34,6 +34,11 @@ $(document).ready(function(){
fn_search();
});
// BOM 복사 버튼
$("#btnBomCopy").click(function(){
fn_openBomCopyPopup();
});
// 전체 체크박스
$(document).on('click', '#checkAll', function() {
$('.rowCheck').prop('checked', $(this).prop('checked'));
@@ -219,6 +224,27 @@ var columns = [
function fn_search(){
// showCheck를 false로 설정하여 자동 체크박스 제거 (columns에 이미 체크박스 정의되어 있음)
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/productionplanning/mBomMgmtGridList.do", columns, false);
// 그리드 로드 완료 후 행 클릭 이벤트 추가
if(_tabulGrid) {
_tabulGrid.on("rowClick", function(e, row){
// 체크박스를 직접 클릭한 경우는 제외
if($(e.target).is('input[type="checkbox"]')) {
return;
}
// M-BOM 아이콘을 클릭한 경우는 제외
if($(e.target).closest('.clip_icon, .hyphen_icon').length > 0) {
return;
}
// 행 클릭 시 체크박스 토글
var checkbox = $(row.getElement()).find('.rowCheck');
if(checkbox.length > 0) {
checkbox.prop('checked', !checkbox.prop('checked'));
}
});
}
}
// E-BOM 팝업
@@ -252,6 +278,80 @@ function fn_openMBomPopup(objId) {
var url = "/productionplanning/mBomFormPopup.do?objId=" + objId;
fn_centerPopup(popup_width, popup_height, url, 'mbomPopup');
}
// BOM 복사 팝업
function fn_openBomCopyPopup() {
// 체크된 행이 있는지 확인
var checkedRows = $('.rowCheck:checked');
if(checkedRows.length === 0) {
Swal.fire({
title: '선택 필요',
text: 'BOM을 복사할 프로젝트를 선택해주세요.',
icon: 'warning'
});
return;
}
if(checkedRows.length > 1) {
Swal.fire({
title: '선택 오류',
text: '한 번에 하나의 프로젝트만 선택해주세요.',
icon: 'warning'
});
return;
}
// 선택된 행의 데이터 가져오기
var selectedObjId = checkedRows.first().data('objid');
var selectedRow = _tabulGrid.searchRows("OBJID", "=", selectedObjId);
if(selectedRow.length === 0) {
Swal.fire('선택된 데이터를 찾을 수 없습니다.');
return;
}
var rowData = selectedRow[0].getData();
var mbomStatus = fnc_checkNull(rowData.MBOM_STATUS);
// M-BOM이 이미 생성되어 있는 경우 경고
if(mbomStatus !== '' && mbomStatus !== '0') {
Swal.fire({
title: '경고',
text: '저장된 M-BOM이 초기화 됩니다.\n계속하시겠습니까?',
icon: 'warning',
showCancelButton: true,
confirmButtonText: '확인',
cancelButtonText: '취소'
}).then((result) => {
if(result.isConfirmed) {
fn_openBomCopyPopupWindow(selectedObjId);
}
});
} else {
fn_openBomCopyPopupWindow(selectedObjId);
}
}
// BOM 복사 팝업 창 열기
function fn_openBomCopyPopupWindow(objId) {
var popup_width = 1400;
var popup_height = 800;
var url = "/partMng/setBomCopyFormPopup.do?objId=" + objId;
var left = (screen.width - popup_width) / 2;
var top = (screen.height - popup_height) / 2;
var popup = window.open(url, "bomCopyPopup", "width=" + popup_width + ",height=" + popup_height + ",left=" + left + ",top=" + top + ",scrollbars=yes,resizable=yes");
// 팝업이 닫힐 때 그리드 새로고침
var checkPopup = setInterval(function() {
if(popup.closed) {
clearInterval(checkPopup);
console.log("BOM 복사 팝업 닫힘 - 그리드 새로고침");
fn_search();
}
}, 500);
}
</script>
<form name="form1" id="form1" method="post">
@@ -264,6 +364,7 @@ function fn_openMBomPopup(objId) {
</h2>
<div class="btnArea">
<input type="button" class="plm_btns" value="조회" id="btnSearch">
<input type="button" class="plm_btns" value="BOM 복사" id="btnBomCopy">
</div>
</div>