diff --git a/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml b/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml index 2edcdb4..5d60271 100644 --- a/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml +++ b/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml @@ -2985,6 +2985,14 @@ WHERE OBJID = #{projectMgmtObjid} + + + UPDATE PROJECT_MGMT + SET + PART_OBJID = NULL + WHERE OBJID = #{projectMgmtObjid} + + SELECT diff --git a/WebContent/WEB-INF/view/partMng/structurePopupCenter.jsp b/WebContent/WEB-INF/view/partMng/structurePopupCenter.jsp index def2380..dc59fcc 100644 --- a/WebContent/WEB-INF/view/partMng/structurePopupCenter.jsp +++ b/WebContent/WEB-INF/view/partMng/structurePopupCenter.jsp @@ -12,8 +12,27 @@ $(function(){ $('.select2').select2(); + // 서버에서 전달받은 상태값 확인 (info.STATUS) + var status = '${info.STATUS}'; + + // 상태가 'Y'인 경우 버튼 비활성화 + if(status === 'Y') { + $("#moveLeft, #moveRight, #moveChange").prop('disabled', true) + .css({ + 'opacity': '0.5', + 'cursor': 'not-allowed' + }) + .attr('title', '상태가 Y인 데이터는 수정할 수 없습니다.'); + } + //Part 연결 $("#moveLeft").click(function(){ + // 상태가 'Y'인 경우 동작 방지 + if(status === 'Y') { + alert('상태가 Y인 데이터는 수정할 수 없습니다.'); + return false; + } + // Tabulator에서 선택된 오른쪽 행 데이터 가져오기 var rightFrame = parent.frames['rightFrame']; var rightSelectedRows = rightFrame.getSelectedRows ? rightFrame.getSelectedRows() : []; @@ -105,6 +124,12 @@ $(function(){ //연결된 part 삭제 $("#moveRight").click(function(){ + // 상태가 'Y'인 경우 동작 방지 + if(status === 'Y') { + alert('상태가 Y인 데이터는 수정할 수 없습니다.'); + return false; + } + var leftPartNoObj = $("input[name=checkedPartNo]:checked", parent.frames['leftFrame'].document); var leftPartChildObjId = leftPartNoObj.val(); var leftPartNo = $("input[name=checkedPartNo]:checked", parent.frames['leftFrame'].document).attr("data-PART_NO"); @@ -118,6 +143,12 @@ $(function(){ //연결된 part 변경 $("#moveChange").click(function(){ + // 상태가 'Y'인 경우 동작 방지 + if(status === 'Y') { + alert('상태가 Y인 데이터는 수정할 수 없습니다.'); + return false; + } + var leftPartNoList = $("input[name=checkedPartNo]:checked", parent.frames['leftFrame'].document); if(leftPartNoList.length === 0){ diff --git a/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp b/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp index 1cf2ae3..1e522bc 100644 --- a/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp +++ b/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp @@ -87,6 +87,21 @@ $(document).ready(function(){ // 날짜 선택기 초기화 fnc_datepick("search_fromDate", "search_toDate"); + // 초기화 버튼과 Excel Download 버튼 숨기기 (계속 감시) + fnc_hideResetButton(); + + // Excel Download 버튼 완전히 제거 (반복 확인) + var hideExcelBtn = function() { + $('.excelBtn').remove(); + $('.resetBtn').remove(); + $('.btnArea input[value="Excel Download"]').remove(); + $('.btnArea input[value="초기화"]').remove(); + }; + + // 즉시 실행 및 반복 실행 + hideExcelBtn(); + setInterval(hideExcelBtn, 100); + // Enter 키로 검색 $("input").keyup(function(e) { if (e.keyCode == 13) { @@ -104,6 +119,11 @@ $(document).ready(function(){ fn_showEbomList(); }); + // 제거 버튼 + $("#btnRemove").click(function(){ + fn_removeEbom(); + }); + // 초기 상태 설정 if(hasCurrentEbom) { // 할당된 E-BOM이 있으면 상세보기만 표시 @@ -219,6 +239,36 @@ function fn_assignEbom() { }); } } + +// E-BOM 제거 +function fn_removeEbom() { + var projectMgmtObjid = "${param.projectMgmtObjid}"; + + if(confirm("할당된 E-BOM을 제거하시겠습니까?")) { + $.ajax({ + url: "/productionplanning/removeEbomFromMbom.do", + type: "POST", + data: { + projectMgmtObjid: projectMgmtObjid + }, + dataType: "json", + success: function(result) { + if(result.success) { + alert("E-BOM이 제거되었습니다."); + if(window.opener && window.opener.fn_search) { + window.opener.fn_search(); // 부모 창 새로고침 + } + window.close(); + } else { + alert(result.message || "제거에 실패했습니다."); + } + }, + error: function(xhr, status, error) { + alert("오류가 발생했습니다: " + error); + } + }); + } +} @@ -232,6 +282,7 @@ function fn_assignEbom() { E-BOM ${not empty currentEbom ? '상세 및 변경' : '선택'} - 품번: ${param.partNo} / 품명: ${param.partName} + diff --git a/src/com/pms/controller/ProductionPlanningController.java b/src/com/pms/controller/ProductionPlanningController.java index 8de2da3..70e4ec3 100644 --- a/src/com/pms/controller/ProductionPlanningController.java +++ b/src/com/pms/controller/ProductionPlanningController.java @@ -970,4 +970,41 @@ public class ProductionPlanningController extends BaseService { } return resultMap; } + + /** + * M-BOM에서 E-BOM 제거 + * @param request + * @param paramMap + * @return + */ + @ResponseBody + @RequestMapping("/productionplanning/removeEbomFromMbom.do") + public Map removeEbomFromMbom(HttpServletRequest request, @RequestParam Map paramMap) { + Map resultMap = new HashMap<>(); + try { + String projectMgmtObjid = CommonUtils.checkNull(paramMap.get("projectMgmtObjid")); + + if(projectMgmtObjid.isEmpty()) { + resultMap.put("success", false); + resultMap.put("message", "필수 파라미터가 누락되었습니다."); + return resultMap; + } + + // PROJECT_MGMT 테이블의 PART_OBJID를 null로 업데이트 + int updateResult = productionPlanningService.removeEbomFromProject(projectMgmtObjid); + + if(updateResult > 0) { + resultMap.put("success", true); + resultMap.put("message", "E-BOM이 제거되었습니다."); + } else { + resultMap.put("success", false); + resultMap.put("message", "제거에 실패했습니다."); + } + } catch(Exception e) { + e.printStackTrace(); + resultMap.put("success", false); + resultMap.put("message", "오류가 발생했습니다: " + e.getMessage()); + } + return resultMap; + } } diff --git a/src/com/pms/mapper/productionplanning.xml b/src/com/pms/mapper/productionplanning.xml index 2edcdb4..5d60271 100644 --- a/src/com/pms/mapper/productionplanning.xml +++ b/src/com/pms/mapper/productionplanning.xml @@ -2985,6 +2985,14 @@ WHERE OBJID = #{projectMgmtObjid} + + + UPDATE PROJECT_MGMT + SET + PART_OBJID = NULL + WHERE OBJID = #{projectMgmtObjid} + + SELECT diff --git a/src/com/pms/service/ProductionPlanningService.java b/src/com/pms/service/ProductionPlanningService.java index 3f3f063..34e60e7 100644 --- a/src/com/pms/service/ProductionPlanningService.java +++ b/src/com/pms/service/ProductionPlanningService.java @@ -725,6 +725,36 @@ public class ProductionPlanningService { } } + /** + * PROJECT_MGMT에서 E-BOM 제거 (PART_OBJID를 null로 설정) + * @param projectMgmtObjid + * @return + * @throws Exception + */ + public int removeEbomFromProject(String projectMgmtObjid) throws Exception { + SqlSession sqlSession = null; + try { + sqlSession = SqlMapConfig.getInstance().getSqlSession(); + + Map paramMap = new HashMap<>(); + paramMap.put("projectMgmtObjid", projectMgmtObjid); + + int result = sqlSession.update("productionplanning.removeEbomFromProject", paramMap); + sqlSession.commit(); + + return result; + } catch(Exception e) { + if(sqlSession != null) { + sqlSession.rollback(); + } + throw e; + } finally { + if(sqlSession != null) { + sqlSession.close(); + } + } + } + /** * E-BOM 정보 조회 * @param bomReportObjid