feat: 제품입력 - barcode 입력

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

@ -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<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")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKdAndMnfSeqInfo(@ModelAttribute NimsApiRequest.ProductInfoReq dto) throws JsonProcessingException, ParseException {
String rslt = ApiUtil.callNimsApi(apiHost + productAndseqInfoEndpoint, dto);

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

@ -61,24 +61,24 @@
<input type="text" class="form-control w-60" id="prductNm--${pageName}" name="prductNm" data-map="prductNm" readonly>
</div>
<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>
</div>
<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="btnProductBarcodeSearch--${pageName}" title="검색">바코드 검색</button>
</div>
<div class="col-md-4">
<label for="rgsDt--${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">
<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="prdValidDe--${pageName}" name="prdValidDe" data-map="prdValidDe">
</div>
<div class="col-md-4">
<label for="prdlstMstCd--${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">
<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="mnfNo--${pageName}" name="mnfNo" data-map="mnfNo">
</div>
<div class="col-md-4">
<label for="prdlstMstCd--${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">
<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="mnfSeq--${pageName}" name="mnfSeq" data-map="mnfSeq">
</div>
<div class="col-md-4">
<label for="prdMinDistbQy--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">유통단위 수량</label>
@ -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);
}
});
}
});
//-------------------------------------------------------------------------
}
// 초기 화면 설정

@ -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);
}

Loading…
Cancel
Save