|
|
@ -42,8 +42,7 @@ public class AutoCreateInst { |
|
|
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); |
|
|
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); |
|
|
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
|
List<TaskDto> list = taskserver.queryAll("task_status = '0' ORDER BY create_time ASC"); |
|
|
|
List<TaskDto> list2 = taskserver.queryAll("task_status = '1' ORDER BY create_time ASC"); |
|
|
|
List<TaskDto> list = taskserver.queryAllFromCacheByStatus("0"); |
|
|
|
Map<String, List<TaskDto>> collect = list.stream().sorted(Comparator.comparing(TaskDto::getCreate_time).thenComparing(TaskDto::getTask_code)) |
|
|
|
.collect(Collectors.groupingBy(TaskDto::getPriority)); |
|
|
|
TreeMap<String, List<TaskDto>> treeMap = new TreeMap<>(new Comparator<String>() { |
|
|
@ -80,8 +79,8 @@ public class AutoCreateInst { |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
acsTask.setRemark("同列起点已存在,创建指令失败"); |
|
|
|
taskserver.update(acsTask); |
|
|
|
//acsTask.setRemark("同列起点已存在,创建指令失败");
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} else if (nextDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
@ -96,13 +95,14 @@ public class AutoCreateInst { |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
acsTask.setRemark("同列起点已存在,创建指令失败"); |
|
|
|
taskserver.update(acsTask); |
|
|
|
// acsTask.setRemark("同列终点已存在,创建指令失败");
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Boolean flag2 = false; |
|
|
|
List<TaskDto> list2 = taskserver.queryAllFromCacheByStatus("1"); |
|
|
|
if (CollUtil.isNotEmpty(list2)) { |
|
|
|
for (TaskDto taskDto : list2) { |
|
|
|
if (taskDto.getTask_type().equals(acsTask.getTask_type())) { |
|
|
@ -122,8 +122,8 @@ public class AutoCreateInst { |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
acsTask.setRemark("同列起点已存在,创建指令失败"); |
|
|
|
taskserver.update(acsTask); |
|
|
|
//acsTask.setRemark("同列起点已存在,创建指令失败");
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
flag2 = true; |
|
|
|
break; |
|
|
|
} |
|
|
@ -143,8 +143,8 @@ public class AutoCreateInst { |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
acsTask.setRemark("同列起点已存在,创建指令失败"); |
|
|
|
taskserver.update(acsTask); |
|
|
|
//acsTask.setRemark("同列终点已存在,创建指令失败");
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
flag2 = true; |
|
|
|
break; |
|
|
|
} |
|
|
@ -192,8 +192,8 @@ public class AutoCreateInst { |
|
|
|
//校验路由关系
|
|
|
|
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); |
|
|
|
if (ObjectUtils.isEmpty(shortPathsList)) { |
|
|
|
acsTask.setRemark("路由不通无法生成指令"); |
|
|
|
taskserver.updateByCodeFromCache(acsTask); |
|
|
|
//acsTask.setRemark("路由不通无法生成指令");
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
@ -259,8 +259,8 @@ public class AutoCreateInst { |
|
|
|
try { |
|
|
|
instructionService.create(instdto); |
|
|
|
} catch (Exception e) { |
|
|
|
acsTask.setRemark(e.getMessage()); |
|
|
|
taskserver.updateByCodeFromCache(acsTask); |
|
|
|
//acsTask.setRemark(e.getMessage());
|
|
|
|
//taskserver.updateByCodeFromCache(acsTask);
|
|
|
|
log.info("自动创建指令失败{}", e.getMessage()); |
|
|
|
continue; |
|
|
|
} |
|
|
|