| | |
| | | if (!locService.updateById(loc)) {
|
| | | throw new CoolException("库位更新失败!!");
|
| | | }
|
| | |
|
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, shelvesParams.getBarcode()));
|
| | | if (waitPakins.isEmpty()) {
|
| | | throw new CoolException("当前拖盘没有组拖档!!");
|
| | |
| | | }
|
| | | //修改状态为入库中
|
| | | pakin.setIoStatus(1);
|
| | |
|
| | | OrderDetl detl = orderDetlService.getById(pakin.getDetlId());
|
| | | if (Objects.isNull(detl)) {
|
| | | throw new CoolException("数据错误:单据明细不存在!!");
|
| | | }
|
| | | Double qty = Math.round((detl.getQty() + pakin.getAnfme()) * 1000) / 1000.0;
|
| | | detl.setQty(qty);
|
| | | if (!orderDetlService.updateById(detl)) {
|
| | | 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));
|
| | | //订单入历史档
|
| | | orders.forEach(order -> {
|
| | | // if (order.getOrderType() != OrderType.PK_IN_ORDER.id) {
|
| | | // throw new CoolException("当前订单类型:" + order.getOrderType() + ",不可做平库上架操作!!");
|
| | | // }
|
| | | //修改订单状态为已完成
|
| | | order.setOrderSettle(OrderSettleType.COMPLETE.val());
|
| | | OrderLog orderLog = new OrderLog();
|
| | | BeanUtils.copyProperties(order, orderLog);
|
| | | orderLog.setId(null);
|
| | | if (!orderLogService.save(orderLog)) {
|
| | | throw new CoolException("历史单据更新失败!!");
|
| | | List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId()));
|
| | | Double sum = detls.stream().mapToDouble(OrderDetl::getQty).sum();
|
| | | Double summed = detls.stream().mapToDouble(OrderDetl::getWorkQty).sum();
|
| | | Double v = Math.round((sum + summed) * 1000) / 1000.0;
|
| | | Double anfme = detls.stream().mapToDouble(OrderDetl::getAnfme).sum();
|
| | | if (v.compareTo(anfme) == 0.0) {
|
| | | order.setOrderSettle(OrderSettleType.COMPLETE.val());
|
| | | if (! orderService.updateById(order)) {
|
| | | throw new CoolException("单据状态修改失败!!");
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | // //订单入历史档
|
| | | // orders.forEach(order -> {
|
| | | //// if (order.getOrderType() != OrderType.PK_IN_ORDER.id) {
|
| | | //// throw new CoolException("当前订单类型:" + order.getOrderType() + ",不可做平库上架操作!!");
|
| | | //// }
|
| | | // //修改订单状态为已完成
|
| | | // order.setOrderSettle(OrderSettleType.COMPLETE.val());
|
| | | // OrderLog orderLog = new OrderLog();
|
| | | // BeanUtils.copyProperties(order, orderLog);
|
| | | // orderLog.setId(null);
|
| | | // if (!orderLogService.save(orderLog)) {
|
| | | // 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 ->{
|
| | |
| | | // detlLog.setId(null);
|
| | | // detlLogs.add(detlLog);
|
| | | // });
|
| | |
|
| | | // //订单明细转历史档
|
| | | // if (!orderDetlLogService.saveBatch(detlLogs)) {
|
| | | // throw new CoolException("订单明细转历史失败!!");
|