| | |
| | | checkDiff = new CheckDiff(); |
| | | checkDiff.setAnfme(order.getAnfme()) |
| | | .setCheckType(order.getCheckType()) |
| | | .setId(null) |
| | | .setOrderCode(order.getCode()) |
| | | .setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_INIT.val) |
| | | .setCreateBy(loginUserId) |
| | |
| | | |
| | | List<TaskItem> items = taskMps.get(orderId); |
| | | List<CheckDiffItem> diffItems = new ArrayList<>(); |
| | | CheckDiff finalCheckDiff = checkDiff; |
| | | for (TaskItem item : items) { |
| | | Task task = taskService.getById(item.getTaskId()); |
| | | if (Objects.isNull(task)) { |
| | |
| | | .setOrderCode(checkDiff.getOrderCode()); |
| | | diffItems.add(checkDiffItem); |
| | | |
| | | // if (Objects.isNull(checkDiff.getAreaId())) { |
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | // .eq(Loc::getCode, task.getOrgLoc()) |
| | | // .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); |
| | | // if (Objects.isNull(loc)) { |
| | | // throw new CoolException("盘点库位不存在!!"); |
| | | // } |
| | | //// finalCheckDiff.setAreaId(loc.getAreaId()).setAreaName(loc.getAreaId$()); |
| | | // } |
| | | if (Objects.isNull(checkDiff.getAreaId())) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("盘点库位不存在!!"); |
| | | } |
| | | finalCheckDiff.setAreaId(loc.getAreaId()).setAreaName(loc.getAreaId$()); |
| | | } |
| | | } |
| | | |
| | | // checkDiff.setAreaId(finalCheckDiff.getAreaId()).setAreaName(finalCheckDiff.getAreaName()); |
| | | // |
| | | // if (!checkDiffService.updateById(checkDiff)) { |
| | | // throw new CoolException("库区信息修改失败!!"); |
| | | // } |
| | | checkDiff.setAreaId(finalCheckDiff.getAreaId()).setAreaName(finalCheckDiff.getAreaName()); |
| | | |
| | | if (!checkDiffService.updateById(checkDiff)) { |
| | | throw new CoolException("库区信息修改失败!!"); |
| | | } |
| | | |
| | | if (!checkDiffItemService.saveBatch(diffItems)) { |
| | | throw new CoolException("盘点差异单保存失败!!"); |