opt:1.去除点位路由。2.仙工任务参数修改。

This commit is contained in:
2025-06-27 15:03:03 +08:00
parent fafb1daca8
commit 90812171e4
4 changed files with 171 additions and 170 deletions

View File

@@ -377,32 +377,32 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} }
public com.alibaba.fastjson.JSONArray createBlocksData(Instruction inst) { public com.alibaba.fastjson.JSONArray createBlocksData(Instruction inst) {
com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray(); com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject jo9 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo9 = new com.alibaba.fastjson.JSONObject();
jo9.put("blockId", IdUtil.simpleUUID()); // jo9.put("blockId", IdUtil.simpleUUID());
jo9.put("location", inst.getStart_point_code() + "INGET"); // jo9.put("location", inst.getStart_point_code() + "INGET");
jo9.put("binTask", "ForkLoad"); // jo9.put("binTask", "ForkLoad");
ja.add(jo9); // ja.add(jo9);
Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); // Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code());
if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) { // if ("true".equals(startDevice.getExtraValue().get("ignore_pickup_check"))) {
//取货前等待 // //取货前等待
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
jo.put("blockId", IdUtil.simpleUUID()); // jo.put("blockId", IdUtil.simpleUUID());
jo.put("location", inst.getStart_point_code() + "INGET"); // jo.put("location", inst.getStart_point_code() + "INGET");
jo.put("operation", "script"); // jo.put("operation", "script");
jo.put("id", inst.getStart_point_code() + "INGET"); // jo.put("id", inst.getStart_point_code() + "INGET");
jo.put("script_name", "userpy/interact1.py"); // jo.put("script_name", "userpy/interact1.py");
com.alibaba.fastjson.JSONObject script_args = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject script_args = new com.alibaba.fastjson.JSONObject();
script_args.put("addr", addr); // script_args.put("addr", addr);
com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reach = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject reach = new com.alibaba.fastjson.JSONObject();
reach.put("task_code", inst.getInstruction_code()); // reach.put("task_code", inst.getInstruction_code());
reach.put("address", inst.getStart_point_code() + "INGET"); // reach.put("address", inst.getStart_point_code() + "INGET");
data.put("reach", reach); // data.put("reach", reach);
script_args.put("data", data); // script_args.put("data", data);
script_args.put("protocol", "HTTP"); // script_args.put("protocol", "HTTP");
jo.put("script_args", script_args); // jo.put("script_args", script_args);
ja.add(jo); // ja.add(jo);
} // }
com.alibaba.fastjson.JSONObject jo1 = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject jo1 = new com.alibaba.fastjson.JSONObject();
jo1.put("blockId", IdUtil.simpleUUID()); jo1.put("blockId", IdUtil.simpleUUID());
jo1.put("location", inst.getStart_point_code()); jo1.put("location", inst.getStart_point_code());
@@ -410,85 +410,85 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
ja.add(jo1); ja.add(jo1);
//取货完成等待 //取货完成等待
com.alibaba.fastjson.JSONObject jo2 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo2 = new com.alibaba.fastjson.JSONObject();
jo2.put("blockId", IdUtil.simpleUUID()); // jo2.put("blockId", IdUtil.simpleUUID());
jo2.put("location", inst.getStart_point_code() + "OUTGET"); // jo2.put("location", inst.getStart_point_code() + "OUTGET");
jo2.put("operation", "script"); // jo2.put("operation", "script");
jo2.put("id", inst.getStart_point_code() + "OUTGET"); // jo2.put("id", inst.getStart_point_code() + "OUTGET");
jo2.put("script_name", "userpy/interact1.py"); // jo2.put("script_name", "userpy/interact1.py");
com.alibaba.fastjson.JSONObject script_args2 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject script_args2 = new com.alibaba.fastjson.JSONObject();
script_args2.put("addr", addr); // script_args2.put("addr", addr);
com.alibaba.fastjson.JSONObject data2 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject data2 = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reach2 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject reach2 = new com.alibaba.fastjson.JSONObject();
reach2.put("task_code", inst.getInstruction_code()); // reach2.put("task_code", inst.getInstruction_code());
reach2.put("address", inst.getStart_point_code() + "OUTGET"); // reach2.put("address", inst.getStart_point_code() + "OUTGET");
data2.put("reach", reach2); // data2.put("reach", reach2);
script_args2.put("data", data2); // script_args2.put("data", data2);
script_args2.put("protocol", "HTTP"); // script_args2.put("protocol", "HTTP");
jo2.put("script_args", script_args2); // jo2.put("script_args", script_args2);
ja.add(jo2); // ja.add(jo2);
com.alibaba.fastjson.JSONObject jo6 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo6 = new com.alibaba.fastjson.JSONObject();
jo6.put("blockId", IdUtil.simpleUUID()); // jo6.put("blockId", IdUtil.simpleUUID());
jo6.put("location", inst.getStart_point_code() + "OUTGET"); // jo6.put("location", inst.getStart_point_code() + "OUTGET");
jo6.put("binTask", "ForkUnload"); // jo6.put("binTask", "ForkUnload");
ja.add(jo6); // ja.add(jo6);
com.alibaba.fastjson.JSONObject jo7 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo7 = new com.alibaba.fastjson.JSONObject();
jo7.put("blockId", IdUtil.simpleUUID()); // jo7.put("blockId", IdUtil.simpleUUID());
jo7.put("location", inst.getNext_point_code() + "INPUT"); // jo7.put("location", inst.getNext_point_code() + "INPUT");
jo7.put("binTask", "ForkLoad"); // jo7.put("binTask", "ForkLoad");
ja.add(jo7); // ja.add(jo7);
Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code()); // Device nextDevice = deviceAppService.findDeviceByCode(inst.getNext_device_code());
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { // if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
//放货前等待 // //放货前等待
com.alibaba.fastjson.JSONObject jo3 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo3 = new com.alibaba.fastjson.JSONObject();
jo3.put("blockId", IdUtil.simpleUUID()); // jo3.put("blockId", IdUtil.simpleUUID());
jo3.put("location", inst.getNext_point_code() + "INPUT"); // jo3.put("location", inst.getNext_point_code() + "INPUT");
jo3.put("operation", "script"); // jo3.put("operation", "script");
jo3.put("id", inst.getNext_point_code() + "INPUT"); // jo3.put("id", inst.getNext_point_code() + "INPUT");
jo3.put("script_name", "userpy/interact1.py"); // jo3.put("script_name", "userpy/interact1.py");
com.alibaba.fastjson.JSONObject script_args3 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject script_args3 = new com.alibaba.fastjson.JSONObject();
script_args3.put("addr", addr); // script_args3.put("addr", addr);
com.alibaba.fastjson.JSONObject data3 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject data3 = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reach3 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject reach3 = new com.alibaba.fastjson.JSONObject();
reach3.put("task_code", inst.getInstruction_code()); // reach3.put("task_code", inst.getInstruction_code());
reach3.put("address", inst.getNext_point_code() + "INPUT"); // reach3.put("address", inst.getNext_point_code() + "INPUT");
data3.put("reach", reach3); // data3.put("reach", reach3);
script_args3.put("data", data3); // script_args3.put("data", data3);
script_args3.put("protocol", "HTTP"); // script_args3.put("protocol", "HTTP");
jo3.put("script_args", script_args3); // jo3.put("script_args", script_args3);
ja.add(jo3); // ja.add(jo3);
} // }
com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject();
jo4.put("blockId", IdUtil.simpleUUID()); jo4.put("blockId", IdUtil.simpleUUID());
jo4.put("location", inst.getNext_point_code()); jo4.put("location", inst.getNext_point_code());
jo4.put("binTask", "ForkUnload"); jo4.put("binTask", "ForkUnload");
ja.add(jo4); ja.add(jo4);
if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) { // if ("true".equals(nextDevice.getExtraValue().get("ignore_release_check"))) {
//放货完成等待 // //放货完成等待
com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject();
jo5.put("blockId", IdUtil.simpleUUID()); // jo5.put("blockId", IdUtil.simpleUUID());
jo5.put("location", inst.getNext_point_code() + "OUTPUT"); // jo5.put("location", inst.getNext_point_code() + "OUTPUT");
jo5.put("operation", "script"); // jo5.put("operation", "script");
jo5.put("id", inst.getNext_point_code() + "OUTPUT"); // jo5.put("id", inst.getNext_point_code() + "OUTPUT");
jo5.put("script_name", "userpy/interact1.py"); // jo5.put("script_name", "userpy/interact1.py");
com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject();
script_args5.put("addr", addr); // script_args5.put("addr", addr);
com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject();
reach5.put("task_code", inst.getInstruction_code()); // reach5.put("task_code", inst.getInstruction_code());
reach5.put("address", inst.getNext_point_code() + "OUTPUT"); // reach5.put("address", inst.getNext_point_code() + "OUTPUT");
data5.put("reach", reach5); // data5.put("reach", reach5);
script_args5.put("data", data5); // script_args5.put("data", data5);
script_args5.put("protocol", "HTTP"); // script_args5.put("protocol", "HTTP");
jo5.put("script_args", script_args5); // jo5.put("script_args", script_args5);
ja.add(jo5); // ja.add(jo5);
} // }
com.alibaba.fastjson.JSONObject jo8 = new com.alibaba.fastjson.JSONObject(); // com.alibaba.fastjson.JSONObject jo8 = new com.alibaba.fastjson.JSONObject();
jo8.put("blockId", IdUtil.simpleUUID()); // jo8.put("blockId", IdUtil.simpleUUID());
jo8.put("location", inst.getNext_point_code() + "OUTPUT"); // jo8.put("location", inst.getNext_point_code() + "OUTPUT");
jo8.put("binTask", "ForkUnload"); // jo8.put("binTask", "ForkUnload");
ja.add(jo8); // ja.add(jo8);
return ja; return ja;
} }

View File

@@ -361,27 +361,27 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
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")) {
try { try {
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) { // if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(),String.valueOf(AgvSystemEnum.Maigic.getIndex()))) { if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(),String.valueOf(AgvSystemEnum.Maigic.getIndex()))) {
HttpResponse result = magicAgvService.sendAgvInstToMagic(dto); HttpResponse result = magicAgvService.sendAgvInstToMagic(dto);
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) { if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
@@ -415,13 +415,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class); ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
zheDaAgvService.sendAgvInstToAgv(dto); zheDaAgvService.sendAgvInstToAgv(dto);
} }
} // }
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); dto.setSend_status("2");
e.printStackTrace(); e.printStackTrace();
} }
} // }
} catch (Exception e) { } catch (Exception e) {
dto.setSend_status("2"); dto.setSend_status("2");
e.printStackTrace(); e.printStackTrace();

View File

@@ -475,12 +475,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);
@@ -1097,28 +1097,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();

View File

@@ -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();
@@ -146,6 +146,7 @@ public class AutoCreateInst {
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
acsTask.setRemark(e.getMessage()); acsTask.setRemark(e.getMessage());
log.info("自动创建指令失败,任务号:{},失败消息:{}",acsTask.getTask_code(),e.getMessage());
taskserver.updateByCodeFromCache(acsTask); taskserver.updateByCodeFromCache(acsTask);
continue; continue;
} }