Browse Source

rev:解除路由

master
gengby 8 months ago
parent
commit
6d2ce1b20a
  1. 96
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  2. 68
      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

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

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

Loading…
Cancel
Save