更新
This commit is contained in:
@@ -77,9 +77,9 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
|
||||
//不同楼层下发不同的agv系统
|
||||
if (task_type.equals("1")) {
|
||||
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
|
||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + inst.getInstruction_code();
|
||||
} else {
|
||||
agvurl = agvurl2 + ":" + agvport2 + "/v1/transportOrders/" + inst.getInstruction_code();
|
||||
agvurl = agvurl2 + ":" + agvport2 + "/rmds/v1/transportOrders/" + inst.getInstruction_code();
|
||||
}
|
||||
log.info("下发agv任务请求:{}", agvurl);
|
||||
log.info("下发agv任务参数:{}", jo.toString());
|
||||
@@ -111,8 +111,9 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
|
||||
}
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/v1/transportOrders";
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/query";
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body("{}")
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
|
||||
@@ -283,7 +284,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
String url = agvurl + ":" + agvport + "/addDestinations";
|
||||
String url = agvurl + ":" + agvport + "/rmds/addDestinations";
|
||||
log.info("下发agv任务请求:{}", url);
|
||||
|
||||
HttpResponse result = HttpRequest.post(url)
|
||||
@@ -425,7 +426,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
|
||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/" + code + "/markComplete";
|
||||
log.info("关闭agv运单序列请求:{}", agvurl);
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
@@ -473,7 +474,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
properties.add(pro1);
|
||||
JSONObject pro2 = new JSONObject();
|
||||
pro2.put("key", "PauseOnStation");
|
||||
pro2.put("value", "True");
|
||||
pro2.put("value", "true");
|
||||
properties.add(pro2);
|
||||
destinationOrder.put("properties", properties);
|
||||
//进入等待 离开不等待
|
||||
@@ -481,11 +482,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
JSONArray properties = new JSONArray();
|
||||
JSONObject pro1 = new JSONObject();
|
||||
pro1.put("key", "EntryRequired");
|
||||
pro1.put("value", "True");
|
||||
pro1.put("value", "true");
|
||||
properties.add(pro1);
|
||||
JSONObject pro2 = new JSONObject();
|
||||
pro2.put("key", "PauseOnStation");
|
||||
pro2.put("value", "False");
|
||||
pro2.put("value", "false");
|
||||
properties.add(pro2);
|
||||
destinationOrder.put("properties", properties);
|
||||
//进入不等待 离开等待
|
||||
@@ -493,11 +494,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
JSONArray properties = new JSONArray();
|
||||
JSONObject pro1 = new JSONObject();
|
||||
pro1.put("key", "EntryRequired");
|
||||
pro1.put("value", "False");
|
||||
pro1.put("value", "false");
|
||||
properties.add(pro1);
|
||||
JSONObject pro2 = new JSONObject();
|
||||
pro2.put("key", "PauseOnStation");
|
||||
pro2.put("value", "True");
|
||||
pro2.put("value", "true");
|
||||
properties.add(pro2);
|
||||
destinationOrder.put("properties", properties);
|
||||
//不等待
|
||||
@@ -505,11 +506,11 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
JSONArray properties = new JSONArray();
|
||||
JSONObject pro1 = new JSONObject();
|
||||
pro1.put("key", "EntryRequired");
|
||||
pro1.put("value", "False");
|
||||
pro1.put("value", "false");
|
||||
properties.add(pro1);
|
||||
JSONObject pro2 = new JSONObject();
|
||||
pro2.put("key", "PauseOnStation");
|
||||
pro2.put("value", "False");
|
||||
pro2.put("value", "false");
|
||||
properties.add(pro2);
|
||||
destinationOrder.put("properties", properties);
|
||||
}
|
||||
@@ -547,7 +548,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
JSONArray properties = new JSONArray();
|
||||
JSONObject pro1 = new JSONObject();
|
||||
pro1.put("key", "Wait");
|
||||
pro1.put("value", "True");
|
||||
pro1.put("value", "true");
|
||||
properties.add(pro1);
|
||||
destinationOrder.put("properties", properties);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -378,13 +379,17 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (StrUtil.equals(route.getType(), "1")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
if (!ObjectUtils.isEmpty(result)) {
|
||||
JSONObject jo = JSON.parseObject(result.body());
|
||||
if(jo.getInteger("status") != 200){
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
@@ -942,6 +947,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class QueryZDAgvTaskStatus {
|
||||
public class QueryOneZDAgvTaskStatus {
|
||||
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
@@ -58,71 +58,6 @@ public class QueryZDAgvTaskStatus {
|
||||
// WITHDRAWN:业务订单已被撤销
|
||||
// FINISHED:业务订单已完成
|
||||
// FAILED:业务订单已失败
|
||||
// UNROUTABLE:无法规划该业务订单的执行路线
|
||||
|
||||
//执行中
|
||||
if ("BEING_PROCESSED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
}
|
||||
} else if ("WITHDRAWN".equals(state) || "FAILED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("3");
|
||||
instructionService.update(inst);
|
||||
instructionService.removeByCodeFromCache(inst_jo.getString("task_code"));
|
||||
}
|
||||
}
|
||||
JSONArray ja = inst_jo.getJSONArray("destinations");
|
||||
for (int j = 0; j < ja.size(); j++) {
|
||||
JSONObject jo = ja.getJSONObject(j);
|
||||
JSONArray pro_rows = jo.getJSONArray("properties");
|
||||
//Load 取货动作 Unload放货动作 Wait等待
|
||||
String operation = jo.getString("operation");
|
||||
String device = jo.getString("locationName");
|
||||
for (int k = 0; k < pro_rows.size(); k++) {
|
||||
JSONObject item = pro_rows.getJSONObject(k);
|
||||
if ("True".equals(item.get("value"))) {
|
||||
String param = item.get("key").toString();
|
||||
//EntryRequired是否进入前等待 PauseOnStation是否离开等待 Wait在该点进行等待
|
||||
agvService.process(inst_code, param, device, operation, vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HttpResponse response2 = agvService.queryAgvInstStatus("2");
|
||||
//查询AGV指令列表
|
||||
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
|
||||
for (int i = 0; i < inst_rows2.size(); i++) {
|
||||
JSONObject inst_jo = inst_rows2.getJSONObject(i);
|
||||
String inst_code = inst_jo.getString("task_code");
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
continue;
|
||||
}
|
||||
//反馈结果状态
|
||||
log.info("instcode:" + inst_code + "," + inst_jo.toString());
|
||||
|
||||
String state = inst_jo.getString("state");
|
||||
String vehicle = "";
|
||||
//正在执行指令agv车号
|
||||
if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) {
|
||||
vehicle = inst_jo.getString("vehicle");
|
||||
inst.setCarno(vehicle);
|
||||
}
|
||||
// RAW:初始状态
|
||||
// ACTIVE:业务订单已激活
|
||||
// DISPATCHABLE:业务订单已通过系统验证,等待被调度执行
|
||||
// BEING_PROCESSED:业务订单正在被执行
|
||||
// WITHDRAWN:业务订单已被撤销
|
||||
// FINISHED:业务订单已完成
|
||||
// FAILED:业务订单已失败
|
||||
// UNROUTABLE:无法规划该业务订单的执行路线
|
||||
|
||||
//执行中
|
||||
@@ -0,0 +1,95 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 查询AGV任务状态
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class QueryTwoZDAgvTaskStatus {
|
||||
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
ZheDaAgvService agvService;
|
||||
|
||||
|
||||
public void run() throws Exception {
|
||||
HttpResponse response2 = agvService.queryAgvInstStatus("2");
|
||||
//查询AGV指令列表
|
||||
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
|
||||
for (int i = 0; i < inst_rows2.size(); i++) {
|
||||
JSONObject inst_jo = inst_rows2.getJSONObject(i);
|
||||
String inst_code = inst_jo.getString("task_code");
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
continue;
|
||||
}
|
||||
//反馈结果状态
|
||||
log.info("instcode:" + inst_code + "," + inst_jo.toString());
|
||||
|
||||
String status = inst_jo.getString("status");
|
||||
String vehicle = "";
|
||||
//正在执行指令agv车号
|
||||
if (!StrUtil.isEmpty(inst_jo.getString("vehicle"))) {
|
||||
vehicle = inst_jo.getString("vehicle");
|
||||
inst.setCarno(vehicle);
|
||||
}
|
||||
// RAW:初始状态
|
||||
// ACTIVE:业务订单已激活
|
||||
// DISPATCHABLE:业务订单已通过系统验证,等待被调度执行
|
||||
// BEING_PROCESSED:业务订单正在被执行
|
||||
// WITHDRAWN:业务订单已被撤销
|
||||
// FINISHED:业务订单已完成
|
||||
// FAILED:业务订单已失败
|
||||
// UNROUTABLE:无法规划该业务订单的执行路线
|
||||
|
||||
//执行中
|
||||
if ("BEING_PROCESSED".equals(status) || "ACTIVE".equals(status)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
} else if ("FINISHED".equals(status)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
}
|
||||
} else if ("WITHDRAWN".equals(status) || "FAILED".equals(status)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("3");
|
||||
instructionService.update(inst);
|
||||
instructionService.removeByCodeFromCache(inst_jo.getString("task_code"));
|
||||
}
|
||||
}
|
||||
JSONArray ja = inst_jo.getJSONArray("destinations");
|
||||
for (int j = 0; j < ja.size(); j++) {
|
||||
JSONObject jo = ja.getJSONObject(j);
|
||||
JSONArray pro_rows = jo.getJSONArray("properties");
|
||||
//Load 取货动作 Unload放货动作 Wait等待
|
||||
String operation = jo.getString("operation");
|
||||
String device = jo.getString("locationName");
|
||||
for (int k = 0; k < pro_rows.size(); k++) {
|
||||
JSONObject item = pro_rows.getJSONObject(k);
|
||||
if ("True".equals(item.get("value"))) {
|
||||
String param = item.get("key").toString();
|
||||
//EntryRequired是否进入前等待 PauseOnStation是否离开等待 Wait在该点进行等待
|
||||
agvService.process(inst_code, param, device, operation, vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="off">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
|
||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http://47.97.157.227:8010'
|
||||
VUE_APP_BASE_API = 'http://192.168.4.116:8010'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'ws://47.97.157.227:8010'
|
||||
VUE_APP_WS_API = 'ws://192.168.4.116:8010'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
VUE_APP_BASE_API: 'http://192.168.4.116:8010'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
VUE_APP_BASE_API: 'http://192.168.4.1168010'
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user