fit : 제품조회와 일련번호 조회 분리. (유효기간 조회로 해뒀는데 유효기간이 아니라 기준일자로 다른것 같음. 확인필요)

dev
Leeyh1121 4 months ago
parent 8806ee3a71
commit e0c0adeffd

@ -2,46 +2,44 @@
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">마약류 제품 조회</c:set>
<!-- 입력 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="content-wrapper">
<div class="container flex-grow-1 px-0 row g-1">
<div class="card col-6">
<!-- 입력 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<!-- hidden -->
<div class="row my-1 mx-4 g-1" style="align-items: baseline">
<div class="col-md-4">
<label for="ProductNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">제품명</label>
<input type="text" class="form-control w-60" id="productNm--${pageName}" name="schProductNm" >
<div class="row my-0 mx-1 g-0" style="align-items: baseline">
<div class="col-md-6">
<label for="ProductNm--${pageName}" class="w-px-90 bg-lighter pe-2 col-form-label text-sm-end">제품명</label>
<input type="text" class="form-control w-50" id="productNm--${pageName}" name="schProductNm" >
</div>
<div class="col-md-4">
<label for="ProductCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">제품코드</label>
<input type="text" class="form-control w-60" id="productCd--${pageName}" name="schProductCd" >
<div class="col-md-6">
<label for="ProductCd--${pageName}" class="w-px-80 bg-lighter pe-2 col-form-label text-sm-end">제품코드</label>
<input type="text" class="form-control w-50" id="productCd--${pageName}" name="schProductCd" >
</div>
<div class="d-flex flex-row justify-content-between p-3">
<div>
<div class="input-group" id="DataTables_Table_0_length">
</div>
</div>
<div>
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">검색</button>&nbsp;
<button type="button" class="btn btn-primary w-px-120" id="btnSearch2--${pageName}" title="검색">NIMS 검색</button>
</div>
</div>
</form>
<!-- 업무 버튼 표시 -->
<div>
<span class="container-page-btn">
<span class="container-window-btn-right">
<!-- 업무 버튼 -->
<button type="button" class="btn btn-primary w-px-80" id="btnSave--${pageName}" title="선택">선택</button>
</span>
</span>
</div>
<!-- / 업무 버튼 표시 -->
<div class="card-datatable text-nowrap">
</div>
</div>
</form>
<!-- / 업무 버튼 표시 -->
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsiv-0--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th class="sorting" style="width: 146.156px;">제품코드</th>
<th class="sorting" style="width: 300.141px;">제품명</th>
<th class="sorting" style="width: 120.469px;">유효기간</th>
<th class="sorting" style="width: 160.469px;">제조번호</th>
<th class="sorting" style="width: 160.469px;">제조일련번호</th>
<th class="sorting" style="width: 120.469px;">유통단위</th>
<th class="sorting" style="width: 120.469px;">낱개단위</th>
<th class="sorting" style="width: 130.141px;">마약/향정구분</th>
@ -55,9 +53,6 @@
<tr data-key="{keyCnt}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{prductNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdValidDe}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfNo}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfSeq}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdMinDistbQy} {stdPackngStleNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdTotPceQy} {pceCoUnitNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{nrcdSeNm}</td>
@ -73,13 +68,77 @@
</table>
</div>
</div>
</div>
<div class="d-flex flex-row p-3 justify-content-between">
</div>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}Paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging--${pageName}" class="pagination pagination-primary" style="display: none;">
</ul>
</div>
</div>
<div class="card col-6">
<form id="frmSearch--${pageName}Detail" name="frmSearchDetail">
<div class="container-search">
<!-- hidden -->
<div class="row my-0 mx-1 g-1" style="align-items: baseline">
<div class="col-md-9">
<label for="schPrdValidDe--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">유효기간</label>
<input type="text" class="form-control w-30 form-date" id="schPrdValidDe--${pageName}" name="schPrdValidDe" data-fmt-type="day" data-map="schPrdValidDe" autocomplete="off" title="유효기간" />
<button type="button" class="bx bx-sm bx-calendar bg-white"></button>
</div>
<button type="button" class="btn btn-primary w-px-120" id="btnSearch3--${pageName}" title="검색">NIMS 검색</button>
</div>
</div>
</form>
<!-- 업무 버튼 표시 -->
<div>
<span class="container-page-btn" style="min-height: 36px">
<span class="container-window-btn-right">
<!-- 업무 버튼 -->
<button type="button" class="btn btn-primary w-px-80" id="btnSave--${pageName}" title="선택">선택</button>
</span>
</span>
</div>
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_1_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive-1--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_1--${pageName}" aria-describedby="DataTables_Table_1_info">
<thead>
<tr>
<th class="sorting" style="width: 146.156px;">제품코드</th>
<th class="sorting" style="width: 300.141px;">제품명</th>
<th class="sorting" style="width: 120.469px;">유효기간</th>
<th class="sorting" style="width: 160.469px;">제조번호</th>
<th class="sorting" style="width: 160.469px;">제조일련번호</th>
</tr>
</thead>
<tbody id="tbody--${pageName}Detail">
</tbody>
<template id="${infoPrefix}Row--${pageName}Detail">
<tr data-key="{keyCnt}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{prductNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdValidDe}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfNo}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfSeq}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}Detail">
<tr class="odd">
<td valign="top" colspan="13" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</div>
</div>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}DetailPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}DetailPaging--${pageName}" class="pagination pagination-primary" style="display: none;">
</ul>
</div>
</div>
</div>
</div>
<script>
/**************************************************************************
* Global Variable
@ -102,18 +161,8 @@
$P.control = new DatasetControl({
urls : {
// FIXME: 2024-07-05 제품검색 완료후 교체
load : wctx.url("/adds/nims/getNimsProductInfoKdAndMnfSeqInfo.do"),
//load : wctx.url("/adds/nims/getNimsProductInfoKd.do"), // 제품 검색
//load : wctx.url("/adds/nims/getNimsProductSeqInfo.do"), // 시리얼번호 검색
/*
{
fg: "1", // 1-제조번호, 2-시리얼번호
p: "717726", //제품코드
t: "", //제조번호 또는 시리얼번호,
userId: "${currentUser.account}"
}
*/
//load : wctx.url("/adds/nims/getNimsProductInfoKdAndMnfSeqInfo.do"),
load : wctx.url("/adds/nims/getNimsProductInfoKd.do"), // 제품 검색
}
, prefix: "productMain"
, prefixName: "마약류 제품 조회"
@ -125,9 +174,8 @@
}
// 제품 목록
let keyCnt = 1; // key 설정 : 상품코드로는 불가하여 임시로 생성
return obj.data?.map(item => {
return obj.data?.map(item => ({
// mnfSeqInfos 배열의 데이터 갯수만큼 반복문 실행
return item.mnfSeqInfos.map(info => ({
keyCnt: keyCnt++,
prductCd: item.prductCd,
prductNm: item.prductNm,
@ -137,18 +185,11 @@
stdPackngStleNm: item.stdPackngStleNm,
prdTotPceQy: item.prdTotPceQy,
pceCoUnitNm: item.pceCoUnitNm,
bsshCd: item.bsshCd,
mnfNo: info.mnfNo,
mnfSeq: info.mnfSeq,
prdValidDe: info.prdValidDe
bsshCd: item.bsshCd
}));
}).flat();
}
, appendData: true
, infoSize: "xl"
, formats: {
prdValidDe: dateFormat
}
});
// $P.control 설정
@ -157,6 +198,44 @@
$P.control.beforeCurrent = null;
$P.control.tableRenderComplete = false; // dataTables 에 자료 추가 완료 여부
$P.detailControl = new DatasetControl({
urls : {
// FIXME: 2024-07-05 제품검색 완료후 교체
load : wctx.url("/adds/nims/getNimsProductSeqInfo.do"), // 시리얼번호 검색
}
, prefix: "productMain"
, prefixName: "마약류 제품 조회"
, keymapper: info => info ? info.keyCnt : ""
, dataGetter : obj => {
if (!obj.success){
dialog.alert(obj.message);
return false;
}
// 제품 목록
let keyCnt = 1; // key 설정 : 상품코드로는 불가하여 임시로 생성
return obj.data?.map(item => ({
// mnfSeqInfos 배열의 데이터 갯수만큼 반복문 실행
keyCnt: keyCnt++,
prductCd: item.prductCd,
prductNm: item.prductNm,
mnfNo: item.mnfNo,
mnfSeq: item.mnfSeq,
prdValidDe: item.prdValidDe
}));
}
, appendData: true
, infoSize: "xl"
, formats: {
prdValidDe: dateFormat
}
});
// $P.control 설정
$P.detailControl.defaultFetchSize = FETCH_XXS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
$P.detailControl.untilPageNum = 0; // 현재 페이지 번호
$P.detailControl.beforeCurrent = null;
$P.detailControl.tableRenderComplete = false; // dataTables 에 자료 추가 완료 여부
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
@ -185,9 +264,33 @@
$("#tbody--${pageName}").setCurrentRow(key);
// Dataset 셋팅
$P.formFields.set($P.control, item);
$P.fnDetailSearchList();
}
// 현재 선택 자료 변경 이벤트
$P.detailControl.onCurrentChange = (item) => {
if (!item) return;
let key = item.data.keyCnt;
$("#tbody--${pageName}Detail").setCurrentRow(key);
};
$P.detailControl.onDatasetChange = (obj) => {
$P.renderDetailList(obj.${infoPrefix}Total);
$("#${infoPrefix}DetailPaging--${pageName}").setPagingInfo({
list: $P.detailControl.dataset
, prefix: "${infoPrefix}DetailPaging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].detailControl.load({index})"
});
$P.control.tableRenderComplete = true; // dataTables 에 자료 추가 완료
};
// 저장 callback
// 저장
@ -212,8 +315,8 @@
//
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');");
// .replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").content.outerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
@ -230,6 +333,22 @@
}
}
$P.renderDetailList = () => {
let ${infoPrefix}DetailList = $P.detailControl.dataset;
let empty = ${infoPrefix}DetailList.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}Detail").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}DetailList.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}Detail").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].detailControl.setCurrent('" + dataItem.getValue("keyCnt") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()")
);
$("#tbody--${pageName}Detail").html(trs.join());
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
@ -241,6 +360,7 @@
$P.fnSearchList = (dbSkipYn) => {
$P.control.query = {
... $P.formFields.get(),
k: "1d6646562470902a61fc334c83a249cdcc5dc753426942138ee04342e66c8128",
p: $P.formFields.get().schProductCd,
pn: $P.formFields.get().schProductNm,
dbSkipYn: dbSkipYn? dbSkipYn : "N",
@ -252,6 +372,21 @@
$P.control.load(1);
}
$P.fnDetailSearchList = (prdValidDe) => {
$P.detailControl.query = {
fg: "1", // 1-제조번호, 2-시리얼번호
p: $P.control.dataset.getCurrent().prductCd , //제품코드
ymd: prdValidDe,
t: "", //제조번호 또는 시리얼번호
userId: "${currentUser.account}"
};
$P.detailControl.query.fetchSize = FETCH_XXL; // 한번에 조회되는 자료 건수
$P.detailControl.query.delYn = "N"; // 삭제 여부
$P.detailControl.load(1);
}
// 저장
$P.fnSave = () => {
dialog.alert({
@ -260,7 +395,10 @@
, onOK: () => {
let openPage = new AddsFormFields("#${openPage}");
openPage.set (null,$P.control.getCurrent()); // formFields
productData = {...$P.control.getCurrent(), ...$P.detailControl.getCurrent()}
openPage.set (null,productData); // formFields
//openPage.set (null,$P.DetailControl.getCurrent()); // formFields
dialog.close("productMainDialog");
}
});
@ -271,17 +409,34 @@
**************************************************************************/
// 이벤트 설정
$P.setEvent = () => {
// form-date 항목에서 키보드로 입력시 날짜 포맷팅 적용
$("#frmSearch--${pageName}").find(".form-date").each(function() {
$(this).on("input", function() {
let value = this.value.replaceAll("-", "");
if (value.length > 7) {
this.value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6);
} else if (value.length > 5) {
this.value = value.substring(0, 4) + "-" + value.substring(4);
}
});
});
// 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList());
$("#btnSearch2--${pageName}").on("click", () => $P.fnSearchList("Y"));
$("#btnSearch3--${pageName}").on("click", () => $P.fnDetailSearchList($("input[name='schPrdValidDe']").val().replaceAll("-", "")));
}
// DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고)
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
// fnMakeResizableTable($("#table-responsive-0--${pageName}")[0]);
// fnMakeResizableTable($("#table-responsive-1--${pageName}")[0]);
// 초기 화면 설정
$P.initForm = () => {}
$P.initForm = () => {
$("#schPrdValidDe--${pageName}").datepicker("setDate", new Date());
}
/**************************************************************************
* 최초 실행 함수

Loading…
Cancel
Save