Browse Source

rev:解除路由

master
gengby 8 months ago
parent
commit
6d2ce1b20a
  1. 88
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  2. 58
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  3. 48
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

88
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -339,33 +339,33 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
// StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
try {
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null;
for (int i = 0; i < shortPathsList.size(); i++) {
RouteLineDto routeLineDto = shortPathsList.get(i);
String route_device = routeLineDto.getDevice_code();
String route_next_device = routeLineDto.getNext_device_code();
if (route_device.equals(dto.getStart_device_code())
&& route_next_device.equals(dto.getNext_device_code())) {
route = routeLineDto;
break;
}
}
if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
// String start_device_code = dto.getStart_device_code();
// String next_device_code = dto.getNext_device_code();
// String route_plan_code = task.getRoute_plan_code();
// List<RouteLineDto> shortPathsList =
// routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// RouteLineDto route = null;
// for (int i = 0; i < shortPathsList.size(); i++) {
// RouteLineDto routeLineDto = shortPathsList.get(i);
// String route_device = routeLineDto.getDevice_code();
// String route_next_device = routeLineDto.getNext_device_code();
// if (route_device.equals(dto.getStart_device_code())
// && route_next_device.equals(dto.getNext_device_code())) {
// route = routeLineDto;
// break;
// }
// }
// if (ObjectUtil.isEmpty(route)) {
// throw new BadRequestException("未查询到相关路由!");
// }
//if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
}
// }
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();
@ -447,29 +447,29 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
try {
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null;
for (int i = 0; i < shortPathsList.size(); i++) {
RouteLineDto routeLineDto = shortPathsList.get(i);
String route_device = routeLineDto.getDevice_code();
String route_next_device = routeLineDto.getNext_device_code();
if (route_device.equals(dto.getStart_device_code())
&& route_next_device.equals(dto.getNext_device_code())) {
route = routeLineDto;
break;
}
}
if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
// String start_device_code = dto.getStart_device_code();
// String next_device_code = dto.getNext_device_code();
// String route_plan_code = task.getRoute_plan_code();
// List<RouteLineDto> shortPathsList =
// routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// RouteLineDto route = null;
// for (int i = 0; i < shortPathsList.size(); i++) {
// RouteLineDto routeLineDto = shortPathsList.get(i);
// String route_device = routeLineDto.getDevice_code();
// String route_next_device = routeLineDto.getNext_device_code();
// if (route_device.equals(dto.getStart_device_code())
// && route_next_device.equals(dto.getNext_device_code())) {
// route = routeLineDto;
// break;
// }
// }
// if (ObjectUtil.isEmpty(route)) {
// throw new BadRequestException("未查询到相关路由!");
// }
// if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
}
// }
} catch (Exception e) {
dto.setSend_status("2");
e.printStackTrace();

58
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -467,12 +467,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
// 判断起点终点设备类型
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code());
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code());
if (routelineserver
.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
.size()
== 0) {
throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
}
// if (routelineserver
// .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
// .size()
// == 0) {
// throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
// }
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@ -965,6 +965,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
entity.getStart_device_code(),
entity.getNext_device_code(),
entity.getRoute_plan_code());
if (ObjectUtil.isNotEmpty(shortPathsList)){
String type = shortPathsList.get(0).getType();
// != 0 为agv任务
if (!StrUtil.equals(type, "0")) {
@ -973,6 +974,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -1181,28 +1183,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String agv_system_type = acsTask.getAgv_system_type();
String task_type = acsTask.getTask_type();
/** 开始平均分解校验 */
String this_device_code =
this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(
start_device_code, acsTask.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
} else {
next_device_code = this_device_code;
}
// String this_device_code =
// this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
// if (StrUtil.isEmpty(this_device_code)) {
// List<RouteLineDto> shortPathsList =
// routeLineService.getShortPathLines(
// start_device_code, acsTask.getNext_device_code(), route_plan_code);
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
// } else {
// next_device_code = this_device_code;
// }
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();

48
acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -76,30 +76,30 @@ 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);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// if (ObjectUtils.isEmpty(shortPathsList)) {
// acsTask.setRemark("路由不通无法生成指令");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
// if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
// continue;
// }
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();

Loading…
Cancel
Save