add 仙工叉车下发任务
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
package org.nl.acs.agv.rest;
|
package org.nl.acs.agv.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -22,14 +27,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
public class XianGongAgvController {
|
public class XianGongAgvController {
|
||||||
@Autowired
|
@Autowired
|
||||||
XianGongAgvService xianGongAgvService;
|
XianGongAgvService xianGongAgvService;
|
||||||
@GetMapping("/waitPointRequest")
|
@PostMapping("/api/agv/xg/waitPointRequest")
|
||||||
@Log("agv等待点请求")
|
@Log("仙工AGV请求取放货")
|
||||||
@ApiOperation("下发agv任务")
|
@ApiOperation("仙工AGV请求取放货")
|
||||||
//@PreAuthorize("@el.check('routePlan:list')")
|
@SaIgnore
|
||||||
public ResponseEntity<Object> waitPointRequest(HttpServletRequest req) throws Exception {
|
public ResponseEntity<JSONObject> xgAGVWaitPointRequest(@RequestBody JSONObject requestParam) {
|
||||||
String serviceName = req.getRequestURI();
|
return new ResponseEntity<>(xianGongAgvService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK);
|
||||||
String param = StringUtils.substringAfterLast(serviceName, "/");
|
|
||||||
return new ResponseEntity<>(xianGongAgvService.waitPointRequest(param), HttpStatus.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public interface XianGongAgvService {
|
|||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String waitPointRequest(String param);
|
JSONObject xgAGVWaitPointRequest(JSONObject requestParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acs->agv
|
* acs->agv
|
||||||
|
|||||||
@@ -57,34 +57,116 @@ public class AgvDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 角度
|
* 角度
|
||||||
*/
|
*/
|
||||||
private String positionAngle;
|
private float positionAngle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X坐标
|
* X坐标
|
||||||
*/
|
*/
|
||||||
private String positionX;
|
private float positionX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Y坐标
|
* Y坐标
|
||||||
*/
|
*/
|
||||||
private String positionY;
|
private float positionY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前任务号
|
* 当前任务号
|
||||||
*/
|
*/
|
||||||
private String transportOrder;
|
private String transportOrder;
|
||||||
/**
|
|
||||||
* 状态码
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
/**
|
|
||||||
* 状态描述
|
|
||||||
*/
|
|
||||||
private String statusDescription;
|
|
||||||
/**
|
|
||||||
* 当前车号
|
|
||||||
*/
|
|
||||||
private String vehicle;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池温度
|
||||||
|
*/
|
||||||
|
private String battery_temp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池电量
|
||||||
|
*/
|
||||||
|
private float battery_level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否阻挡
|
||||||
|
*/
|
||||||
|
private String blocked;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否刹车
|
||||||
|
*/
|
||||||
|
private String brake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否充电
|
||||||
|
*/
|
||||||
|
private Boolean charging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人连接状态,0表示断连,1表示连接上
|
||||||
|
*/
|
||||||
|
private Integer connection_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器温度
|
||||||
|
*/
|
||||||
|
private String controller_temp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前地图
|
||||||
|
*/
|
||||||
|
private String current_map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前位置
|
||||||
|
*/
|
||||||
|
private String current_station;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 急停
|
||||||
|
*/
|
||||||
|
private String emergency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 里程
|
||||||
|
*/
|
||||||
|
private String odo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求电流
|
||||||
|
*/
|
||||||
|
private String requestCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求电压
|
||||||
|
*/
|
||||||
|
private String requestVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 软急停
|
||||||
|
*/
|
||||||
|
private String soft_emc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 今天运行的里程
|
||||||
|
*/
|
||||||
|
private String today_odo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压
|
||||||
|
*/
|
||||||
|
private String voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* x方向的速度
|
||||||
|
*/
|
||||||
|
private String vx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* y方向的速度
|
||||||
|
*/
|
||||||
|
private String vy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加速度
|
||||||
|
*/
|
||||||
|
private String w;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,50 +287,9 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse queryMagicAgvDeviceStatus() {
|
public HttpResponse queryMagicAgvDeviceStatus() {
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
|
||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
|
||||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
|
||||||
agvurl = agvurl + ":" + agvport + "/v1/vehicles";
|
|
||||||
HttpResponse result = HttpRequest.get(agvurl)
|
|
||||||
.timeout(20000)//超时,毫秒
|
|
||||||
.execute();
|
|
||||||
log.info("查询agv状态数据:{}", result.body());
|
|
||||||
if (result.getStatus() == 200) {
|
|
||||||
JSONArray ja = (JSONArray) JSONArray.parse(result.body());
|
|
||||||
for (int i = 0; i < ja.size(); i++) {
|
|
||||||
JSONObject jo = (JSONObject) ja.get(i);
|
|
||||||
String name = jo.getString("name");
|
|
||||||
String state = jo.getString("state");
|
|
||||||
String energyLevel = jo.getString("energyLevel");
|
|
||||||
String transportOrder = jo.getString("transportOrder");
|
|
||||||
String positionAngle = jo.getString("positionAngle");
|
|
||||||
String positionX = jo.getString("positionX");
|
|
||||||
String positionY = jo.getString("positionY");
|
|
||||||
AgvDto dto = new AgvDto();
|
|
||||||
dto.setName(name);
|
|
||||||
dto.setEnergyLevel(energyLevel);
|
|
||||||
dto.setState(state);
|
|
||||||
dto.setPositionAngle(positionAngle);
|
|
||||||
dto.setPositionX(positionX);
|
|
||||||
dto.setPositionY(positionY);
|
|
||||||
dto.setTransportOrder(transportOrder);
|
|
||||||
|
|
||||||
if (AGVDeviceStatus.containsKey(name)) {
|
|
||||||
AGVDeviceStatus.remove(name);
|
|
||||||
AGVDeviceStatus.put(name, dto);
|
|
||||||
} else {
|
|
||||||
AGVDeviceStatus.put(name, dto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse deleteAgvInst(String instCode) {
|
public HttpResponse deleteAgvInst(String instCode) {
|
||||||
|
|||||||
@@ -47,136 +47,123 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ParamService paramService;
|
private ParamService paramService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
TaskService taskService;
|
||||||
|
@Autowired
|
||||||
private AcsToWmsService acsToWmsService;
|
private AcsToWmsService acsToWmsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
InstructionService instructionService;
|
InstructionService instructionService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
AcsToWmsZDService acsToWmsZDService;
|
||||||
|
@Autowired
|
||||||
AcsConfigService acsConfigService;
|
AcsConfigService acsConfigService;
|
||||||
|
|
||||||
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
|
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
|
||||||
|
|
||||||
|
|
||||||
@Value("${agvToAcs.addr}")
|
@Value("${agvToAcs.addr}")
|
||||||
private String addr;
|
private String addr;
|
||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public String waitPointRequest(String param) {
|
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) {
|
||||||
log.info("收到AGV请求参数:{}", param);
|
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
||||||
String[] strs = param.split("-");
|
String instCode = requestParam.getString("task_code");
|
||||||
String address = strs[0];
|
Instruction inst = instructionService.findByCodeFromCache(instCode);
|
||||||
String inst_code = strs[1];
|
if (ObjectUtil.isEmpty(inst)) {
|
||||||
String type = strs[2];
|
throw new BadRequestException("请求失败,未找到指令!");
|
||||||
String newaddress = null;
|
}
|
||||||
// 前置点会加上p
|
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
||||||
if (address.endsWith("IN")) {
|
if (ObjectUtil.isEmpty(task)) {
|
||||||
newaddress = address.substring(0, address.length() - 2);
|
throw new BadRequestException("请求失败,未找到指令对应任务!");
|
||||||
} else if (address.endsWith("OUT")) {
|
}
|
||||||
newaddress = address.substring(0, address.length() - 3);
|
String address = requestParam.getString("address");
|
||||||
} else if (address.endsWith("P") || address.endsWith("L") || address.endsWith("R")) {
|
if (StrUtil.isBlank(address)) {
|
||||||
newaddress = address.substring(0, address.length() - 1);
|
throw new BadRequestException("请求失败,地址为空!");
|
||||||
} else if (address.endsWith("CZ")) {
|
|
||||||
newaddress = address.substring(0, address.length() - 2);
|
|
||||||
} else if (address.endsWith("IQ") || address.endsWith("OQ")) {
|
|
||||||
newaddress = address.substring(0, address.length() - 2);
|
|
||||||
} else {
|
|
||||||
newaddress = address;
|
|
||||||
}
|
}
|
||||||
boolean is_feedback = false;
|
|
||||||
Device device = deviceAppService.findDeviceByCode(newaddress);
|
|
||||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
|
||||||
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl");
|
|
||||||
AcsToWmsZDService acsToWmsZDService = SpringContextHolder.getBean("acsToWmsZDServiceImpl");
|
|
||||||
TaskDto task = taskService.findByCode(inst.getTask_code());
|
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
//请求取货
|
//请求取货
|
||||||
if (StrUtil.equals(type, "01") && address.endsWith("IN")) {
|
if (address.contains("INGET")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "applyTake");
|
jo.put("feedbackStatus", "applyTake");
|
||||||
log.info("请求参数:{}", jo);
|
log.info("请求取货请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
is_feedback = true;
|
JSONObject jo2 = new JSONObject();
|
||||||
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
|
return jo2;
|
||||||
|
}else{
|
||||||
|
throw new BadRequestException("上位系统不允许取货");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取货完成
|
//取货完成
|
||||||
else if (StrUtil.equals(type, "02")) {
|
if (address.contains("OUTGET")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "takeFinish");
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
log.info("请求参数:{}", jo);
|
log.info("取货完成请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
is_feedback = true;
|
JSONObject jo2 = new JSONObject();
|
||||||
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
|
return jo2;
|
||||||
|
}else{
|
||||||
|
throw new BadRequestException("上位系统不允许取货完成离开");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取货完成离开
|
// //取货完成离开
|
||||||
else if (StrUtil.equals(type, "05") && address.endsWith("OUT")) {
|
// else if (StrUtil.equals(type, "05") && address.endsWith("OUT")) {
|
||||||
is_feedback = true;
|
// is_feedback = true;
|
||||||
}
|
// }
|
||||||
//请求放货
|
//请求放货
|
||||||
else if (StrUtil.equals(type, "03") && address.endsWith("IN")) {
|
if (address.contains("INPUT")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "applyPut");
|
jo.put("feedbackStatus", "applyPut");
|
||||||
log.info("请求参数:{}", jo);
|
log.info("请求放货请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
is_feedback = true;
|
JSONObject jo2 = new JSONObject();
|
||||||
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
|
return jo2;
|
||||||
|
}else{
|
||||||
|
throw new BadRequestException("上位系统不允许请求放货");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//放货完成
|
//放货完成
|
||||||
else if (StrUtil.equals(type, "04")) {
|
if (address.contains("OUTPUT")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "putFinish");
|
jo.put("feedbackStatus", "putFinish");
|
||||||
log.info("请求参数:{}", jo);
|
log.info("放货完成请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
is_feedback = true;
|
JSONObject jo2 = new JSONObject();
|
||||||
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
}
|
return jo2;
|
||||||
}
|
|
||||||
//放货完成离开
|
|
||||||
else if (StrUtil.equals(type, "06") && address.endsWith("OUT")
|
|
||||||
&& standardOrdinarySiteDeviceDriver.getMove() != 0) {
|
|
||||||
is_feedback = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
if (is_feedback) {
|
|
||||||
jo.put("name", param);
|
|
||||||
jo.put("lastAction", "wait");
|
|
||||||
jo.put("lastActionStatus", "DONE");
|
|
||||||
jo.put("status", "IDLE");
|
|
||||||
}else{
|
}else{
|
||||||
jo.put("name", param);
|
throw new BadRequestException("上位系统不允许放货完成离开");
|
||||||
jo.put("lastAction", "wait");
|
|
||||||
jo.put("lastActionStatus", "FAILED");
|
|
||||||
jo.put("status", "IDLE");
|
|
||||||
}
|
}
|
||||||
is_feedback = false;
|
}
|
||||||
log.info("反馈AGV请求参数:{}", jo.toString());
|
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||||
return jo.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@@ -208,53 +195,80 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
@Override
|
@Override
|
||||||
public HttpResponse queryXZAgvDeviceStatus() {
|
public HttpResponse queryXZAgvDeviceStatus() {
|
||||||
|
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue().toString(), "1")) {
|
||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||||
|
|
||||||
String agvurl1 = agvurl + ":" + agvport + "/api/route/vehicles";
|
agvurl = agvurl + ":" + agvport + "/robotsStatus";
|
||||||
String agvurl2 = agvurl + ":" + agvport + "/api/route/vehicleDetails";
|
|
||||||
|
|
||||||
HttpResponse result = HttpRequest.get(agvurl1)
|
HttpResponse result = HttpRequest.get(agvurl)
|
||||||
.timeout(20000)//超时,毫秒
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
|
|
||||||
HttpResponse result2 = HttpRequest.get(agvurl2)
|
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
System.out.println("查询agv状态数据:" + result.body());
|
System.out.println("查询agv状态数据:" + result.body());
|
||||||
if (result.getStatus() == 200) {
|
if (result.getStatus() == 200) {
|
||||||
JSONArray ja = (JSONArray) JSONArray.parse(result.body());
|
com.alibaba.fastjson.JSONObject body = com.alibaba.fastjson.JSONObject.parseObject(result.body());
|
||||||
|
com.alibaba.fastjson.JSONArray ja = body.getJSONArray("report");
|
||||||
for (int i = 0; i < ja.size(); i++) {
|
for (int i = 0; i < ja.size(); i++) {
|
||||||
JSONObject jo = (JSONObject) ja.get(i);
|
com.alibaba.fastjson.JSONObject jo = ja.getJSONObject(i);
|
||||||
String name = jo.getString("name");
|
//机器人编码
|
||||||
String state = jo.getString("state");
|
String agv_code = jo.getString("uuid");
|
||||||
String energyLevel = jo.getString("energyLevel");
|
//机器人详细状态信息
|
||||||
String transportOrder = jo.getString("transportOrder");
|
com.alibaba.fastjson.JSONObject rbk_report = jo.getJSONObject("rbk_report");
|
||||||
String vehicle=jo.getString("getString");
|
//是否正在充电
|
||||||
JSONObject detailjo = (JSONObject) JSONObject.parse(result2.body());
|
Boolean charging = rbk_report.getBoolean("charging");
|
||||||
JSONObject item = (JSONObject) detailjo.get(name);
|
//电池电量
|
||||||
String x = item.getString("x");
|
float battery_level1 = rbk_report.getFloatValue("battery_level");
|
||||||
String y = item.getString("y");
|
float battery_level=battery_level1*100;
|
||||||
String angle = item.getString("angle");
|
//当前地图
|
||||||
|
String current_map = rbk_report.getString("current_map");
|
||||||
|
//角度
|
||||||
|
float angle = rbk_report.getFloatValue("angle");
|
||||||
|
//执行运单信息
|
||||||
|
com.alibaba.fastjson.JSONObject current_order = jo.getJSONObject("current_order");
|
||||||
|
int task_status=rbk_report.getInteger("task_status");
|
||||||
|
String state=null;
|
||||||
|
if(task_status==0){
|
||||||
|
state="NONE";
|
||||||
|
}if(task_status==1){
|
||||||
|
state="WAITING";
|
||||||
|
}if(task_status==2){
|
||||||
|
state="RUNNING";
|
||||||
|
}if(task_status==3){
|
||||||
|
state="SUSPENDED";
|
||||||
|
}if(task_status==4){
|
||||||
|
state="COMPLETED";
|
||||||
|
}if(task_status==5){
|
||||||
|
state="FAILED";
|
||||||
|
}if(task_status==6){
|
||||||
|
state="CANCELED";
|
||||||
|
}
|
||||||
|
Integer connectionStatus = jo.getInteger("connection_status");
|
||||||
|
String inst_code = current_order.getString("id");
|
||||||
|
String taskNo= "0";
|
||||||
|
if (StrUtil.isNotEmpty(inst_code)) {
|
||||||
|
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||||
|
if (ObjectUtil.isNotEmpty(inst)) {
|
||||||
|
//任务号
|
||||||
|
taskNo = inst.getTask_code();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//x坐标
|
||||||
|
float x = rbk_report.getFloatValue("x");
|
||||||
|
//y坐标
|
||||||
|
float y = rbk_report.getFloatValue("y");
|
||||||
AgvDto dto = new AgvDto();
|
AgvDto dto = new AgvDto();
|
||||||
dto.setName(name);
|
dto.setName(agv_code);
|
||||||
dto.setEnergyLevel(energyLevel);
|
dto.setCurrent_map(current_map);
|
||||||
dto.setState(state);
|
dto.setCharging(charging);
|
||||||
dto.setTransportOrder(transportOrder);
|
dto.setBattery_level(battery_level);
|
||||||
dto.setVehicle(vehicle);
|
dto.setTransportOrder(taskNo);
|
||||||
dto.setPositionAngle(angle);
|
|
||||||
dto.setPositionX(x);
|
dto.setPositionX(x);
|
||||||
dto.setPositionY(y);
|
dto.setPositionY(y);
|
||||||
if (AGVDeviceStatus.containsKey(name)) {
|
dto.setPositionAngle(angle);
|
||||||
AGVDeviceStatus.remove(name);
|
dto.setConnection_status(connectionStatus);
|
||||||
AGVDeviceStatus.put(name, dto);
|
dto.setState(state);
|
||||||
} else {
|
AGVDeviceStatus.put(agv_code, dto);
|
||||||
AGVDeviceStatus.put(name, dto);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -268,9 +282,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse queryXZAgvInstStatus() {
|
public HttpResponse queryXZAgvInstStatus() {
|
||||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||||
|
|
||||||
agvurl = agvurl + ":" + agvport + "/orders?page=1&size=9999";
|
agvurl = agvurl + ":" + agvport + "/orders?page=1&size=9999";
|
||||||
List<Instruction> insts = instructionService.findAllInstFromCache();
|
List<Instruction> insts = instructionService.findAllInstFromCache();
|
||||||
@@ -307,9 +321,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||||
|
|
||||||
agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + instCode + "/withdrawal";
|
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
|
||||||
|
param.put("id", instCode);
|
||||||
|
param.put("disableVehicle", false);
|
||||||
|
agvurl = agvurl + ":" + agvport + "/terminate";
|
||||||
log.info("删除agv指令请求agvurl:{}", agvurl);
|
log.info("删除agv指令请求agvurl:{}", agvurl);
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
|
.body(param.toJSONString())
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
.execute();
|
.execute();
|
||||||
log.info("删除agv指令请求反馈:{}", result);
|
log.info("删除agv指令请求反馈:{}", result);
|
||||||
@@ -322,18 +340,19 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception {
|
public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception {
|
||||||
|
|
||||||
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
|
||||||
jo.put("id", inst.getInstruction_code());
|
jo.put("id", inst.getInstruction_code());
|
||||||
jo.put("complete", true);
|
jo.put("complete", true);
|
||||||
jo.put("blocks", createBlocksData(inst));
|
jo.put("blocks", createBlocksData(inst));
|
||||||
jo.put("priority", inst.getPriority());
|
jo.put("priority", inst.getPriority());
|
||||||
log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo.toString());
|
log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo.toString());
|
||||||
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV), "1")) {
|
log.info("准备下发");
|
||||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||||
agvurl = agvurl + ":" + agvport + "/setOrder";
|
agvurl = agvurl + ":" + agvport + "/setOrder";
|
||||||
|
log.info("下发地址为{}",agvurl);
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
.body(String.valueOf(jo))//表单内容
|
.body(String.valueOf(jo))//表单内容
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
@@ -347,6 +366,11 @@ 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();
|
||||||
|
jo9.put("blockId", IdUtil.simpleUUID());
|
||||||
|
jo9.put("location", inst.getStart_point_code() + "INGET");
|
||||||
|
jo9.put("binTask", "ForkLoad");
|
||||||
|
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"))) {
|
||||||
//取货前等待
|
//取货前等待
|
||||||
@@ -355,7 +379,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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/interact.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();
|
||||||
@@ -368,11 +392,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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());
|
||||||
jo1.put("operation", "JackLoad");
|
jo1.put("binTask", "ForkLoad");
|
||||||
ja.add(jo1);
|
ja.add(jo1);
|
||||||
|
|
||||||
//取货完成等待
|
//取货完成等待
|
||||||
@@ -381,7 +404,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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/interact.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();
|
||||||
@@ -393,7 +416,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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();
|
||||||
|
jo6.put("blockId", IdUtil.simpleUUID());
|
||||||
|
jo6.put("location", inst.getStart_point_code() + "OUTGET");
|
||||||
|
jo6.put("binTask", "ForkUnload");
|
||||||
|
ja.add(jo6);
|
||||||
|
com.alibaba.fastjson.JSONObject jo7 = new com.alibaba.fastjson.JSONObject();
|
||||||
|
jo7.put("blockId", IdUtil.simpleUUID());
|
||||||
|
jo7.put("location", inst.getNext_point_code() + "INPUT");
|
||||||
|
jo7.put("binTask", "ForkLoad");
|
||||||
|
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"))) {
|
||||||
//放货前等待
|
//放货前等待
|
||||||
@@ -402,7 +434,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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/interact.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();
|
||||||
@@ -415,26 +447,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
jo3.put("script_args", script_args3);
|
jo3.put("script_args", script_args3);
|
||||||
ja.add(jo3);
|
ja.add(jo3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// //放货前下发旋转角度
|
|
||||||
// com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject();
|
|
||||||
// AcsPointAngleDto acsPointAngleDto = acsPointAngleService.findByCode(inst.getStart_device_code(),inst.getNext_device_code());
|
|
||||||
// if (ObjectUtil.isNotEmpty(acsPointAngleDto)){
|
|
||||||
// log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString());
|
|
||||||
// com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject();
|
|
||||||
// BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle();
|
|
||||||
// operation_args.put("increase_spin_angle",next_point_angle);//弧度值,如3.14
|
|
||||||
// operation_args.put("skill_name","GoByOdometer");
|
|
||||||
// json1.put("blockId", IdUtil.simpleUUID());
|
|
||||||
// json1.put("location", inst.getNext_point_code() + "INPUT");
|
|
||||||
// json1.put("operation_args",operation_args);
|
|
||||||
// ja.add(json1);
|
|
||||||
// }
|
|
||||||
|
|
||||||
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("operation", "JackUnload");
|
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"))) {
|
||||||
@@ -444,7 +460,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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/interact.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();
|
||||||
@@ -457,6 +473,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
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();
|
||||||
|
jo8.put("blockId", IdUtil.simpleUUID());
|
||||||
|
jo8.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||||
|
jo8.put("binTask", "ForkUnload");
|
||||||
|
ja.add(jo8);
|
||||||
return ja;
|
return ja;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,21 +21,20 @@ import java.util.Map;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "wms接口")
|
@Api(tags = "wms接口")
|
||||||
@RequestMapping("/restful/api/v3/system_car")
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Lazy
|
@Lazy
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public class AcsToWmsZDController {
|
public class AcsToWmsZDController {
|
||||||
private final AcsToWmsZDService acsToWmsZDService;
|
private final AcsToWmsZDService acsToWmsZDService;
|
||||||
|
|
||||||
@PostMapping("/feedbackTask")
|
@PostMapping("/wcs/restful/api/v3/system_ca/feedbackTask")
|
||||||
@Log("任务反馈")
|
@Log("任务反馈")
|
||||||
@ApiOperation("任务反馈")
|
@ApiOperation("任务反馈")
|
||||||
public ResponseEntity<Object> taskFeedback(@RequestBody JSONObject whereJson) throws Exception {
|
public ResponseEntity<Object> taskFeedback(@RequestBody JSONObject whereJson) throws Exception {
|
||||||
return new ResponseEntity<>(acsToWmsZDService.taskFeedback(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(acsToWmsZDService.taskFeedback(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/deprecateTask")
|
@PostMapping("/restful/api/v3/system_car/deprecateTask")
|
||||||
@Log("任务取消")
|
@Log("任务取消")
|
||||||
@ApiOperation("任务取消")
|
@ApiOperation("任务取消")
|
||||||
public ResponseEntity<Object> taskDeprecate(@RequestBody JSONObject whereJson) throws Exception {
|
public ResponseEntity<Object> taskDeprecate(@RequestBody JSONObject whereJson) throws Exception {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "wms接口")
|
@Api(tags = "wms接口")
|
||||||
@RequestMapping("/restful/API/V3")
|
@RequestMapping("/restful/api/v3")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Lazy
|
@Lazy
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class WmsZDToAcsServiceImpl implements WmsZDToAcsService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
map.put("responseCode", 1);
|
map.put("responseCode", 1);
|
||||||
map.put("responseMessage", e.getMessage());
|
map.put("responseMessage", e.getMessage());
|
||||||
|
log.info("报错信息为{}",map);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
map.put("responseCode", 0);
|
map.put("responseCode", 0);
|
||||||
|
|||||||
@@ -357,6 +357,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
log.info("仙工订单准备下发");
|
||||||
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();
|
||||||
@@ -392,7 +393,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
ndcAgvService.sendAgvInstToNDC("1", dto);
|
ndcAgvService.sendAgvInstToNDC("1", dto);
|
||||||
dto.setSend_status("1");
|
dto.setSend_status("1");
|
||||||
|
|
||||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).toString(), String.valueOf(AgvSystemEnum.XianGong.getIndex()))) {
|
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(), String.valueOf(AgvSystemEnum.XianGong.getIndex()))) {
|
||||||
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
|
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
|
||||||
//追加订单
|
//追加订单
|
||||||
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
HttpResponse result = xianGongAgvService.sendOrderSequencesToXZ(dto);
|
||||||
@@ -945,37 +946,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject requestjo = new com.alibaba.fastjson.JSONObject();
|
||||||
requestjo.put("task_code", entity.getInstruction_code());
|
requestjo.put("task_code", entity.getInstruction_code());
|
||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
|
||||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
|
||||||
String taskcode=entity.getInstruction_code();
|
|
||||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + taskcode + "/withdrawal";
|
|
||||||
HttpResponse result = HttpRequest.post(agvurl)
|
|
||||||
.body(String.valueOf(requestjo))
|
|
||||||
.timeout(20000)//超时,毫秒
|
|
||||||
.execute();
|
|
||||||
log.info("请求地址agvurl{},请求结果{}",agvurl,result.body());
|
|
||||||
if (StrUtil.equals(entity.getInstruction_type(), "7")) {
|
|
||||||
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
|
|
||||||
cancelTaskRequest.setOrderId(entity.getInstruction_code());
|
|
||||||
cancelTaskRequest.setPalletCode(entity.getVehicle_code());
|
|
||||||
cancelTaskRequest.setSrcLocation(entity.getStart_point_code());
|
|
||||||
cancelTaskRequest.setDestLocation(entity.getNext_point_code());
|
|
||||||
// 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库
|
|
||||||
int type = 0;
|
|
||||||
if (StrUtil.equals(task.getStorage_task_type(), "1")) {
|
|
||||||
type = 1;
|
|
||||||
} else if (StrUtil.equals(task.getStorage_task_type(), "2")) {
|
|
||||||
type = 4;
|
|
||||||
} else if (StrUtil.equals(task.getStorage_task_type(), "3")) {
|
|
||||||
type = 2;
|
|
||||||
} else if (StrUtil.equals(task.getStorage_task_type(), "4")) {
|
|
||||||
type = 5;
|
|
||||||
} else if (StrUtil.equals(task.getStorage_task_type(), "5")) {
|
|
||||||
type = 3;
|
|
||||||
}
|
|
||||||
cancelTaskRequest.setTaskType(type);
|
|
||||||
acsToLiKuService.cancelTask(cancelTaskRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public class RouteLineServiceImpl implements RouteLineService, ApplicationAutoIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -851,30 +851,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
|
||||||
// synchronized (TaskServiceImpl.class){
|
|
||||||
// Iterator<TaskDto> it = tasks.iterator();
|
|
||||||
// // 清理缓存
|
|
||||||
// while (it.hasNext()) {
|
|
||||||
// TaskDto taskDto = it.next();
|
|
||||||
// if (taskDto.getTask_id().equals(id)) {
|
|
||||||
// tasks.remove(taskDto);
|
|
||||||
// }
|
|
||||||
// }}
|
|
||||||
|
|
||||||
removeByCodeFromCache(entity.getTask_code());
|
removeByCodeFromCache(entity.getTask_code());
|
||||||
|
|
||||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||||
String Type1=entity.getTask_type();
|
String Type1=entity.getTask_type();
|
||||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||||
|
log.info("取消中鼎任务");
|
||||||
JSONObject feed_jo = new JSONObject();
|
JSONObject feed_jo = new JSONObject();
|
||||||
|
Instruction instCode=instructionservice.findByTaskcode(entity.getTask_code());
|
||||||
feed_jo.put("taskCode", entity.getTask_code());
|
feed_jo.put("taskCode", entity.getTask_code());
|
||||||
// JSONArray ja = new JSONArray();
|
feed_jo.put("carId", instCode.getCarno());
|
||||||
// ja.add(feed_jo);
|
feed_jo.put("taskType ", entity.getTask_type());
|
||||||
// acstowmsService.feedbackTaskStatusToWms(ja);
|
feed_jo.put("feedbackStatus", "deprecate");
|
||||||
HttpResponse result=acsToWmsZDService.taskDeprecate(feed_jo);
|
HttpResponse result=acsToWmsZDService.taskFeedback(feed_jo);
|
||||||
JSONObject response=JSONObject.parseObject(result.body());
|
JSONObject response=JSONObject.parseObject(result.body());
|
||||||
|
log.info("任务取消 返回参数{}",response);
|
||||||
int responseCode= response.getInteger("responseCode");
|
int responseCode= response.getInteger("responseCode");
|
||||||
if(responseCode == 0) {
|
if(responseCode == 0) {
|
||||||
log.info("请求ZDwcs成功,任务取消 请求结果{}",responseCode);
|
log.info("请求ZDwcs成功,任务取消 请求结果{}",responseCode);
|
||||||
@@ -887,11 +878,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
entity.getRoute_plan_code());
|
entity.getRoute_plan_code());
|
||||||
String type = shortPathsList.get(0).getType();
|
String type = shortPathsList.get(0).getType();
|
||||||
// != 0 为agv任务
|
// != 0 为agv任务
|
||||||
if (!StrUtil.equals(type, "0")) {
|
// if (!StrUtil.equals(type, "0")) {
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||||
agvService.markComplete(entity.getTask_code());
|
// agvService.markComplete(entity.getTask_code());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</logger>-->
|
</logger>-->
|
||||||
|
|
||||||
<!-- 打印sql -->
|
<!-- 打印sql -->
|
||||||
<logger name="org.nl.acs.agv.server.impl.ZheDaAgvServiceImpl" level="info" additivity="false">
|
<logger name="org.nl.acs.agv.server.impl.XianGongAgvServiceImpl" level="info" additivity="false">
|
||||||
<appender-ref ref="FILE13"/>
|
<appender-ref ref="FILE13"/>
|
||||||
</logger>
|
</logger>
|
||||||
</included>
|
</included>
|
||||||
@@ -27,7 +27,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||||
<include resource="log/Lucene.xml"/>
|
<include resource="log/Lucene.xml"/>
|
||||||
<include resource="log/OpcUtil.xml"/>
|
<include resource="log/OpcUtil.xml"/>
|
||||||
<include resource="log/ZheDaAgv.xml"/>
|
<include resource="log/XianGongAgvServiceImpl.xml"/>
|
||||||
<include resource="log/AcsToZDWms.xml"/>
|
<include resource="log/AcsToZDWms.xml"/>
|
||||||
<include resource="log/ZDToAcsWms.xml"/>
|
<include resource="log/ZDToAcsWms.xml"/>
|
||||||
<include resource="log/QueryZDAgvTaskStatus.xml"/>
|
<include resource="log/QueryZDAgvTaskStatus.xml"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user