更新
This commit is contained in:
@@ -124,7 +124,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
HttpResponse result = HttpRequest.get(agvurl)
|
HttpResponse result = HttpRequest.get(agvurl)
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
.execute();
|
.execute();
|
||||||
|
log.info("queryXZAgvDeviceStatus----查询agv状态数据数据:{}" + result.body());
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -109,18 +109,18 @@ public class MaGangAgvDeviceDriver extends AbstractOpcDeviceDriver implements De
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writing(String param, String value) {
|
public void writing1(String param, String value) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + param;
|
+ "." + param;
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
Server server = ReadUtil.getServer(opcservcerid);
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
itemMap.put(to_command, value);
|
itemMap.put(to_command, Integer.parseInt(value));
|
||||||
ReadUtil.write(itemMap, server);
|
ReadUtil.write(itemMap, server);
|
||||||
log.info("设备号{},kep点位名称{},下发信号{}", this.getDevice().getDevice_code(), to_command, value);
|
log.info("设备号{},kep点位名称{},下发信号{}", this.getDevice().getDevice_code(), to_command, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writing(String param, float value) {
|
public void writing(String param, String value) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + param;
|
+ "." + param;
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public class QueryXZAgvDeviceStatus {
|
|||||||
JSONObject body = JSONObject.parseObject(response.body());
|
JSONObject body = JSONObject.parseObject(response.body());
|
||||||
JSONArray ja = body.getJSONArray("report");
|
JSONArray ja = body.getJSONArray("report");
|
||||||
for (int i = 0; i < ja.size(); i++) {
|
for (int i = 0; i < ja.size(); i++) {
|
||||||
|
System.out.println(ja.getJSONObject(1));
|
||||||
|
if (i == 1){
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
System.out.println("此刻i=" + i);
|
||||||
JSONObject jo = ja.getJSONObject(i);
|
JSONObject jo = ja.getJSONObject(i);
|
||||||
//机器人编码
|
//机器人编码
|
||||||
String agv_code = jo.getString("uuid");
|
String agv_code = jo.getString("uuid");
|
||||||
@@ -76,6 +81,7 @@ public class QueryXZAgvDeviceStatus {
|
|||||||
String status = "0";
|
String status = "0";
|
||||||
if (connectionStatus == 0) {
|
if (connectionStatus == 0) {
|
||||||
status = "5";
|
status = "5";
|
||||||
|
task_type = "0";
|
||||||
} else {
|
} else {
|
||||||
if (procBusiness) {
|
if (procBusiness) {
|
||||||
//工作中
|
//工作中
|
||||||
@@ -84,13 +90,16 @@ public class QueryXZAgvDeviceStatus {
|
|||||||
if (charging) {
|
if (charging) {
|
||||||
//充电中
|
//充电中
|
||||||
status = "2";
|
status = "2";
|
||||||
|
task_type = "0";
|
||||||
} else {
|
} else {
|
||||||
if (is_error) {
|
if (is_error) {
|
||||||
//故障
|
//故障
|
||||||
status = "3";
|
status = "3";
|
||||||
|
task_type = "0";
|
||||||
} else {
|
} else {
|
||||||
//休息中
|
//休息中
|
||||||
status = "4";
|
status = "4";
|
||||||
|
task_type = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,10 +111,10 @@ public class QueryXZAgvDeviceStatus {
|
|||||||
String kepStatus = String.valueOf(maGangAgvDeviceDriver.getStatus());
|
String kepStatus = String.valueOf(maGangAgvDeviceDriver.getStatus());
|
||||||
String kepType = String.valueOf(maGangAgvDeviceDriver.getType());
|
String kepType = String.valueOf(maGangAgvDeviceDriver.getType());
|
||||||
if (!StrUtil.equals(kepStatus, status)) {
|
if (!StrUtil.equals(kepStatus, status)) {
|
||||||
maGangAgvDeviceDriver.writing("status", Integer.parseInt(status));
|
maGangAgvDeviceDriver.writing1("status", status);
|
||||||
}
|
}
|
||||||
if (!StrUtil.equals(kepType, task_type)) {
|
if (!StrUtil.equals(kepType, task_type)) {
|
||||||
maGangAgvDeviceDriver.writing("type", Integer.parseInt(task_type));
|
maGangAgvDeviceDriver.writing1("type", task_type);
|
||||||
}
|
}
|
||||||
maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x));
|
maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x));
|
||||||
maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y));
|
maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y));
|
||||||
@@ -114,7 +123,8 @@ public class QueryXZAgvDeviceStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
System.out.println("出现异常");
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user