Files
wace_plm/WebContent/WEB-INF/view/purchaseOrder/deliveryMngAcceptancePartList.jsp

407 lines
15 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<%
// DB에서 메뉴명 조회 (공통 유틸 사용)
String menuObjId = request.getParameter("menuObjId");
String menuName = CommonUtils.getMenuName(menuObjId, "품목별 입고 관리");
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<style>
.select2-selection__choice {
font-size: 11px;
background-color: #fff !important;
border: none !important;
margin-right: 0px !important;
}
.select2-selection__choice__remove {
display: contents !important;
}
.select2-container .select2-selection--multiple {
min-height: 20px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 3.5px !important;
}
.select2-selection__rendered {
height: 18px !important;
}
.select2-container .select2-selection--multiple .select2-selection__rendered {
overflow: auto !important;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
fnc_changePaginationAndTotalCountArea();
$('.select2').select2();
fnc_datepick();
// 품번/품명 Select2 AJAX 초기화
initPartSelect2Ajax("#SEARCH_PART_NO", "#SEARCH_PART_NAME", "#SEARCH_PART_OBJID");
$("input").keyup(function(e){
if(e.keyCode == 13){
$("#page").val("1");
fn_search();
}
});
$("#delivery_status").val("${param.delivery_status}").trigger("change");
// 조회
$("#btnSearch").click(function(){
$("#page").val("1");
fn_search();
});
// 입고등록
$("#btnAccept").click(function(){
fn_deliveryAcceptancePopUp();
});
// 매입마감 버튼
$("#btnClose").click(function(){
fn_purchaseClose();
});
$("#project_no").change(function(){
fn_UnitCodeList(this.value, "unit_code", "");
});
fn_search();
});
var columns = [
{title:'STATUS', field:'STATUS', visible:false, frozen:true},
{title:'PURCHASE_ORDER_MASTER_OBJID', field:'PURCHASE_ORDER_MASTER_OBJID', visible:false, frozen:true},
{title:'PURCHASE_ORDER_PART_OBJID', field:'PURCHASE_ORDER_PART_OBJID', visible:false, frozen:true},
{title:'FORM_TYPE', field:'FORM_TYPE', visible:false, frozen:true},
{headerHozAlign:'center', hozAlign:'center', minWidth:120, widthGrow:0.9, title:'품의서 No', field:'PROPOSAL_NO',
formatter: fnc_createGridAnchorTag,
cellClick: function(e, cell){
fn_openProposalFormPopUp(cell.getData().SALES_REQUEST_OBJID);
}
},
{headerHozAlign:'center', hozAlign:'center', minWidth:120, widthGrow:0.9, title:'발주서 No', field:'PURCHASE_ORDER_NO',
formatter: fnc_createGridAnchorTag,
cellClick: function(e, cell){
var objId = fnc_checkNull(cell.getData().PURCHASE_ORDER_MASTER_OBJID);
var formType = fnc_checkNull(cell.getData().FORM_TYPE, 'general');
fn_formPopUp(objId, formType);
}
},
{headerHozAlign:'center', hozAlign:'center', minWidth:130, widthGrow:0.9, title:'프로젝트번호', field:'PROJECT_NO'},
{headerHozAlign:'center', hozAlign:'left', minWidth:120, widthGrow:1.5, title:'품번', field:'PART_NO'},
{headerHozAlign:'center', hozAlign:'left', minWidth:150, widthGrow:2, title:'품명', field:'PART_NAME'},
{headerHozAlign:'center', hozAlign:'left', minWidth:120, widthGrow:1.2, title:'공급업체', field:'PARTNER_NAME'},
{headerHozAlign:'center', hozAlign:'right', minWidth:80, widthGrow:0.8, title:'발주수량', field:'ORDER_QTY',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"p", precision:false}
},
{headerHozAlign:'center', hozAlign:'right', minWidth:80, widthGrow:0.8, title:'입고수량', field:'DELIVERY_QTY',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"p", precision:false}
},
{headerHozAlign:'center', hozAlign:'right', minWidth:80, widthGrow:0.8, title:'미입고수량', field:'NON_DELIVERY_QTY',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"p", precision:false}
},
{headerHozAlign:'center', hozAlign:'center', minWidth:90, widthGrow:1.1, title:'수입검사 검사현황', field:'INSPECTION_STATUS'},
{headerHozAlign:'center', hozAlign:'right', minWidth:80, widthGrow:1.1, title:'처리결과 폐기수량', field:'DEFECT_QTY',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"p", precision:false}
},
{headerHozAlign:'center', hozAlign:'right', minWidth:90, widthGrow:0.9, title:'확정입고수량', field:'CONFIRMED_QTY',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"p", precision:false}
},
{headerHozAlign:'center', hozAlign:'center', minWidth:90, widthGrow:0.6, title:'매입마감', field:'PURCHASE_CLOSE_DATE'}
];
function fn_search(){
var selectedValues = $("#project_no").val();
$('<input>').attr({
type: 'hidden',
name: 'project_nos',
value: selectedValues
}).appendTo('#form1');
var selectedIdValues = $("#sales_mng_user_id").val();
$('input[name="sales_mng_user_ids"]').remove();
$('<input>').attr({
type: 'hidden',
name: 'sales_mng_user_ids',
value: selectedIdValues
}).appendTo('#form1');
// 그리드 조회
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/purchaseOrder/deliveryMngAcceptancePartGridList.do", columns, true);
// 데이터 렌더링 완료 후 높이 조절
if(_tabulGrid) {
_tabulGrid.off("renderComplete");
_tabulGrid.on("renderComplete", function(){
fnc_calculateContentHeight("gridDiv", 30);
});
}
// 윈도우 리사이즈 이벤트
$(window).off("resize.gridHeight").on("resize.gridHeight", function() {
fnc_calculateContentHeight("gridDiv", 30);
});
}
// 입고등록 팝업
function fn_deliveryAcceptancePopUp(){
var selected = _tabulGrid.getSelectedData();
if(selected.length == 0){
Swal.fire("선택된 데이터가 없습니다.");
return;
}
if(selected.length > 1){
Swal.fire("한건씩 등록 가능합니다.");
return;
}
var status = fnc_checkNull(selected[0].STATUS);
if(status === 'orderCancel'){
Swal.fire("발주취소된 건은 입고등록할 수 없습니다.");
return;
}
var popup_width = 1560;
var popup_height = 1050;
var hiddenForm = document.hiddenForm;
var target = "deliveryAcceptancePopUp";
var url = "/purchaseOrder/deliveryAcceptanceFormPopUp_new.do";
var purchaseOrderMasterObjid = fnc_checkNull(selected[0].PURCHASE_ORDER_MASTER_OBJID);
var purchaseOrderNo = fnc_checkNull(selected[0].PURCHASE_ORDER_NO);
var deliveryStatus = fnc_checkNull(selected[0].DELIVERY_STATUS);
fn_centerPopup(popup_width, popup_height, "", target);
hiddenForm.action = url;
hiddenForm.checkArr.value = purchaseOrderMasterObjid;
hiddenForm.PURCHASE_ORDER_MASTER_OBJID.value = purchaseOrderMasterObjid;
hiddenForm.PURCHASE_ORDER_NO.value = purchaseOrderNo;
hiddenForm.DELIVERY_STATUS.value = deliveryStatus;
hiddenForm.actionType.value = 'regist';
hiddenForm.target = target;
hiddenForm.submit();
}
// 품의서 상세 팝업
function fn_openProposalFormPopUp(objId){
var url = "/salesMng/proposalFormPopUp.do?PROPOSAL_OBJID=" + fnc_checkNull(objId);
window.open(url, "proposalFormPopUp", "width=1200,height=900,scrollbars=yes,resizable=yes");
}
// 발주서 팝업
function fn_formPopUp(objId, formType){
var popup_width = 1460;
var popup_height = 1050;
formType = fnc_checkNull(formType, 'general');
var hiddenForm = document.hiddenForm;
var target = "";
var url = "";
if(formType == 'outsourcing'){
target = "purchaseOrderFormPopup_outsourcing";
url = "/purchaseOrder/purchaseOrderFormPopup_outsourcing.do";
popup_width = 1200;
popup_height = 900;
} else if(formType == 'general'){
target = "purchaseOrderFormPopup_general";
url = "/purchaseOrder/purchaseOrderFormPopup_general.do";
popup_width = 1000;
popup_height = 900;
} else {
target = "purchaseOrderFormPopup_new";
url = "/purchaseOrder/purchaseOrderFormPopup_new.do";
}
fn_centerPopup(popup_width, popup_height, "", target);
hiddenForm.PURCHASE_ORDER_MASTER_OBJID.value = objId;
hiddenForm.action = url;
hiddenForm.target = target;
hiddenForm.submit();
}
// 매입마감 처리
function fn_purchaseClose(){
var selected = _tabulGrid.getSelectedData();
if(selected.length == 0){
Swal.fire("선택된 데이터가 없습니다.");
return;
}
// 이미 마감된 건 체크
var alreadyClosed = selected.filter(function(item){
return fnc_checkNull(item.PURCHASE_CLOSE_DATE) != '';
});
if(alreadyClosed.length > 0){
Swal.fire("이미 매입마감 처리된 건이 포함되어 있습니다.");
return;
}
// 입고완료 건만 마감 가능
var notCompleted = selected.filter(function(item){
return item.DELIVERY_STATUS != '입고완료';
});
if(notCompleted.length > 0){
Swal.fire("입고완료 건만 매입마감 처리가 가능합니다.");
return;
}
Swal.fire({
title: '매입마감',
text: '선택한 ' + selected.length + '건을 매입마감 처리하시겠습니까?',
icon: 'question',
showCancelButton: true,
confirmButtonText: '확인',
cancelButtonText: '취소'
}).then((result) => {
if(result.isConfirmed){
var objIds = selected.map(function(item){
return item.PURCHASE_ORDER_MASTER_OBJID;
}).join(',');
$.ajax({
url: '/purchaseOrder/purchaseClose.do',
type: 'POST',
data: { objIds: objIds },
dataType: 'json',
success: function(response){
if(response.result == 'SUCCESS'){
Swal.fire('매입마감 처리가 완료되었습니다.').then(function(){
fn_search();
});
} else {
Swal.fire('매입마감 처리 중 오류가 발생했습니다.');
}
},
error: function(){
Swal.fire('서버 통신 중 오류가 발생했습니다.');
}
});
}
});
}
</script>
<body class="bodyNoScroll">
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="checkArr" id="checkArr">
<input type="hidden" name="PURCHASE_ORDER_MASTER_OBJID" id="PURCHASE_ORDER_MASTER_OBJID">
<input type="hidden" name="PURCHASE_ORDER_NO" id="PURCHASE_ORDER_NO">
<input type="hidden" name="DELIVERY_STATUS" id="DELIVERY_STATUS">
<input type="hidden" name="actionType" id="actionType">
</form>
<form name="form1" id="form1" action="" method="post">
<textarea style="width:0px; height:0px; visibility: hidden;" id="jsonLevel3_csmCategory">${code_map.jsonLevel3_csmCategory}</textarea>
<div class="content-box" style="height: 99.3%;">
<div class="content-box-s">
<div class="plm_menu_name_gdnsi">
<h2>
<span><%=menuName%></span>
</h2>
<div class="btnArea">
<input type="button" class="plm_btns" value="조회" id="btnSearch">
<input type="button" class="plm_btns" value="입고등록" id="btnAccept">
<input type="button" class="plm_btns" value="매입마감" id="btnClose">
</div>
</div>
<div id="plmSearchZon">
<table>
<tr>
<td><label for="Year">년도</label></td>
<td>
<select name="Year" id="Year" class="select2" autocomplete="off" style="width:170px;">
<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><label for="">고객사</label></td>
<td><select name="customer_cd" id="customer_cd" class="select2" autocomplete="off" style="width:170px;"><option value="">선택</option>${code_map.customer_cd}</select></td>
<td><label for="project_no">프로젝트번호</label></td>
<td>
<select name="project_no" id="project_no" style="width:253px;" class="select2" autocomplete="off" multiple="multiple">
<option value="">선택</option>
${code_map.project_no}
</select>
</td>
<td><label for="">발주No.</label></td>
<td><input type="text" name="purchase_order_no" id="purchase_order_no" autocomplete="off" value="${param.purchase_order_no}" style="width:185px;"/></td>
<td><label for="">규격</label></td>
<td><input type="text" name="SEARCH_PART_SPEC" id="SEARCH_PART_SPEC" autocomplete="off" value="${param.SEARCH_PART_SPEC}" style=""/></td>
<td><label for="">품명</label></td>
<td>
<select name="SEARCH_PART_NAME" id="SEARCH_PART_NAME" class="select2-part" style="">
<option value="">품명 선택</option>
</select>
</td>
</tr>
<tr>
<td><label for="">공급업체</label></td>
<td><select name="partner_objid" id="partner_objid" class="select2" autocomplete="off" style="width:170px;"><option value="">선택</option>${code_map.partner_objid}</select></td>
<td><label for="">구매담당자</label></td>
<td><select name="sales_mng_user_id" id="sales_mng_user_id" class="select2" autocomplete="off" style="width:170px;" multiple="multiple"><option value="">선택</option>${code_map.sales_mng_user_id}</select></td>
<td class=""><label>입고요청일</label></td>
<td>
<input type="text" name="delivery_start_date" id="delivery_start_date" style="width:120px;" autocomplete="off" value="${param.delivery_start_date}" class="date_icon">~
<input type="text" name="delivery_end_date" id="delivery_end_date" style="width:120px;" autocomplete="off" value="${param.delivery_end_date}" class="date_icon">
</td>
<td class=""><label>발주일</label></td>
<td>
<input type="text" name="reg_start_date" id="reg_start_date" style="width:87px;" autocomplete="off" value="${param.reg_start_date}" class="date_icon">~
<input type="text" name="reg_end_date" id="reg_end_date" style="width:87px;" autocomplete="off" value="${param.reg_end_date}" class="date_icon">
</td>
<td><label for="">입고결과</label></td>
<td>
<select name="delivery_status" id="delivery_status" class="select2" autocomplete="off" style="">
<option value="">선택</option>
<option value="입고중">입고중</option>
<option value="입고완료">입고완료</option>
<option value="지연">지연</option>
</select>
</td>
<td><label for="">품번</label></td>
<td>
<select name="SEARCH_PART_NO" id="SEARCH_PART_NO" class="select2-part" style="width:120px;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="SEARCH_PART_OBJID" id="SEARCH_PART_OBJID" value="">
</td>
</tr>
</table>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</div>
</div>
</form>
</body>
</html>