fix: 폐기접수 처리

dev
Jonguk. Lim 5 months ago
parent 281a0379c6
commit 65cc22ff1d

@ -2,6 +2,7 @@ package cokr.xit.adds.nims.web;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@ -17,8 +18,10 @@ import cokr.xit.foundation.web.AbstractController;
value = {"/adds/nims"} value = {"/adds/nims"}
) )
public class DsuseMgtReceiptController extends AbstractController { public class DsuseMgtReceiptController extends AbstractController {
@Value("${app.api.host:}")
private String apiHost;
public static final String CLASS_URL = "/adds/nims"; private static final String CLASS_URL = "/adds/nims";
public class METHOD_URL { public class METHOD_URL {
public static final String public static final String
@ -60,8 +63,6 @@ public class DsuseMgtReceiptController extends AbstractController {
return mav return mav
.addObject("pageName", "dsuseMgtReceiptInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("pageName", "dsuseMgtReceiptInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix .addObject("apiHost", apiHost);
// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
;
} }
} }

@ -36,13 +36,17 @@
<input type="text" class="form-control w-60" id="bizrno--${pageName}" name="bizrno" data-map="bizrno" readonly> <input type="text" class="form-control w-60" id="bizrno--${pageName}" name="bizrno" data-map="bizrno" readonly>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<label for="addr--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기사유</label> <label for="dsusePrvCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기사유</label>
<select class="form-select" id="schVltnCd--${pageName}" name="schVltnCd"><option value="">사고마약류(파손)</option><option value="01">사고마약류(변질,부패)</option><option value="02">유효기한 또는 사용기한 경과</option><option value="03">재고관리 또는 보관을 하기에 곤란한 사유(유효기한 임박)</option> <select class="form-select" id="dsusePrvCd--${pageName}" name="dsusePrvCd">
<option value="04">재고관리 또는 보관을 하기에 곤란한 사유(사용중단)</option> <option value="01">사고마약류(파손)</option>
<option value="05">재고관리 또는 보관을 하기에 곤란한 사유(폐업)</option> <option value="02">사고마약류(변질,부패)</option>
<option value="06">재고관리 또는 보관을 하기에 곤란한 사유(환자반납)</option> <option value="03">유효기한/사용기한 경과</option>
<option value="07">기타(사고마약류(도난,분실,재해) 발생보고 완료건)</option> <option value="04">유효기한 임박</option>
<option value="08">기타(제조공정 중 폐기물)</option></select> <option value="05">사용중단</option>
<option value="07">폐업</option>
<option value="08">환자반납</option>
<option value="09">기타</option>
<option value="12">제조공정 중 폐기물</option></select>
</div> </div>
</div> </div>
<div class="row my-1 mx-1 g-1 border-card rounded"></div> <div class="row my-1 mx-1 g-1 border-card rounded"></div>
@ -105,15 +109,15 @@
data-by="by--productList" data-by-output="byOutput--productList" data-main-option="mainOption--productList" data-sub-option="subOption--productList"> data-by="by--productList" data-by-output="byOutput--productList" data-main-option="mainOption--productList" data-sub-option="subOption--productList">
<th class="sorting" style="width: 146.156px;">제품코드</th> <th class="sorting" style="width: 146.156px;">제품코드</th>
<th class="sorting sorting_asc" aria-sort="ascending" style="width: 300.719px;">제품명</th> <th class="sorting sorting_asc" aria-sort="ascending" style="width: 300.719px;">제품명</th>
<th class="sorting" style="width: 230.469px;">폐기 수량</th> <th class="sorting" style="width: 100.469px;">폐기수량</th>
<th class="sorting" style="width: 230.469px;">유효기간</th> <th class="sorting" style="width: 100.469px;">유효기간</th>
<th class="sorting" style="width: 160.141px;">제조 번호</th> <th class="sorting" style="width: 160.141px;">제조번호</th>
<th class="sorting" style="width: 160.141px;">제조 일련 번호</th> <th class="sorting" style="width: 160.141px;">일련번호</th>
<th class="sorting" style="width: 230.469px;">최소 유통단위 수량</th>
<th class="sorting" style="width: 230.469px;">최소 유통단위</th>
<th class="sorting" style="width: 230.469px;">낱개 단위 수량</th>
<th class="sorting" style="width: 230.469px;">낱개 단위</th>
<th class="sorting" style="width: 230.469px;">이미지</th> <th class="sorting" style="width: 230.469px;">이미지</th>
<th class="sorting" style="width: 160.469px;">유통단위수량</th>
<th class="sorting" style="width: 120.469px;">유통단위</th>
<th class="sorting" style="width: 130.469px;">낱개단위수량</th>
<th class="sorting" style="width: 100.469px;">낱개단위</th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--productList"> <tbody id="tbody--productList">
@ -126,11 +130,11 @@
<td class="cmn text-center" {onclick}="" {ondblclick}="">{prdValidDe}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{prdValidDe}</td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{mnfNo}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{mnfNo}</td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{mnfSeq}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{mnfSeq}</td>
<td class="cmn text-center prdDsuseImg" {onclick}="" {ondblclick}=""></td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{minDistbQy}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{minDistbQy}</td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{minDistbUnit}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{minDistbUnit}</td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{pceUnit}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{pceUnit}</td>
<td class="cmn text-center" {onclick}="" {ondblclick}="">{dsuseQy}</td> <td class="cmn text-center" {onclick}="" {ondblclick}="">{dsuseQy}</td>
<td class="cmn text-center aaaa" {onclick}="" {ondblclick}=""></td>
</tr> </tr>
</template> </template>
<template id="productListNotFound--productList"> <template id="productListNotFound--productList">
@ -284,15 +288,35 @@
} }
// 저장 // 저장
$P.control.save = (info) => { $P.control.save = (jsonBssh, datasetListPrd) => {
if (!info) return; let saveBsshData = {
...jsonBssh,
let create = (info.mngId == ""); rndDtlRptCnt: datasetListPrd.length,
userId: "${currentUser.account}"
}
let saveData = {
dsuseMgtJsonStr: JSON.stringify(saveBsshData),
dsuseMgtDtlsJsonStr: JSON.stringify(datasetListPrd),
// 폐기상품이미지목록
dsusePrdImgFiles: []
}
let create = (jsonBssh.dscdmngId == "");
ajax.post({ ajax.post({
url: !create ? $P.control.urls.update : $P.control.urls.create url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtReceipt" />'
, data: info || {} , data: saveData || {}
, success: resp => $P.control.onSave(resp) , success: resp => {
if(!resp.success){
dialog.alert({
content: resp.message
});
return;
}
//$P.control.onSave(resp.data)
dialog.alert("저장됐습니다.");
dialog.close(this.prefixed("dialog"));
//this._load();
}
}); });
} }
@ -319,7 +343,7 @@
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), true, true); $("#table-responsive--${pageName}")[0].changeContent(trs.join(), true, true);
fnMakeGridImageViewer($("#tbody--productList").find("td.aaaa").get(), "dsusePrdImgFiles"); fnMakeGridImageViewer($("#tbody--productList").find("td.prdDsuseImg").get(), "dsusePrdImgFiles");
} }
/************************************************************************** /**************************************************************************
@ -359,11 +383,27 @@
// validate 확인 // validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return; if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
let bsshData = $P.bsshFormFields.get();
if(bsshData.bsshCd == ""){
dialog.alert({
content: "마약류 취급업체 정보를 입력해주세요."
});
return false;
}
let dsProd = $P.productList.getDataset();
if(dsProd.length == 0){
dialog.alert({
content: "폐기 제품 정보를 입력해주세요."
});
return false;
}
dialog.alert({ dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?" content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); } , init: () => { setDialogZindex(); }
, onOK: () => { , onOK: () => {
$P.control.save($P.bsshFormFields.get()); // formFields $P.control.save(bsshData, dsProd); // formFields
} }
}); });
} }
@ -383,11 +423,12 @@
return false; return false;
} }
let dupData = $P.productList let isDup = $P.productList
.getDataset() .getDataset()
.filter(item => item.prductCd == $P.productFormFields.get().prductCd); .filter(item => item.prductCd == $P.productFormFields.get().prductCd)
.length > 0;
if(dupData.length > 0){ if(isDup){
dialog.alert({ dialog.alert({
content: "등록한 상품[" + $P.productFormFields.get().prductCd + "]입니다" content: "등록한 상품[" + $P.productFormFields.get().prductCd + "]입니다"
}); });

Loading…
Cancel
Save