| | |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | |
| | | HashMap<String, Object> comData = new HashMap<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | |
| | | .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()); |
| | |
| | | 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() + "已有相同数据"); |
| | | } |
| | | |
| | |
| | | // 生成入库通知档 |
| | | 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()); |
| | | } |
| | |
| | | //for (CombParam.CombMat elem : param.getCombMats()) { |
| | | CombParam.CombMat elem = combMats.get(i); |
| | | CodeDataParam codeDataParam = data.get(i); |
| | | if (!codeDataParam.getQuality().equals(order.getShipCode())) { |
| | | throw new CoolException("单据质量状态和组托物料不匹配"); |
| | | } |
| | | |
| | | elem.setTemp1(codeDataParam.getQuality()); |
| | | elem.setAnfme(codeDataParam.getQty()); |
| | | //elem.setBatch(codeDataParam.getBatchNum()); |
| | |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | throw new CoolException("该单据中未找到对应物料明细"); |
| | | } |
| | | if (Cools.isEmpty(codeDataParam.getQuality())) { |
| | | throw new CoolException("条码未返回质量状态"); |
| | | } |
| | | if (Integer.parseInt(codeDataParam.getQuality()) != orderDetl.getInspect()) { |
| | | throw new CoolException("单据质量状态和组托物料不匹配"); |
| | | } |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | |
| | | |
| | | // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getManu()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(), elem.getThreeCode() |
| | | , orderDetl.getManu(), orderDetl.getSku(), orderDetl.getSupp(), orderDetl.getTemp1(), orderDetl.getTemp2(), orderDetl.getTemp3(), orderDetl.getTemp4()); |
| | | , orderDetl.getManu(), codeDataParam.getBatchNum(), orderDetl.getSupp(), orderDetl.getTemp1(), orderDetl.getTemp2(), orderDetl.getTemp3(), orderDetl.getTemp4()); |
| | | 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 { |
| | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | log.info("getData:{}",response); |
| | | log.info("getData:{}", response); |
| | | MesResponse jsonObject = JSON.parseObject(response, MesResponse.class); |
| | | if (jsonObject.getCode().equals(200)) { |
| | | JSONObject jsonObject1 = JSON.parseObject(jsonObject.getData()); |
| | | if (jsonObject1.getString("barcodeList")!=null){ |
| | | if (jsonObject1.getString("barcodeList") != null) { |
| | | return JSON.parseArray(jsonObject1.getString("barcodeList"), CodeDataParam.class); |
| | | } |
| | | } |