rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -18,6 +18,7 @@ import com.vincent.rsf.server.system.controller.BaseController; import com.vincent.rsf.server.system.service.impl.ConfigServiceImpl; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; @@ -138,8 +139,15 @@ .in(Task::getTaskStatus, longs)); for (Task task : tasks) { if (StringUtils.isNotBlank(task.getParentId() + "")) { Task task1 = taskService.getById(task.getParentId()); if (!Objects.isNull(task1)) { throw new CoolException("父任务:" + task1.getTaskCode() + "未执行完成!"); } } task.setTaskStatus(task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id); } if (!taskService.updateBatchById(tasks)) { return R.error("完成任务失败"); } rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -107,14 +107,6 @@ return; } List<Long> list = tasks.stream().map(Task::getId).collect(Collectors.toList()); List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, list)); if (taskItems.isEmpty()) { return; } Map<Long, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getTaskId)); tasks.forEach(task -> { TaskLog taskLog = new TaskLog(); BeanUtils.copyProperties(task, taskLog); @@ -123,9 +115,9 @@ if (!taskLogService.save(taskLog)) { throw new CoolException("任务历史档保存失败!!"); } List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); List<TaskItemLog> itemLogs = new ArrayList<>(); for (TaskItem item : listMap.get(task.getId())) { for (TaskItem item : taskItems) { TaskItemLog itemLog = new TaskItemLog(); BeanUtils.copyProperties(item, itemLog); itemLog.setId(null) @@ -135,19 +127,19 @@ itemLogs.add(itemLog); } if (!taskItemLogService.saveBatch(itemLogs)) { throw new CoolException("任务明细历史档保存失败!!"); if (!taskService.removeById(task.getId())) { throw new CoolException("原始任务删除失败!!"); } if (!taskItems.isEmpty()) { if (!taskItemLogService.saveBatch(itemLogs)) { throw new CoolException("任务明细历史档保存失败!!"); } if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) { throw new CoolException("原始任务明细删除失败!!"); } } }); if (!taskService.removeByIds(list)) { throw new CoolException("原始任务删除失败!!"); } List<Long> itemIds = taskItems.stream().map(TaskItem::getId).collect(Collectors.toList()); if (!taskItemService.removeByIds(itemIds)) { throw new CoolException("原始任务明细删除失败!!"); } } } rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -426,23 +426,22 @@ } List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); if (taskItems.isEmpty()) { throw new CoolException("任务明细不存在!!"); if (!taskItems.isEmpty()) { //移库有可能是空板 try { //更新库位明细 saveLocItem(taskItems, task.getId()); } catch (Exception e) { throw new CoolException("库位明细更新失败!!"); } if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { throw new CoolException("源库位明细删除失败!"); } } try { //更新库位明细 saveLocItem(taskItems, task.getId()); } catch (Exception e) { throw new CoolException("库位明细更新失败!!"); } // /**对任务明细按组拖明细进行分组*/ // try { // //保存库存明细 // saveStockItems(taskItems, null, null, pakinItem.getWkType(), pakinItem.getType()); // } catch (Exception e) { // log.error("<UNK>", e); // throw new CoolException(e.getMessage()); // } /**修改库位状态为F.在库*/ if (!locService.update(new LambdaUpdateWrapper<Loc>() .set(Loc::getBarcode, task.getBarcode()) @@ -457,9 +456,6 @@ throw new CoolException("库位状态修改失败!!"); } if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { throw new CoolException("源库位明细删除失败!"); } if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { throw new CoolException("任务状态修改失败!!"); @@ -743,12 +739,6 @@ public void complateOutStock(Task task) throws Exception { if (Objects.isNull(task)) { throw new CoolException("参数不能为空!!"); } if (StringUtils.isNotBlank(task.getParentId() + "")) { Task task1 = taskService.getById(task.getParentId()); if (!Objects.isNull(task1)) { throw new CoolException("父任务:" + task1.getTaskCode() + "未执行完成!"); } } Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));