ERP-node/WebContent/WEB-INF/view/ions/itemmgmt/materialWarehousing/materialWarehousingFormPopu...

556 lines
19 KiB
Plaintext

<%
/**
* 자재입고 등록
* @since 2021.11.16
* @author kim
* @version 1.0
*
* << 개정 이력 >>
*
* 수정일 수정자 수정내용
* ---------------- --------------------- --------------------------------------------------------
* 2021.11.16 김효일 최초작성
**/
%>
<%@ 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" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<link rel="stylesheet" href="/css/ions-basic.css">
<script type="text/javascript" src="/js/ions-common.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$('.select2').select2();
fnc_makeDatepick();
// 거래명세표번호 검색
$("#btnRcDocNoSearch").click(function(){
window.open("/common/itemMgmt/searchRcDocNo.do", "searchRcDocNo", "width=1024, height=710", "menubars=no, scrollbars=yes, resizable=yes");
});
// 업체 검색
$("#btnSuVndSearch").click(function(){
window.open("/common/itemMgmt/searchVendor.do", "searchRcDocNo", "width=1024, height=710", "menubars=no, scrollbars=yes, resizable=yes");
});
// 품목 검색
$("#btnItemAdd").click(function(){
window.open("/common/itemMgmt/searchItem.do", "searchProduct", "width=1024, height=710", "menubars=no, scrollbars=yes, resizable=yes");
});
// 저장
$("#btnSave").click(function(){
fn_save();
});
// 삭제
$("#btnDelete").click(function(){
fn_delete();
});
// 닫기
$("#btnClose").click(function(){
self.close(0);
});
$("#imInspection").change(function() {
if ($(this).is(":checked")) {
Swal.fire("체크박스 체크했음!");
} else {
Swal.fire("체크박스 체크 해제!");
}
});
$("input:radio[name='inGB']").change(function() {
if ($("#inGB_1").is(":checked")) {
// 거래명세표 선택
$("#displayRcDocNo").prop("disabled", false);
$("#btnRcDocNoSearch").prop("disabled", false);
$("#acntUnit").prop("disabled", true);
$("#acntUnit").val("");
} else if ($("#inGB_2").is(":checked")) {
// 일반입고 선택
$("#acntUnit").prop("disabled", false);
$("#displayRcDocNo").prop("disabled", true);
$("#btnRcDocNoSearch").prop("disabled", true);
$("#displayRcDocNo").val("");
$("#rcDocNo").val("");
}
});
});
// 자재입고 정보 등록
function fn_save(){
if ($("input:radio[name='inGB']:checked").length == 0) {
Swal.fire("거래명세표 또는 일반입고 중 하나를 선택해 주세요.");
return false;
}
if ($("#inGB_1").is(":checked")) {
// 거래명세표 선택
if ($("#rcDocNo").val() == "") {
Swal.fire("거래명세표를 선택해 주세요.");
return false;
}
} else if ($("#inGB_2").is(":checked")) {
// 일반입고 선택
if ($("#acntUnit").val() == "") {
Swal.fire("사업부를 선택해 주세요.");
return false;
}
}
if(fnc_valitate("form1")){
if(confirm("등록 하시겠습니까?")){
saveProcess();
}
}
}
// 등록
function saveProcess(){
$.ajax({
url:"/imItem/saveMaterialWarehousing.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.RESULT.msg);
if (data.RESULT.result) {
opener.fn_search();
self.close();
}
},
error: function(jqxhr, status, error){
}
});
}
// 자재입고 정보 삭제
function fn_delete() {
if(confirm("삭제 하시겠습니까?")){
deleteProcess();
}
}
// 삭제
function deleteProcess(){
$.ajax({
url:"/imItem/deleteMaterialWarehousing.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.RESULT.msg);
if (data.RESULT.result) {
opener.fn_search();
self.close();
}
},
error: function(jqxhr, status, error){
}
});
}
// 거래명세서번호 선택
function rcDocNoSelected(selectedItem) {
form1.rcDocNo.value = selectedItem[0].odOrderNo;
form1.displayRcDocNo.value = selectedItem[0].odOrderNo;
form1.suVndCd.value = selectedItem[0].suVndCd;
form1.suVndNm.value = selectedItem[0].suVndNm;
var rcDocNos = "";
var suVndCds = "";
var odOrderNo = "";
for (var idx = 0; idx < selectedItem.length; idx += 1) {
odOrderNo += odOrderNo == "" ? "\'" + selectedItem[idx].odOrderNo + "\'" : ",\'" + selectedItem[idx].odOrderNo + "\'";
rcDocNos += rcDocNos == "" ? selectedItem[idx].odOrderNo : "\|" + selectedItem[idx].odOrderNo;
suVndCds += suVndCds == "" ? selectedItem[idx].suVndCd : "\|" + selectedItem[idx].suVndCd;
}
$("#rcDocNos").val(rcDocNos);
$("#suVndCds").val(suVndCds);
fn_tradingStatementItemList(odOrderNo);
}
// 업체 선택
function verndorSelected(selectedItem) {
form1.suVndCd.value = selectedItem.suVndCd;
form1.suVndNm.value = selectedItem.suVndNm;
}
var riSeqNo = Number('${riSeqNo}'); // 일련번호
function fn_tradingStatementItemList(odOrderNo) {
var html = "";
html += '<tr style="text-align:center;">';
html += ' <td align="center" colspan="13">조회된 데이터가 없습니다.</td>';
html += '</tr>';
$("#item").html(html);
$.ajax({
url:"/imItem/tradingStatementItemList.do",
type:"GET",
data:"odOrderNo=" + odOrderNo,
dataType:"json",
success:function(data){
var result = data.RESULT;
if (result === "" || result === undefined) {
return;
}
html = "";
var len = result.length;
for (var idx = 0; idx < len; idx++) {
riSeqNo = result[idx].ISNO;
var imItemSpec = result[idx].IMITEMSPEC === undefined ? "" : result[idx].IMITEMSPEC;
var imMaterial = result[idx].IMMATERIAL === undefined ? "" : result[idx].IMMATERIAL;
var imUnit = result[idx].IMUNIT === undefined ? "" : result[idx].IMUNIT;
var oiOrderQty = result[idx].OIORDERQTY === undefined ? "0" : result[idx].OIORDERQTY;
html += '<input type="hidden" name="riSeqNo" id="riSeqNo" value="'+riSeqNo+'" />';
html += '<input type="hidden" name="imItemId" id="imItemId" value="'+result[idx].IMITEMID+'" />';
html += '<input type="hidden" name="riPrice" id="riPrice" value="'+result[idx].RIPRICE+'" />';
html += '<input type="hidden" name="riRcptAmt" id="riRcptAmt" value="'+result[idx].RIRCPTAMT+'" />';
html += '<input type="hidden" name="odOrderNo" id="odOrderNo" value="'+result[idx].ODORDERNO+'" />';
html += '<tr id='+riSeqNo+'>';
html += ' <td>'+result[idx].ODORDERNO+'</td>';
html += ' <td>'+riSeqNo+'</td>';
html += ' <td>'+result[idx].IMITEMNO+'</td>';
html += ' <td>'+result[idx].IMITEMNM+'</td>';
html += ' <td>'+imItemSpec+'</td>';
html += ' <td>'+imMaterial+'</td>';
html += ' <td>'+imUnit+'</td>';
html += ' <td class="selected">';
html += ' <input type="text" name="riNogoodQty" id="riNogoodQty" value="0" maxlength="9" style="width:100px;" />';
html += ' </td>';
html += ' <td class="selected">';
html += ' <input type="text" name="riRcptQty" id="riRcptQty" value="'+oiOrderQty+'" maxlength="9" style="width:100px;" />';
html += ' </td>';
html += ' <td>'+result[idx].RIPRICE+'</td>';
html += ' <td>'+result[idx].RIRCPTAMT+'</td>';
html += ' <td class="selected">';
html += ' <input type="checkbox" name="imInspection_'+riSeqNo+'" id="imInspection_'+riSeqNo+'" checked value="Y" />';
html += ' </td>';
html += ' <td class="selected">';
html += ' <input type="text" name="inInspectNo" id="inInspectNo" value="'+riSeqNo+'" maxlength="15" style="width:100px;" />';
html += ' </td>';
html += '</tr>';
}
$("#item").html(html);
},
error: function(jqxhr, status, error){
}
});
}
// 품목 선택
function itemSelected(selectedItem) {
riSeqNo += 1;
var html = "";
html += riSeqNo > 1 ? $("#item").html() : "";
html += '<input type="hidden" name="riSeqNo" id="riSeqNo" value="'+riSeqNo+'" />';
html += '<input type="hidden" name="imItemId" id="imItemId" value="'+selectedItem.imItemId+'" />';
html += '<input type="hidden" name="riPrice" id="riPrice" value="0" />';
html += '<input type="hidden" name="riRcptAmt" id="riRcptAmt" value="0" />';
html += '<tr id='+riSeqNo+'>';
html += ' <td>'+riSeqNo+'</td>';
html += ' <td>'+selectedItem.imItemNo+'</td>';
html += ' <td>'+selectedItem.imItemNm+'</td>';
html += ' <td>'+selectedItem.imItemSpec+'</td>';
html += ' <td>'+selectedItem.imMaterial+'</td>';
html += ' <td>'+selectedItem.imUnit+'</td>';
html += ' <td class="selected">';
html += ' <input type="text" name="riNogoodQty" id="riNogoodQty" value="0" maxlength="9" style="width:100px;" />';
html += ' </td>';
html += ' <td class="selected">';
html += ' <input type="text" name="riRcptQty" id="riRcptQty" value="0" maxlength="9" style="width:100px;" />';
html += ' </td>';
html += ' <td>0</td>';
html += ' <td>0</td>';
html += ' <td class="selected">';
html += ' <input type="checkbox" name="imInspection_'+riSeqNo+'" id="imInspection_'+riSeqNo+'" value="Y" />';
html += ' </td>';
html += ' <td class="selected">';
html += ' <input type="text" name="inInspectNo" id="inInspectNo" maxlength="15" style="width:100px;" />';
html += ' </td>';
html += '</tr>';
$("#item").html(html);
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="rcRcptNo" id="rcRcptNo" value="${param.rcRcptNo}" />
<input type="hidden" name="rcDocNo" id="rcDocNo" value="${info.RCDOCNO}" />
<input type="hidden" name="hiddenInGB" id="hiddenInGB" value="${info.INGB}" />
<input type="hidden" name="rcDocNos" id="rcDocNos" value="${info.RCDOCNO}" />
<input type="hidden" name="suVndCds" id="suVndCds" value="${info.SUVNDCD}" />
<section>
<div class="plm_menu_name">
<h2>
<span>자재입고 등록</span>
</h2>
</div>
<div id="businessPopupFormWrap" >
<table class="pmsPopupForm">
<colgroup>
<col width="25%"/>
<col width="15%"/>
<col width="20%"/>
<col width="15%"/>
<col width="25%"/>
</colgroup>
<tr><td colspan="5" style="height:15px;"></td></tr>
<tr>
<td rowspan="8" class="sub_title">자재입고정보</td>
</tr>
<tr>
<td class="input_title">
<input type="radio"
name="inGB"
id="inGB_1"
value="1"
${info.INGB eq '1' ? 'checked':''}
${param.actionType ne 'regist' ? 'disabled':''}
/><label for="inGB_1">* 발주번호</label>
</td>
<td colspan="3">
<input type="text"
name="displayRcDocNo"
id="displayRcDocNo"
value="${info.RCDOCNO}"
disabled
style="width:130px;float:left;"
/>
<c:if test="${param.actionType eq 'regist'}">
<span><input type="button" value="?" class="gray_btns" id="btnRcDocNoSearch" disabled /></span>
</c:if>
</td>
</tr>
<tr>
<td class="input_title">
<input type="radio"
name="inGB"
id="inGB_2"
value="2"
${info.INGB eq '2' ? 'checked':''}
${param.actionType ne 'regist' ? 'disabled':''}
/><label for="inGB_2">* 일반입고</label>
</td>
<td colspan="3">
<c:if test="${param.actionType eq 'regist'}">
<select name="acntUnit" id="acntUnit" disabled type="select" style="width:150px;">
<option value="">선택</option>
<option value="41" ${info.ACNTUNIT eq '41' ? 'selected':'' }>크레인사업부</option>
<option value="42" ${info.ACNTUNIT eq '42' ? 'selected':'' }>실린더생산팀</option>
<option value="43" ${info.ACNTUNIT eq '43' ? 'selected':'' }>출고</option>
<option value="44" ${info.ACNTUNIT eq '44' ? 'selected':'' }>전장제작반</option>
<option value="50" ${info.ACNTUNIT eq '50' ? 'selected':'' }>특장사업부</option>
<option value="F0" ${info.ACNTUNIT eq 'F0' ? 'selected':'' }>정비사업부</option>
</select>
</c:if>
<c:if test="${param.actionType ne 'regist'}">
<input type="hidden" name="acntUnit" id="acntUnit" value="${info.ACNTUNIT}"/>
<select disabled style="width:150px;" class="select2">
<option value="">선택</option>
<option value="41" ${info.ACNTUNIT eq '41' ? 'selected':'' }>크레인사업부</option>
<option value="42" ${info.ACNTUNIT eq '42' ? 'selected':'' }>실린더생산팀</option>
<option value="43" ${info.ACNTUNIT eq '43' ? 'selected':'' }>출고</option>
<option value="44" ${info.ACNTUNIT eq '44' ? 'selected':'' }>전장제작반</option>
<option value="50" ${info.ACNTUNIT eq '50' ? 'selected':'' }>특장사업부</option>
<option value="F0" ${info.ACNTUNIT eq 'F0' ? 'selected':'' }>정비사업부</option>
</select>
</c:if>
</td>
</tr>
<tr>
<td class="input_title"><label for="">* 입고일</label></td>
<td colspan="3">
<input type="text"
id="rcArrvDt"
name="rcArrvDt"
required
reqTitle="입고일"
value="${info.RCARRVDT}"
class="date_icon"
style="width: 100px !important;"
autocomplete="off"
/>
</td>
</tr>
<tr>
<td class="input_title"><label for="">* 입고구분</label></td>
<td colspan="3">
<select name="rcRcptTp" id="rcRcptTp" required reqTitle="입고구분" type="select" style="width:130px;" class="select2">
<option value="">선택</option>
<option value="0" ${info.RCRCPTTP eq '0' ? 'selected' : ''}>정상입고</option>
<option value="1" ${info.RCRCPTTP eq '1' ? 'selected' : ''}>임가공품입고</option>
<option value="2" ${info.RCRCPTTP eq '2' ? 'selected' : ''}>외자입고</option>
<option value="3" ${info.RCRCPTTP eq '3' ? 'selected' : ''}>장착비</option>
<option value="4" ${info.RCRCPTTP eq '4' ? 'selected' : ''}>사업부입고</option>
<option value="5" ${info.RCRCPTTP eq '5' ? 'selected' : ''}>반제품입고</option>
<option value="U" ${info.RCRCPTTP eq 'U' ? 'selected' : ''}>실린더입고</option>
</select>
</td>
</tr>
<tr>
<td class="input_title"><label for="label5">* 업체코드</label></td>
<td colspan="3">
<input type="text" name="suVndCd" id="suVndCd" required reqTitle="업체코드" value="${info.SUVNDCD}" readonly style="width:130px;float:left;background-color:#fefefe;" />
<input type="button" value="?" class="gray_btns" id="btnSuVndSearch" />
</td>
</tr>
<tr>
<td class="input_title"><label for="label5">업체명</label></td>
<td colspan="3">
<input type="text" name="suVndNm" id="suVndNm" value="${info.SUVNDNM}" disabled style="width:90%;" />
</td>
</tr>
<tr>
<td class="input_title"><label for="">* 입고계정</label></td>
<td colspan="3">
<select name="rcAccNo" id="rcAccNo" required reqTitle="입고계정" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<c:forEach var="rcAccNoList" items="${codeMap.rcAccNoList}">
${rcAccNoList}
</c:forEach>
</select>
</td>
</tr>
<tr><td colspan="5" style="height:15px;"></td></tr>
</table>
<br />
<div class="plm_btn_wrap">
<input type="button" value="추가" id="btnItemAdd" class="plm_btns">
</div>
<table class="plm_table">
<colgroup>
<col width="10%" />
<col width="7%" />
<col width="8%" />
<col width="15%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="10%" />
<col width="10%" />
<col width="6%" />
<col width="6%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<thead>
<tr class="plm_thead">
<td>발주번호</td>
<td>일련번호</td>
<td>품번</td>
<td>품명</td>
<td>규격</td>
<td>재질</td>
<td>단위</td>
<td>불량수량</td>
<td>입고수량</td>
<td>입고단가</td>
<td>금액</td>
<td>검수여부</td>
<td>검수번호</td>
</tr>
</thead>
</table>
<div style="height:350px;overflow-y:scroll;margin-right:-10px;">
<table class="plm_table">
<colgroup>
<col width="10%" />
<col width="7%" />
<col width="8%" />
<col width="15%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="10%" />
<col width="10%" />
<col width="6%" />
<col width="6%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<tbody id="item">
<c:choose>
<c:when test="${empty itemList}">
<tr style="text-align:center;">
<td align="center" colspan="14">조회된 데이터가 없습니다.</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${itemList}" varStatus="varStatus">
<input type="hidden" name="riSeqNo" id="riSeqNo" value="${item.RISEQNO}" />
<input type="hidden" name="imItemId" id="imItemId" value="${item.IMITEMID}" />
<input type="hidden" name="riPrice" id="riPrice" value="${item.RIPRICE}" />
<input type="hidden" name="riRcptAmt" id="riRcptAmt" value="${item.RIRCPTAMT}" />
<tr id="${item.RISEQNO}">
<td>${item.ODORDERNO}</td>
<td>${item.RISEQNO}</td>
<td>${item.IMITEMNO}</td>
<td>${item.IMITEMNM}</td>
<td>${item.IMITEMSPEC}</td>
<td>${item.IMMATERIAL}</td>
<td>${item.IMUNIT}</td>
<td>
<input type="text" name="riNogoodQty" id="riNogoodQty" value="${item.RINOGOODQTY}" maxlength="9" />
</td>
<td>
<input type="text" name="riRcptQty" id="riRcptQty" value="${item.RIRCPTQTY}" maxlength="9" />
</td>
<td>${item.RIPRICE}</td>
<td>${item.RIRCPTAMT}</td>
<td>
<input type="checkbox" name="imInspection_${item.RISEQNO}" id="imInspection_${item.RISEQNO}" value="Y" ${item.IMINSPECTION eq 'Y' ? 'checked':''} />
</td>
<td>
<input type="text" name="inInspectNo" id="inInspectNo" value="${item.ININSPECTNO}" maxlength="15" />
</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</tbody>
</table>
</div>
</div>
<div class="btn_wrap">
<div class="plm_btn_wrap_center">
<c:if test="${(param.actionType ne 'view' and info.REG_USER_ID eq connectUserId) or 'regist' eq param.actionType or 'plm_admin' eq connectUserId}">
<input type="button" value="저장" id="btnSave" class="plm_btns">
</c:if>
<c:if test="${(param.actionType eq 'modify' and info.REG_USER_ID eq connectUserId) or 'plm_admin' eq connectUserId}">
<input type="button" value="삭제" id="btnDelete" class="plm_btns">
</c:if>
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</section>
</form>
</body>
</html>