feat: 제품입력 - barcode 입력

dev
Jonguk. Lim 4 months ago
parent 77c2ebcfe3
commit 1078999743

@ -1,6 +1,7 @@
package cokr.xit.adds.nims.web; package cokr.xit.adds.nims.web;
import java.io.File; import java.io.File;
import java.net.http.HttpResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -14,9 +15,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; 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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; 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.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; 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.base.web.ApplicationController;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.JSON; import cokr.xit.foundation.data.JSON;
import net.minidev.json.JSONObject; import cokr.xit.foundation.web.WebClient;
import net.minidev.json.parser.ParseException;
@Controller @Controller
@RequestMapping( @RequestMapping(
@ -71,6 +75,9 @@ public class AddsNimsController extends ApplicationController {
@Value("${app.inf.nims.api.productAndseqInfo}") @Value("${app.inf.nims.api.productAndseqInfo}")
private String productAndseqInfoEndpoint; private String productAndseqInfoEndpoint;
@Value("${app.inf.nims.api.prdMnfSeqInfoOfBarcode}")
private String prdMnfSeqInfoOfBarcodeEndpoint;
@Resource(name="sigunguDepartmentService") @Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService; private SigunguDepartmentService sggDeptService;
@ -573,6 +580,18 @@ public class AddsNimsController extends ApplicationController {
return json.parse(rslt, new TypeReference<>() {}); return json.parse(rslt, new TypeReference<>() {});
} }
@RequestMapping(value = "/getNimsPrdMnfSeqInfoOfBarcode.do", name="NIMS 바코드 조회", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<JSONObject> getNimsPrdMnfSeqInfoOfBarcode(@RequestParam String barcodeStr) throws JsonProcessingException, ParseException {
HttpResponse<String> 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") @RequestMapping(value = "/getNimsProductInfoKdAndMnfSeqInfo.do", name="제품 & 시리얼번호 검색", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKdAndMnfSeqInfo(@ModelAttribute NimsApiRequest.ProductInfoReq dto) throws JsonProcessingException, ParseException { public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKdAndMnfSeqInfo(@ModelAttribute NimsApiRequest.ProductInfoReq dto) throws JsonProcessingException, ParseException {
String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto); String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto);

@ -69,6 +69,8 @@ app:
# 폐기보고 조회 # 폐기보고 조회
nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo nimsDsuseRptInfo: /api/biz/nims/v1/getNimsDsuseRptInfo
prdMnfSeqInfoOfBarcode: /api/biz/nims/v1/getPrdMnfSeqInfoOfBarcode
logging: logging:
file: file:

@ -61,24 +61,24 @@
<input type="text" class="form-control w-60" id="prductNm--${pageName}" name="prductNm" data-map="prductNm" readonly> <input type="text" class="form-control w-60" id="prductNm--${pageName}" name="prductNm" data-map="prductNm" readonly>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="prductCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">제품코드</label> <label for="prductCd--${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="prductCd--${pageName}" name="prductCd" data-map="prductCd" readonly> <input type="text" class="form-control w-60" id="prductCd--${pageName}" name="prductCd" data-map="prductCd" readonly>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<button type="button" style="display: none;" class="btn btn-search w-px-120" id="btnProductBarcodeSearch--${pageName}" title="검색">바코드 검색</button>
<button type="button" class="btn btn-search w-px-120" id="btnProductSearch--${pageName}" title="검색">제품 검색</button> <button type="button" class="btn btn-search w-px-120" id="btnProductSearch--${pageName}" title="검색">제품 검색</button>
<button type="button" class="btn btn-search w-px-120" id="btnProductBarcodeSearch--${pageName}" title="검색">바코드 검색</button>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="rgsDt--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">유효기간</label> <label for="prdValidDe--${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="rgsDt--${pageName}" name="prdValidDe" data-map="prdValidDe"> <input type="text" class="form-control w-60" id="prdValidDe--${pageName}" name="prdValidDe" data-map="prdValidDe">
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="prdlstMstCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">제조 번호</label> <label for="mnfNo--${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="prdlstMstCd--${pageName}" name="mnfNo" data-map="mnfNo"> <input type="text" class="form-control w-60" id="mnfNo--${pageName}" name="mnfNo" data-map="mnfNo">
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="prdlstMstCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">제조 일련 번호</label> <label for="mnfSeq--${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="prdlstMstCd--${pageName}" name="mnfSeq" data-map="mnfSeq"> <input type="text" class="form-control w-60" id="mnfSeq--${pageName}" name="mnfSeq" data-map="mnfSeq">
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="prdMinDistbQy--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">유통단위 수량</label> <label for="prdMinDistbQy--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">유통단위 수량</label>
@ -453,7 +453,6 @@
return false; return false;
} }
debugger;
dialog.alert({ dialog.alert({
content: "현재 폐기 신청서 접수 정보를 저장 하시겠습니까?" content: "현재 폐기 신청서 접수 정보를 저장 하시겠습니까?"
, init: () => { setDialogZindex(); } , init: () => { setDialogZindex(); }
@ -564,6 +563,51 @@ debugger;
$("#dsusePrvCd--${pageName}").on("change", () => $P.fnChangeDsusePrvCd()); // 추가 $("#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);
}
});
}
});
//-------------------------------------------------------------------------
} }
// 초기 화면 설정 // 초기 화면 설정

@ -160,8 +160,6 @@
**************************************************************************/ **************************************************************************/
$P.control = new DatasetControl({ $P.control = new DatasetControl({
urls : { urls : {
// FIXME: 2024-07-05 제품검색 완료후 교체
//load : wctx.url("/adds/nims/getNimsProductInfoKdAndMnfSeqInfo.do"),
load : wctx.url("/adds/nims/getNimsProductInfoKd.do"), // 제품 검색 load : wctx.url("/adds/nims/getNimsProductInfoKd.do"), // 제품 검색
} }
, prefix: "productMain" , prefix: "productMain"
@ -441,14 +439,8 @@
fnMakeScrollableTable($("#table-responsive-1--${pageName}")[0], $P.scrollDetailDataList); 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 = () => { $P.initForm = () => {
//$("#schPrdValidDe--${pageName}").datepicker("setDate", new Date());
$("#btnSearch3--${pageName}").prop("disabled", true); $("#btnSearch3--${pageName}").prop("disabled", true);
} }

Loading…
Cancel
Save