| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R saveCheckDiff(SaveCheckDiffParams params, Long loginUserId) { |
| | | if (params.getCheckDiffItems() == null || params.getCheckDiffItems().isEmpty()) { |
| | | throw new CoolException("盘点明细不能为空"); |
| | | } |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.getContainer()).last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("数据错误,未找到容器码对应盘点任务"); |
| | | } |
| | | |
| | | CheckDiff checkDiff = checkDiffService.getById(params.getCheckId()); |
| | | if (null == checkDiff) { |
| | | return R.error("未找到盘点差异单"); |
| | | } |
| | | if (checkDiff.getExceStatus().equals(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_END.val)) { |
| | | return R.error("该盘点单已完成"); |
| | | } |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.getContainer()).last("limit 1")); |
| | | if (null == task) { |
| | | throw new CoolException("数据错误,未找到容器码对应盘点任务"); |
| | | } |
| | | for (CheckDiffItem ckDiffItem : params.getCheckDiffItems()) { |
| | | CheckDiffItem diffItem = new CheckDiffItem(); |
| | |
| | | if (checkDiffItems.isEmpty()) { |
| | | throw new CoolException("此条码不在当前盘点单中"); |
| | | } |
| | | |
| | | return R.ok(Cools.add("checkDiffItems",checkDiffItems).add("checkDiff",checkDiff)); |
| | | return R.ok(Cools.add("checkDiffItems", checkDiffItems).add("checkDiff", checkDiff)); |
| | | } |
| | | } |