| | |
| | | Date now = new Date(); |
| | | |
| | | // 无单组托 |
| | | if (Cools.isEmpty(param.getOrderNo())) { |
| | | if (Cools.isEmpty(param.getCombMats().get(0).getOrderNo())) { |
| | | |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | |
| | | } |
| | | // 关联组托 |
| | | } else { |
| | | Order order = orderService.selectByNo(param.getOrderNo(), hostId); |
| | | if (order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | Order order = orderService.selectByNo(elem.getOrderNo(), hostId); |
| | | if (order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),hostId); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | |
| | | assert one != null; |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | } else { |
| | | detlDto.setOrderNo(order.getOrderNo()); |
| | | detlDtos.add(detlDto); |
| | | } |
| | | }); |
| | |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | |
| | | Order order = orderService.selectByNo(detlDto.getOrderNo(), hostId); |
| | | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | |
| | | if (!waitPakinService.save(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId, hostId); |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId, hostId); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | if (!Cools.isEmpty(waitPakin.getOrderNo())){ |
| | | Order order = orderService.selectByNo(waitPakin.getOrderNo(), hostId); |
| | | if (Cools.isEmpty(order)){ |
| | | continue; |
| | | throw new CoolException("平库上架查询订单失败"); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(),hostId); |
| | | if (Cools.isEmpty(orderDetl)){ |
| | | continue; |
| | | throw new CoolException("平库上架查询订单明细失败"); |
| | | } |
| | | // 修改订单明细完成数量 |
| | | if (!orderDetlService.increase(order.getId(), hostId, waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getAnfme())) { |
| | |
| | | .eq(LocDetl::getHostId, hostId) |
| | | .eq(LocDetl::getZpallet, combMat.getZpallet()) |
| | | .eq(LocDetl::getMatnr, combMat.getMatnr()) |
| | | .eq(LocDetl::getBatch, combMat.getBatch()) |
| | | // .eq(LocDetl::getBatch, combMat.getBatch()) |
| | | ); |
| | | if (Cools.isEmpty(locDetl)){ |
| | | return R.error("未查询到库存数据"); |
| | |
| | | continue; |
| | | } |
| | | if (orderDetl.getAnfme() < orderDetl.getWorkQty()+combMat.getAnfme()){ |
| | | throw new CoolException("下架数量出错"); |
| | | combMat.setAnfme(orderDetl.getAnfme()-orderDetl.getWorkQty()); |
| | | } |
| | | // 修改订单明细作业数量 |
| | | if (!orderDetlService.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), hostId)) { |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |