| | |
| | | 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("下发执行异常,请稍候重试!"); |
| | | } |
| | | } |
| | | |
| | | 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, taskItems.stream().mapToDouble(TaskItem::getAnfme).sum()) |
| | | .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("波次状态修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |