| | |
| | | if(param.getCombMats().stream().anyMatch(obj -> obj.getAnfme() == null)){ |
| | | throw new CoolException("入库物料数量不能为空"); |
| | | } |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | |
| | | if (wrkMast.getWrkSts() != 14 && wrkMast.getIoType() != 104){ |
| | | throw new CoolException(param.getBarcode() + "该条码数据不为并板出库"); |
| | | } |
| | | |
| | | //设置非null批号, |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | Date now = new Date(); |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch()); |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | throw new CoolException("该单据中未找到对应物料明细"); |
| | | } |
| | | if (combMat.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(combMat.getMatnr()); |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.sync(mat); |
| | | locDetl.setLocNo(wrkMast.getSourceLocNo()); |
| | | locDetl.setZpallet(param.getBarcode()); |
| | | locDetl.setAnfme(combMat.getAnfme()); |
| | | locDetl.setAppeTime(now); |
| | | locDetl.setAppeUser(userId); |
| | | locDetl.setModiTime(now); |
| | | locDetl.setModiUser(userId); |
| | | locDetlService.insert(locDetl); |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(mat); |
| | | wrkDetl.setBatch(combMat.getBatch()); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setOrderNo(param.getOrderNo()); |
| | | wrkDetl.setZpallet(param.getBarcode()); |
| | | wrkDetl.setAnfme(combMat.getAnfme()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetlService.insert(wrkDetl); |
| | | } |
| | | |
| | | |