|
|
@ -58,14 +58,16 @@ public class CTQKTask extends AbstractTask { |
|
|
|
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|
|
|
for (SchBaseTask task : tasks) { |
|
|
|
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
|
|
|
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); |
|
|
|
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// 找起点
|
|
|
|
SchBasePoint point = findStartPoint(startRegionStr); |
|
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
|
task.setRemark("暂无托盘!"); |
|
|
|
taskService.updateById(task); |
|
|
|
// 消息通知
|
|
|
|
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(), NoticeTypeEnum.WARN.getCode()); |
|
|
|
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getPoint_code2(), |
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 设置终点并修改创建成功状态
|
|
|
@ -74,14 +76,11 @@ public class CTQKTask extends AbstractTask { |
|
|
|
task.setVehicle_qty(point.getVehicle_qty()); |
|
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
taskService.updateById(task); |
|
|
|
|
|
|
|
// 点位信息更新
|
|
|
|
point.setIng_task_code(task.getTask_code()); |
|
|
|
pointService.update(point); |
|
|
|
PointUtils.setUpdateByAcs(point); |
|
|
|
pointService.updateById(point); |
|
|
|
|
|
|
|
//下发
|
|
|
|
//this.renotifyAcs(task);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -91,8 +90,9 @@ public class CTQKTask extends AbstractTask { |
|
|
|
// 配置信息
|
|
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
|
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|
|
|
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
|
|
|
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); |
|
|
|
TaskUtils.setUpdateByAcs(task); |
|
|
|
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// 找起点
|
|
|
|
SchBasePoint point = findStartPoint(startRegionStr); |
|
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
@ -107,7 +107,7 @@ public class CTQKTask extends AbstractTask { |
|
|
|
task.setVehicle_qty(point.getVehicle_qty()); |
|
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
taskService.save(task); |
|
|
|
|
|
|
|
// 点位更新
|
|
|
|
point.setIng_task_code(task.getTask_code()); |
|
|
|
pointService.update(point); |
|
|
|
PointUtils.setUpdateByAcs(point); |
|
|
@ -135,7 +135,6 @@ public class CTQKTask extends AbstractTask { |
|
|
|
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|
|
|
throw new BadRequestException("该任务已取消!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 根据传来的类型去对任务进行操作
|
|
|
|
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
|
|
|
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|
|
@ -168,12 +167,11 @@ public class CTQKTask extends AbstractTask { |
|
|
|
} |
|
|
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|
|
|
} |
|
|
|
|
|
|
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|
|
|
// 获取参数
|
|
|
|
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|
|
|
String endPoint = taskObj.getPoint_code2(); // 获取起点
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
|
SchBasePoint endPointObj = pointService.getById(endPoint); |
|
|
|
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1()); |
|
|
|
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2()); |
|
|
|
// 起点清空
|
|
|
|
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|
|
|
PointUtils.setUpdateByType(startPointObj, taskFinishedType); |
|
|
@ -193,10 +191,10 @@ public class CTQKTask extends AbstractTask { |
|
|
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|
|
|
taskService.updateById(taskObj); |
|
|
|
} |
|
|
|
|
|
|
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|
|
|
// 获取参数
|
|
|
|
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
|
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1()); |
|
|
|
// 起点解锁
|
|
|
|
if (ObjectUtil.isNotEmpty(startPointObj)) { |
|
|
|
startPointObj.setIng_task_code(""); |
|
|
|