| | |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, Arrays.asList(ids))); |
| | | if (!taskItems.isEmpty()) { |
| | | taskItems.forEach(taskItem -> { |
| | | if (!checkOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>() |
| | | .eq(WkOrderItem::getId, taskItem.getOrderItemId()) |
| | | .setSql("work_qty = work_qty - " + taskItem.getAnfme()))) { |
| | | throw new CoolException("明细数量修改失败!!"); |
| | | } |
| | | |
| | | if (!checkOrderService.update(new LambdaUpdateWrapper<WkOrder>() |
| | | .eq(WkOrder::getId, taskItem.getOrderId()) |
| | | .setSql("work_qty = work_qty - " + taskItem.getAnfme()))) { |
| | | throw new CoolException("盘点单执行数量修改失败!!"); |
| | | } |
| | | |
| | | checkDiffItemService.remove(new LambdaQueryWrapper<CheckDiffItem>().eq(CheckDiffItem::getTaskItemId, taskItem.getId())); |
| | | |
| | | checkDiffService.removeById(taskItem.getSourceId()); |
| | |
| | | tempLocs.forEach(working -> { |
| | | taskItems.forEach(taskItem -> { |
| | | if (taskItem.getMatnrId().equals(working.getMatnrId())) { |
| | | Double minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0; |
| | | Double minQty = taskItem.getAnfme(); |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0; |
| | | } |
| | | if (minQty.compareTo(0.0) > 0) { |
| | | taskItem.setAnfme(minQty); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | throw new CoolException("任务明细修改失败!!"); |
| | | } |
| | | |
| | | } else { |
| | | if (!taskItemService.removeById(taskItem)) { |
| | | throw new CoolException("任务明细修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | }); |
| | | }); |
| | | List<Long> matnrIds = taskItems.stream().map(TaskItem::getMatnrId).collect(Collectors.toList()); |
| | |
| | | TaskItem taskItem = taskItems.stream().findFirst().get(); |
| | | taskItem.setMatnrId(working.getMatnrId()) |
| | | .setMaktx(working.getMaktx()) |
| | | .setMatnrId(working.getMatnrId()) |
| | | .setMatnrCode(working.getMatnrCode()) |
| | | .setSpec(working.getSpec()) |
| | | .setAnfme(working.getAnfme()) |
| | | .setBatch(working.getBatch()) |
| | |
| | | }); |
| | | |
| | | locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId())); |
| | | Loc loc1 = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); |
| | | Loc loc1 = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())); |
| | | if (Objects.isNull(loc1)) { |
| | | throw new CoolException("目标库位不存在!!"); |
| | | } |