ERP-node/WebContent/WEB-INF/view/materMgmt/matermgmtList.jsp

711 lines
24 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 connector = person.getUserId();
%>
<!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}" />
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<c:set var="connector" value="<%=connector %>" />
<script type="text/javascript">
$(function(){
$(document).ready(function(){
$('.select2').select2();
fnc_datepick();
$("input[type=text]").keyup(function(e){
if(e.keyCode == 13) search();
});
//image src encoding
$("img").each(function(i){
var imgSrc = $(this).attr("data-SRC");
$(this).attr("src", encodeURI(imgSrc));
});
$(".btnRevision").click(function(){
var partNo = $(this).attr("data-PART_NO");
fn_openPartListPop(partNo);
});
//체크박스 전체선택/전체해제
$("#allCheck").click(function(){
if($("#allCheck").prop("checked")) {
$("input[type=checkbox]").prop("checked",true);
} else {
$("input[type=checkbox]").prop("checked",false);
}
});
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
$("#btnWritePop").click(function(){
fn_materWrite();
});
//발주
$("#relemater").click(function(){
fn_relemater();
});
//접수
$("#btnReg").click(function(){
fn_regmater();
});
//발주서 다운
$("#btnDown").click(function(){
fn_downmater();
});
$("#btnSupSave").click(function(){
fn_materSupWrite();
});
$("#btnrevSave").click(function(){
fn_RecSavePopup();
});
$("#btnDelete").click(function(){
fn_deletemater();
});
$(".btnApprovalDetail").click(function(){
var approvalObjId = $(this).attr("data-APPROVAL_OBJID");
var routeObjId = $(this).attr("data-ROUTE_OBJID");
//Swal.fire("approvalObjId : "+approvalObjId+", routeObjId : "+routeObjId);
var params = "?approvalObjId="+approvalObjId;
params += "&routeObjId="+routeObjId;
//Swal.fire("params : "+params);
window.open("/approval/approvalDetail.do"+params,"approvalDetailPopup","width=650 height=760 menubar=no status=no");
});
//체크박스 전체선택/전체해제
$("#allCheck").click(function(){
if($("#allCheck").prop("checked")) {
$("input[type=checkbox]").prop("checked",true);
} else {
$("input[type=checkbox]").prop("checked",false);
}
});
//SR자료등록 팝업
$(".File").click(function(){
var objId = $(this).attr("data-OBJID");
var docType =$(this).attr("data-docType");
var docTypeName = $(this).attr("data-docTypeName");
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName;
window.open("/projectConcept/FileRegistPopup.do"+params, "", "width=800, height=335");
});
});
});
function savepop(){
var url = "/partmgmt/partmgmtsaveFormPopup.do";
var target = "partmgmtsaveFormPopup";
window.open(url,target,"width=1300, height=550, menubars=no, scrollbars=yes, resizable=yes");
}
function excelExport(){
var form = document.form1;
form.target = "_self";
form.actionType.value = "excel"
form.action = "/partmgmt/partmgmtList.do";
form1.submit();
}
function openEOPopup(objId,actionType){
var hiddenForm = document.hiddenForm;
var target = "tempEoListPopup";
var url = "/eo/eoDetailViewPopup.do";
window.open("",target,"width=1500,height=700");
hiddenForm.objId.value = objId;
hiddenForm.actionType.value = actionType;
hiddenForm.action = url;
hiddenForm.target = target;
hiddenForm.submit();
}
function openImagePopUp(url){
var img=new Image();
img.src=url;
var img_width=img.width;
var img_height=img.height;
var win_width=img.width+25;
var height=img.height+30;
window.open(url,"partListShapeImgPopUp","width="+img_width+",height="+height+", menubars=no, scrollbars=yes, resizable=yes'");
}
//Revision 클릭 시 해당 파트의 모든 Revision을 보여준다.
function fn_openPartListPop(partNo){
window.open("/part/openRevisionPartPopUp.do?partNo="+partNo,"openPartListPop","width=1500 height=560 menubar=no status=no");
}
//수주활동 검색 기능
function fn_search(){
document.form1.action = "/materMgmt/matermgmtList.do";
document.form1.submit();
}
function fn_materWrite(){
var _width = '950';
var _height = '765';
// 팝업을 가운데 위치시키기 위해 아래와 같이 값 구하기
var _left = Math.ceil(( window.screen.width - _width )/2);
var _top = Math.ceil(( window.screen.width - _height )/2);
//window.open("/materMgmt/materWrite.do", "", 'width='+ _width +', height='+ _height +', left=' + _left);
window.open("/materMgmt/matermgmtFormPopup.do", "", 'width='+ _width +', height='+ _height +', left=' + _left);
}
function fn_materSupWrite(){
var _width = '1600';
var _height = '600';
// 팝업을 가운데 위치시키기 위해 아래와 같이 값 구하기
var _left = Math.ceil(( window.screen.width - _width )/2);
var _top = Math.ceil(( window.screen.width - _height )/2);
window.open("/materMgmt/materSupWrite.do", "", 'width='+ _width +', height='+ _height +', left=' + _left);
}
function fn_MaterModifyPopup(objId,status_cd){
var _width = '920';
var _height = '760';
// 팝업을 가운데 위치시키기 위해 아래와 같이 값 구하기
var _left = Math.ceil(( window.screen.width - _width )/2);
var _top = Math.ceil(( window.screen.width - _height )/2);
window.open("/materMgmt/matermgmtFormPopup.do?objId="+objId, "", 'width='+ _width +', height='+_height+', left=' + _left);
// if(status_cd=="PURSTCD00100" || status_cd==""){
// window.open("/materMgmt/materModify.do?objId="+objId, "", 'width=950, height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00200"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00300"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00400"){
// window.open("/materMgmt/materRegViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00500"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00600"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00700"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00800"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }else if(status_cd=="PURSTCD00900"){
// window.open("/materMgmt/materViwer.do?objId="+objId, "", 'width='+ _width +', height=765, left=' + _left);
// }
}
function fn_RecSavePopup(){
var _width = '930';
var _height = '550';
var _left = Math.ceil(( window.screen.width - _width )/2);
var _top = Math.ceil(( window.screen.width - _height )/2);
var partLength = $("input[name=partCheckBox]:checked").length;
if(0 < partLength){
var checkArr = new Array();
var statusFlag = false;
$("input[name=partCheckBox]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
var ststus_cd = fnc_checkNull($(this).attr("data-STATUS_CD").replace(" ",""));
if(ststus_cd=="PURSTCD00700" || ststus_cd=="PURSTCD00800"){
checkArr.push(objId);
statusFlag = true;
}
});
if(1 < checkArr.length){
Swal.fire('1건씩만 입고결과 등록이 가능합니다.');
return;
}
if(statusFlag){
window.open("/materMgmt/materRecSave.do?objId="+checkArr[0], "", 'width='+ _width +', height=500, left=' + _left);
}else{
Swal.fire("발주완료및 미입고 상태만 입고등록 가능합니다.");
}
}else{
Swal.fire("선택한 항목이 없습니다.");
}
}
function fn_regmater(){
var partLength = $("input[name=partCheckBox]:checked").length;
//초기화
$("#materRegObjId").val("");
if(0 < partLength){
var checkArr = new Array();
var statusFlag = false;
$("input[name=partCheckBox]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
var ststus_cd = fnc_checkNull($(this).attr("data-STATUS_CD").replace(" ",""));
if(ststus_cd=="PURSTCD00300"){
checkArr.push(objId);
statusFlag = true;
}
});
$("#materRegObjId").val(checkArr);
if(statusFlag){
if(confirm("선택한 항목을 접수하시겠습니까?")){
var param = $("#hiddenForm").serialize();
$.ajax({
type : "POST",
url : "/materMgmt/changeMaterRegStatus.do",
data: param,
dataType:"json",
success:function(data){
if(data=="SUCCESS"){
Swal.fire("접수되었습니다.");
fn_search();
};
}
,error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("접수가능한 항목이 없습니다.");
}
}else{
Swal.fire("접수가능한 항목이 없습니다.");
}
}
function fn_deletemater(){
var partLength = $("input[name=partCheckBox]:checked").length;
//초기화
$("#materOrdObjId").val("");
if(0 < partLength){
var checkArr = new Array();
var statusFlag = false;
$("input[name=partCheckBox]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
var ststus_cd = fnc_checkNull($(this).attr("data-STATUS_CD").replace(" ",""));
if(ststus_cd=="PURSTCD00100"){
checkArr.push(objId);
statusFlag = true;
}
});
$("#materOrdObjId").val(checkArr);
if(statusFlag){
if(confirm("선택한 발주서를 삭제하시겠습니까?")){
var param = $("#hiddenForm").serialize();
$.ajax({
type : "POST",
url : "/materMgmt/materDelete.do",
data: param,
dataType:"json",
success:function(data){
if(data =="SUCCESS"){
Swal.fire("삭제되었습니다.");
fn_search();
};
}
,error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("삭제 가능한 항목이 없습니다.");
}
}else{
Swal.fire("선택한 항목이 없습니다.");
}
}
function fn_downmater(){
var partLength = $("input[name=partCheckBox]:checked").length;
if(0 < partLength){
var checkArr = new Array();
var projectArr = new Array();
var statusFlag = false;
$("input[name=partCheckBox]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
var projectno = fnc_checkNull($(this).attr("data-project").replace(" ",""));
var ststus_cd = fnc_checkNull($(this).attr("data-STATUS_CD").replace(" ",""));
if(ststus_cd=="PURSTCD00600" || ststus_cd=="PURSTCD00700" || ststus_cd=="PURSTCD00800"){
checkArr.push(objId);
projectArr.push(projectno);
statusFlag = true;
}
});
if(1 < checkArr.length){
Swal.fire('1건씩만 발주서 다운로드가 가능합니다.');
return;
}
if(statusFlag){
document.form1.action = "/materMgmt/materOrderDown.do?objId="+checkArr[0]+"&projectno="+projectArr[0];
document.form1.submit();
}else{
Swal.fire("발주다운 가능한 항목이 없습니다.");
}
}else{
Swal.fire("선택한 항목이 없습니다.");
}
}
function fn_relemater(){
var partLength = $("input[name=partCheckBox]:checked").length;
//초기화
$("#materOrdObjId").val("");
if(0 < partLength){
var checkArr = new Array();
var statusFlag = false;
$("input[name=partCheckBox]:checked").each(function(){
var objId = fnc_checkNull($(this).attr("data-objId").replace(" ",""));
var ststus_cd = fnc_checkNull($(this).attr("data-STATUS_CD").replace(" ",""));
if(ststus_cd=="PURSTCD00600"){
checkArr.push(objId);
statusFlag = true;
}
});
$("#materOrdObjId").val(checkArr);
if(statusFlag){
if(confirm("선택한 항목을 발주 하시겠습니까?")){
var param = $("#hiddenForm").serialize();
$.ajax({
type : "POST",
url : "/materMgmt/changeMaterOrdStatus.do",
data: param,
dataType:"json",
success:function(data){
if(data=="SUCCESS"){
Swal.fire("발주되었습니다.");
fn_search();
};
}
,error: function(jqxhr, status, error){
}
});
}
}else{
Swal.fire("발주가능한 항목이 없습니다.");
}
}else{
Swal.fire("발주가능한 항목이 없습니다.");
}
}
</script>
</head>
<body class="backcolor">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="actionType" id="actionType">
<input type="hidden" name="objId" id="objId">
<input type="hidden" name="objid" id="objid">
<input type="hidden" name="materRegObjId" id="materRegObjId">
<input type="hidden" name="materOrdObjId" id="materOrdObjId">
</form>
<form name="form1" id="form1" method="post">
<input type="hidden" name="actionType">
<div class="content-box">
<div class="content-box-s">
<div class="plm_menu_name">
<h2>
<span>자재관리_발주 관리</span>
</h2>
</div>
<div id="plmSearchZon">
<table>
<tbody>
<tr>
<td><label for="Year">연도</label></td>
<td>
<select name="Year" id="Year" class="select2" autocomplete="off" style="width:70px;" class="select2" autocomplete="off">
<option value="">선택</option>
<c:forEach begin="${sysYear-4}" end="${sysYear}" var="req_year">
<option value="${req_year}"${param.Year eq req_year ? 'selected':'' }>${req_year}</option>
</c:forEach>
</select>
</td>
<%-- <td class="align_r">
<label for="" class="">발주번호</label>
</td>
<td>
<select name="order_no" id="order_no" style="width:150px;" class="select2" autocomplete="off">
<option value="">전체</option>
${code_map.order_no}
</select>
</td> --%>
<td class="align_r">
<label for="" class="">공급업체명</label>
</td>
<td>
<select name="supply_cd" id="supply_cd" style="width:150px;" class="select2" style="width:180px;" autocomplete="off">
<option value="">전체</option>
${code_map.supply_cd}
</select>
</td>
<%-- <td class="align_r">
<label for="" class="">발주자</label>
</td>
<td>
<select name="reg_user_id" id="reg_user_id" style="width:120px;" class="select2" autocomplete="off">
<option value="">전체</option>
${code_map.recv_userid}
</select>
</td> --%>
<%-- <td class="align_r">
<label for="" class="">상태</label>
</td>
<td colspan="">
<select name="status_cd" id="status_cd" style="width:100px;" class="select2" autocomplete="off">
<option value="">전체</option>
${code_map.status_cd}
</select>
</td> --%>
<td><label for="recv_fromDate">입고요청일</label></td>
<td colspan=""><input type="text" id="recv_fromDate"
name="recv_fromDate" class="date_icon"
value="${param.recv_fromDate}"
style="width: 80px !important;" autocomplete="off"> ~ <input type="text"
id="recv_toDate" name="recv_toDate" class="date_icon"
value="${param.recv_toDate}" style="width: 80px !important;" autocomplete="off">
</td>
<td><label for="order_fromDate">발주일</label></td>
<td colspan="">
<input type="text" id="order_fromDate" name="order_fromDate" class="date_icon"
value="${param.order_fromDate}"
style="width: 80px !important;" autocomplete="off"> ~ <input type="text"
id="order_toDate" name="order_toDate" class="date_icon"
value="${param.order_toDate}" style="width: 80px !important;" autocomplete="off">
</td>
<td><label for="order_fromDate">발주월</label></td>
<td colspan="">
<select name="order_month" style="width:60px;" autocomplete="off">
<option value="">선택</option>
<c:forEach begin="1" end="12" var="req_month">
<option value="${req_month < 10 ? '0':''}${req_month}" ${param.order_month eq req_month ? 'selected':'' }>${req_month}월</option>
</c:forEach>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<section class="contents_page_basic_margin">
<div class="btn_wrap">
<div class="plm_btn_wrap">
<!-- <input type="button" value="입고결과등록" class="plm_btns" id="btnrevSave"> -->
<!-- <input type="button" value="업체등록" class="plm_btns" id="btnSupSave"> -->
<!-- <input type="button" value="발주서다운로드" class="plm_btns" id="btnDown"> -->
<input type="button" value="발주서삭제" class="plm_btns" id="btnDelete">
<!-- <input type="button" value="발주" class="plm_btns" id="relemater"> -->
<!-- <input type="button" value="접수" class="plm_btns" id="btnReg"> -->
<input type="button" value="작성" class="plm_btns" id="btnWritePop">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<!-- <input type="button" value="PART 등록" class="plm_btns" onclick="savepop();"> -->
<!-- <input type="button" value="배포" class="plm_btns" onclick="relepart();"> -->
<!-- <input type="button" value="Excel Export" class="plm_btns" onclick="excelExport()"> -->
</div>
</div>
<div class="plm_table_wrap">
<table class="plm_table">
<colgroup>
<col width="4%" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
<!-- <col width="10%" /> -->
<!-- <col width="10%" /> -->
<col width="10%" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
<!-- <col width="10%" /> -->
<!-- <col width="10%" /> -->
<!-- <col width="10%" /> -->
</colgroup>
<thead>
<tr class="plm_thead">
<td><input type="checkbox" id="allCheck" class="checkBox" style="width:15px;height:15px"></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>첨부파일</td> -->
</tr>
</thead>
<c:choose>
<c:when test="${empty LIST}">
<tr style="text-align:center;">
<td align="center" colspan="9">조회된 데이터가 없습니다.</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${LIST}" varStatus="varStatus">
<tr>
<td>
<%-- <c:if test="${item.STATUS_CD eq 'PURSTCD00600' or item.STATUS_CD eq 'PURSTCD00300' or item.STATUS_CD eq 'PURSTCD00700' or item.STATUS_CD eq 'PURSTCD00100' or item.STATUS_CD eq 'PURSTCD00800' or item.STATUS_CD eq 'PURSTCD00900'}"> --%>
<c:if test="${empty item.APPR_STATUS_CD or item.APPR_STATUS_CD eq 'reject' }">
<input style="width:15px;height:15px" type="checkbox" value="${item.MATERIAL_MASTER_OBJID}" name="partCheckBox" id="partCheckBox" data-objId="${item.MATERIAL_MASTER_OBJID}" data-STATUS_CD="${item.STATUS_CD}" data-project="${item.PROJECT_MGMT_OBJID}">
</c:if>
</td>
<td><a href="#" onclick="fn_MaterModifyPopup('${item.MATERIAL_MASTER_OBJID}','${item.STATUS_CD}')">${item.ORDER_NO}</a></td>
<td title="${item.SUP_NAME}">${item.SUP_NAME}</td>
<td title="${item.TITLE}" style="text-align:left; padding:0px 0px 0px 15px;">${item.TITLE}</td>
<%-- <td title="${item.FINAL_ORDER_AMOUNT}" style="text-align:right; padding:0px 15px 0px 0px;"><fmt:formatNumber value="${item.FINAL_ORDER_AMOUNT}"/></td> --%>
<%-- <td title="${item.DELIVERY_PLACE}">${item.DELIVERY_PLACE}</td> --%>
<td title="${item.RECV_DATE}">${item.RECV_DATE}</td>
<td title="${item.ORDER_DATE}">${item.ORDER_DATE}</td>
<td title="${item.REG_USER_NAME}">${item.REG_USER_NAME}</td>
<td title="${item.STATUS_NAME}">
<a href="#" class="btnApprovalDetail" data-APPROVAL_OBJID="${item.APPROVAL_OBJID}" data-ROUTE_OBJID="${item.ROUTE_OBJID}">
${item.APPR_STATUS}
</a>
</td>
<td title="${item.TOTAL_CNT}">${item.TOTAL_CNT}</td>
<%-- <td title="${item.COMP_CNT}">${item.COMP_CNT}</td> --%>
<%-- <td title="${item.FAIL_CNT}">${item.FAIL_CNT}</td> --%>
<%-- <td><a href="#" class="File file_${item.FILE_CNT eq 0?'empty_':''}icon" data-OBJID="${item.MATERIAL_MASTER_OBJID}" data-docType="MATERREC" data-docTypeName="입고관리"></a></td> --%>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
<div class="pdm_page">
<input type="hidden" name="page" id="page" value="${nPage}">
<c:if test="${!empty LIST}">
<div class="page_pro">
<table align="center">
<tr>
<c:choose>
<c:when test="${nPage > 1}">
<td><a href="javascript:fnc_goPrev('${prevPage}');">prev</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:when>
<c:otherwise>
<td class="no_more_page">prev</td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:otherwise>
</c:choose>
<c:forEach var="v" begin="${nPage>5?nPage-5:1}" end="${nPage>5?nPage+4:10}" step="1" varStatus="status">
<c:if test="${status.index -1 < maxPage}">
<c:choose>
<c:when test="${status.index eq nPage}">
<td><a href="#" class="now_page">${nPage}</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:when>
<c:otherwise>
<td><a href="javascript:fnc_goPage('${status.index}');">${status.index}</a></td>
<td>&nbsp;&nbsp;&nbsp;</td>
</c:otherwise>
</c:choose>
</c:if>
</c:forEach>
<c:choose>
<c:when test="${nPage < maxPage}">
<td><a href="javascript:fnc_goNext('${nextPage}');">next</a></td>
</c:when>
<c:otherwise>
<td class="no_more_page">next</td>
</c:otherwise>
</c:choose>
</tr>
</table>
<c:if test="${!empty LIST}">
<p id="adminPageCount">총 ${totalCount}건</p>
</c:if>
</div>
</c:if>
</div>
</section>
</div>
</div>
</form>
</body>
</html>