ERP-node/WebContent/WEB-INF/view/inventoryMng/inventoryMngList.jsp

447 lines
16 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(){
fnc_datepick();
$("input[type=text]").keyup(function(e){
if(e.keyCode == 13) search();
});
$("#btnReg").click(function(){
openResourceMasterMngPopUp("");
});
//재고등록
$("#btnInventoryReg").click(function(){
openInventoryRegistPopUp();
});
//자재투입등록
$("#btnResourceReg").click(function(){
openInputResourceRegistFormPopUp();
});
$("#btnDelete").click(function(){
fn_deleteCustomerMng();
});
//체크박스 전체선택/전체해제
$("#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();
});
$("#search_resource_title").change(function(){
$("#search_product_title").empty();
if("" != this.value){
fnc_getCodeListAppend(this.value,"search_product_title","");
}else{
$("#search_product_title").append("<option value=''>선택</option>");
}
});
//첨부팝업
$(".File").click(function(){
var popup_width = 800;
var popup_height = 335;
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;
var url = "/projectConcept/FileRegistPopup.do"+params;
fn_centerPopup(popup_width, popup_height, url);
});
//명칭기준정보 목록을 가져온다.
fnc_getCodeListAppend("<%=Constants.RESOURCE_TITLE_CD%>","search_resource_title","${param.search_resource_title}");
if("" != "${param.search_resource_title}"){
fnc_getCodeListAppend("${param.search_resource_title}","search_product_title","${param.search_product_title}");
}
});
});
function fn_deleteCustomerMng(){
var objIdArr = $("input[name=resourceMasterObjId]:checked");
if(0 == objIdArr.length){
Swal.fire("선택된 대상이 없습니다.");
}else{
var checkArr = new Array();
var ngCnt = 0;
$("input[name=resourceMasterObjId]:checked").each(function(){
var objId = fnc_checkNull($(this).val().replace(" ",""));
checkArr.push(objId);
});
if(confirm("삭제하시겠습니까?")){
$.ajax({
type : "POST",
url : "/inventoryMng/deleteInventoryMng.do",
data: {"checkArr":checkArr.join()},
dataType:"json",
success:function(data){
Swal.fire(data.msg);
if(data.result =="true"){
fn_search();
}
}
,error: function(jqxhr, status, error){
}
});
}
}
}
//재고등록
function openInventoryRegistPopUp(){
var resourceObjId = "";
if(1 < $("input[name=resourceMasterObjId]:checked").length){
Swal.fire("1개의 자재품목만 선택 가능합니다.");
return false;
}else if(0 == $("input[name=resourceMasterObjId]:checked").length){
Swal.fire("선택된 자재품목이 없습니다.");
return false;
}else if(1 == $("input[name=resourceMasterObjId]:checked").length){
resourceObjId = $("input[name=resourceMasterObjId]:checked").val();
}
var hiddenForm = document.hiddenForm;
var url = "/inventoryMng/inventoryRegistFormPopUp.do";
var target = "inventoryRegistFormPopUp";
var popup_width = 450;
var popup_height = 420;
fn_centerPopup(popup_width, popup_height, url, target);
hiddenForm.action = url;
hiddenForm.OBJID.value = resourceObjId;
hiddenForm.target = target;
hiddenForm.submit();
}
//자재투입등록
function openInputResourceRegistFormPopUp(){
var resourceObjId = "";
var totalQty = "0";
if(1 < $("input[name=resourceMasterObjId]:checked").length){
Swal.fire("1개의 자재품목만 선택 가능합니다.");
return false;
}else if(0 == $("input[name=resourceMasterObjId]:checked").length){
Swal.fire("선택된 자재품목이 없습니다.");
return false;
}else if(1 == $("input[name=resourceMasterObjId]:checked").length){
resourceObjId = $("input[name=resourceMasterObjId]:checked").val();
totalQty = $("input[name=resourceMasterObjId]:checked").attr("data-TOTAL_QTY");
if(totalQty == 0){
Swal.fire("투입가능한 재고가 존재하지 않습니다.");
return false;
}
}
var popup_width = 450;
var popup_height = 530;
var hiddenForm = document.hiddenForm;
var url = "/inventoryMng/inputResourceRegistFormPopUp.do";
var target = "inputResourceRegistFormPopUp";
fn_centerPopup(popup_width, popup_height, url, target);
hiddenForm.action = url;
hiddenForm.OBJID.value = resourceObjId;
hiddenForm.target = target;
hiddenForm.submit();
}
//재고 및 투입이력
function openInventoryHistoryPopUp(objId){
var popup_width = 1200;
var popup_height = 430;
var hiddenForm = document.hiddenForm;
var url = "/inventoryMng/inventoryHistoryPopUp.do";
var target = "inventoryHistoryPopUp";
fn_centerPopup(popup_width, popup_height, url, target);
hiddenForm.action = url;
hiddenForm.OBJID.value = objId;
hiddenForm.target = target;
hiddenForm.submit();
}
function fn_search(){
document.form1.action = "/inventoryMng/inventoryMngList.do";
document.form1.submit();
}
function openFilePopup(objId,title,docType){
var hiddenForm = document.hiddenForm;
var url = "/resourceMasterMng/resourceMasterFilePopUp.do";
var target = "resourceMasterMng";
window.open(url,target,"width=600, height=250, menubars=no, scrollbars=yes, resizable=yes");
hiddenForm.action = url;
hiddenForm.DOC_TYPE.value = docType;
hiddenForm.TITLE.value = title;
hiddenForm.OBJID.value = objId;
hiddenForm.target = target;
hiddenForm.submit();
}
</script>
</head>
<body class="backcolor">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="OBJID" id="OBJID">
<input type="hidden" name="DOC_TYPE" id="DOC_TYPE">
<input type="hidden" name="TITLE" id="TITLE">
<input type="hidden" name="actionType" id="actionType">
<input type="hidden" name="status" id="status">
</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="search_year" id="search_year" style="width:200px;" autocomplete="off">
<option value="">선택</option>
<c:forEach begin="${sysYear-4}" end="${sysYear}" var="req_year">
<option value="${req_year}"${param.search_year eq req_year ? 'selected':'' }>${req_year}</option>
</c:forEach>
</select>
</td>
<td><label for="">품번</label></td>
<td>
<input type="text" name="part_no" id="part_no" style="width:200px;" value="${param.part_no}">
</td>
<td><label for="">품명</label></td>
<td>
<input type="text" name="part_name" id="part_name" style="width:200px;" value="${param.part_name}">
</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="btnResourceReg">
<input type="button" value="삭제" class="plm_btns" id="btnDelete">
<input type="button" value="재고등록" class="plm_btns" id="btnInventoryReg">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
</div>
</div>
<div class="plm_table_wrap">
<div>
<table class="plm_table">
<colgroup>
<col width="1.5%" />
<col width="6%" /> <!-- 품목 -->
<col width="6%" /> <!-- 품명 -->
<col width="7%" /> <!-- 규격 -->
<col width="8%" /> <!-- 재질 -->
<col width="5%" /> <!-- 단위 -->
<!-- <col width="5%" /> --> <!-- 중량 -->
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<!-- <col width="4%" /> -->
<col width="5%" /> <!-- 형상 -->
<c:if test="${!empty inventoryLocationList}">
<c:forEach var="info" items="${inventoryLocationList}" varStatus="status">
<col width="6%">
</c:forEach>
</c:if> <!-- Location -->
<col width="6%" /> <!-- 총수량 -->
<col width="*" /> <!-- 비고 -->
</colgroup>
<thead>
<tr class="plm_thead">
<td rowspan="2"><input type="checkbox" name="allCheck"></td>
<td colspan="11">자재정보</td>
<td colspan="${fn:length(inventoryLocationList)+1}">위치별수량</td>
<td rowspan="2">비고</td> <!-- 비고 -->
</tr>
<tr class="plm_thead">
<td>품목</td> <!-- 명칭 -->
<td>품명</td> <!-- 품명 -->
<td>규격</td> <!-- 규격 -->
<td>재질</td> <!-- 단위 -->
<td>단위</td> <!-- Unit -->
<!-- <td>중량</td> --> <!-- 중량-->
<td>두께</td>
<td>가로</td>
<td>세로</td>
<td>외경</td>
<td>내경</td>
<td>길이</td>
<!-- <td>형상</td> -->
<c:if test="${!empty inventoryLocationList}">
<c:forEach var="info" items="${inventoryLocationList}" varStatus="status">
<td>${info.CODE_NAME}</td>
</c:forEach>
</c:if> <!-- Location -->
<td>총수량</td> <!-- 중량 -->
</tr>
</thead>
<c:choose>
<c:when test="${empty LIST}">
<tr style="text-align:center;">
<td align="center" colspan="${fn:length(inventoryLocationList)+14}">조회된 데이터가 없습니다.</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${LIST}" varStatus="varStatus">
<tr>
<td><input type="checkbox" name="resourceMasterObjId" value="${item.OBJID}" data-TOTAL_QTY="${item.QTY_SUM}"></td>
<td title="${item.PART_NO}">${item.PART_NO}</td>
<td title="${item.PART_NAME}">${item.PART_NAME}</td>
<td title="${item.SPEC}">${item.SPEC}</td>
<td title="${item.MATERIAL}">${item.STANDARD}</td>
<td title="${item.UNIT}">${item.UNIT}</td>
<%-- <td title="${item.WEIGHT}">${item.WEIGHT}</td> --%>
<td title="${item.THICKNESS}">${item.THICKNESS}</td>
<td title="${item.WIDTH}">${item.WIDTH}</td>
<td title="${item.HEIGHT}">${item.HEIGHT}</td>
<td title="${item.OUT_DIAMETER}">${item.OUT_DIAMETER}</td>
<td title="${item.IN_DIAMETER}">${item.IN_DIAMETER}</td>
<td title="${item.LENGTH}">${item.LENGTH}</td>
<%-- <td title="" class="align_c">
<c:if test="${!empty item.SAVED_FILE_NAME and !empty item.REAL_FILE_NAME and !empty item.FILE_PATH}">
<img src="#" height='85px' width='100%' onclick="fnc_openImagePopUp(this.src)" data-SRC="/common/viewImage.do?realFileName=${item.REAL_FILE_NAME}&savedFileName=${item.SAVED_FILE_NAME}&attDir=${item.FILE_PATH}"/>
</c:if>
</td>
<td><a href="#" class="File file_${item.CU01_CNT eq 0?'empty_':''}icon" data-OBJID="${item.PART_OBJID}" data-docType="3D_CAD" data-docTypeName="3D CAD 첨부파일"></a></td>
<td><a href="#" class="File file_${item.CU02_CNT eq 0?'empty_':''}icon" data-OBJID="${item.PART_OBJID}" data-docType="2D_DRAWING_CAD" data-docTypeName="2D(Drawing) CAD 첨부파일"></a></td>
<td><a href="#" class="File file_${item.CU03_CNT eq 0?'empty_':''}icon" data-OBJID="${item.PART_OBJID}" data-docType="2D_PDF_CAD" data-docTypeName="2D(PDF) CAD 첨부파일"></a></td>
--%>
<c:if test="${!empty inventoryLocationList}">
<c:forEach var="commCD" items="${inventoryLocationList}" varStatus="status">
<c:set var="colName" value="COL_${commCD.CODE_ID}" />
<td title="<fmt:formatNumber value="${item[colName]}"/>"><fmt:formatNumber value="${item[colName]}"/></td>
</c:forEach>
</c:if>
<td title="<fmt:formatNumber value="${item.QTY_SUM}"/>"><a href="#" onclick="openInventoryHistoryPopUp('${item.OBJID}')"><fmt:formatNumber value="${item.QTY_SUM}"/></a></td> <!-- Date -->
<td title="${item.REMARK}" class='align_l'>${item.REMARK}</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
</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>