diff --git a/WebContent/WEB-INF/view/partMng/partMngHisList.jsp b/WebContent/WEB-INF/view/partMng/partMngHisList.jsp index fa2d7c1..770d0bf 100644 --- a/WebContent/WEB-INF/view/partMng/partMngHisList.jsp +++ b/WebContent/WEB-INF/view/partMng/partMngHisList.jsp @@ -123,7 +123,7 @@ function fn_partMngHisDetail(objId){

- 제품관리_설계변경 리스트 + 개발관리_설계변경 리스트

diff --git a/WebContent/WEB-INF/view/partMng/partMngList.jsp b/WebContent/WEB-INF/view/partMng/partMngList.jsp index 7dc7f6f..dc5d79c 100644 --- a/WebContent/WEB-INF/view/partMng/partMngList.jsp +++ b/WebContent/WEB-INF/view/partMng/partMngList.jsp @@ -484,7 +484,7 @@ String connector = person.getUserId();

- 제품관리_PART 조회 + 개발관리_PART 조회

diff --git a/WebContent/WEB-INF/view/partMng/partMngTempList.jsp b/WebContent/WEB-INF/view/partMng/partMngTempList.jsp index e5d7e28..6357c4f 100644 --- a/WebContent/WEB-INF/view/partMng/partMngTempList.jsp +++ b/WebContent/WEB-INF/view/partMng/partMngTempList.jsp @@ -585,7 +585,7 @@ ui-jqgrid tr.jqgrow td {

- 제품관리_PART 등록 + 개발관리_PART 등록

diff --git a/WebContent/WEB-INF/view/partMng/structureAscendingList.jsp b/WebContent/WEB-INF/view/partMng/structureAscendingList.jsp index d220980..bea1765 100644 --- a/WebContent/WEB-INF/view/partMng/structureAscendingList.jsp +++ b/WebContent/WEB-INF/view/partMng/structureAscendingList.jsp @@ -799,7 +799,7 @@ function fn_excelExport(pGridObj,pFileName){

- 제품관리_BOM 조회 + 개발관리_BOM 조회 (${param.searchType eq 'descending' ? '역전개' : '정전개'}) diff --git a/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp b/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp index 04d61c9..23e97df 100644 --- a/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp +++ b/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp @@ -76,6 +76,8 @@ var columns = [ {title:'OBJID', field:'OBJID', visible: false}, {title:'CONTRACT_OBJID', field:'CONTRACT_OBJID', visible: false}, {title:'BOM_REPORT_OBJID', field:'BOM_REPORT_OBJID', visible: false}, + {title:'MBOM_HEADER_OBJID', field:'MBOM_HEADER_OBJID', visible: false}, + {title:'PURCHASE_LIST_OBJID', field:'PURCHASE_LIST_OBJID', visible: false}, // 1. 체크박스 { @@ -479,7 +481,7 @@ function fn_checkAssignmentAndOpenMbom(projectObjId) { }); } -// 구매리스트 생성 팝업 열기 +// 구매리스트 생성 function fn_openPurchaseListPopup() { // 체크된 행 가져오기 var checkedRows = []; @@ -514,38 +516,82 @@ function fn_openPurchaseListPopup() { // 선택된 프로젝트 정보 var selectedRow = checkedRows[0]; - var projectObjId = selectedRow.OBJID; - var projectNo = selectedRow.PROJECT_NO; + var projectObjId = selectedRow.OBJID; // PROJECT_MGMT.OBJID + var projectNo = selectedRow.PROJECT_NO; // 프로젝트 번호 (문자열) + var mbomHeaderObjid = selectedRow.MBOM_HEADER_OBJID; // MBOM_HEADER.OBJID + var purchaseListObjid = selectedRow.PURCHASE_LIST_OBJID; // 기존 구매리스트 OBJID - // 구매요청서 마스터 생성 후 팝업 열기 - $.ajax({ - url: "/salesMng/createPurchaseListFromMBom.do", - method: "POST", - data: { - PROJECT_MGMT_OBJID: projectObjId, - PROJECT_NO: projectNo - }, - dataType: "json", - success: function(result) { - if(result.resultFlag === "S") { - var salesRequestMasterObjid = result.SALES_REQUEST_MASTER_OBJID; - // 구매리스트 팝업 열기 - var url = "/salesMng/purchaseListFormPopUp.do?SALES_REQUEST_MASTER_OBJID=" + salesRequestMasterObjid - + "&PROJECT_MGMT_OBJID=" + projectObjId; - window.open(url, "purchaseListPopup", "width=1400,height=800,scrollbars=yes,resizable=yes"); - } else { - Swal.fire({ - title: '오류', - text: result.message || '구매리스트 생성 중 오류가 발생했습니다.', - icon: 'error' - }); - } - }, - error: function(xhr, status, error) { - Swal.fire({ - title: '오류', - text: '서버 통신 중 오류가 발생했습니다.', - icon: 'error' + if(!projectObjId || projectObjId === 'null' || projectObjId === '') { + Swal.fire({ + title: '오류', + text: '프로젝트 OBJID를 찾을 수 없습니다.', + icon: 'error' + }); + return; + } + + if(!mbomHeaderObjid || mbomHeaderObjid === 'null' || mbomHeaderObjid === '') { + Swal.fire({ + title: '오류', + text: 'M-BOM이 생성되지 않았습니다.\n먼저 M-BOM을 생성해주세요.', + icon: 'warning' + }); + return; + } + + // 이미 생성된 구매리스트가 있는지 확인 + if(purchaseListObjid && purchaseListObjid !== 'null' && purchaseListObjid !== '') { + Swal.fire({ + title: '알림', + text: '이미 생성된 구매리스트가 있습니다.\n구매리스트관리 화면에서 확인하세요.', + icon: 'info' + }); + return; + } + + // 생성 확인 + Swal.fire({ + title: '구매리스트 생성', + text: '구매리스트를 생성하시겠습니까?', + icon: 'question', + showCancelButton: true, + confirmButtonText: '예', + cancelButtonText: '아니오' + }).then((result) => { + if (result.isConfirmed) { + // 구매요청서 마스터 생성 + $.ajax({ + url: "/salesMng/createPurchaseListFromMBom.do", + method: "POST", + data: { + PROJECT_MGMT_OBJID: projectObjId, // PROJECT_MGMT.OBJID 전달 + PROJECT_NO: projectNo, // 프로젝트 번호 전달 + MBOM_HEADER_OBJID: mbomHeaderObjid // MBOM_HEADER.OBJID 전달 + }, + dataType: "json", + success: function(result) { + if(result.resultFlag === "S") { + // 성공 알림 + Swal.fire({ + title: '생성 완료', + text: '구매리스트가 생성되었습니다.\n구매리스트관리 화면에서 확인하세요.', + icon: 'success' + }); + } else { + Swal.fire({ + title: '오류', + text: result.message || '구매리스트 생성 중 오류가 발생했습니다.', + icon: 'error' + }); + } + }, + error: function(xhr, status, error) { + Swal.fire({ + title: '오류', + text: '서버 통신 중 오류가 발생했습니다.', + icon: 'error' + }); + } }); } }); diff --git a/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp b/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp index ee44d64..516f77f 100644 --- a/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp +++ b/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp @@ -45,6 +45,9 @@ var _tabulGrid; // 프로젝트 수주수량 (최상위 프레임에서 가져오기) var projectQuantity = 1; // 기본값 +// 소재 목록 전역 변수 +var materialList = []; + $(function(){ // 최상위 프레임(mBomPopupHeaderFs.jsp)에서 프로젝트 수주수량 가져오기 try { @@ -58,10 +61,37 @@ $(function(){ console.log("프로젝트 수주수량 가져오기 실패:", e); } + // 소재 목록 로드 + fn_loadMaterialList(); + // Tabulator 초기화 fn_initGrid(); }); +// 소재 목록 로드 +function fn_loadMaterialList() { + $.ajax({ + url: '/admin/getMaterialList.do', + method: 'POST', + async: false, + success: function(response) { + if(response && response.list) { + // 중복 제거하여 소재 코드만 추출 + var uniqueMaterials = {}; + response.list.forEach(function(item) { + uniqueMaterials[item.MATERIAL_CODE] = true; + }); + materialList = Object.keys(uniqueMaterials); + console.log("소재 목록 로드 완료:", materialList); + } + }, + error: function() { + console.error("소재 목록 로드 실패"); + materialList = []; + } + }); +} + // Tabulator 그리드 초기화 function fn_initGrid() { var maxLevel = ${empty MAXLEV ? 1 : MAXLEV}; @@ -312,26 +342,7 @@ function fn_initGrid() { field: 'RAW_MATERIAL', editor: 'list', editorParams: { - values: ['SM45C', 'STS304', 'STS316', 'AL6061', 'AL7075'] // TODO: 실제 소재 목록으로 교체 - }, - editable: function(cell) { - return cell.getRow().getData().SUPPLY_TYPE === '사급'; - }, - formatter: function(cell) { - var data = cell.getRow().getData(); - if(data.SUPPLY_TYPE === '자급') return '-'; - return cell.getValue() || ''; - } - }, - { - headerHozAlign: 'center', - hozAlign: 'left', - width: 100, - title: '사이즈', - field: 'SIZE', - editor: 'list', - editorParams: { - values: ['Φ10', 'Φ20', 'Φ30', '10x10', '20x20'] // TODO: 실제 사이즈 목록으로 교체 + values: materialList // 로드된 소재 목록 사용 }, editable: function(cell) { return cell.getRow().getData().SUPPLY_TYPE === '사급'; @@ -342,12 +353,77 @@ function fn_initGrid() { return cell.getValue() || ''; }, cellEdited: function(cell) { - // 소재, 사이즈 선택 시 소재품번 자동 생성 + // 소재 선택 시 사이즈 초기화 + var row = cell.getRow(); + row.update({ + SIZE: '', + RAW_MATERIAL_NO: '' + }); + } + }, + { + headerHozAlign: 'center', + hozAlign: 'left', + width: 100, + title: '사이즈', + field: 'SIZE', + editor: 'list', + editorParams: function(cell) { + // 선택된 소재에 따라 동적으로 사이즈 목록 로드 + var data = cell.getRow().getData(); + var materialCode = data.RAW_MATERIAL; + + if(!materialCode) { + return {values: []}; + } + + // 서버에서 해당 소재의 사이즈 목록 가져오기 + var sizes = []; + $.ajax({ + url: '/admin/getMaterialSizes.do', + method: 'POST', + data: {materialCode: materialCode}, + async: false, + success: function(response) { + if(response && response.list) { + sizes = response.list.map(function(item) { + return item.SIZE_SPEC; + }); + } + } + }); + + return {values: sizes}; + }, + editable: function(cell) { + var data = cell.getRow().getData(); + return data.SUPPLY_TYPE === '사급' && data.RAW_MATERIAL; + }, + formatter: function(cell) { + var data = cell.getRow().getData(); + if(data.SUPPLY_TYPE === '자급') return '-'; + return cell.getValue() || ''; + }, + cellEdited: function(cell) { + // 사이즈 선택 시 소재품번 자동 조회 var row = cell.getRow(); var data = row.getData(); + if(data.RAW_MATERIAL && data.SIZE) { - var materialNo = data.RAW_MATERIAL + '-' + data.SIZE; - row.update({RAW_MATERIAL_NO: materialNo}); + // 서버에서 소재품번 조회 + $.ajax({ + url: '/admin/getMaterialPartNo.do', + method: 'POST', + data: { + materialCode: data.RAW_MATERIAL, + sizeSpec: data.SIZE + }, + success: function(response) { + if(response && response.MATERIAL_PART_NO) { + row.update({RAW_MATERIAL_NO: response.MATERIAL_PART_NO}); + } + } + }); } } }, @@ -471,7 +547,7 @@ function fn_initGrid() { hozAlign: 'left', width: 150, title: '공급업체', - field: 'VENDOR', + field: 'VENDOR_NAME', editor: false, // 구매쪽에서 입력 formatter: function(cell) { return cell.getValue() || '-'; @@ -815,7 +891,7 @@ function getMbomTreeData() { shortageQty: toNumber(row.SHORTAGE_QTY), // 구매 정보 - vendor: row.VENDOR, + vendor: row.VENDOR_NAME, unitPrice: toNumber(row.UNIT_PRICE), totalPrice: toNumber(row.TOTAL_PRICE), currency: row.CURRENCY, diff --git a/WebContent/WEB-INF/view/salesMng/purchaseListFormPopUp.jsp b/WebContent/WEB-INF/view/salesMng/purchaseListFormPopUp.jsp index a79497e..aa3737e 100644 --- a/WebContent/WEB-INF/view/salesMng/purchaseListFormPopUp.jsp +++ b/WebContent/WEB-INF/view/salesMng/purchaseListFormPopUp.jsp @@ -39,6 +39,7 @@ body, html { padding: 15px 20px; background: #f5f5f5; border-bottom: 2px solid #ddd; + text-align: right; } .header h3 { margin: 0 0 10px 0; @@ -60,27 +61,22 @@ body, html { padding: 20px; overflow: auto; } -.footer { - padding: 15px 20px; - background: #f5f5f5; - border-top: 1px solid #ddd; - text-align: center; -}
- - +
+ + +
+
- - +