diff --git a/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml b/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml
index 58fd9e1..2edcdb4 100644
--- a/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml
+++ b/WebContent/WEB-INF/classes/com/pms/mapper/productionplanning.xml
@@ -2928,7 +2928,7 @@
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = PM.CONTRACT_OBJID
AND CI.PART_OBJID = PM.PART_OBJID
- AND CI.STATUS = 'ACTIVE'),
+ AND CI.STATUS = 'ACTIVE' LIMIT 1),
PM.DUE_DATE,
CM.req_del_date
) AS REQ_DEL_DATE,
@@ -2938,19 +2938,31 @@
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = PM.CONTRACT_OBJID
AND CI.PART_OBJID = PM.PART_OBJID
- AND CI.STATUS = 'ACTIVE'),
+ AND CI.STATUS = 'ACTIVE' LIMIT 1),
''
) AS CUSTOMER_REQUEST,
- PBR.OBJID AS BOM_REPORT_OBJID,
- COALESCE(PBR.STATUS, '') AS EBOM_STATUS,
- COALESCE(TO_CHAR(PBR.REGDATE, 'YYYY-MM-DD'), '') AS EBOM_REGDATE,
+ -- E-BOM 정보: PM.PART_OBJID가 E-BOM OBJID를 직접 가리킴
+ PM.PART_OBJID AS BOM_REPORT_OBJID,
+ COALESCE(
+ (SELECT PBR.STATUS
+ FROM PART_BOM_REPORT PBR
+ WHERE PBR.OBJID::VARCHAR = PM.PART_OBJID
+ LIMIT 1),
+ ''
+ ) AS EBOM_STATUS,
+ COALESCE(
+ (SELECT TO_CHAR(PBR.REGDATE, 'YYYY-MM-DD')
+ FROM PART_BOM_REPORT PBR
+ WHERE PBR.OBJID::VARCHAR = PM.PART_OBJID
+ LIMIT 1),
+ ''
+ ) AS EBOM_REGDATE,
COALESCE(PM.MBOM_STATUS, '') AS MBOM_STATUS,
'1.0' AS MBOM_VERSION,
TO_CHAR(PM.REGDATE, 'YYYY-MM-DD') AS MBOM_REGDATE
FROM
PROJECT_MGMT PM
LEFT JOIN CONTRACT_MGMT CM ON PM.CONTRACT_OBJID = CM.OBJID
- LEFT JOIN PART_BOM_REPORT PBR ON PM.CONTRACT_OBJID = PBR.CONTRACT_OBJID::VARCHAR
WHERE 1=1
AND PM.PROJECT_NO IS NOT NULL
AND PM.PROJECT_NO != ''
@@ -2964,4 +2976,31 @@
ORDER BY PM.REGDATE DESC
+
+
+
+ UPDATE PROJECT_MGMT
+ SET
+ PART_OBJID = #{bomReportObjid}
+ WHERE OBJID = #{projectMgmtObjid}
+
+
+
+
diff --git a/WebContent/WEB-INF/view/partMng/partMngList.jsp b/WebContent/WEB-INF/view/partMng/partMngList.jsp
index 8d69036..fb8e84e 100644
--- a/WebContent/WEB-INF/view/partMng/partMngList.jsp
+++ b/WebContent/WEB-INF/view/partMng/partMngList.jsp
@@ -146,7 +146,7 @@ String connector = person.getUserId();
openPartMngPopup(objid);
}
},
- {headerHozAlign : 'center', hozAlign : 'left', /* width : '270', */ title : '품명', field : 'PART_NAME' },
+ {headerHozAlign : 'center', hozAlign : 'left', width : '180', 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,
diff --git a/WebContent/WEB-INF/view/partMng/partMngTempList.jsp b/WebContent/WEB-INF/view/partMng/partMngTempList.jsp
index edd2b87..1414cc4 100644
--- a/WebContent/WEB-INF/view/partMng/partMngTempList.jsp
+++ b/WebContent/WEB-INF/view/partMng/partMngTempList.jsp
@@ -138,7 +138,7 @@ ui-jqgrid tr.jqgrow td {
openPartMngPopup(objid);
}
},
- {headerHozAlign : 'center', hozAlign : 'left', /*width : '270',*/ title : '품명', field : 'PART_NAME' ,frozen:true},
+ {headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PART_NAME' ,frozen:true},
// {headerHozAlign : 'center', hozAlign : 'center', width : '70', title : '수량', field : 'Q_QTY' },
{headerHozAlign : 'center', hozAlign : 'center', width : '60', title : '3D', field : 'CU01_CNT',
formatter:fnc_subInfoValueFormatter,
diff --git a/WebContent/WEB-INF/view/partMng/structureList.jsp b/WebContent/WEB-INF/view/partMng/structureList.jsp
index a127940..bf72982 100644
--- a/WebContent/WEB-INF/view/partMng/structureList.jsp
+++ b/WebContent/WEB-INF/view/partMng/structureList.jsp
@@ -157,27 +157,27 @@ var columns = [
{headerHozAlign : 'center', hozAlign : 'left', width : '270', title : '유닛명', field : 'UNIT_NAME' },*/
- {headerHozAlign : 'center', hozAlign : 'center', width : '200', title : '제품구분', field : 'PRODUCT_NAME' },
- // {headerHozAlign : 'center', hozAlign : 'center', title : '제품구분', field : 'PRODUCT_CD' ,hidden: true},
- {headerHozAlign : 'center', hozAlign : 'left', width : '300', title : '품번', field : 'PART_NO' },
- {headerHozAlign : 'center', hozAlign : 'left', /* width : '300',*/ title : '품명', field : 'PART_NAME' },
-
- {headerHozAlign : 'center', hozAlign : 'center', width : '200', 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 : 'center', width : '120', title : '등록자', field : 'DEPT_USER_NAME' },
- {headerHozAlign : 'center', hozAlign : 'center', width : '200', title : '등록일', field : 'REG_DATE' },
- // {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '배포일', field : 'DEPLOY_DATE' },
-
- {headerHozAlign : 'center', hozAlign : 'center', width : '200', title : 'Version', field : 'REVISION' },
- // {headerHozAlign : 'center', hozAlign : 'left', /* width : '200', */ title : '배포사유', field : 'NOTE' },
- {headerHozAlign : 'center', hozAlign : 'center', width : '200', title : '상태', field : 'STATUS' }
+ {headerHozAlign : 'center', hozAlign : 'center', width : '160', title : '제품구분', field : 'PRODUCT_NAME' },
+ // {headerHozAlign : 'center', hozAlign : 'center', title : '제품구분', field : 'PRODUCT_CD' ,hidden: true},
+ {headerHozAlign : 'center', hozAlign : 'left', width : '210', title : '품번', field : 'PART_NO' },
+ {headerHozAlign : 'center', hozAlign : 'left', title : '품명', field : 'PART_NAME' },
+
+ {headerHozAlign : 'center', hozAlign : 'center', width : '150', 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 : 'center', width : '120', title : '등록자', field : 'DEPT_USER_NAME' },
+ {headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '등록일', field : 'REG_DATE' },
+ // {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '배포일', field : 'DEPLOY_DATE' },
+
+ {headerHozAlign : 'center', hozAlign : 'center', width : '110', title : 'Version', field : 'REVISION' },
+ // {headerHozAlign : 'center', hozAlign : 'left', /* width : '200', */ title : '배포사유', field : 'NOTE' },
+ {headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '상태', field : 'STATUS' }
];
// 중복 요청 방지를 위한 로딩 플래그
diff --git a/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp b/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp
new file mode 100644
index 0000000..1cf2ae3
--- /dev/null
+++ b/WebContent/WEB-INF/view/productionplanning/mBomEbomSelectPopup.jsp
@@ -0,0 +1,324 @@
+<%@ 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" %>
+
+
+
+
+<%=Constants.SYSTEM_NAME%>
+
+
+
+
+
+
+
+
diff --git a/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp b/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp
index ea6c570..d467ff0 100644
--- a/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp
+++ b/WebContent/WEB-INF/view/productionplanning/mBomMgmtList.jsp
@@ -200,12 +200,13 @@ var columns = [
field: 'EBOM_STATUS',
formatter: fnc_subInfoValueFormatter,
cellClick: function(e, cell) {
- var objid = fnc_checkNull(cell.getData().BOM_REPORT_OBJID);
- if(objid) {
- fn_openEBomPopup(objid);
- } else {
- alert("E-BOM 정보가 없습니다.");
- }
+ var bomReportObjid = fnc_checkNull(cell.getData().BOM_REPORT_OBJID);
+ var projectMgmtObjid = fnc_checkNull(cell.getData().OBJID);
+ var partNo = fnc_checkNull(cell.getData().PART_NO);
+ var partName = fnc_checkNull(cell.getData().PART_NAME);
+
+ // E-BOM이 있든 없든 선택 팝업 열기 (할당된 경우 상세 + 변경 가능)
+ fn_openEBomSelectPopup(projectMgmtObjid, partNo, partName, bomReportObjid);
}
},
@@ -264,6 +265,22 @@ function fn_openEBomPopup(bomReportObjId) {
fn_centerPopup(popup_width, popup_height, url, 'ebomPopup');
}
+// E-BOM 선택 팝업
+function fn_openEBomSelectPopup(projectMgmtObjid, partNo, partName, bomReportObjid) {
+ var popup_width = 1200;
+ var popup_height = 900;
+ var url = "/productionplanning/mBomEbomSelectPopup.do?projectMgmtObjid=" + projectMgmtObjid
+ + "&partNo=" + encodeURIComponent(partNo)
+ + "&partName=" + encodeURIComponent(partName);
+
+ // 이미 할당된 E-BOM이 있으면 bomReportObjid 추가
+ if(bomReportObjid) {
+ url += "&bomReportObjid=" + bomReportObjid;
+ }
+
+ fn_centerPopup(popup_width, popup_height, url, 'ebomSelectPopup');
+}
+
// M-BOM 팝업
function fn_openMBomPopup(objId) {
var popup_width = 1800;
diff --git a/src/com/pms/controller/ProductionPlanningController.java b/src/com/pms/controller/ProductionPlanningController.java
index ac993b2..8de2da3 100644
--- a/src/com/pms/controller/ProductionPlanningController.java
+++ b/src/com/pms/controller/ProductionPlanningController.java
@@ -904,4 +904,70 @@ public class ProductionPlanningController extends BaseService {
commonService.selectListPagingNew("productionplanning.mBomMgmtGridList", request, paramMap);
return paramMap;
}
+
+ /**
+ * M-BOM E-BOM 선택 팝업
+ * @param request
+ * @param paramMap
+ * @return
+ */
+ @RequestMapping("/productionplanning/mBomEbomSelectPopup.do")
+ public String mBomEbomSelectPopup(HttpServletRequest request, @RequestParam Map paramMap) {
+ try {
+ // 필요한 코드 맵 설정 (structureList.jsp 참고)
+ Map codeMap = new HashMap<>();
+ // 제품구분 코드 - structureList와 동일하게 설정
+ codeMap.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product_cd")), "common.getCodeselect"));
+ request.setAttribute("code_map", codeMap);
+
+ // 현재 할당된 E-BOM 정보 조회
+ String bomReportObjid = CommonUtils.checkNull(paramMap.get("bomReportObjid"));
+ if(!"".equals(bomReportObjid)) {
+ // E-BOM 정보 조회
+ Map ebomInfo = productionPlanningService.getEbomInfo(bomReportObjid);
+ request.setAttribute("currentEbom", ebomInfo);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ return "/productionplanning/mBomEbomSelectPopup";
+ }
+
+ /**
+ * E-BOM을 M-BOM(PROJECT_MGMT)에 할당
+ * @param request
+ * @param paramMap
+ * @return
+ */
+ @ResponseBody
+ @RequestMapping("/productionplanning/assignEbomToMbom.do")
+ public Map assignEbomToMbom(HttpServletRequest request, @RequestParam Map paramMap) {
+ Map resultMap = new HashMap<>();
+ try {
+ String projectMgmtObjid = CommonUtils.checkNull(paramMap.get("projectMgmtObjid"));
+ String bomReportObjid = CommonUtils.checkNull(paramMap.get("bomReportObjid"));
+
+ if(projectMgmtObjid.isEmpty() || bomReportObjid.isEmpty()) {
+ resultMap.put("success", false);
+ resultMap.put("message", "필수 파라미터가 누락되었습니다.");
+ return resultMap;
+ }
+
+ // PROJECT_MGMT 테이블의 PART_OBJID 업데이트
+ int updateResult = productionPlanningService.assignEbomToProject(projectMgmtObjid, bomReportObjid);
+
+ 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 58fd9e1..2edcdb4 100644
--- a/src/com/pms/mapper/productionplanning.xml
+++ b/src/com/pms/mapper/productionplanning.xml
@@ -2928,7 +2928,7 @@
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = PM.CONTRACT_OBJID
AND CI.PART_OBJID = PM.PART_OBJID
- AND CI.STATUS = 'ACTIVE'),
+ AND CI.STATUS = 'ACTIVE' LIMIT 1),
PM.DUE_DATE,
CM.req_del_date
) AS REQ_DEL_DATE,
@@ -2938,19 +2938,31 @@
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = PM.CONTRACT_OBJID
AND CI.PART_OBJID = PM.PART_OBJID
- AND CI.STATUS = 'ACTIVE'),
+ AND CI.STATUS = 'ACTIVE' LIMIT 1),
''
) AS CUSTOMER_REQUEST,
- PBR.OBJID AS BOM_REPORT_OBJID,
- COALESCE(PBR.STATUS, '') AS EBOM_STATUS,
- COALESCE(TO_CHAR(PBR.REGDATE, 'YYYY-MM-DD'), '') AS EBOM_REGDATE,
+ -- E-BOM 정보: PM.PART_OBJID가 E-BOM OBJID를 직접 가리킴
+ PM.PART_OBJID AS BOM_REPORT_OBJID,
+ COALESCE(
+ (SELECT PBR.STATUS
+ FROM PART_BOM_REPORT PBR
+ WHERE PBR.OBJID::VARCHAR = PM.PART_OBJID
+ LIMIT 1),
+ ''
+ ) AS EBOM_STATUS,
+ COALESCE(
+ (SELECT TO_CHAR(PBR.REGDATE, 'YYYY-MM-DD')
+ FROM PART_BOM_REPORT PBR
+ WHERE PBR.OBJID::VARCHAR = PM.PART_OBJID
+ LIMIT 1),
+ ''
+ ) AS EBOM_REGDATE,
COALESCE(PM.MBOM_STATUS, '') AS MBOM_STATUS,
'1.0' AS MBOM_VERSION,
TO_CHAR(PM.REGDATE, 'YYYY-MM-DD') AS MBOM_REGDATE
FROM
PROJECT_MGMT PM
LEFT JOIN CONTRACT_MGMT CM ON PM.CONTRACT_OBJID = CM.OBJID
- LEFT JOIN PART_BOM_REPORT PBR ON PM.CONTRACT_OBJID = PBR.CONTRACT_OBJID::VARCHAR
WHERE 1=1
AND PM.PROJECT_NO IS NOT NULL
AND PM.PROJECT_NO != ''
@@ -2964,4 +2976,31 @@
ORDER BY PM.REGDATE DESC
+
+
+
+ UPDATE PROJECT_MGMT
+ SET
+ PART_OBJID = #{bomReportObjid}
+ WHERE OBJID = #{projectMgmtObjid}
+
+
+
+
diff --git a/src/com/pms/service/ProductionPlanningService.java b/src/com/pms/service/ProductionPlanningService.java
index b5d623f..3f3f063 100644
--- a/src/com/pms/service/ProductionPlanningService.java
+++ b/src/com/pms/service/ProductionPlanningService.java
@@ -692,4 +692,61 @@ public class ProductionPlanningService {
}
return resultMap;
}
+
+ /**
+ * E-BOM을 PROJECT_MGMT에 할당
+ * @param projectMgmtObjid
+ * @param bomReportObjid
+ * @return
+ * @throws Exception
+ */
+ public int assignEbomToProject(String projectMgmtObjid, String bomReportObjid) throws Exception {
+ SqlSession sqlSession = null;
+ try {
+ sqlSession = SqlMapConfig.getInstance().getSqlSession();
+
+ Map paramMap = new HashMap<>();
+ paramMap.put("projectMgmtObjid", projectMgmtObjid);
+ paramMap.put("bomReportObjid", bomReportObjid);
+
+ int result = sqlSession.update("productionplanning.assignEbomToProject", 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
+ * @return
+ */
+ public Map getEbomInfo(String bomReportObjid) {
+ Map resultMap = new HashMap<>();
+ SqlSession sqlSession = null;
+
+ try {
+ sqlSession = SqlMapConfig.getInstance().getSqlSession();
+ Map paramMap = new HashMap<>();
+ paramMap.put("objid", bomReportObjid);
+ resultMap = sqlSession.selectOne("productionplanning.getEbomInfo", paramMap);
+ } catch(Exception e) {
+ e.printStackTrace();
+ } finally {
+ if(sqlSession != null) {
+ sqlSession.close();
+ }
+ }
+
+ return resultMap;
+ }
}