From c73b0e2f40e0a143b5f815793de24b060816c664 Mon Sep 17 00:00:00 2001 From: zc <zc@123> Date: 星期三, 02 七月 2025 10:24:36 +0800 Subject: [PATCH] 完善erp对接 --- src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java index e9f38e3..a30255d 100644 --- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java @@ -89,10 +89,10 @@ @Resource private BasDevpMapper basDevpMapper; - @Value("mes.url") + @Value("${mes.url}") private String url; - @Value("mes.pakin") + @Value("${mes.code}") private String code; @Override @@ -290,9 +290,7 @@ if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { throw new CoolException(BaseRes.PARAM); } - if (param.getCombMats().size() > 1) { - throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒"); - } + HashMap<String, Object> comData = new HashMap<>(); param.getCombMats().forEach(elem -> { // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁 if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). @@ -301,7 +299,13 @@ .eq("matnr", elem.getMatnr()).eq("batch", elem.getBatch())) > 0) { throw new CoolException(param.getBarcode() + "宸叉湁鐩稿悓鏁版嵁"); } + if (comData.get(elem.getThreeCode()) == null) { + comData.put(elem.getThreeCode(), elem); + } else { + throw new CoolException(elem.getThreeCode() + "璇ユ潯鐮佹壂鐮佷簡澶氭"); + } }); + if (param.getBarcode().length() != 8) { throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode()); @@ -327,7 +331,7 @@ if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). eq("zpallet", param.getBarcode()) .eq("io_status", "N") - .eq("matnr", elem.getMatnr()).eq("batch", elem.getBatch())) > 0) { + .eq("matnr", elem.getMatnr()).eq("three_code",elem.getThreeCode()).eq("batch", elem.getBatch())) > 0) { throw new CoolException(param.getBarcode() + "宸叉湁鐩稿悓鏁版嵁"); } @@ -371,7 +375,7 @@ // 鐢熸垚鍏ュ簱閫氱煡妗� List<DetlDto> detlDtos = new ArrayList<>(); - List<String> codes=new ArrayList<>(); + List<String> codes = new ArrayList<>(); for (CombParam.CombMat elem : param.getCombMats()) { codes.add(elem.getThreeCode()); } @@ -388,7 +392,7 @@ } elem.setTemp1(codeDataParam.getQuality()); elem.setAnfme(codeDataParam.getQty()); - elem.setBatch(codeDataParam.getBatchNum()); + //elem.setBatch(codeDataParam.getBatchNum()); elem.setThreeCode(codeDataParam.getBarcode()); elem.setMatnr(codeDataParam.getProductionCode()); elem.setMaktx(codeDataParam.getProductionName()); @@ -413,7 +417,7 @@ detlDto.setTemp1(codeDataParam.getQuality()); detlDto.setFromOrderNo(codeDataParam.getBarcode()); if (DetlDto.has(detlDtos, detlDto)) { - DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); + DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getFromOrderNo()); assert one != null; one.setAnfme(one.getAnfme() + detlDto.getAnfme()); } else { @@ -475,9 +479,13 @@ } catch (IOException e) { throw new RuntimeException(e); } + log.info("getData:{}", response); MesResponse jsonObject = JSON.parseObject(response, MesResponse.class); if (jsonObject.getCode().equals(200)) { - return JSON.parseArray(jsonObject.getData(), CodeDataParam.class); + JSONObject jsonObject1 = JSON.parseObject(jsonObject.getData()); + if (jsonObject1.getString("barcodeList") != null) { + return JSON.parseArray(jsonObject1.getString("barcodeList"), CodeDataParam.class); + } } throw new CoolException(jsonObject.getMessage()); } -- Gitblit v1.9.1