add:新增查询设备状态接口,点位角度管理
This commit is contained in:
@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -22,7 +23,9 @@ import java.util.Enumeration;
|
||||
@RequestMapping("/api")
|
||||
@Slf4j
|
||||
public class AgvController {
|
||||
private final AgvService agvService;
|
||||
@Autowired
|
||||
AgvService agvService;
|
||||
@Autowired
|
||||
private final DeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,11 @@ import org.springframework.stereotype.Service;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AgvWaitUtil {
|
||||
private final AcsToWmsService acsToWmsService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService;
|
||||
|
||||
@Autowired
|
||||
LogServer logServer;
|
||||
|
||||
|
||||
@@ -57,17 +57,17 @@ public class AgvDto implements Serializable {
|
||||
/**
|
||||
* 角度
|
||||
*/
|
||||
private String positionAngle;
|
||||
private float positionAngle;
|
||||
|
||||
/**
|
||||
* X坐标
|
||||
*/
|
||||
private String positionX;
|
||||
private float positionX;
|
||||
|
||||
/**
|
||||
* Y坐标
|
||||
*/
|
||||
private String positionY;
|
||||
private float positionY;
|
||||
|
||||
/**
|
||||
* 当前任务号
|
||||
@@ -79,6 +79,11 @@ public class AgvDto implements Serializable {
|
||||
*/
|
||||
private String battery_temp;
|
||||
|
||||
/**
|
||||
* 电池电量
|
||||
*/
|
||||
private float battery_level;
|
||||
|
||||
/**
|
||||
* 是否阻挡
|
||||
*/
|
||||
@@ -92,7 +97,12 @@ public class AgvDto implements Serializable {
|
||||
/**
|
||||
* 是否充电
|
||||
*/
|
||||
private String charging;
|
||||
private Boolean charging;
|
||||
|
||||
/**
|
||||
* 机器人连接状态,0表示断连,1表示连接上
|
||||
*/
|
||||
private Integer connection_status;
|
||||
|
||||
/**
|
||||
* 控制器温度
|
||||
|
||||
@@ -12,6 +12,8 @@ import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.AgvWaitUtil;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.angle.service.AcsPointAngleService;
|
||||
import org.nl.acs.angle.service.dto.AcsPointAngleDto;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
@@ -47,10 +49,14 @@ import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -62,10 +68,13 @@ import java.util.stream.Stream;
|
||||
@RequiredArgsConstructor
|
||||
public class AgvServiceImpl implements AgvService {
|
||||
|
||||
|
||||
protected BusinessLogger execute_log;
|
||||
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
@Autowired
|
||||
@@ -78,6 +87,8 @@ public class AgvServiceImpl implements AgvService {
|
||||
AcsToWmsService acsToWmsService;
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
@Autowired
|
||||
private static AcsPointAngleService acsPointAngleService;
|
||||
|
||||
private final LogServer logServer;
|
||||
|
||||
@@ -220,7 +231,7 @@ public class AgvServiceImpl implements AgvService {
|
||||
* demo:destination("cz14", "JackUnload", "3", "")
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject destination2(String locationName, String operation, String propertiesType, String pro) {
|
||||
public static JSONObject destination2(String locationName, String operation, String propertiesType, String pro,Instruction dto) {
|
||||
//新增业务订单
|
||||
JSONObject destinationOrder = new JSONObject();
|
||||
//目标工作站
|
||||
@@ -235,10 +246,16 @@ public class AgvServiceImpl implements AgvService {
|
||||
properties.add(pro2);
|
||||
destinationOrder.put("properties", properties);
|
||||
} else if (propertiesType.equals("2")) {//Spin转动
|
||||
AcsPointAngleDto acsPointAngleDto = new AcsPointAngleDto();
|
||||
acsPointAngleDto = getAcsPointAngleDto(dto);
|
||||
if (ObjectUtil.isEmpty(acsPointAngleDto)){
|
||||
throw new RuntimeException("沒有找到内容,无法下发");
|
||||
}
|
||||
BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle();
|
||||
JSONArray properties = new JSONArray();
|
||||
JSONObject pro1 = new JSONObject();
|
||||
pro1.put("key", "global_spin_angle");//坐标系类型,global_spin_angle为全局坐标系
|
||||
pro1.put("value", pro);//弧度值,如3.14
|
||||
pro1.put("value", next_point_angle);//弧度值,如3.14
|
||||
properties.add(pro1);
|
||||
JSONObject pro2 = new JSONObject();
|
||||
pro2.put("key", "spin_direction");//固定值
|
||||
@@ -272,6 +289,21 @@ public class AgvServiceImpl implements AgvService {
|
||||
return destinationOrder;
|
||||
}
|
||||
|
||||
private static AcsPointAngleDto getAcsPointAngleDto(Instruction dto) {
|
||||
List<AcsPointAngleDto> list = acsPointAngleService.queryAll(new HashMap());
|
||||
AcsPointAngleDto acsPointAngleDto = new AcsPointAngleDto();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
acsPointAngleDto = list.get(i);
|
||||
String start_device_code = acsPointAngleDto.getStart_device_code();
|
||||
String next_device_code = acsPointAngleDto.getNext_device_code();
|
||||
String is_active = acsPointAngleDto.getIs_active();
|
||||
if (!(dto.getStart_device_code().equals(start_device_code) && dto.getNext_device_code().equals(next_device_code) && is_active == "1")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return acsPointAngleDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse sendAgvInstToMagic(Instruction inst) throws Exception {
|
||||
JSONArray ja = new JSONArray();
|
||||
@@ -539,14 +571,16 @@ public class AgvServiceImpl implements AgvService {
|
||||
String positionAngle = jo.getString("positionAngle");
|
||||
String positionX = jo.getString("positionX");
|
||||
String positionY = jo.getString("positionY");
|
||||
String current_map = jo.getString("current_map");
|
||||
AgvDto dto = new AgvDto();
|
||||
dto.setName(name);
|
||||
dto.setEnergyLevel(energyLevel);
|
||||
dto.setState(state);
|
||||
dto.setPositionAngle(positionAngle);
|
||||
dto.setPositionX(positionX);
|
||||
dto.setPositionY(positionY);
|
||||
// dto.setPositionAngle(positionAngle);
|
||||
// dto.setPositionX(positionX);
|
||||
// dto.setPositionY(positionY);
|
||||
dto.setTransportOrder(transportOrder);
|
||||
dto.setCurrent_map(current_map);
|
||||
|
||||
if (AGVDeviceStatus.containsKey(name)) {
|
||||
AGVDeviceStatus.remove(name);
|
||||
@@ -599,52 +633,61 @@ public class AgvServiceImpl implements AgvService {
|
||||
@Override
|
||||
public HttpResponse queryXZAgvDeviceStatus() {
|
||||
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.FORKAGV).getValue().toString(), "1")) {
|
||||
String agvurl = acsConfigService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = acsConfigService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/robotsStatus";
|
||||
|
||||
String agvurl1 = agvurl + ":" + agvport + "/api/route/vehicles";
|
||||
String agvurl2 = agvurl + ":" + agvport + "/api/route/vehicleDetails";
|
||||
|
||||
HttpResponse result = HttpRequest.get(agvurl1)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
|
||||
|
||||
HttpResponse result2 = HttpRequest.get(agvurl2)
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
|
||||
System.out.println("查询agv状态数据:" + result.body());
|
||||
if (result.getStatus() == 200) {
|
||||
com.alibaba.fastjson.JSONArray ja = (com.alibaba.fastjson.JSONArray) com.alibaba.fastjson.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++) {
|
||||
com.alibaba.fastjson.JSONObject jo = (com.alibaba.fastjson.JSONObject) ja.get(i);
|
||||
String name = jo.getString("name");
|
||||
String state = jo.getString("state");
|
||||
String energyLevel = jo.getString("energyLevel");
|
||||
String transportOrder = jo.getString("transportOrder");
|
||||
com.alibaba.fastjson.JSONObject detailjo = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(result2.body());
|
||||
com.alibaba.fastjson.JSONObject item = (com.alibaba.fastjson.JSONObject) detailjo.get(name);
|
||||
String x = item.getString("x");
|
||||
String y = item.getString("y");
|
||||
String angle = item.getString("angle");
|
||||
com.alibaba.fastjson.JSONObject jo = ja.getJSONObject(i);
|
||||
//机器人编码
|
||||
String agv_code = jo.getString("uuid");
|
||||
//机器人详细状态信息
|
||||
com.alibaba.fastjson.JSONObject rbk_report = jo.getJSONObject("rbk_report");
|
||||
//是否正在充电
|
||||
Boolean charging = rbk_report.getBoolean("charging");
|
||||
//电池电量
|
||||
float battery_level = rbk_report.getFloatValue("battery_level");
|
||||
//当前地图
|
||||
String current_map = rbk_report.getString("current_map");
|
||||
//角度
|
||||
float angle = rbk_report.getFloatValue("angle");
|
||||
//执行运单信息
|
||||
com.alibaba.fastjson.JSONObject current_order = jo.getJSONObject("current_order");
|
||||
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();
|
||||
dto.setName(name);
|
||||
dto.setEnergyLevel(energyLevel);
|
||||
dto.setState(state);
|
||||
dto.setTransportOrder(transportOrder);
|
||||
dto.setPositionAngle(angle);
|
||||
dto.setName(agv_code);
|
||||
dto.setCurrent_map(current_map);
|
||||
dto.setCharging(charging);
|
||||
dto.setBattery_level(battery_level);
|
||||
dto.setTransportOrder(taskNo);
|
||||
dto.setPositionX(x);
|
||||
dto.setPositionY(y);
|
||||
if (AGVDeviceStatus.containsKey(name)) {
|
||||
AGVDeviceStatus.remove(name);
|
||||
AGVDeviceStatus.put(name, dto);
|
||||
} else {
|
||||
AGVDeviceStatus.put(name, dto);
|
||||
}
|
||||
dto.setPositionAngle(angle);
|
||||
dto.setConnection_status(connectionStatus);
|
||||
AGVDeviceStatus.put(agv_code, dto);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -1773,18 +1816,18 @@ public class AgvServiceImpl implements AgvService {
|
||||
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
||||
ja.add(destination2(device_code + "IN", "Wait", "1", device_code + "IN"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(device_code, "Wait", "1", device_code
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(device_code + "OUT", "Wait", "1", device_code + "OUT"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
|
||||
} else {
|
||||
ja.add(destination2(device_code, "Wait", "1", device_code + "-" + inst_code + "-" + "01"));
|
||||
ja.add(destination2(device_code, "Wait", "1", device_code + "-" + inst_code + "-" + "01",inst));
|
||||
}
|
||||
}
|
||||
|
||||
ja.add(destination2(inst.getNext_point_code(), "Wait", "1", inst.getNext_point_code() + "-" + inst_code + "-" + "01"));
|
||||
ja.add(destination2(inst.getNext_point_code(), "Wait", "1", inst.getNext_point_code() + "-" + inst_code + "-" + "01",inst));
|
||||
|
||||
} else {
|
||||
String startAddress = inst.getStart_device_code();
|
||||
@@ -1795,25 +1838,25 @@ public class AgvServiceImpl implements AgvService {
|
||||
MachinesSiteDeviceDriver machinesSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
|
||||
ja.add(destination2(startAddress, "Wait", "5", startAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
} else {
|
||||
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
}
|
||||
|
||||
} else {
|
||||
ja.add(destination2(startAddress, "Wait", "1", startAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1830,33 +1873,33 @@ public class AgvServiceImpl implements AgvService {
|
||||
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"), "true") &&
|
||||
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin"))) {
|
||||
ja.add(destination2(startAddress + "IQ", "Spin", "2",
|
||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin").toString()));
|
||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin").toString(),inst));
|
||||
}
|
||||
ja.add(destination2(startAddress + "IQ", "Wait", "1", startAddress + "IQ"
|
||||
+ "-" + inst_code + "-" + "07"));
|
||||
+ "-" + inst_code + "-" + "07",inst));
|
||||
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||
+ "-" + inst_code + "-" + "02"));
|
||||
+ "-" + inst_code + "-" + "02",inst));
|
||||
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
||||
+ "-" + inst_code + "-" + "05"));
|
||||
+ "-" + inst_code + "-" + "05",inst));
|
||||
ja.add(destination2(startAddress + "OQ", "Wait", "1", startAddress + "OQ"
|
||||
+ "-" + inst_code + "-" + "08"));
|
||||
+ "-" + inst_code + "-" + "08",inst));
|
||||
|
||||
} else if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
|
||||
ja.add(destination2(startAddress + "IN", "Wait", "1", startAddress + "IN"
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||
+ "-" + inst_code + "-" + "02"));
|
||||
+ "-" + inst_code + "-" + "02",inst));
|
||||
ja.add(destination2(startAddress + "OUT", "Wait", "1", startAddress + "OUT"
|
||||
+ "-" + inst_code + "-" + "05"));
|
||||
+ "-" + inst_code + "-" + "05",inst));
|
||||
|
||||
} else {
|
||||
ja.add(destination2(nextAddress, "Wait", "1", startAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(startAddress, "JackLoad", "3", startAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
}
|
||||
|
||||
//终点
|
||||
@@ -1865,31 +1908,31 @@ public class AgvServiceImpl implements AgvService {
|
||||
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_release_spin"), "true") &&
|
||||
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin"))) {
|
||||
ja.add(destination2(nextAddress + "IQ", "Spin", "2",
|
||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin").toString()));
|
||||
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin").toString(),inst));
|
||||
}
|
||||
ja.add(destination2(nextAddress + "IQ", "Wait", "1", nextAddress + "IQ"
|
||||
+ "-" + inst_code + "-" + "07"));
|
||||
+ "-" + inst_code + "-" + "07",inst));
|
||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||
+ "-" + inst_code + "-" + "03"));
|
||||
+ "-" + inst_code + "-" + "03",inst));
|
||||
|
||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||
+ "-" + inst_code + "-" + "04"));
|
||||
+ "-" + inst_code + "-" + "04",inst));
|
||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||
+ "-" + inst_code + "-" + "06"));
|
||||
+ "-" + inst_code + "-" + "06",inst));
|
||||
ja.add(destination2(nextAddress + "OQ", "Wait", "1", nextAddress + "OQ"
|
||||
+ "-" + inst_code + "-" + "08"));
|
||||
+ "-" + inst_code + "-" + "08",inst));
|
||||
} else if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
ja.add(destination2(nextAddress + "IN", "Wait", "1", nextAddress + "IN"
|
||||
+ "-" + inst_code + "-" + "03"));
|
||||
+ "-" + inst_code + "-" + "03",inst));
|
||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||
+ "-" + inst_code + "-" + "04"));
|
||||
+ "-" + inst_code + "-" + "04",inst));
|
||||
ja.add(destination2(nextAddress + "OUT", "Wait", "1", nextAddress + "OUT"
|
||||
+ "-" + inst_code + "-" + "06"));
|
||||
+ "-" + inst_code + "-" + "06",inst));
|
||||
} else {
|
||||
ja.add(destination2(nextAddress, "Wait", "1", nextAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
ja.add(destination2(nextAddress, "JackUnload", "3", nextAddress
|
||||
+ "-" + inst_code + "-" + "01"));
|
||||
+ "-" + inst_code + "-" + "01",inst));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package org.nl.acs.angle.rest;
|
||||
|
||||
|
||||
import org.nl.acs.angle.service.dto.AcsPointAngleDto;
|
||||
import org.nl.acs.angle.service.AcsPointAngleService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author tuq
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "点位角度管理")
|
||||
@RequestMapping("/api/acsPointAngle")
|
||||
@Slf4j
|
||||
public class AcsPointAngleController {
|
||||
|
||||
private final AcsPointAngleService acsPointAngleService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询点位角度")
|
||||
@ApiOperation("查询点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:list')")
|
||||
public ResponseEntity
|
||||
<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(acsPointAngleService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增点位角度")
|
||||
@ApiOperation("新增点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:add')")
|
||||
public ResponseEntity
|
||||
<Object> create(@Validated @RequestBody AcsPointAngleDto dto) {
|
||||
acsPointAngleService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改点位角度")
|
||||
@ApiOperation("修改点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:edit')")
|
||||
public ResponseEntity
|
||||
<Object> update(@Validated @RequestBody AcsPointAngleDto dto) {
|
||||
acsPointAngleService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除点位角度")
|
||||
@ApiOperation("删除点位角度")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
acsPointAngleService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出点位角度")
|
||||
@ApiOperation("导出点位角度")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('acsPointAngle:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
acsPointAngleService.download(acsPointAngleService.queryAll(whereJson), response);
|
||||
}
|
||||
@GetMapping("/updateActive")
|
||||
@Log("是否启用")
|
||||
@ApiOperation("是否启用")
|
||||
public ResponseEntity<Object> updateOn(@RequestParam String id, @RequestParam String is_active) {
|
||||
acsPointAngleService.updateOn(id, is_active);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.acs.angle.service;
|
||||
|
||||
import org.nl.acs.angle.service.dto.AcsPointAngleDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author tuq
|
||||
* @description 服务接口
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
public interface AcsPointAngleService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map
|
||||
* <String,Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List
|
||||
* <AcsPointAngleDto>
|
||||
*/
|
||||
List<AcsPointAngleDto> queryAll(Map whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return AcsPointAngle
|
||||
*/
|
||||
AcsPointAngleDto findById(String id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return AcsPointAngle
|
||||
*/
|
||||
AcsPointAngleDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(AcsPointAngleDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(AcsPointAngleDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<AcsPointAngleDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
void updateOn(String id, String is_active);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.angle.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author tuq
|
||||
* @description /
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Data
|
||||
public class AcsPointAngleDto implements Serializable {
|
||||
|
||||
/**
|
||||
* id标识
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 起始设备编码
|
||||
*/
|
||||
private String start_device_code;
|
||||
|
||||
/**
|
||||
* 目标设备编码
|
||||
*/
|
||||
private String next_device_code;
|
||||
|
||||
|
||||
/**
|
||||
* 目标点位角度
|
||||
*/
|
||||
private BigDecimal next_point_angle;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package org.nl.acs.angle.service.impl;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.angle.service.AcsPointAngleService;
|
||||
import org.nl.acs.angle.service.dto.AcsPointAngleDto;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author tuq
|
||||
* @description 服务实现
|
||||
* @date 2023-12-11
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsPointAngleServiceImpl implements AcsPointAngleService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AcsPointAngleDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<AcsPointAngleDto> list = JSONArray.toList(arr, AcsPointAngleDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AcsPointAngleDto findById(String id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONObject json = wo.query("id ='" + id + "'").uniqueResult(0);
|
||||
final AcsPointAngleDto obj = (AcsPointAngleDto) JSONObject.toBean(json, AcsPointAngleDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsPointAngleDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final AcsPointAngleDto obj = (AcsPointAngleDto) JSONObject.toBean(json, AcsPointAngleDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(AcsPointAngleDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONObject json = JSONObject.fromObject(dto);
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(AcsPointAngleDto dto) {
|
||||
AcsPointAngleDto entity = this.findById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONObject json = JSONObject.fromObject(dto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
for (String id : ids) {
|
||||
wo.delete("id = '" + id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<AcsPointAngleDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (AcsPointAngleDto acsPointAngle : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("起始设备编码", acsPointAngle.getStart_device_code());
|
||||
map.put("目标设备编码", acsPointAngle.getNext_device_code());
|
||||
map.put("目标点位角度", acsPointAngle.getNext_point_angle());
|
||||
map.put("是否启用", acsPointAngle.getIs_active());
|
||||
map.put("创建者", acsPointAngle.getCreate_by());
|
||||
map.put("创建时间", acsPointAngle.getCreate_time());
|
||||
map.put("修改者", acsPointAngle.getUpdate_by());
|
||||
map.put("修改时间", acsPointAngle.getUpdate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOn(String id, String is_active) {
|
||||
AcsPointAngleDto entity = this.findById(id);
|
||||
entity.setIs_active(is_active);
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setUpdate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_point_angle");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
}
|
||||
}
|
||||
@@ -66,13 +66,26 @@ import java.util.*;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial {
|
||||
private final DeviceExtraService deviceExtraService;
|
||||
private final OpcService opcService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final OpcPlcService opcPlcService;
|
||||
private final DeviceDriverDefinationAppService deviceDriverDefinationAppService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final AcsConfigService acsConfigService;
|
||||
@Autowired
|
||||
DeviceExtraService deviceExtraService;
|
||||
|
||||
@Autowired
|
||||
OpcService opcService;
|
||||
|
||||
@Autowired
|
||||
RedisUtils redisUtils;
|
||||
|
||||
@Autowired
|
||||
OpcPlcService opcPlcService;
|
||||
|
||||
@Autowired
|
||||
DeviceDriverDefinationAppService deviceDriverDefinationAppService;
|
||||
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
|
||||
@Autowired
|
||||
AcsConfigService acsConfigService;
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -10,6 +10,7 @@ import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -29,7 +30,9 @@ import java.util.Map;
|
||||
@RequestMapping("/api/wms")
|
||||
@Slf4j
|
||||
public class AcsToWmsController {
|
||||
private final AcsToWmsService acstowmsService;
|
||||
|
||||
@Autowired
|
||||
AcsToWmsService acstowmsService;
|
||||
|
||||
@PostMapping("/applyTask")
|
||||
@Log("向WMS申请任务")
|
||||
|
||||
@@ -76,4 +76,11 @@ public class WmsToAcsController {
|
||||
public ResponseEntity<Object> gccCancelTask(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.gccCancelTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryAgvDeviceStatus")
|
||||
@Log("查询XZAGV设备状态")
|
||||
@ApiOperation("查询XZAGV设备状态")
|
||||
public ResponseEntity<Object> queryAgvDeviceStatus() {
|
||||
return new ResponseEntity<>(wmstoacsService.queryAgvDeviceStatus(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -54,4 +55,6 @@ public interface WmsToAcsService {
|
||||
Map<String, Object> queryDevice(String jsonObject) throws Exception;
|
||||
|
||||
Map<String, Object> gccCancelTask(String whereJson);
|
||||
|
||||
JSONArray queryAgvDeviceStatus();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
@@ -65,6 +67,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final RouteLineService RouteLineService;
|
||||
@Autowired
|
||||
LogServer logServer;
|
||||
@Autowired
|
||||
AgvService agvService;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> createFromWms(String param) {
|
||||
@@ -997,4 +1002,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
log.info("gccCancelTask 响应参数:{}", resultJson);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.alibaba.fastjson.JSONArray queryAgvDeviceStatus() {
|
||||
JSONObject json = new JSONObject();
|
||||
Map<String, AgvDto> agv_map = agvService.findAllAgvFromCache();
|
||||
if(ObjectUtil.isEmpty(agv_map)){
|
||||
System.out.println("AGV设备数据为空,无法反馈");
|
||||
return new com.alibaba.fastjson.JSONArray();
|
||||
}
|
||||
// JSONArray agv_rows = new JSONArray();
|
||||
com.alibaba.fastjson.JSONArray agv_rows = new com.alibaba.fastjson.JSONArray();
|
||||
JSONObject row = new JSONObject();
|
||||
|
||||
for (AgvDto agvDto : agv_map.values()) {
|
||||
row.put("device_code", agvDto.getName());
|
||||
row.put("battery_level", agvDto.getBattery_level());
|
||||
row.put("device_status",agvDto.getConnection_status());
|
||||
row.put("transportOrder", agvDto.getTransportOrder());
|
||||
row.put("positionX", agvDto.getPositionX());
|
||||
row.put("positionY", agvDto.getPositionY());
|
||||
row.put("positionAngle", agvDto.getPositionAngle());
|
||||
row.put("current_map", agvDto.getCurrent_map());
|
||||
agv_rows.add(row);
|
||||
}
|
||||
log.info("queryAgvDeviceStatus--------------:输出参数" + agv_rows.toString());
|
||||
return agv_rows;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package org.nl.acs.instruction.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -12,6 +13,8 @@ import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.angle.service.AcsPointAngleService;
|
||||
import org.nl.acs.angle.service.dto.AcsPointAngleDto;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
@@ -51,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -79,6 +83,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
TaskService taskService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void autoInitial() {
|
||||
this.reload();
|
||||
@@ -465,6 +470,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAgain(Instruction dto) throws Exception {
|
||||
@@ -669,7 +676,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
} else {
|
||||
jo1.put("hasGoodStatus", "2");
|
||||
}
|
||||
jo1.put("put_goods_time",DateUtil.now());
|
||||
jo1.put("put_goods_time", DateUtil.now());
|
||||
jo1.put("material_type", startdevice.getMaterial_type());
|
||||
jo1.put("quantity", startdevice.getQuantity());
|
||||
jo1.put("remark", startdevice.getRemark());
|
||||
@@ -871,7 +878,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
// != 0 为agv任务 1=magic 2=NDC 3=XZ
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")
|
||||
&& !StrUtil.equals(entity.getSend_status(),"2")) {
|
||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
agvService.deleteAgvInst(entity.getInstruction_code());
|
||||
flag = true;
|
||||
|
||||
@@ -883,7 +890,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
flag = true;
|
||||
}
|
||||
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")
|
||||
&& !StrUtil.equals(entity.getSend_status(),"2")) {
|
||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
agvService.deleteXZAgvInst(entity.getInstruction_code());
|
||||
flag = true;
|
||||
} else {
|
||||
@@ -1037,7 +1044,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
return null; }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByIdFromCache(String id) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
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 net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.device_driver.electric_fence.ElectricFenceDeviceDriver;
|
||||
import org.nl.acs.device_driver.feedback_agv_status_site.FeedbackAGVStatusSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
@@ -15,6 +18,9 @@ import org.nl.utils.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* 查询先工AGV设备状态
|
||||
*/
|
||||
@@ -28,9 +34,11 @@ public class QueryXZAgvDeviceStatus {
|
||||
@Autowired
|
||||
AgvService agvService;
|
||||
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
|
||||
|
||||
public void run() throws Exception {
|
||||
HttpResponse response = agvService.queryXZAgvDeviceStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class ToAgvDevice {
|
||||
row.put("positionX", agvDto.getPositionX());
|
||||
row.put("positionY", agvDto.getPositionY());
|
||||
row.put("positionAngle", agvDto.getPositionAngle());
|
||||
row.put("current_map", agvDto.getCurrent_map());
|
||||
agv_rows.add(row);
|
||||
}
|
||||
// json.put("agv_rows", agv_rows);
|
||||
|
||||
@@ -83,14 +83,17 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return NDCSocketConnectionAutoRun.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "NDC在线连接";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoRun() {
|
||||
|
||||
try {
|
||||
@@ -780,7 +783,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionX(String.valueOf(ikey));
|
||||
dto.setPositionX(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//Y坐标
|
||||
@@ -794,7 +797,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionY(String.valueOf(ikey));
|
||||
dto.setPositionY(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//角度
|
||||
@@ -808,7 +811,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionAngle(String.valueOf(ikey));
|
||||
dto.setPositionAngle(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//电量
|
||||
@@ -1407,7 +1410,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionX(String.valueOf(ikey));
|
||||
dto.setPositionX(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//Y坐标
|
||||
@@ -1420,7 +1423,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionY(String.valueOf(ikey));
|
||||
dto.setPositionY(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//角度
|
||||
@@ -1434,7 +1437,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionAngle(String.valueOf(ikey));
|
||||
dto.setPositionAngle(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
|
||||
}
|
||||
@@ -1826,7 +1829,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionX(String.valueOf(ikey));
|
||||
dto.setPositionX(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//Y坐标
|
||||
@@ -1839,7 +1842,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionY(String.valueOf(ikey));
|
||||
dto.setPositionY(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//角度
|
||||
@@ -1853,7 +1856,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionAngle(String.valueOf(ikey));
|
||||
dto.setPositionAngle(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
|
||||
}
|
||||
@@ -2946,7 +2949,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionX(String.valueOf(ikey));
|
||||
dto.setPositionX(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//Y坐标
|
||||
@@ -2959,7 +2962,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionY(String.valueOf(ikey));
|
||||
dto.setPositionY(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//角度
|
||||
@@ -2973,7 +2976,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionAngle(String.valueOf(ikey));
|
||||
dto.setPositionAngle(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
|
||||
}
|
||||
@@ -3596,7 +3599,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionX(String.valueOf(ikey));
|
||||
dto.setPositionX(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//Y坐标
|
||||
@@ -3610,7 +3613,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionY(String.valueOf(ikey));
|
||||
dto.setPositionY(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//角度
|
||||
@@ -3624,7 +3627,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dto = new AgvDto();
|
||||
}
|
||||
dto.setName(String.valueOf(carno));
|
||||
dto.setPositionAngle(String.valueOf(ikey));
|
||||
dto.setPositionAngle(Float.valueOf(ikey));
|
||||
AgvService.updateAgvFromCache(dto);
|
||||
}
|
||||
//电量
|
||||
|
||||
Reference in New Issue
Block a user