| | |
| | | WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>() |
| | | .eq("matnr", stationDetl.getMatnr()) |
| | | .eq("wrk_no", wrkMast.getWrkNo()) |
| | | .eq("suppCode", combMat.getSuppCode())); |
| | | .eq("supp_code", combMat.getSuppCode())); |
| | | |
| | | if (Objects.isNull(wrkDetl)) { |
| | | //TODO 新插入 |
| | |
| | | } |
| | | |
| | | } |
| | | // // 判断是否有相同条码的数据 |
| | | // if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()) |
| | | // .eq("io_status", "N")) > 0) { |
| | | // throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | // } |
| | | // |
| | | // int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode())); |
| | | // int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode())); |
| | | // if (countWrk > 0 || countLoc > 0) { |
| | | // WrkMast wrkDetl = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode())); |
| | | // if (!wrkDetl.getIoType().equals(TaskIOType.MERGE_OUT.type)) { |
| | | // throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode()); |
| | | // } |
| | | // } |
| | | // int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); |
| | | // if (countwait > 0) { |
| | | // throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode()); |
| | | // } |
| | | // |
| | | // // 生成入库通知档 |
| | | // List<DetlDto> detlDtos = new ArrayList<>(); |
| | | // param.getCombMats().forEach(elem -> { |
| | | // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), |
| | | // elem.getStandby2(), elem.getStandby3(), |
| | | // elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), elem.getThreeCode()); |
| | | // if (DetlDto.has(detlDtos, detlDto)) { |
| | | // DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | // assert one != null; |
| | | // one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | // } else { |
| | | // detlDtos.add(detlDto); |
| | | // } |
| | | // }); |
| | | // BasContainer container = basContainerService |
| | | // .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode())); |
| | | // if (Objects.isNull(container)) { |
| | | // throw new CoolException("数据错误:容器码不存在!!"); |
| | | // } |
| | | // if (container.getMixMax() < detlDtos.size()) { |
| | | // throw new CoolException("超出容器最大混装数量,当前容器最大数量为:" + container.getMixMax() + "!!"); |
| | | // } |
| | | // List<Mat> tempMats = new ArrayList<>(); |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", detlDto.getMatnr()) |
| | | // .eq("supp_code", detlDto.getStandby1())); |
| | | // tempMats.add(mat); |
| | | // } |
| | | // Set<Long> tagIds = tempMats.stream().map(Mat::getTagId).collect(Collectors.toSet()); |
| | | // if (tagIds.size() > 1) { |
| | | // throw new CoolException("组托物料类型不一致,只有相同的物料分类才可以组托!!"); |
| | | // } |
| | | // // 还可以放入多少种物料 |
| | | // Double suplus = container.getMixMax(); |
| | | // Date now = new Date(); |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | // if (Cools.isEmpty(mat)) { |
| | | // throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | // } |
| | | // // 最多可放数量 |
| | | // Double singleMax = mat.getUpQty() * suplus; |
| | | // if (singleMax.compareTo(detlDto.getAnfme()) < 0) { |
| | | // throw new CoolException("物料:" + detlDto.getMatnr() + "单次组托上限为:" + mat.getUpQty() + ",当前总量超出托盘装载上限!!"); |
| | | // } |
| | | // BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty()); |
| | | // // 当前物料需要占用料箱格数 |
| | | // Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue(); |
| | | // suplus = suplus - curr; |
| | | // if (suplus < 0) { |
| | | // throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!"); |
| | | // } |
| | | // |
| | | // BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>() |
| | | // .eq("zpallet", param.getCarBarcode()) |
| | | // .eq("three_code", detlDto.getThreeCode())); |
| | | // if (Objects.isNull(stationDetl)) { |
| | | // throw new CoolException("明细内容不存在!!"); |
| | | // } |
| | | // |
| | | // Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0; |
| | | // if (detlDto.getAnfme().compareTo(v) > 0) { |
| | | // throw new CoolException("组托上限为:" + stationDetl.getAnfme() + ", 已组托:" + stationDetl.getWorkQty() + ", 还可组托:" + v); |
| | | // } |
| | | // |
| | | // WaitPakin waitPakin = new WaitPakin(); |
| | | // BeanUtils.copyProperties(mat, waitPakin); |
| | | // waitPakin.setBatch(detlDto.getBatch()); |
| | | // waitPakin.setType(param.getType()); |
| | | // waitPakin.setZpallet(param.getBarcode()); |
| | | // // 设置组托类型 |
| | | // waitPakin.setType(param.getType()); |
| | | // waitPakin.setIoStatus("N"); |
| | | // waitPakin.setAnfme(detlDto.getAnfme()); |
| | | // waitPakin.setThreeCode(detlDto.getThreeCode()); |
| | | // waitPakin.setStatus("Y"); |
| | | // waitPakin.setSuppCode(detlDto.getStandby1()); |
| | | // waitPakin.setStandby1(detlDto.getStandby1()); |
| | | // waitPakin.setStandby2(detlDto.getStandby2()); |
| | | // waitPakin.setStandby3(detlDto.getStandby3()); |
| | | // waitPakin.setBoxType1(detlDto.getBoxType1()); |
| | | // waitPakin.setBoxType2(detlDto.getBoxType2()); |
| | | // waitPakin.setBoxType3(detlDto.getBoxType3()); |
| | | // waitPakin.setAppeUser(userId); |
| | | // waitPakin.setAppeTime(now); |
| | | // waitPakin.setModiUser(userId); |
| | | // waitPakin.setModiTime(now); |
| | | // if (!waitPakinService.insert(waitPakin)) { |
| | | // throw new CoolException("保存入库通知档失败"); |
| | | // } |
| | | // |
| | | // Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0; |
| | | // stationDetl.setWorkQty(v1); |
| | | // |
| | | // if (!basStationDetlService.updateById(stationDetl)) { |
| | | // throw new CoolException("站点明细修改失败"); |
| | | // } |
| | | // |
| | | // if (v1.compareTo(stationDetl.getAnfme()) >= 0) { |
| | | // if (!basStationDetlService.deleteById(stationDetl)) { |
| | | // throw new CoolException("原始数据移除失败!"); |
| | | // } |
| | | // } |
| | | // |
| | | // List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>() |
| | | // .eq("dev_no", stationDetl.getDevNo())); |
| | | // if (Objects.isNull(stas) || stas.isEmpty()) { |
| | | // BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo())); |
| | | // if (Objects.isNull(station)) { |
| | | // throw new CoolException("数据错误,站点不存在!!"); |
| | | // } |
| | | // station.setLocSts(LocStsType.LOC_STS_TYPE_O.type); |
| | | // station.setBarcode(""); |
| | | // if (!basStationService.updateById(station)) { |
| | | // throw new CoolException("站点状态更新失败!!"); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |