| | |
| | | throw new CoolException("当前状态无法下发执行!!"); |
| | | } |
| | | |
| | | List<WaveItem> items = waveItemService.list(new LambdaQueryWrapper<WaveItem>().eq(WaveItem::getWaveId, wave.getId())); |
| | | List<WaveItem> items = waveItemService.list(new LambdaQueryWrapper<WaveItem>() |
| | | .le(WaveItem::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val) |
| | | .eq(WaveItem::getWaveId, wave.getId())); |
| | | if (items.isEmpty()) { |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | |
| | | throw new CoolException("下发执行异常,请稍候重试!"); |
| | | } |
| | | } |
| | | if (!waveService.update(new LambdaUpdateWrapper<Wave>() |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_TASK.val) |
| | | .set(Wave::getWorkQty, taskItems.stream().mapToDouble(TaskItem::getAnfme).sum()) |
| | | .set(Wave::getUpdateBy, loginUserId) |
| | | .set(Wave::getMemo, null) |
| | | .set(Wave::getUpdateTime, new Date()) |
| | | .eq(Wave::getId, wave.getId()))) { |
| | | throw new CoolException("波次状态修改失败!!"); |
| | | |
| | | Double sum = taskItems.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | Double v = Math.round((wave.getWorkQty() + sum) * 1000000) / 1000000.0; |
| | | if (wave.getAnfme().compareTo(v) == 0) { |
| | | if (!waveService.update(new LambdaUpdateWrapper<Wave>() |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_TASK.val) |
| | | .set(Wave::getWorkQty, v) |
| | | .set(Wave::getUpdateBy, loginUserId) |
| | | .set(Wave::getMemo, null) |
| | | .set(Wave::getUpdateTime, new Date()) |
| | | .eq(Wave::getId, wave.getId()))) { |
| | | throw new CoolException("波次状态修改失败!!"); |
| | | } |
| | | } else { |
| | | if (!waveService.update(new LambdaUpdateWrapper<Wave>() |
| | | .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_EXCING.val) |
| | | .set(Wave::getWorkQty, v) |
| | | .set(Wave::getUpdateBy, loginUserId) |
| | | .set(Wave::getMemo, null) |
| | | .set(Wave::getUpdateTime, new Date()) |
| | | .eq(Wave::getId, wave.getId()))) { |
| | | throw new CoolException("波次状态修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateOutTask(List<OrderOutItemDto> itemParams, Long loginUserId, Wave wave) throws Exception { |
| | | public synchronized void generateOutTask(List<OrderOutItemDto> itemParams, Long loginUserId, Wave wave) throws Exception { |
| | | Map<Long, List<OrderOutItemDto>> listMap = itemParams.stream().collect(Collectors.groupingBy(OrderOutItemDto::getLocId)); |
| | | listMap.keySet().forEach(id -> { |
| | | // double sum = listMap.get(id).stream().mapToDouble(OrderOutItemDto::getAnfme).sum(); |
| | |
| | | } catch (Exception e) { |
| | | throw new CoolException("出库任务生成失败!"); |
| | | } |
| | | |
| | | //添加300毫秒间隔 |
| | | try { |
| | | Thread.sleep(300); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | // for (OrderOutItemDto itemDto : itemParams) { |