|
|
|
|
@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.desk.basic.service.IWorkCenterService; |
|
|
|
|
@ -94,6 +95,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement |
|
|
|
|
@Autowired |
|
|
|
|
ILocationService locationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
ITaskService taskService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void savePipelineWeigh(String boxBarcode, BigDecimal actualWeight, Integer statusStart) { |
|
|
|
|
// 1.查询物料箱 筛选状态
|
|
|
|
|
@ -230,6 +234,33 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement |
|
|
|
|
return taskDetailsVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean taskClosed(TaskDetailsDto taskDetailsDto) { |
|
|
|
|
// 1. 参数校验
|
|
|
|
|
if (taskDetailsDto == null) { |
|
|
|
|
throw new ServiceException("任务详情不能为空"); |
|
|
|
|
} |
|
|
|
|
if (taskDetailsDto.getTaskId() == null) { |
|
|
|
|
throw new ServiceException("任务ID不能为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 2. 查询任务
|
|
|
|
|
Task task = taskService.getById(taskDetailsDto.getTaskId()); |
|
|
|
|
if (task == null) { |
|
|
|
|
throw new ServiceException("任务不存在, taskId: " + taskDetailsDto.getTaskId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 3. 状态校验
|
|
|
|
|
if (Task.STATUS_FINISHED.equals(task.getTaskStatus()) |
|
|
|
|
|| Task.STATUS_FAILING.equals(task.getTaskStatus())) { |
|
|
|
|
throw new ServiceException("任务状态为[结束]或[失败]无法关闭"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 4. 关闭任务
|
|
|
|
|
task.setTaskStatus(Task.STATUS_FINISHED); |
|
|
|
|
return taskService.updateById(task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 格式化位置信息(提取公共逻辑) |
|
|
|
|
*/ |
|
|
|
|
|