From bbc4474d55f037722370a14db02fc3eb187f7cdf Mon Sep 17 00:00:00 2001 From: hjjeong Date: Fri, 19 Dec 2025 15:19:40 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=9D=EC=82=B0=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=83=9D=EC=82=B0=EA=B3=84=ED=9A=8D=20=EC=99=84=EC=84=B1,=20?= =?UTF-8?q?=EC=8B=A4=EC=A0=81=EA=B4=80=EB=A6=AC=EB=8A=94=20=ED=8B=80?= =?UTF-8?q?=EB=A7=8C..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../productionplanning/prodPlanFormPopup.jsp | 62 ++-- .../prodPlanResultMgmtList.jsp | 40 +-- .../prodResultFormPopup.jsp | 302 ++++++++++++++++++ WebContent/css/basic_new.css | 2 +- .../ProductionPlanningController.java | 56 ++++ src/com/pms/mapper/productionplanning.xml | 282 ++++++++++------ .../service/ProductionPlanningService.java | 69 ++++ 7 files changed, 676 insertions(+), 137 deletions(-) create mode 100644 WebContent/WEB-INF/view/productionplanning/prodResultFormPopup.jsp diff --git a/WebContent/WEB-INF/view/productionplanning/prodPlanFormPopup.jsp b/WebContent/WEB-INF/view/productionplanning/prodPlanFormPopup.jsp index 6cccde9..e164789 100644 --- a/WebContent/WEB-INF/view/productionplanning/prodPlanFormPopup.jsp +++ b/WebContent/WEB-INF/view/productionplanning/prodPlanFormPopup.jsp @@ -44,6 +44,8 @@ $(function(){ $("#PROJECT_NO").on("change select2:select", function(){ var projectObjid = $(this).val(); console.log("프로젝트번호 변경됨:", projectObjid); + // PROJECT_OBJID hidden 필드에도 값 설정 + $("#PROJECT_OBJID").val(projectObjid); if(fnc_checkNull(projectObjid) != ""){ fn_loadProjectInfo(projectObjid); } else { @@ -113,11 +115,25 @@ function fn_loadProjectInfo(projectObjid){ $("#CATEGORY_CODE").val(info.category_code).trigger("change.select2"); } - // 고객사 (C_ 접두어 제거) + // 고객사 설정 (C_ 접두어 유무 모두 시도) if(fnc_checkNull(info.customer_objid) != ""){ - var customerObjid = info.customer_objid.replace("C_", ""); - console.log("고객사 설정:", customerObjid); - $("#CUSTOMER_OBJID").val(customerObjid).trigger("change.select2"); + var customerObjid = info.customer_objid; + console.log("고객사 원본값:", customerObjid); + + // 먼저 원본값으로 시도 + $("#CUSTOMER_OBJID").val(customerObjid); + if($("#CUSTOMER_OBJID").val() != customerObjid) { + // C_ 제거 후 시도 + customerObjid = info.customer_objid.replace("C_", ""); + $("#CUSTOMER_OBJID").val(customerObjid); + } + if($("#CUSTOMER_OBJID").val() != customerObjid) { + // C_ 추가 후 시도 + customerObjid = "C_" + info.customer_objid.replace("C_", ""); + $("#CUSTOMER_OBJID").val(customerObjid); + } + console.log("고객사 최종설정:", $("#CUSTOMER_OBJID").val()); + $("#CUSTOMER_OBJID").trigger("change.select2"); } // 품번 @@ -166,11 +182,21 @@ function fn_clearProjectInfo(){ // 기존 데이터 로드 (수정 모드) function fn_loadExistingData(){ - // JSP EL로 기존 데이터 설정 + // JSP EL로 기존 데이터 설정 (resultMap 키는 소문자) <% if(info != null) { %> - $("#PRODUCT_CODE").val("${resultMap.PRODUCT_CODE}").trigger("change"); - $("#CATEGORY_CODE").val("${resultMap.CATEGORY_CODE}").trigger("change"); - $("#CUSTOMER_OBJID").val("${resultMap.CUSTOMER_OBJID}").trigger("change"); + // 프로젝트번호 설정 + var projectObjid = "${resultMap.project_objid}"; + if(projectObjid) { + $("#PROJECT_NO").val(projectObjid).trigger("change.select2"); + } + // 제품구분 + $("#PRODUCT_CODE").val("${resultMap.product_code}").trigger("change.select2"); + // 주문유형 + $("#CATEGORY_CODE").val("${resultMap.category_code}").trigger("change.select2"); + // 생산유형 + $("#PRODUCTION_TYPE").val("${resultMap.production_type}").trigger("change.select2"); + // 고객사 + $("#CUSTOMER_OBJID").val("${resultMap.customer_objid}").trigger("change.select2"); fn_calcTotalQty(); <% } %> } @@ -254,8 +280,8 @@ function fn_save(){
- - + +
@@ -319,7 +345,7 @@ function fn_save(){ - + @@ -327,15 +353,15 @@ function fn_save(){ - + - + - + @@ -343,15 +369,15 @@ function fn_save(){ - + - + - + @@ -359,7 +385,7 @@ function fn_save(){ - + diff --git a/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtList.jsp b/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtList.jsp index 4a25b1a..08506c3 100644 --- a/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtList.jsp +++ b/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtList.jsp @@ -244,11 +244,9 @@ var columns = [ width: 80, title: '완조립', field: 'ASSEMBLY_QTY', - formatter:fnc_createGridAnchorTag, + formatter: fnc_createGridAnchorTag, cellClick: function(e, cell) { - if(cell.getValue() > 0) { - fn_openQtyDetailPopup(cell.getData().OBJID, 'ASSEMBLY'); - } + fn_openProdResultPopup(cell.getData().OBJID, 'ASSEMBLY'); } }, @@ -259,11 +257,9 @@ var columns = [ width: 70, title: '검사', field: 'INSPECTION_QTY', - formatter:fnc_createGridAnchorTag, + formatter: fnc_createGridAnchorTag, cellClick: function(e, cell) { - if(cell.getValue() > 0) { - fn_openQtyDetailPopup(cell.getData().OBJID, 'INSPECTION'); - } + fn_openProdResultPopup(cell.getData().OBJID, 'INSPECTION'); } }, @@ -274,11 +270,9 @@ var columns = [ width: 90, title: '출하대기', field: 'SHIP_WAIT_QTY', - formatter:fnc_createGridAnchorTag, + formatter: fnc_createGridAnchorTag, cellClick: function(e, cell) { - if(cell.getValue() > 0) { - fn_openQtyDetailPopup(cell.getData().OBJID, 'SHIP_WAIT'); - } + fn_openProdResultPopup(cell.getData().OBJID, 'SHIP_WAIT'); } }, @@ -332,7 +326,7 @@ function fn_createProdPlan() { var checkedRows = getCheckedRows(); var popup_width = 900; - var popup_height = 500; + var popup_height = 400; var url = "/productionplanning/prodPlanFormPopup.do"; if(checkedRows.length === 1) { @@ -399,18 +393,16 @@ function fn_registProdResult() { } var rowData = checkedRows[0]; - var popup_width = 1000; - var popup_height = 700; - var url = "/productionplanning/prodResultFormPopup.do?projectObjid=" + rowData.OBJID; - fn_centerPopup(popup_width, popup_height, url, 'prodResultPopup'); + // 실적유형 선택 없이 팝업 열기 (팝업에서 선택 가능) + fn_openProdResultPopup(rowData.OBJID, ''); } -// 수량 상세 팝업 (완조립, 검사, 출하대기 클릭 시) -function fn_openQtyDetailPopup(projectObjid, qtyType) { - var popup_width = 800; - var popup_height = 500; - var url = "/productionplanning/prodQtyDetailPopup.do?projectObjid=" + projectObjid + "&qtyType=" + qtyType; - fn_centerPopup(popup_width, popup_height, url, 'qtyDetailPopup'); +// 생산실적 등록/수정 팝업 (완조립, 검사, 출하대기 클릭 시) +function fn_openProdResultPopup(projectObjid, resultType) { + var popup_width = 1000; + var popup_height = 700; + var url = "/productionplanning/prodResultFormPopup.do?projectObjid=" + projectObjid + "&resultType=" + resultType; + fn_centerPopup(popup_width, popup_height, url, 'prodResultPopup'); } // 선택된 행 가져오기 (Tabulator 선택 기능 사용) @@ -440,7 +432,7 @@ function getCheckedRows() {
- +
diff --git a/WebContent/WEB-INF/view/productionplanning/prodResultFormPopup.jsp b/WebContent/WEB-INF/view/productionplanning/prodResultFormPopup.jsp new file mode 100644 index 0000000..105b8a3 --- /dev/null +++ b/WebContent/WEB-INF/view/productionplanning/prodResultFormPopup.jsp @@ -0,0 +1,302 @@ +<%@ 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_new.jsp" %> + + + + + + +<%=Constants.SYSTEM_NAME%> + + + + + + + + + +
+
+

+ 생산실적 등록/수정 +

+
+ + +
+ + + + + + + + + + + +
프로젝트:-품번:-품명:-수주수량:-
+
+ +
+

실적 목록

+
+ + + + +
+
+ +
+
+ + + diff --git a/WebContent/css/basic_new.css b/WebContent/css/basic_new.css index 68d1f97..05dfad6 100644 --- a/WebContent/css/basic_new.css +++ b/WebContent/css/basic_new.css @@ -27,7 +27,7 @@ /* 기본 바디 스타일 - 깔끔한 배경 */ body { background: var(--background); - min-height: 100vh; + /* min-height: 100vh; */ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, 'Helvetica Neue', Arial, sans-serif; color: var(--text-primary); line-height: 1.6; diff --git a/src/com/pms/controller/ProductionPlanningController.java b/src/com/pms/controller/ProductionPlanningController.java index e4e6225..41b40c5 100644 --- a/src/com/pms/controller/ProductionPlanningController.java +++ b/src/com/pms/controller/ProductionPlanningController.java @@ -1788,4 +1788,60 @@ public class ProductionPlanningController extends BaseService { return resultMap; } + /** + * 생산실적 등록/수정 팝업 + */ + @RequestMapping("/productionplanning/prodResultFormPopup.do") + public String prodResultFormPopup(HttpServletRequest request, @RequestParam Map paramMap) { + return "/productionplanning/prodResultFormPopup"; + } + + /** + * 생산실적 목록 조회 + */ + @ResponseBody + @RequestMapping("/productionplanning/getProdResultList.do") + public Map getProdResultList(HttpServletRequest request, @RequestParam Map paramMap) { + Map resultMap = new HashMap(); + try { + List list = productionPlanningService.getProdResultList(paramMap); + resultMap.put("result", "success"); + resultMap.put("list", list); + } catch(Exception e) { + e.printStackTrace(); + resultMap.put("result", "fail"); + resultMap.put("msg", "조회 실패"); + } + return resultMap; + } + + /** + * 생산실적 저장 (JSON) + */ + @ResponseBody + @RequestMapping(value="/productionplanning/saveProdResultList.do", produces="application/json;charset=UTF-8") + public Map saveProdResultList(HttpServletRequest request, @RequestBody Map paramMap) { + Map resultMap = new HashMap(); + try { + HttpSession session = request.getSession(); + PersonBean person = (PersonBean) session.getAttribute(Constants.PERSON_BEAN); + paramMap.put("userId", person.getUserId()); + paramMap.put("userName", person.getUserName()); + + boolean success = productionPlanningService.saveProdResultList(paramMap); + if(success) { + resultMap.put("result", "success"); + resultMap.put("msg", "저장되었습니다."); + } else { + resultMap.put("result", "fail"); + resultMap.put("msg", "저장에 실패했습니다."); + } + } catch(Exception e) { + e.printStackTrace(); + resultMap.put("result", "fail"); + resultMap.put("msg", "저장 중 오류가 발생했습니다."); + } + return resultMap; + } + } diff --git a/src/com/pms/mapper/productionplanning.xml b/src/com/pms/mapper/productionplanning.xml index cb0e8d0..33ea7d3 100644 --- a/src/com/pms/mapper/productionplanning.xml +++ b/src/com/pms/mapper/productionplanning.xml @@ -4406,134 +4406,161 @@ @@ -4650,4 +4677,71 @@ WHERE OBJID = #{OBJID} + + + + + + INSERT INTO PRODUCTION_RESULT ( + OBJID, + PROJECT_OBJID, + RESULT_TYPE, + RESULT_DATE, + RESULT_QTY, + SERIAL_NO, + WORKER_ID, + WORKER_NAME, + REMARK, + STATUS, + REGDATE, + WRITER + ) VALUES ( + #{OBJID}, + #{PROJECT_OBJID}, + #{RESULT_TYPE}, + #{RESULT_DATE}, + #{RESULT_QTY}, + #{SERIAL_NO}, + #{userId}, + #{WORKER_NAME}, + #{REMARK}, + 'active', + NOW(), + #{userId} + ) + + + + + UPDATE PRODUCTION_RESULT SET + RESULT_TYPE = #{RESULT_TYPE}, + RESULT_DATE = #{RESULT_DATE}, + RESULT_QTY = #{RESULT_QTY}, + SERIAL_NO = #{SERIAL_NO}, + WORKER_NAME = #{WORKER_NAME}, + REMARK = #{REMARK}, + MODDATE = NOW(), + MODIFIER = #{userId} + WHERE OBJID = #{OBJID} + + diff --git a/src/com/pms/service/ProductionPlanningService.java b/src/com/pms/service/ProductionPlanningService.java index 26e6e26..fea250b 100644 --- a/src/com/pms/service/ProductionPlanningService.java +++ b/src/com/pms/service/ProductionPlanningService.java @@ -1758,4 +1758,73 @@ public class ProductionPlanningService { return result; } + + /** + * 생산실적 목록 조회 + */ + public List getProdResultList(Map paramMap) { + List resultList = new ArrayList(); + SqlSession sqlSession = null; + + try { + sqlSession = SqlMapConfig.getInstance().getSqlSession(); + resultList = sqlSession.selectList("productionplanning.getProdResultList", paramMap); + } catch(Exception e) { + e.printStackTrace(); + } finally { + if(sqlSession != null) { + sqlSession.close(); + } + } + + return resultList; + } + + /** + * 생산실적 저장 (리스트) + */ + @SuppressWarnings("unchecked") + public boolean saveProdResultList(Map paramMap) { + boolean result = false; + SqlSession sqlSession = null; + + try { + sqlSession = SqlMapConfig.getInstance().getSqlSession(); + + String projectObjid = CommonUtils.nullToEmpty((String)paramMap.get("projectObjid")); + String userId = CommonUtils.nullToEmpty((String)paramMap.get("userId")); + List> resultList = (List>)paramMap.get("resultList"); + + if(resultList != null && resultList.size() > 0) { + for(Map row : resultList) { + row.put("PROJECT_OBJID", projectObjid); + row.put("userId", userId); + + String objid = CommonUtils.nullToEmpty((String)row.get("OBJID")); + if("".equals(objid)) { + // 신규 등록 + row.put("OBJID", CommonUtils.createObjId()); + sqlSession.insert("productionplanning.insertProdResult", row); + } else { + // 수정 + sqlSession.update("productionplanning.updateProdResult", row); + } + } + } + + sqlSession.commit(); + result = true; + } catch(Exception e) { + e.printStackTrace(); + if(sqlSession != null) { + sqlSession.rollback(); + } + } finally { + if(sqlSession != null) { + sqlSession.close(); + } + } + + return result; + } }