| | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public boolean batchMergeOrders(BatchMergeOrdersParam ordersParam) {
|
| | |
|
| | | Loc locServiceOne = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, ordersParam.getMergeNo()), false);
|
| | | if (!Objects.isNull(locServiceOne)) {
|
| | | throw new CoolException("托盘已入库,不能再组托!!");
|
| | | }
|
| | |
|
| | | Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, ordersParam.getOrderNo()));
|
| | | if (Objects.isNull(order)) {
|
| | | throw new CoolException("订单不存在!!");
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | if (!waitPakinService.removeBatchByIds(waitPakins)) {
|
| | | throw new CoolException("组拖档删除失败!!");
|
| | | }
|
| | |
|
| | | //通过组拖订单ID获取订单,并删除原单据,加入单据历史档
|
| | | Set<Long> list = waitPakins.stream().map(WaitPakin::getOrderId).collect(Collectors.toSet());
|
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getId, list));
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | //删除订单数据
|
| | | if (!orderService.removeBatchByIds(orders)) {
|
| | | throw new CoolException("订单删除失败!!");
|
| | | // //删除订单数据
|
| | | // if (!orderService.removeBatchByIds(orders)) {
|
| | | // throw new CoolException("订单删除失败!!");
|
| | | // }
|
| | |
|
| | | // List<OrderDetl> detls = orderDetlMapper.selectList(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list));
|
| | | // List<OrderDetlLog> detlLogs = new ArrayList<>();
|
| | | // detls.forEach(delt ->{
|
| | | // OrderDetlLog detlLog = new OrderDetlLog();
|
| | | // BeanUtils.copyProperties(delt, detlLog);
|
| | | // detlLog.setQty(delt.getWorkQty());
|
| | | // detlLog.setWorkQty(0.0);
|
| | | // detlLog.setId(null);
|
| | | // detlLogs.add(detlLog);
|
| | | // });
|
| | |
|
| | | // //订单明细转历史档
|
| | | // if (!orderDetlLogService.saveBatch(detlLogs)) {
|
| | | // throw new CoolException("订单明细转历史失败!!");
|
| | | // }
|
| | | //
|
| | | // //删除订单明细数据
|
| | | // if (!orderDetlService.remove(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list))) {
|
| | | // throw new CoolException("订单明细删除失败!!");
|
| | | // }
|
| | | if (!waitPakinService.removeBatchByIds(waitPakins)) {
|
| | | throw new CoolException("组拖档删除失败!!");
|
| | | }
|
| | |
|
| | | List<OrderDetl> detls = orderDetlMapper.selectList(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list));
|
| | | List<OrderDetlLog> detlLogs = new ArrayList<>();
|
| | | detls.forEach(delt ->{
|
| | | OrderDetlLog detlLog = new OrderDetlLog();
|
| | | BeanUtils.copyProperties(delt, detlLog);
|
| | | detlLog.setQty(delt.getWorkQty());
|
| | | detlLog.setWorkQty(0.0);
|
| | | detlLog.setId(null);
|
| | | detlLogs.add(detlLog);
|
| | | });
|
| | |
|
| | | //订单明细转历史档
|
| | | if (!orderDetlLogService.saveBatch(detlLogs)) {
|
| | | throw new CoolException("订单明细转历史失败!!");
|
| | | }
|
| | |
|
| | | //删除订单明细数据
|
| | | if (!orderDetlService.remove(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list))) {
|
| | | throw new CoolException("订单明细删除失败!!");
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|