ERP-node/WebContent/WEB-INF/view/procurStandMgmt/materialCodeFormPopUp.jsp

261 lines
9.0 KiB
Plaintext

<%@ 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"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<%
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
String userId = CommonUtils.checkNull(person.getUserId());
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
<style type="text/css">
::-webkit-scrollbar-thumb {
display: none;
}
.pmsPopupForm tr:last-child td {
border-bottom: none !important;
}
.input_sub_title {
border-left: none !important;
}
.pmsPopupForm select {
width: 100% !important;
}
.bordernone {
border: none !important;
font-size: 25px !important;
width: 60px !important;
margin-top:15px;
}
.bordernone2 {
border: none !important;
font-size: 25px !important;
width: 250px !important;
margin-top:15px;
}
</style>
</head>
<script>
$(document).ready(function(){
if ("${param.actionType}" == "veiw") {
$('.select2').attr("disabled", "disabled");
}
$("#btnClose").click(function(){
self.close(0);
});
$("#btnSave").click(function(){
fn_save();
});
$('.select2').select2();
$("#MAJOR_CATEGORY").change(function(){
$("#CODE1").val($(this).find("option:selected").attr("data-code_id"));
$("#CODENAME1").val($(this).find("option:selected").attr("data-name"));
updateMaterialCodeView();
});
$("#SUB_CATEGORY").change(function(){
$("#CODE2").val($(this).find("option:selected").attr("data-code_id"));
$("#CODENAME2").val($(this).find("option:selected").attr("data-name"));
updateMaterialCodeView();
});
$("#MAKER").change(function(){
$("#CODE3").val($(this).find("option:selected").attr("data-code_id"));
$("#CODENAME3").val($(this).find("option:selected").attr("data-name"));
updateMaterialCodeView();
});
$("#PART_NAME").change(function(){
$("#CODE4").val($(this).find("option:selected").attr("data-code_id"));
$("#CODENAME4").val($(this).find("option:selected").attr("data-name"));
updateMaterialCodeView();
});
$("#SPEC").change(function(){
$("#CODE5").val($(this).find("option:selected").attr("data-code_id"));
$("#CODENAME5").val($(this).find("option:selected").attr("data-name"));
updateMaterialCodeView();
});
//fnc_getCodeListAppendCheckbox('', "IS_LONGD", "IS_LONGD", "${resultMap.IS_LONGD}", false);
});
</script>
<script>
function fn_save(){
if(fnc_validate('form1')){
if(fn_overlapMaterialCode()){
//alert($("#IS_LONGD").val());
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/procurStandMgmt/saveMaterialCode.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
async:false,
success:function(data){
if(data.result == "DUPLICATE"){
alert(data.msg);
$("#PART_NO").focus();
}else{
alert(data.msg);
if(typeof(opener.fn_search) == "function"){
opener.fn_search();
}else{
}
self.close();
}
},
error: function(jqxhr, status, error){
}
});
}
}
}
}
//저장 시 중복여부를 확인한다.
function fn_overlapMaterialCode(){
var returnFlag = false;
var combinedValue = $("#CODE1").val() + $("#CODE2").val() + $("#CODE3").val() + $("#CODE4").val() + $("#CODE5").val();
$("#MATERIAL_CODE").val(combinedValue);
//alert(combinedValue);
$.ajax({
url:"/procurStandMgmt/overlapMaterialCode.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
async:false,
success:function(data){
if(0 < data.length){
Swal.fire("중복되는 자재코드가 존재합니다.\n자재코드를 확인하시기 바랍니다.");
returnFlag = false;
}else{
returnFlag = true;
}
},
error: function(jqxhr, status, error){
}
});
return returnFlag;
}
function updateMaterialCodeView() {
var combinedValue = "(" + ( $("#CODE1").val() + $("#CODE2").val() + $("#CODE3").val() + $("#CODE4").val() + $("#CODE5").val()) + ")";
$("#MATERIAL_CODE_VIEW").val(combinedValue);
}
</script>
<style>
.input_title {border-left:1px solid #ccc;}
.input_sub_title {border-left:1px solid #ccc;}
.pmsPopupForm tr:last-child td{border-bottom:1px solid #ccc;}
</style>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="OBJID" id="OBJID" value="${resultMap.OBJID}">
<input type="hidden" name="CHILD_OBJID" id="CHILD_OBJID" value="${resultMap.CHILD_OBJID}">
<input type="hidden" name="STATUS" id="STATUS" value="${resultMap.STATUS}">
<input type="hidden" name="IS_LAST" id="IS_LAST" value="${resultMap.IS_LAST}">
<input type="hidden" name="ACTION_TYPE" id="ACTION_TYPE" value="${param.ACTION_TYPE}">
<input type="hidden" name="CONTRACT_OBJID" id="CONTRACT_OBJID" value="${resultMap.CONTRACT_OBJID}">
<input type="hidden" name="MATERIAL_CODE" id="MATERIAL_CODE" value="${resultMap.MATERIAL_CODE}">
<section>
<div class="plm_menu_name" style="display:flex;">
<h2>
<span>
<c:if test="${ 'changeDesign' ne param.ACTION_TYPE}">
자재코드 등록
</c:if>
<c:if test="${ 'changeDesign' eq param.ACTION_TYPE}">
품목 설계변경
</c:if>
</span>
</h2>
</div>
<div style="height:50px; width:100%; display: flex; justify-content: space-between; align-items: center;">
<div style="display: flex; width: 85%;">
<div style="margin-left: 10px;"><input type="text" name="CODE1" id="CODE1" class="bordernone" value="${resultMap.CODE1}" readonly style="text-align: right;"/></div>
<div><input type="text" name="CODE2" id="CODE2" class="bordernone" value="${resultMap.CODE2}" readonly style="text-align: center;"/></div>
<div><input type="text" name="CODE3" id="CODE3" class="bordernone" value="${resultMap.CODE3}" readonly/></div>
<div><input type="text" name="CODE4" id="CODE4" class="bordernone" value="${resultMap.CODE4}" readonly/></div>
<div><input type="text" name="CODE5" id="CODE5" class="bordernone" value="${resultMap.CODE5}" readonly/></div>
<div><input type="text" name="MATERIAL_CODE_VIEW" id="MATERIAL_CODE_VIEW" class="bordernone2" style="width:150px;" value="${resultMap.PART_NO_CODE}" readonly/></div>
</div>
<div style="width:15%;">
<%-- <input type="checkbox" name="IS_LONGD" id="IS_LONGD" value="1" ${resultMap.IS_LONGD == '1' ? 'checked' : ''}/>
장납기 --%>
</div>
</div>
<div id="businessPopupFormWrap" style="height:200px;">
<table class="pmsPopupForm">
<colgroup>
<col width="10%">
<col width="20%">
<col width="20%">
<col width="40%">
<col width="40%">
</colgroup>
<tr>
<td class="input_title">
<label for="">대분류</label>
</td>
<td class="input_title">
<label for="">구분</label>
</td>
<td class="input_title">
<label for="">Maker</label>
</td>
<td class="input_title">
<label for="">품명</label>
</td>
<td class="input_title">
<label for="">규격/사양</label>
</td>
</tr>
<tr>
<td class="input_sub_title">
<select name="MAJOR_CATEGORY" id="MAJOR_CATEGORY" class="select2" type="select" required reqTitle="대분류"><option value="">선택</option>${code_map.code1}</select>
<input type="hidden" name="CODENAME1" id="CODENAME1"/>
</td>
<td class="input_sub_title">
<select name="SUB_CATEGORY" id="SUB_CATEGORY" class="select2" type="select" required reqTitle="중분류"><option value="">선택</option>${code_map.code2}</select>
<input type="hidden" name="CODENAME2" id="CODENAME2"/>
</td>
<td class="input_sub_title">
<select name="MAKER" id="MAKER" class="select2" type="select" required reqTitle="Maker"><option value="">선택</option>${code_map.code3}</select>
<input type="hidden" name="CODENAME3" id="CODENAME3"/>
</td>
<td class="input_sub_title">
<select name="PART_NAME" id="PART_NAME" class="select2" type="select" required reqTitle="품명"><option value="">선택</option>${code_map.code4}</select>
<input type="hidden" name="CODENAME4" id="CODENAME4"/>
</td>
<td class="input_sub_title">
<select name="SPEC" id="SPEC" class="select2" type="select" required reqTitle="규격/사양"><option value="">선택</option>${code_map.code5}</select>
<input type="hidden" name="CODENAME5" id="CODENAME5"/>
</td>
</tr>
</table>
</div>
<div class="btn_wrap">
<div class="plm_btn_wrap_center">
<c:if test="${param.actionType ne 'veiw'}">
<input type="button" value="저장" id="btnSave" class="plm_btns create">
</c:if>
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</section>
</form>
</body>
</html>