From 10789997431120c922970508fd815ec59c85d567 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Wed, 10 Jul 2024 17:18:53 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A0=9C=ED=92=88=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?-=20barcode=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/adds/nims/web/AddsNimsController.java | 23 ++++++- src/main/resources/application.yml | 2 + .../jsp/adds/nims/dsuseMgtReceipt-info.jsp | 66 +++++++++++++++---- .../WEB-INF/jsp/adds/nims/product-popup.jsp | 10 +-- 4 files changed, 79 insertions(+), 22 deletions(-) diff --git a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java index c209c22..fbd56d8 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -1,6 +1,7 @@ package cokr.xit.adds.nims.web; import java.io.File; +import java.net.http.HttpResponse; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -14,9 +15,13 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import net.minidev.json.JSONObject; +import net.minidev.json.parser.ParseException; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -44,8 +49,7 @@ import cokr.xit.base.user.service.SigunguDepartmentService; import cokr.xit.base.web.ApplicationController; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.JSON; -import net.minidev.json.JSONObject; -import net.minidev.json.parser.ParseException; +import cokr.xit.foundation.web.WebClient; @Controller @RequestMapping( @@ -71,6 +75,9 @@ public class AddsNimsController extends ApplicationController { @Value("${app.inf.nims.api.productAndseqInfo}") private String productAndseqInfoEndpoint; + @Value("${app.inf.nims.api.prdMnfSeqInfoOfBarcode}") + private String prdMnfSeqInfoOfBarcodeEndpoint; + @Resource(name="sigunguDepartmentService") private SigunguDepartmentService sggDeptService; @@ -573,6 +580,18 @@ public class AddsNimsController extends ApplicationController { return json.parse(rslt, new TypeReference<>() {}); } + @RequestMapping(value = "/getNimsPrdMnfSeqInfoOfBarcode.do", name="NIMS 바코드 조회", produces = "application/json;charset=UTF-8") + public @ResponseBody ApiBaseResponse getNimsPrdMnfSeqInfoOfBarcode(@RequestParam String barcodeStr) throws JsonProcessingException, ParseException { + HttpResponse apiRslt = new WebClient().post(request -> { + request.contentType(WebClient.Request.ContentType.FORM); + request.uri(apiHost + prdMnfSeqInfoOfBarcodeEndpoint); + request.data("barcodeStr", barcodeStr); + }); + String rslt = apiRslt.body(); + + return json.parse(rslt, new TypeReference<>() {}); + } + @RequestMapping(value = "/getNimsProductInfoKdAndMnfSeqInfo.do", name="제품 & 시리얼번호 검색", produces = "application/json;charset=UTF-8") public @ResponseBody ApiBaseResponse> getNimsProductInfoKdAndMnfSeqInfo(@ModelAttribute NimsApiRequest.ProductInfoReq dto) throws JsonProcessingException, ParseException { String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 1e0be99..6d12e36 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -69,6 +69,8 @@ app: # 폐기보고 조회 nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo + prdMnfSeqInfoOfBarcode: /api/biz/nims/v1/getPrdMnfSeqInfoOfBarcode + logging: file: 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 41a0039..c9bf852 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 @@ -61,24 +61,24 @@
- +
- +
- - + +
- - + +
- - + +
@@ -452,8 +452,7 @@ }); return false; } - -debugger; + dialog.alert({ content: "현재 폐기 신청서 접수 정보를 저장 하시겠습니까?" , init: () => { setDialogZindex(); } @@ -563,7 +562,52 @@ debugger; $("#btnDel--${pageName}").on("click", () => $P.fnDel()); // 추가 $("#dsusePrvCd--${pageName}").on("change", () => $P.fnChangeDsusePrvCd()); // 추가 - + + //------------------------------------------------------------------------- + // barcode 입력 처리 + $("#btnProductBarcodeSearch--${pageName}").on("click", () => { + $("#prductCd--${pageName}").prop("readonly", false); + $("#prductCd--${pageName}").val(""); + $("#prductCd--${pageName}").focus(); + }); + + $("#prductCd--${pageName}").on("change", () => { + let barcode = $("#prductCd--${pageName}").val(); + if(barcode.length > 13){ + ajax.get({ + url : wctx.url("/adds/nims/getNimsPrdMnfSeqInfoOfBarcode.do") + , data : {barcodeStr : barcode} + , success : obj => { + if (!obj.success){ + dialog.alert(obj.message); + $("#prductCd--${pageName}").val(""); + $("#prductCd--${pageName}").prop("readonly", true); + return false; + } + + let prdInfo = obj.data; + $P.productFormFields.set( + $P.productControl, + { + prductCd: prdInfo.prductCd, + prductNm: prdInfo.prductNm, + prdMinDistbQy: prdInfo.prdMinDistbQy, + stdPackngStleNm: prdInfo.stdPackngStleNm, + prdTotPceQy: prdInfo.prdTotPceQy, + pceCoUnitNm: prdInfo.pceCoUnitNm, + dsuseQy: prdInfo.dsuseQy, + prdValidDe: prdInfo.mnfSeqInfos[0].prdValidDe, + mnfNo: prdInfo.mnfSeqInfos[0].mnfNo, + mnfSeq: prdInfo.mnfSeqInfos[0].mnfSeq, + + } + ); + $("#prductCd--${pageName}").prop("readonly", true); + } + }); + } + }); + //------------------------------------------------------------------------- } // 초기 화면 설정 diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/product-popup.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/product-popup.jsp index 4cfff05..279fdc7 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/product-popup.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/product-popup.jsp @@ -160,8 +160,6 @@ **************************************************************************/ $P.control = new DatasetControl({ urls : { - // FIXME: 2024-07-05 제품검색 완료후 교체 - //load : wctx.url("/adds/nims/getNimsProductInfoKdAndMnfSeqInfo.do"), load : wctx.url("/adds/nims/getNimsProductInfoKd.do"), // 제품 검색 } , prefix: "productMain" @@ -439,16 +437,10 @@ } fnMakeScrollableTable($("#table-responsive-1--${pageName}")[0], $P.scrollDetailDataList); - - - - // DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고) -// fnMakeResizableTable($("#table-responsive-0--${pageName}")[0]); -// fnMakeResizableTable($("#table-responsive-1--${pageName}")[0]); + // 초기 화면 설정 $P.initForm = () => { - //$("#schPrdValidDe--${pageName}").datepicker("setDate", new Date()); $("#btnSearch3--${pageName}").prop("disabled", true); }