소재관리

This commit is contained in:
2025-12-02 17:04:04 +09:00
parent 59f883b711
commit 8eb7e2cbd0
4 changed files with 581 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<%
String material_name = CommonUtils.checkNull(request.getParameter("material_name"));
String material_code = CommonUtils.checkNull(request.getParameter("material_code"));
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<!-- JSTL 변수선언 -->
<c:set var="totalCount" value="${empty TOTAL_COUNT?0:TOTAL_COUNT}" />
<c:set var="maxPage" value="${empty MAX_PAGE_SIZE?1:MAX_PAGE_SIZE}" />
<c:set var="nPage" value="${empty param.page?1:param.page}" />
<c:set var="pageIndex" value="${(nPage-1)/10}" />
<c:set var="nextPage" value="${empty NEXT_PAGE?1:NEXT_PAGE}" />
<c:set var="prevPage" value="${empty PREV_PAGE?1:PREV_PAGE}" />
<script>
$(document).ready(function(){
fnc_datepick();
// 엔터키로 조회
$("input").keyup(function(e){
if(e.keyCode == 13){
$("#page").val("1");
fn_search();
}
});
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
// 삭제
$("#btnDelete").click(function(){
fn_delete();
});
fn_search();
});
</script>
<script type="text/javascript">
var columns = [
{title:'OBJID', field:'OBJID', visible:false},
{headerHozAlign:'center', hozAlign:'center', width:'80', title:'NO', field:'RNUM'},
{headerHozAlign:'center', hozAlign:'left', width:'150', title:'소재', field:'MATERIAL_CODE',
formatter: fnc_createGridAnchorTag,
cellClick: function(e, cell) {
var objid = fnc_checkNull(cell.getData().OBJID);
openMaterialPopUp(objid);
}
},
{headerHozAlign:'center', hozAlign:'left', width:'200', title:'소재명', field:'MATERIAL_NAME'},
{headerHozAlign:'center', hozAlign:'left', width:'200', title:'사이즈', field:'SIZE_SPEC'},
{headerHozAlign:'center', hozAlign:'left', width:'200', title:'소재품번', field:'MATERIAL_PART_NO'},
{headerHozAlign:'center', hozAlign:'left', title:'비고', field:'REMARK'},
{headerHozAlign:'center', hozAlign:'center', width:'100', title:'상태', field:'STATUS_NAME'},
{headerHozAlign:'center', hozAlign:'center', width:'110', title:'등록일', field:'REGDATE'}
];
// 조회
function fn_search(){
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/admin/materialMngGridList.do", columns, true);
}
// 삭제
function fn_delete(){
var checkedObj = _tabulGrid.getSelectedData();
if(0 < checkedObj.length){
var objId = fnc_checkNull(checkedObj[0].OBJID);
Swal.fire({
title: '선택한 소재를 삭제하시겠습니까?',
text: '',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '확인',
cancelButtonText: '취소',
reverseButtons: false
}).then(result => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "/admin/deleteMaterialMngInfo.do",
data: {"objId": objId},
dataType: "json",
success: function(data){
if(data.result == 'true'){
Swal.fire("삭제되었습니다.");
fn_search();
} else {
Swal.fire("삭제에 실패했습니다.");
}
},
error: function(jqxhr, status, error){
Swal.fire("오류가 발생했습니다.");
}
});
}
});
} else {
Swal.fire("선택한 항목이 없습니다.");
}
}
// 소재 등록/수정 팝업
function openMaterialPopUp(objid){
var popup_width = 700;
var popup_height = 450;
var target = "openMaterialPopUp";
var url = "/admin/materialRegistPopUp.do";
fn_centerPopup(popup_width, popup_height, url, target);
var hiddenForm = document.hiddenForm;
hiddenForm.objid.value = objid;
hiddenForm.target = "openMaterialPopUp";
hiddenForm.action = "/admin/materialRegistPopUp.do";
hiddenForm.submit();
}
</script>
</head>
<body style="overflow-y: hidden;">
<form name="hiddenForm" id="hiddenForm">
<input type="hidden" name="objid">
</form>
<form name="form1" id="form1" method="post">
<input type="hidden" name="status" id="status">
<div class="content-box">
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span>소재관리</span>
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="소재 등록" class="plm_btns" onclick="javascript:openMaterialPopUp('');">
<input type="button" value="삭제" class="plm_btns" id="btnDelete">
</div>
</div>
<div id="plmSearchZon">
<table>
<tbody>
<tr>
<td class="label"><label for="">소재명</label></td>
<td><input type="text" name="material_name" id="material_name" value="<%=material_name%>"></td>
<td class="label"><label for="">소재코드</label></td>
<td><input type="text" name="material_code" id="material_code" value="<%=material_code%>"></td>
</tr>
</tbody>
</table>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</div>
</div>
</form>
</body>
</html>

View File

@@ -0,0 +1,186 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<script>
$(document).ready(function(){
// 닫기 버튼
$("#btn_close").click(function(){
self.close();
});
// 저장 버튼
$("#btn_save").click(function(){
fn_save();
});
});
// 저장
function fn_save(){
// 필수값 체크
var materialName = $("#material_name").val();
if(materialName == null || materialName == ''){
Swal.fire({
title: '알림',
text: '소재명을 입력해주세요.',
icon: 'warning'
});
$("#material_name").focus();
return;
}
Swal.fire({
title: '확인',
text: '저장하시겠습니까?',
icon: 'question',
showCancelButton: true,
confirmButtonText: '확인',
cancelButtonText: '취소'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: "/admin/saveMaterialMngInfo.do",
type: "POST",
data: $("#materialForm").serialize(),
dataType: "json",
success: function(data){
if(data.result == 'true'){
Swal.fire({
title: '성공',
text: data.message,
icon: 'success'
}).then(() => {
if(opener && opener.fn_search){
opener.fn_search();
}
self.close();
});
} else {
Swal.fire({
title: '실패',
text: data.message || '저장에 실패했습니다.',
icon: 'error'
});
}
},
error: function(jqxhr, status, error){
Swal.fire({
title: '오류',
text: '저장 중 오류가 발생했습니다.',
icon: 'error'
});
}
});
}
});
}
</script>
<style>
.form-table {
width: 100%;
border-collapse: collapse;
}
.form-table th, .form-table td {
border: 1px solid #ddd;
padding: 8px 10px;
text-align: left;
}
.form-table th {
background-color: #f5f5f5;
width: 120px;
font-weight: bold;
}
.form-table input[type="text"], .form-table textarea, .form-table select {
width: 100%;
box-sizing: border-box;
padding: 5px;
border: 1px solid #ccc;
}
.form-table textarea {
height: 80px;
resize: vertical;
}
.btn-area {
text-align: center;
padding: 15px;
}
.required:after {
content: " *";
color: red;
}
</style>
</head>
<body>
<form name="materialForm" id="materialForm" method="post">
<input type="hidden" name="objid" id="objid" value="${resultMap.OBJID}">
<div class="plm_menu_name_myungjin">
<h2>
<span>소재 등록/수정</span>
</h2>
</div>
<div style="padding: 15px;">
<table class="form-table">
<colgroup>
<col width="120px">
<col width="*">
</colgroup>
<tbody>
<tr>
<th><label for="material_code" class="required">소재코드</label></th>
<td>
<input type="text" name="material_code" id="material_code" value="${resultMap.MATERIAL_CODE}" maxlength="50" placeholder="예: MAT-001">
</td>
</tr>
<tr>
<th><label for="material_name">소재명</label></th>
<td>
<input type="text" name="material_name" id="material_name" value="${resultMap.MATERIAL_NAME}" maxlength="256" placeholder="소재명을 입력하세요">
</td>
</tr>
<tr>
<th><label for="size_spec" class="required">사이즈</label></th>
<td>
<input type="text" name="size_spec" id="size_spec" value="${resultMap.SIZE_SPEC}" maxlength="100" placeholder="예: 100x50x10mm">
</td>
</tr>
<tr>
<th><label for="material_part_no" class="required">소재품번</label></th>
<td>
<input type="text" name="material_part_no" id="material_part_no" value="${resultMap.MATERIAL_PART_NO}" maxlength="100" placeholder="소재품번을 입력하세요">
</td>
</tr>
<tr>
<th><label for="status">상태</label></th>
<td>
<select name="status" id="status">
<option value="ACTIVE" ${resultMap.STATUS == 'ACTIVE' || empty resultMap.STATUS ? 'selected' : ''}>활성</option>
<option value="INACTIVE" ${resultMap.STATUS == 'INACTIVE' ? 'selected' : ''}>비활성</option>
</select>
</td>
</tr>
<tr>
<th><label for="remark">비고</label></th>
<td>
<textarea name="remark" id="remark" placeholder="비고를 입력하세요">${resultMap.REMARK}</textarea>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn-area">
<input type="button" value="저장" class="plm_btns" id="btn_save">
<input type="button" value="닫기" class="plm_btns" id="btn_close">
</div>
</form>
</body>
</html>