diff --git a/src/main/java/cokr/xit/adds/nims/web/DsuseMgtReceiptController.java b/src/main/java/cokr/xit/adds/nims/web/DsuseMgtReceiptController.java
index 22b48c9..b4808bb 100644
--- a/src/main/java/cokr/xit/adds/nims/web/DsuseMgtReceiptController.java
+++ b/src/main/java/cokr/xit/adds/nims/web/DsuseMgtReceiptController.java
@@ -2,6 +2,7 @@ package cokr.xit.adds.nims.web;
import javax.annotation.Resource;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@@ -17,8 +18,10 @@ import cokr.xit.foundation.web.AbstractController;
value = {"/adds/nims"}
)
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 static final String
@@ -59,9 +62,7 @@ public class DsuseMgtReceiptController extends AbstractController {
ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtReceipt-info");
return mav
- .addObject("pageName", "dsuseMgtReceiptInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
-// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix
-// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
- ;
+ .addObject("pageName", "dsuseMgtReceiptInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
+ .addObject("apiHost", apiHost);
}
}
diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
index ab90c5b..f847558 100644
--- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
+++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
@@ -36,13 +36,17 @@
-
-
+
+
@@ -105,15 +109,15 @@
data-by="by--productList" data-by-output="byOutput--productList" data-main-option="mainOption--productList" data-sub-option="subOption--productList">
제품코드 |
제품명 |
- 폐기 수량 |
- 유효기간 |
- 제조 번호 |
- 제조 일련 번호 |
- 최소 유통단위 수량 |
- 최소 유통단위 |
- 낱개 단위 수량 |
- 낱개 단위 |
+ 폐기수량 |
+ 유효기간 |
+ 제조번호 |
+ 일련번호 |
이미지 |
+ 유통단위수량 |
+ 유통단위 |
+ 낱개단위수량 |
+ 낱개단위 |
@@ -126,11 +130,11 @@
{prdValidDe} |
{mnfNo} |
{mnfSeq} |
+ |
{minDistbQy} |
{minDistbUnit} |
{pceUnit} |
{dsuseQy} |
- |
@@ -284,15 +288,35 @@
}
// 저장
- $P.control.save = (info) => {
- if (!info) return;
-
- let create = (info.mngId == "");
+ $P.control.save = (jsonBssh, datasetListPrd) => {
+ let saveBsshData = {
+ ...jsonBssh,
+ rndDtlRptCnt: datasetListPrd.length,
+ userId: "${currentUser.account}"
+ }
+ let saveData = {
+ dsuseMgtJsonStr: JSON.stringify(saveBsshData),
+ dsuseMgtDtlsJsonStr: JSON.stringify(datasetListPrd),
+ // 폐기상품이미지목록
+ dsusePrdImgFiles: []
+ }
+ let create = (jsonBssh.dscdmngId == "");
ajax.post({
- url: !create ? $P.control.urls.update : $P.control.urls.create
- , data: info || {}
- , success: resp => $P.control.onSave(resp)
+ url: ''
+ , data: saveData || {}
+ , 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);
- fnMakeGridImageViewer($("#tbody--productList").find("td.aaaa").get(), "dsusePrdImgFiles");
+ fnMakeGridImageViewer($("#tbody--productList").find("td.prdDsuseImg").get(), "dsusePrdImgFiles");
}
/**************************************************************************
@@ -359,11 +383,27 @@
// validate 확인
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({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
- $P.control.save($P.bsshFormFields.get()); // formFields
+ $P.control.save(bsshData, dsProd); // formFields
}
});
}
@@ -383,11 +423,12 @@
return false;
}
- let dupData = $P.productList
+ let isDup = $P.productList
.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({
content: "등록한 상품[" + $P.productFormFields.get().prductCd + "]입니다"
});