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