| | |
| | | } |
| | | Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | //加上历史拣料数量 |
| | | Double pickQty = Math.round((orderItem.getQty() + summed) * 10000) / 10000.0; |
| | | Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0; |
| | | if (pickQty.compareTo(orderItem.getAnfme()) > 0.0) { |
| | | throw new CoolException("播种数量不能超出订单需求数量"); |
| | | } |
| | |
| | | |
| | | List<StockItem> stockItems = new ArrayList<>(); |
| | | items.forEach(taskItem -> { |
| | | taskItem.setQty(taskItem.getAnfme()); |
| | | taskItem.setQty(taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId()); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | throw new CoolException("状态完成失败!!"); |
| | | } |
| | |
| | | throw new CoolException("订单数量更新失败!!"); |
| | | } |
| | | //检查单据是否完成 |
| | | if (order.getAnfme().compareTo(order.getQty()) == 0) { |
| | | order.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val); |
| | | if (!asnOrderService.updateById(order)) { |
| | | throw new CoolException("出库单更新状态失败"); |
| | | } |
| | | } |
| | | // if (order.getAnfme().compareTo(order.getQty()) == 0) { |
| | | // order.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val); |
| | | // if (!asnOrderService.updateById(order)) { |
| | | // throw new CoolException("出库单更新状态失败"); |
| | | // } |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | private void saveOrderToStock(Order order) { |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | |
| | | //// } |
| | | // } |
| | | |
| | | task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态更新失败"); |
| | | try { |
| | | taskService.pickOrCheckTask(task.getId(), ""); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | // if (!taskService.updateById(task)) { |
| | | // throw new CoolException("任务状态更新失败"); |
| | | // } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |