377 lines
13 KiB
Plaintext
377 lines
13 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>
|
||
|
|
</head>
|
||
|
|
<style>
|
||
|
|
.pmsPopupForm td {height:24px; font-size: 12px;border-bottom:solid 1px #ccc;border-left:solid 1px #ccc;padding:0px 2px;}
|
||
|
|
</style>
|
||
|
|
<script>
|
||
|
|
$(document).ready(function(){
|
||
|
|
$("#product_code").val("${product_objid}").prop("selected", true);
|
||
|
|
product_code("${product_objid}");
|
||
|
|
//Swal.fire("${product_objid}");
|
||
|
|
$('.select2').select2();
|
||
|
|
|
||
|
|
$("#btnClose").click(function(){
|
||
|
|
self.close(0);
|
||
|
|
});
|
||
|
|
|
||
|
|
//수정
|
||
|
|
$("#btnSave").click(function(){
|
||
|
|
fn_save();
|
||
|
|
});
|
||
|
|
|
||
|
|
//삭제
|
||
|
|
$("#btnDelete").click(function(){
|
||
|
|
fn_delete();
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$("#product_code").change(function(){
|
||
|
|
product_code($(this).val());
|
||
|
|
});
|
||
|
|
|
||
|
|
//추가
|
||
|
|
$("#btnAdd").click(function(){
|
||
|
|
var length = $(".append_table tr").length;
|
||
|
|
var addText ="";
|
||
|
|
addText +="<tr id='row"+Number(length)+"'>"
|
||
|
|
addText +="<td><select onchange='javascript:fn_changetype("+Number(length)+")' name='type' id='type"+Number(length)+"'><option value=''>선택</option>${code_map.product_category}</select></td>"
|
||
|
|
addText +="<td><input type='text' id='part_no"+Number(length)+"' name='part_no' required reqTitle='part_no' style='background-color: yellow;'></td>"
|
||
|
|
addText +="<td><input type='text' id='part_name"+Number(length)+"' name='part_name' required reqTitle='part_name' style='background-color: yellow;'></td>"
|
||
|
|
addText +="</tr>";
|
||
|
|
$(".append_table").append(addText);
|
||
|
|
});
|
||
|
|
$("#product_code").prop("disabled",true);
|
||
|
|
});
|
||
|
|
|
||
|
|
function product_code(code){
|
||
|
|
|
||
|
|
var specText = $(this).find("option:selected").text();
|
||
|
|
$("#specText").val(specText);
|
||
|
|
|
||
|
|
//Swal.fire($(this).val());
|
||
|
|
/* $("#product_upg_name").val("");
|
||
|
|
$("#targetobjId").val("");
|
||
|
|
$("#objId").val("");
|
||
|
|
$("#specText").val("");
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
var specName = $(this).find("option:selected").attr("id");
|
||
|
|
var targetobjId = $(this).find("option:selected").attr("objid");
|
||
|
|
var specText = $(this).find("option:selected").text();
|
||
|
|
if(specText.indexOf("(") > -1){
|
||
|
|
specText = specText.substr(0,specText.indexOf("("));
|
||
|
|
}
|
||
|
|
if(specName !=" "){
|
||
|
|
$("#product_upg_name").attr("readonly",true);
|
||
|
|
}
|
||
|
|
$("#specText").val(specText);
|
||
|
|
$("#product_upg_name").val(specName);
|
||
|
|
$("#targetobjId").val(targetobjId);
|
||
|
|
|
||
|
|
if($("#targetobjId").val() == $(this).val()){
|
||
|
|
$("#objId").val("");
|
||
|
|
}else{
|
||
|
|
$("#objId").val($(this).val());
|
||
|
|
} */
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$("#appendTr").empty();
|
||
|
|
var appendText ="";
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url:"/productmgmt/productUpgList.do?targetObjId="+code,
|
||
|
|
type:"POST",
|
||
|
|
data:"",
|
||
|
|
async: true,
|
||
|
|
dataType:"json",
|
||
|
|
success:function(data){
|
||
|
|
if(data.RESULT.length > 0){
|
||
|
|
var selectText ="";
|
||
|
|
var check = "";
|
||
|
|
for(var i=0;i<data.RESULT.length;i++){
|
||
|
|
selectText ="<option value=''>선택</option>";
|
||
|
|
check = false;
|
||
|
|
var upgNo = data.RESULT[i].UPG_NO;
|
||
|
|
$.ajax({
|
||
|
|
url:"/productmgmt/getUpgNoList.do?upgCode="+data.RESULT[i].UPG_CODE,
|
||
|
|
type:"POST",
|
||
|
|
data : "",
|
||
|
|
dataType:"json",
|
||
|
|
async: false,
|
||
|
|
success:function(data){
|
||
|
|
if(data.RESULT.length > 0){
|
||
|
|
for(var i=0;i<data.RESULT.length;i++){
|
||
|
|
var select ="";
|
||
|
|
if(upgNo==data.RESULT[i].UPG_NO){
|
||
|
|
select = "selected";
|
||
|
|
check = true;
|
||
|
|
}else{
|
||
|
|
|
||
|
|
}
|
||
|
|
selectText += "<option id='"+data.RESULT[i].PRODUCT_OBJID+"' value='"+data.RESULT[i].VC+"' "+select+">"+data.RESULT[i].UPG_NO+"</option>";
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
},
|
||
|
|
error: function(jqxhr, status, error){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
appendText += "<tr>";
|
||
|
|
appendText +=" <td><input type='hidden' name='detailobjid' value='"+data.RESULT[i].OBJID+"'>"+data.RESULT[i].UPG_NAME+"</td>";
|
||
|
|
appendText +=" <td><input type='hidden' name='upgname' value='"+data.RESULT[i].UPG_NAME+"'> <input type='hidden' name='upgcode' id='upgcode"+Number(i)+"' value='"+data.RESULT[i].UPG_CODE+"'>"+data.RESULT[i].UPG_CODE+"</td>";
|
||
|
|
appendText +=" <td><input type='hidden' name='product_objid' id='product_objid"+Number(i)+"' value='"+data.RESULT[i].PRODUCT_OBJID+"'><select name='vc_code"+Number(i)+"' id='vc_code"+Number(i)+"' style='width: 150px;' class='select2' onchange='fn_selectsetupgNo("+Number(i)+")';>"+selectText+"</select></td>";
|
||
|
|
if(check){
|
||
|
|
appendText +=" <td><input type='hidden' name='vc' id='vc"+Number(i)+"' value='"+data.RESULT[i].VC+"'><input type='text' name='txtvc' id='txtvc"+Number(i)+"' readonly onchange='fn_setupgNo("+Number(i)+")';></td>";
|
||
|
|
}else{
|
||
|
|
appendText +=" <td><input type='hidden' name='vc' id='vc"+Number(i)+"' value='"+data.RESULT[i].VC+"'><input type='text' name='txtvc' id='txtvc"+Number(i)+"' onchange='fn_setupgNo("+Number(i)+")';></td>";
|
||
|
|
}
|
||
|
|
appendText +=" <td><input type='text' name='upg_no' id='upg_no"+Number(i)+"' readonly type='text' reqTitle='upg_no' value='"+data.RESULT[i].UPG_NO+"'></td>";
|
||
|
|
appendText +=" <td><input type='text' name='note' id='note' value='"+data.RESULT[i].NOTE+"'></td>";
|
||
|
|
appendText += "</tr>";
|
||
|
|
/* appendText += "<tr>";
|
||
|
|
appendText +=" <td><input type='hidden' name='detailobjid' value='"+data.RESULT[i].OBJID+"'>"+data.RESULT[i].UPG_NAME+"</td>";
|
||
|
|
appendText +=" <td><input type='hidden' name='upgname' value='"+data.RESULT[i].UPG_NAME+"'> <input type='hidden' name='upgcode' id='upgcode"+Number(i)+"' value='"+data.RESULT[i].UPG_CODE+"'>"+data.RESULT[i].UPG_CODE+"</td>";
|
||
|
|
appendText +=" <td><input type='hidden' name='product_objid' id='product_objid"+Number(i)+"' value='"+data.RESULT[i].PRODUCT_OBJID+"'><select name='vc_code"+Number(i)+"' id='vc_code"+Number(i)+"' style='width: 120px;' class='select2' onchange='fn_selectsetupgNo("+Number(i)+")';>"+selectText+"</select></td>";
|
||
|
|
appendText +=" <td><input type='hidden' name='vc' id='vc"+Number(i)+"' value='"+data.RESULT[i].VC+"'><input type='text' name='txtvc' id='txtvc"+Number(i)+"' readonly onchange='fn_setupgNo("+Number(i)+")';></td>";
|
||
|
|
appendText +=" <td><input type='text' name='upg_no' id='upg_no"+Number(i)+"' readonly required type='text' reqTitle='upg_no' value='"+data.RESULT[i].UPG_NO+"'></td>";
|
||
|
|
appendText +=" <td><input type='text' name='note' id='note' value='"+data.RESULT[i].NOTE+"'></td>";
|
||
|
|
appendText += "</tr>"; */
|
||
|
|
}
|
||
|
|
$("#appendTr").append(appendText);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
error: function(jqxhr, status, error){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
//$('.select2').select2();
|
||
|
|
}
|
||
|
|
|
||
|
|
//수주활동 등록정보 수정
|
||
|
|
function fn_save(){
|
||
|
|
if(fnc_valitate("form1")){
|
||
|
|
if(confirm("수정 하시겠습니까?")){
|
||
|
|
saveProcess();
|
||
|
|
}
|
||
|
|
/* if(fn_checkDuplicate()){
|
||
|
|
}else{
|
||
|
|
Swal.fire("입력된 제품번호는 이미 사용중인 제품번호 입니다.");
|
||
|
|
return false;
|
||
|
|
} */
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//UPG삭제
|
||
|
|
function fn_delete(){
|
||
|
|
if(fnc_valitate("form1")){
|
||
|
|
if(confirm("기등록된 BOM&PART도 함께 삭제 됩니다. 삭제 하시겠습니까?")){
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url:"/productmgmt/productUpgDelete.do",
|
||
|
|
type:"POST",
|
||
|
|
data:$("#form1").serialize(),
|
||
|
|
dataType:"json",
|
||
|
|
success:function(data){
|
||
|
|
if(data=="SUCCESS"){
|
||
|
|
Swal.fire('수정되었습니다.');
|
||
|
|
}else{
|
||
|
|
Swal.fire('실패하였씁니다.');
|
||
|
|
}
|
||
|
|
opener.fn_search();
|
||
|
|
self.close();
|
||
|
|
},
|
||
|
|
error: function(jqxhr, status, error){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
}
|
||
|
|
/* if(fn_checkDuplicate()){
|
||
|
|
}else{
|
||
|
|
Swal.fire("입력된 제품번호는 이미 사용중인 제품번호 입니다.");
|
||
|
|
return false;
|
||
|
|
} */
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function fn_setupgNo(index){
|
||
|
|
var upg_no = "";
|
||
|
|
|
||
|
|
if($("#txtvc"+index).val()!==""){
|
||
|
|
upg_no = $("#upgcode"+index).val()+"-"+$("#product_code").find("option:selected").text()+"-"+$("#txtvc"+index).val();
|
||
|
|
}
|
||
|
|
$("#vc"+index).val($("#txtvc"+index).val());
|
||
|
|
$("#upg_no"+index).val(upg_no);
|
||
|
|
}
|
||
|
|
|
||
|
|
function fn_selectsetupgNo(index){
|
||
|
|
var upg_no = $("#vc_code"+index).find("option:selected").text();
|
||
|
|
var vc = $("#vc_code"+index).find("option:selected").val();
|
||
|
|
var product_objid = $("#vc_code"+index).find("option:selected").attr("id");
|
||
|
|
if(vc!==""){
|
||
|
|
$("#product_objid"+index).val(product_objid);
|
||
|
|
$("#upg_no"+index).val(upg_no);
|
||
|
|
$("#txtvc"+index).val("");
|
||
|
|
$("#txtvc"+index).prop("readonly",true);
|
||
|
|
$("#vc"+index).val(vc);
|
||
|
|
}else{
|
||
|
|
$("#product_objid"+index).val("${info.TARGET_OBJID}");
|
||
|
|
$("#upg_no"+index).val("");
|
||
|
|
$("#vc"+index).val("");
|
||
|
|
$("#txtvc"+index).prop("readonly",false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function saveProcess(){
|
||
|
|
/* Swal.fire($("#form1").serialize());
|
||
|
|
return; */
|
||
|
|
$.ajax({
|
||
|
|
url:"/productmgmt/saveproductMgmtUpg.do",
|
||
|
|
type:"POST",
|
||
|
|
data:$("#form1").serialize(),
|
||
|
|
dataType:"json",
|
||
|
|
success:function(data){
|
||
|
|
if(data=="SUCCESS"){
|
||
|
|
Swal.fire('수정되었습니다.');
|
||
|
|
}else{
|
||
|
|
Swal.fire('실패하였씁니다.');
|
||
|
|
}
|
||
|
|
opener.fn_search();
|
||
|
|
self.close();
|
||
|
|
},
|
||
|
|
error: function(jqxhr, status, error){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
function fn_checkDuplicate(){
|
||
|
|
var resultFlag = false;
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url:"/productmgmt/checkDuplicateProductMgmt.do",
|
||
|
|
type:"POST",
|
||
|
|
data:$("#form1").serialize(),
|
||
|
|
dataType:"json",
|
||
|
|
async:false,
|
||
|
|
success:function(data){
|
||
|
|
var cnt = new Number(data.CNT);
|
||
|
|
if(0 == cnt){
|
||
|
|
resultFlag = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
error: function(jqxhr, status, error){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
return resultFlag;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
</script>
|
||
|
|
<body>
|
||
|
|
<form name="form1" id="form1" action="" method="post">
|
||
|
|
<input type="hidden" name="targetobjId" id="targetobjId" value="${info.TARGET_OBJID}">
|
||
|
|
<input type="hidden" name="objId" id="objId" value="${info.OBJID}">
|
||
|
|
<input type="hidden" name="specText" id="specText" value="">
|
||
|
|
<%-- <input type="hidden" name="OBJID" id="OBJID" value="${objId}"> --%>
|
||
|
|
<%-- <input type="hidden" name="STATUS_CD" id="STATUS_CD" value="${info.STATUS_CD}"> --%>
|
||
|
|
<section>
|
||
|
|
<div class="plm_menu_name">
|
||
|
|
<h2>
|
||
|
|
<span>제품사양 등록</span>
|
||
|
|
</h2>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="plmSearchZon">
|
||
|
|
<table>
|
||
|
|
<tbody>
|
||
|
|
<tr>
|
||
|
|
|
||
|
|
<td class="align_r"><label for="" class="">양산제품코드</label></td>
|
||
|
|
<td>
|
||
|
|
<select name="product_code" id="product_code" style="width: 150px;" class="select2" autocomplete="off" required type="select" reqTitle="양산제품코드">
|
||
|
|
<option value="">전체</option>
|
||
|
|
${code_map.product_code}
|
||
|
|
</select>
|
||
|
|
</td>
|
||
|
|
|
||
|
|
<td class="align_r"><label for="" class="">사양명</label></td>
|
||
|
|
<td>
|
||
|
|
<input type="text" name="product_upg_name" id="product_upg_name" style="width: 150px;" required type="text" reqTitle="사양명" value="${info.SPEC_NAME}">
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<div id="businessPopupFormWrap" >
|
||
|
|
<table class="plm_table append_table">
|
||
|
|
<colgroup>
|
||
|
|
<col width="100px">
|
||
|
|
<col width="80px">
|
||
|
|
<col width="120px">
|
||
|
|
<col width="100px">
|
||
|
|
<col width="100px">
|
||
|
|
<col width="100px">
|
||
|
|
</colgroup>
|
||
|
|
<thead>
|
||
|
|
<tr class="plm_thead">
|
||
|
|
<td>NAME</td>
|
||
|
|
<td>CODE</td>
|
||
|
|
<td>C/O VC</td>
|
||
|
|
<td>VC</td>
|
||
|
|
<td>UPG No</td>
|
||
|
|
<td>비고</td>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody id="appendTr">
|
||
|
|
<%-- <tr id="row${status.count}">
|
||
|
|
<td>
|
||
|
|
<select onchange="javascript:fn_changetype(${status.count})" name="type" id="type${status.count}">
|
||
|
|
<option value="">전체</option> ${code_map.product_category}
|
||
|
|
</select>
|
||
|
|
</td>
|
||
|
|
<td><input type="text" id="sr_weight${status.count}" name="sr_weight" value="${info.SR_WEIGHT}" required reqTitle="sr_weight" readonly="readonly" style="background-color: #26f926;"></td>
|
||
|
|
<td><input type="text" id="part_no${status.count}" required reqTitle="part_no" name="part_no" value="${info.PART_NO}" style="background-color: yellow;"></td>
|
||
|
|
<td><input type="text" id="part_name${status.count}" required reqTitle="part_name" name="part_name" value="${info.PART_NAME}" style="background-color: yellow;"></td>
|
||
|
|
<td><input type="button" class="blue_btn" value="삭제" onclick="fn_deletephone(${status.count});" style="float:none;"></td>
|
||
|
|
</tr> --%>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
<div class="btn_wrap">
|
||
|
|
<div class="plm_btn_wrap_center">
|
||
|
|
<!-- <input type="button" value="행추가" class="plm_btns" id="btnAdd"> -->
|
||
|
|
<input type="button" value="수정" id="btnSave" class="plm_btns">
|
||
|
|
<!-- <input type="button" value="삭제" id="btnDelete" class="plm_btns"> -->
|
||
|
|
<input type="button" value="닫기" id="btnClose" class="plm_btns">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
</form>
|
||
|
|
</body>
|
||
|
|
</html>
|