품의서 개발 & DB에 저장된 메뉴명 표시

This commit is contained in:
2025-11-27 17:26:06 +09:00
parent 25ddce6480
commit ef9a6d2ac1
9 changed files with 722 additions and 121 deletions

View File

@@ -23,32 +23,9 @@ try {
sqlSession.close();
}
// 메뉴 이름 조회
// 메뉴 이름 조회 (공통 유틸 사용)
String menuObjId = request.getParameter("menuObjId");
if(menuObjId != null && !menuObjId.isEmpty()) {
org.apache.ibatis.session.SqlSession sqlSession = com.pms.common.SqlMapConfig.getInstance().getSqlSession();
java.util.Map<String, Object> menuParam = new java.util.HashMap<String, Object>();
menuParam.put("OBJID", menuObjId);
java.util.Map menuInfo = (java.util.Map)sqlSession.selectOne("admin.selectMenuInfo", menuParam);
if(menuInfo != null && menuInfo.get("MENU_NAME_KOR") != null) {
// 상위 메뉴 이름 조회
String parentObjId = CommonUtils.checkNull(menuInfo.get("PARENT_OBJ_ID"));
if(!parentObjId.isEmpty() && !"0".equals(parentObjId)) {
menuParam.put("OBJID", parentObjId);
java.util.Map parentMenuInfo = (java.util.Map)sqlSession.selectOne("admin.selectMenuInfo", menuParam);
if(parentMenuInfo != null && parentMenuInfo.get("MENU_NAME_KOR") != null) {
menuName = CommonUtils.checkNull(parentMenuInfo.get("MENU_NAME_KOR")) + "_" + CommonUtils.checkNull(menuInfo.get("MENU_NAME_KOR"));
} else {
menuName = CommonUtils.checkNull(menuInfo.get("MENU_NAME_KOR"));
}
} else {
menuName = CommonUtils.checkNull(menuInfo.get("MENU_NAME_KOR"));
}
}
sqlSession.close();
}
menuName = CommonUtils.getMenuName(menuObjId, menuName);
} catch(Exception e) {
e.printStackTrace();
}

View File

@@ -4,12 +4,25 @@
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<%
// DB에서 메뉴명 조회 (공통 유틸 사용)
String menuObjId = request.getParameter("menuObjId");
String menuName = CommonUtils.getMenuName(menuObjId, "생산관리_M-BOM관리");
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<style>
body, html {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script type="text/javascript" src="/js/tabulator/tabulator_custom.js"></script>
<style>
/* 체크박스 컬럼 오른쪽에 얇은 구분선 추가 (데이터 행만) */
@@ -611,7 +624,7 @@ function fn_openPurchaseListPopup() {
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span>생산관리_M-BOM관리</span>
<span><%=menuName%></span>
</h2>
<div class="btnArea">
<input type="button" class="plm_btns" value="조회" id="btnSearch">

View File

@@ -6,12 +6,23 @@
<%@include file= "/init.jsp" %>
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<%
// DB에서 메뉴명 조회 (공통 유틸 사용)
String menuObjId = request.getParameter("menuObjId");
String menuName = CommonUtils.getMenuName(menuObjId, "기본메뉴명");
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<style>
body, html {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.pmsPopupForm tr:last-child td {
border-bottom: none;
}
@@ -50,6 +61,15 @@
var _tabulGrid;
$(document).ready(function(){
// DOM 렌더링 완료 후 그리드 높이 계산
setTimeout(function() {
fnc_calculateContentHeight("gridDiv", 10);
}, 100);
$(window).resize(function() {
fnc_calculateContentHeight("gridDiv", 10);
});
$('.select2').select2();
$("input[type=text]").keyup(function(e){
@@ -125,14 +145,11 @@ $(document).ready(function(){
var columns = [
{title:'OBJID', field:'OBJID', visible: false},
{title:'STATUS', field:'STATUS', visible: false},
{headerHozAlign:'center', hozAlign:'left', title:"품의서 No", field:"PROPOSAL_NO", widthGrow:1.2, frozen:true,
cellClick: function(e, cell){
var objId = cell.getData().OBJID;
fn_openProposalFormPopUp(objId);
},
formatter: function(cell){
return '<a href="#" style="color:#0066cc; text-decoration:underline;">' + fnc_checkNull(cell.getValue()) + '</a>';
}
{headerHozAlign:'center', hozAlign:'center', title:"품의서 No", field:"PROPOSAL_NO", widthGrow:1.2, frozen:true,
formatter: fnc_createGridAnchorTag,
cellClick : function(e, cell) {
fn_openProposalFormPopUp(cell.getData().OBJID);
}
},
{headerHozAlign:'center', hozAlign:'left', title:"프로젝트번호", field:"PROJECT_NUMBER", widthGrow:1.3},
{headerHozAlign:'center', hozAlign:'center', title:"구매유형", field:"PURCHASE_TYPE_NAME", widthGrow:1.0},
@@ -175,15 +192,15 @@ function fn_openProposalFormPopUp(objId){
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span>구매관리_품의서관리</span>
<span><%=menuName%></span>
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="결재상신" class="plm_btns" id="btnApproval" style="background:#17a2b8; color:white;">
<input type="button" value="발주서생성" class="plm_btns" id="btnCreatePO" style="background:#28a745; color:white;">
<%-- <input type="button" value="초기화" class="plm_btns" id="btnReset">
<input type="button" value="엑셀 다운로드" class="plm_btns" id="btnExcel"> --%>
</div>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="결재상신" class="plm_btns" id="btnApproval" style="background:#17a2b8; color:white;">
<input type="button" value="발주서생성" class="plm_btns" id="btnCreatePO" style="background:#28a745; color:white;">
<%-- <input type="button" value="초기화" class="plm_btns" id="btnReset">
<input type="button" value="엑셀 다운로드" class="plm_btns" id="btnExcel"> --%>
</div>
</div>
<div id="plmSearchZon">
<table>

View File

@@ -722,15 +722,10 @@ function fn_save() {
}
// 품의서작성일 자동 설정 (현재 날짜)
var today = new Date();
var proposalDate = today.getFullYear() + '-' +
String(today.getMonth() + 1).padStart(2, '0') + '-' +
String(today.getDate()).padStart(2, '0');
gridData.forEach(function(item) {
if(!item.PROPOSAL_DATE) {
item.PROPOSAL_DATE = proposalDate;
}
// PROPOSAL_DATE는 품의서 생성 시에만 자동 설정되므로 여기서는 제거
// (기존에 저장된 값이 있으면 유지, 없으면 NULL로 유지)
// 사용여부 변환: 사용/미사용 → Y/N
if(item.USE_YN === '사용') {
item.USE_YN = 'Y';

View File

@@ -5,6 +5,11 @@
<%@include file= "/init.jsp" %>
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<%
// DB에서 메뉴명 조회 (공통 유틸 사용)
String menuObjId = request.getParameter("menuObjId");
String menuName = CommonUtils.getMenuName(menuObjId, "기본메뉴명");
%>
<!DOCTYPE html>
<html>
<head>
@@ -103,57 +108,10 @@ $(document).ready(function(){
fn_openSalesRequestFormPopUp("");
});
//품의서 생성 (TODO: 품의서 생성 기능 구현 필요 - 기존 발주서 작성 기능과 다름)
/*
// 품의서 생성
$("#btnReg").click(function(){
var selectedRowIds = _tabulGrid.getSelectedData();
console.log(selectedRowIds);
if(selectedRowIds.length==0){
Swal.fire("품의서 생성할 행을 선택해주십시오.");
return false;
}
var targetStatus = fnc_checkNull(selectedRowIds[0].STATUS_TITLE);
if(targetStatus != "접수"){
Swal.fire("접수 상태일 경우 품의서 생성이 가능합니다.");
return false;
}
//var sales_request_objId = fnc_checkNull(selectedRowIds[0].OBJID);
//fn_formPopUp("",sales_request_objId);
Swal.fire({
title: '품의서를 생성 하시겠습니까?',
text: '',
icon: 'warning',
showCancelButton: true, // cancel버튼 보이기. 기본은 원래 없음
confirmButtonColor: '#3085d6', // confrim 버튼 색깔 지정
cancelButtonColor: '#d33', // cancel 버튼 색깔 지정
confirmButtonText: '확인', // confirm 버튼 텍스트 지정
cancelButtonText: '취소', // cancel 버튼 텍스트 지정
reverseButtons: false, // 버튼 순서 거꾸로
}).then(result => {
// 만약 Promise리턴을 받으면,
if (result.isConfirmed) { // 만약 모달창에서 confirm 버튼을 눌렀다면
$.ajax({
url:"/purchaseOrder/purchaseOrder_salesRequest_Save.do"
,type:"POST"
,data: $("#form1").serialize() + "&jqGrid="+ encodeURIComponent(JSON.stringify(selectedRowIds))
,dataType:"json"
,success:function(data){
if(data =="SUCCESS"){
alert("저장되었습니다.");
};
fn_search();
}
,error: function(jqxhr, status, error){
}
});
}
});
fn_createProposal();
});
*/
$("#btnOrderBOMReg").click(function(){
fn_salesRequestTargetBOMListPopUp();
@@ -478,6 +436,139 @@ function fn_formPopUp(objId,sales_request_objid){
hiddenForm.target = target;
hiddenForm.submit(); */
}
/**
* 품의서 생성 함수
* - 선택된 구매요청서에서 단가가 입력된 품목만 필터링
* - 이미 품의서가 생성된 품목은 제외
* - 하나의 품의서로 생성
*/
function fn_createProposal() {
// 1. 선택된 행 확인
var selectedRows = _tabulGrid.getSelectedData();
if(selectedRows.length == 0) {
Swal.fire({
title: '알림',
text: '품의서를 생성할 구매요청서를 선택해주세요.',
icon: 'info'
});
return;
}
if(selectedRows.length > 1) {
Swal.fire({
title: '알림',
text: '한 번에 하나의 구매요청서만 선택해주세요.',
icon: 'info'
});
return;
}
var selectedRow = selectedRows[0];
var salesRequestObjid = fnc_checkNull(selectedRow.OBJID);
// 2. 구매요청서의 품목 중 단가가 입력되고 품의서 미생성된 품목 조회
$.ajax({
url: "/salesMng/getProposalTargetParts.do",
type: "POST",
data: {
SALES_REQUEST_MASTER_OBJID: salesRequestObjid
},
dataType: "json",
success: function(response) {
if(response.resultFlag === "S") {
var targetParts = response.data;
// 3. 대상 품목 확인
if(!targetParts || targetParts.length == 0) {
Swal.fire({
title: '알림',
text: '품의서를 생성할 품목이 없습니다.\n(단가가 입력되고 품의서가 생성되지 않은 품목만 대상)',
icon: 'info'
});
return;
}
// 4. 품의서 생성 확인
var partCount = targetParts.length;
var partList = targetParts.map(function(part) {
return '- ' + fnc_checkNull(part.PART_NO) + ' / ' + fnc_checkNull(part.PART_NAME);
}).join('\n');
Swal.fire({
title: '품의서 생성',
html: '<div style="text-align:left;">' +
'<p>총 <strong>' + partCount + '건</strong>의 품목으로 품의서를 생성합니다.</p>' +
'<div style="max-height:200px; overflow-y:auto; border:1px solid #ddd; padding:10px; margin-top:10px; font-size:12px;">' +
partList +
'</div>' +
'</div>',
icon: 'question',
showCancelButton: true,
confirmButtonText: '생성',
cancelButtonText: '취소'
}).then((result) => {
if (result.isConfirmed) {
fn_executeCreateProposal(salesRequestObjid, targetParts);
}
});
} else {
Swal.fire({
title: '오류',
text: response.message || '품목 조회 중 오류가 발생했습니다.',
icon: 'error'
});
}
},
error: function(xhr, status, error) {
Swal.fire({
title: '오류',
text: '서버 통신 중 오류가 발생했습니다.22',
icon: 'error'
});
}
});
}
/**
* 품의서 생성 실행
*/
function fn_executeCreateProposal(salesRequestObjid, targetParts) {
$.ajax({
url: "/salesMng/createProposalFromPurchaseList.do",
type: "POST",
data: {
SALES_REQUEST_MASTER_OBJID: salesRequestObjid,
TARGET_PARTS: JSON.stringify(targetParts)
},
dataType: "json",
success: function(response) {
if(response.resultFlag === "S") {
Swal.fire({
title: '생성 완료',
text: '품의서가 생성되었습니다.\n품의서 관리에서 확인하세요.',
icon: 'success'
}).then(() => {
fn_search(); // 목록 새로고침
});
} else {
Swal.fire({
title: '오류',
text: response.message || '품의서 생성 중 오류가 발생했습니다.',
icon: 'error'
});
}
},
error: function(xhr, status, error) {
Swal.fire({
title: '오류',
text: '서버 통신 중 오류가 발생했습니다.',
icon: 'error'
});
}
});
}
</script>
</head>
<body class="backcolor">
@@ -491,7 +582,7 @@ function fn_formPopUp(objId,sales_request_objid){
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span>구매관리_구매리스트관리</span>
<span><%=menuName%></span>
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">