opt:输送线分类优化
This commit is contained in:
@@ -94,7 +94,7 @@ public class SyncDeviceStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void device() {
|
private void device() {
|
||||||
long startTime = System.currentTimeMillis();
|
//long startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
JSONArray baoshijian = new JSONArray();
|
JSONArray baoshijian = new JSONArray();
|
||||||
JSONArray guhuashi = new JSONArray();
|
JSONArray guhuashi = new JSONArray();
|
||||||
@@ -152,9 +152,7 @@ public class SyncDeviceStatus {
|
|||||||
json.put("action", siteDeviceDriver.getAction());
|
json.put("action", siteDeviceDriver.getAction());
|
||||||
json.put("vehicle_type", siteDeviceDriver.getPallet_type());
|
json.put("vehicle_type", siteDeviceDriver.getPallet_type());
|
||||||
json.put("error", siteDeviceDriver.getError());
|
json.put("error", siteDeviceDriver.getError());
|
||||||
//todo 检查mode值是否正常
|
json.put("device_status", siteDeviceDriver.getMode());
|
||||||
json.put("device_status", siteDeviceDriver.getMode() == 0 ? 1 : 0);
|
|
||||||
// json.put("device_status", siteDeviceDriver.getError() == 0 ? 1 : 0);
|
|
||||||
site.add(json);
|
site.add(json);
|
||||||
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||||
@@ -185,22 +183,23 @@ public class SyncDeviceStatus {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
JSONArray siteJsonArray = new JSONArray();
|
JSONArray siteJsonArray = new JSONArray();
|
||||||
for (String deviceCode : siteList) {
|
if (ObjectUtil.isNotEmpty(siteList)) {
|
||||||
JSONArray siteJSONArray = site.stream()
|
for (String deviceCode : siteList) {
|
||||||
.filter(obj -> ((JSONObject) obj).getString("device_code").startsWith(deviceCode))
|
JSONArray filterJsonArray = site.stream()
|
||||||
.collect(Collectors.toCollection(JSONArray::new));
|
.filter(obj -> ((JSONObject) obj).getString("device_code").startsWith(deviceCode))
|
||||||
long siteCount = site.stream()
|
.collect(Collectors.toCollection(JSONArray::new));
|
||||||
.filter(obj -> "0".equals(((JSONObject) obj).getString("device_status")))
|
//有站点运行代表输送线运行
|
||||||
.count();
|
long siteCount = site.stream()
|
||||||
JSONObject json = new JSONObject();
|
.filter(obj -> !"0".equals(((JSONObject) obj).getString("device_status")))
|
||||||
json.put("device_code", deviceCode);
|
.count();
|
||||||
json.put("device_status", siteCount > 0 ? 0 : 1);
|
JSONObject json = new JSONObject();
|
||||||
if (!siteList.isEmpty()) {
|
json.put("device_code", deviceCode);
|
||||||
JSONObject item = siteJSONArray.getJSONObject(0);
|
json.put("device_status", siteCount > 0 ? 1 : 0);
|
||||||
|
JSONObject item = filterJsonArray.getJSONObject(0);
|
||||||
json.put("vehicle_type", item.getString("vehicle_type"));
|
json.put("vehicle_type", item.getString("vehicle_type"));
|
||||||
json.put("action", item.getString("action"));
|
json.put("action", item.getString("action"));
|
||||||
|
siteJsonArray.add(json);
|
||||||
}
|
}
|
||||||
siteJsonArray.add(json);
|
|
||||||
}
|
}
|
||||||
JSONArray ptJsonArray = site.stream()
|
JSONArray ptJsonArray = site.stream()
|
||||||
.filter(obj -> ((JSONObject) obj).getString("device_code").startsWith("PTHCW"))
|
.filter(obj -> ((JSONObject) obj).getString("device_code").startsWith("PTHCW"))
|
||||||
@@ -247,7 +246,7 @@ public class SyncDeviceStatus {
|
|||||||
redisUtils.set("agv", agv);
|
redisUtils.set("agv", agv);
|
||||||
// log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
// log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage());
|
log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user