opt:优化超威大屏接口。
This commit is contained in:
@@ -47,23 +47,8 @@ public class SyncDeviceStatus {
|
|||||||
|
|
||||||
|
|
||||||
private void device() {
|
private void device() {
|
||||||
long startTime = System.currentTimeMillis();
|
//long startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
//总数
|
|
||||||
Integer a1_count = 0;
|
|
||||||
//正常运行
|
|
||||||
Long a1_item1 = 0L;
|
|
||||||
//暂未生产
|
|
||||||
Long a1_item2 = 0L;
|
|
||||||
//空闲设备
|
|
||||||
Long a1_item3 = 0L;
|
|
||||||
//故障设备
|
|
||||||
Long a1_item4 = 0L;
|
|
||||||
Integer a2_count = 0;
|
|
||||||
Long a2_item1 = 0L;
|
|
||||||
Long a2_item2 = 0L;
|
|
||||||
Long a2_item3 = 0L;
|
|
||||||
Long a2_item4 = 0L;
|
|
||||||
JSONArray tbxList1 = new JSONArray();
|
JSONArray tbxList1 = new JSONArray();
|
||||||
JSONArray tbxList2 = new JSONArray();
|
JSONArray tbxList2 = new JSONArray();
|
||||||
JSONArray ghsList1 = new JSONArray();
|
JSONArray ghsList1 = new JSONArray();
|
||||||
@@ -209,9 +194,9 @@ public class SyncDeviceStatus {
|
|||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
//redisUtils.set("agvList", agvList);
|
//redisUtils.set("agvList", agvList);
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,59 +206,59 @@ public class SyncDeviceStatus {
|
|||||||
Long a1_item1;
|
Long a1_item1;
|
||||||
Long a1_item2;
|
Long a1_item2;
|
||||||
Long a1_item4;
|
Long a1_item4;
|
||||||
//0:脱机,1:故障,2:待机,3:运行中
|
|
||||||
a1_count = deviceList.size();
|
|
||||||
JSONObject item1 = new JSONObject();
|
JSONObject item1 = new JSONObject();
|
||||||
item1.put("count", a1_count);
|
try {
|
||||||
result.add(item1);
|
//0:脱机,1:故障,2:待机,3:运行中
|
||||||
a1_item1 = deviceList.stream()
|
a1_count = deviceList.size();
|
||||||
.map(JSONObject.class::cast)
|
item1.put("count", a1_count);
|
||||||
.filter(r -> "3".equals(r.getString("mode")))
|
result.add(item1);
|
||||||
.count();
|
a1_item1 = deviceList.stream()
|
||||||
JSONObject item2 = new JSONObject();
|
.map(JSONObject.class::cast)
|
||||||
item2.put("count", a1_item1.toString());
|
.filter(r -> "3".equals(r.getString("mode")))
|
||||||
item2.put("name", "正常运行");
|
.count();
|
||||||
// 计算百分比
|
JSONObject item2 = new JSONObject();
|
||||||
double a1Item1Percentage = (double) a1_item1 / a1_count * 100;
|
item2.put("count", a1_item1.toString());
|
||||||
String a1Item1Percentages = new DecimalFormat("0.00").format(a1Item1Percentage) + "%";
|
item2.put("name", "正常运行");
|
||||||
item2.put("percent", a1Item1Percentages);
|
double a1Item1Percentage = (double) a1_item1 / a1_count * 100;
|
||||||
result.add(item2);
|
String a1Item1Percentages = new DecimalFormat("0.00").format(a1Item1Percentage) + "%";
|
||||||
a1_item2 = deviceList.stream()
|
item2.put("percent", a1Item1Percentages);
|
||||||
.map(JSONObject.class::cast)
|
result.add(item2);
|
||||||
.filter(r -> "2".equals(r.getString("mode")))
|
a1_item2 = deviceList.stream()
|
||||||
.count();
|
.map(JSONObject.class::cast)
|
||||||
JSONObject item3 = new JSONObject();
|
.filter(r -> "2".equals(r.getString("mode")))
|
||||||
item3.put("count", a1_item2.toString());
|
.count();
|
||||||
item3.put("name", "暂未生产");
|
JSONObject item3 = new JSONObject();
|
||||||
// 计算百分比
|
item3.put("count", a1_item2.toString());
|
||||||
double a1Item2Percentage = (double) a1_item2 / a1_count * 100;
|
item3.put("name", "暂未生产");
|
||||||
String a1Item2Percentages = new DecimalFormat("0.00").format(a1Item2Percentage) + "%";
|
double a1Item2Percentage = (double) a1_item2 / a1_count * 100;
|
||||||
item3.put("percent", a1Item2Percentages);
|
String a1Item2Percentages = new DecimalFormat("0.00").format(a1Item2Percentage) + "%";
|
||||||
result.add(item3);
|
item3.put("percent", a1Item2Percentages);
|
||||||
a1_item3 = deviceList.stream()
|
result.add(item3);
|
||||||
.map(JSONObject.class::cast)
|
a1_item3 = deviceList.stream()
|
||||||
.filter(r -> "0".equals(r.getString("mode")))
|
.map(JSONObject.class::cast)
|
||||||
.count();
|
.filter(r -> "0".equals(r.getString("mode")))
|
||||||
JSONObject item4 = new JSONObject();
|
.count();
|
||||||
item4.put("count", a1_item3.toString());
|
JSONObject item4 = new JSONObject();
|
||||||
item4.put("name", "空闲设备");
|
item4.put("count", a1_item3.toString());
|
||||||
// 计算百分比
|
item4.put("name", "空闲设备");
|
||||||
double a1Item3Percentage = (double) a1_item3 / a1_count * 100;
|
double a1Item3Percentage = (double) a1_item3 / a1_count * 100;
|
||||||
String a1Item3Percentages = new DecimalFormat("0.00").format(a1Item3Percentage) + "%";
|
String a1Item3Percentages = new DecimalFormat("0.00").format(a1Item3Percentage) + "%";
|
||||||
item4.put("percent", a1Item3Percentages);
|
item4.put("percent", a1Item3Percentages);
|
||||||
result.add(item4);
|
result.add(item4);
|
||||||
a1_item4 = deviceList.stream()
|
a1_item4 = deviceList.stream()
|
||||||
.map(JSONObject.class::cast)
|
.map(JSONObject.class::cast)
|
||||||
.filter(r -> "1".equals(r.getString("mode")))
|
.filter(r -> "1".equals(r.getString("mode")))
|
||||||
.count();
|
.count();
|
||||||
JSONObject item5 = new JSONObject();
|
JSONObject item5 = new JSONObject();
|
||||||
item5.put("count", a1_item4.toString());
|
item5.put("count", a1_item4.toString());
|
||||||
item5.put("name", "故障设备");
|
item5.put("name", "故障设备");
|
||||||
// 计算百分比
|
double a1Item4Percentage = (double) a1_item4 / a1_count * 100;
|
||||||
double a1Item4Percentage = (double) a1_item4 / a1_count * 100;
|
String a1Item4Percentages = new DecimalFormat("0.00").format(a1Item4Percentage) + "%";
|
||||||
String a1Item4Percentages = new DecimalFormat("0.00").format(a1Item4Percentage) + "%";
|
item5.put("percent", a1Item4Percentages);
|
||||||
item5.put("percent", a1Item4Percentages);
|
result.add(item5);
|
||||||
result.add(item5);
|
} catch (Exception e) {
|
||||||
|
log.error("获取设备数量和百分比失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getDeviceMode(Integer mode, JSONObject json) {
|
private static void getDeviceMode(Integer mode, JSONObject json) {
|
||||||
|
|||||||
@@ -251,17 +251,27 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
//涂板线
|
//涂板线
|
||||||
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> {
|
||||||
// todo 初始化点位所在排信息
|
// todo 初始化点位所在排信息
|
||||||
// List<SchBasePoint> list = schBasePoint.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getIs_used, 1));
|
List<SchBasePoint> list = schBasePoint.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getIs_used, 1));
|
||||||
// List<SchBasePoint> list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList());
|
List<SchBasePoint> list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList());
|
||||||
// for (SchBasePoint r : list1) {
|
for (SchBasePoint r : list1) {
|
||||||
// if (r.getRow_num() == 0) {
|
if (r.getRow_num() == 0) {
|
||||||
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
||||||
// .eq(SchBasePoint::getPoint_code, r.getPoint_code());
|
.eq(SchBasePoint::getPoint_code, r.getPoint_code());
|
||||||
// String pointId = r.getPoint_code().substring(5, 9);
|
String pointId = r.getPoint_code().substring(5, 9);
|
||||||
// updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
|
updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
|
||||||
// schBasePoint.update(null, updateWrapper);
|
schBasePoint.update(null, updateWrapper);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
List<SchBasePoint> basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList());
|
||||||
|
if (ObjectUtil.isNotEmpty(basePointList)) {
|
||||||
|
if ("A1".equals(basePointList.get(0).getWorkshop_code())) {
|
||||||
|
List<String> regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2"));
|
||||||
|
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
||||||
|
.in(SchBasePoint::getRegion_code, regionList);
|
||||||
|
updateWrapper.set(SchBasePoint::getWorkshop_code, "A2");
|
||||||
|
schBasePoint.update(null, updateWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
// todo 未对接的涂板线数据
|
// todo 未对接的涂板线数据
|
||||||
JSONObject tbx01 = new JSONObject();
|
JSONObject tbx01 = new JSONObject();
|
||||||
tbx01.put("mode", "0");
|
tbx01.put("mode", "0");
|
||||||
@@ -448,16 +458,16 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
Integer[] ghEndProduction = {0, 0};
|
Integer[] ghEndProduction = {0, 0};
|
||||||
//生产中的涂板任务
|
//生产中的涂板任务
|
||||||
List<TaskInfo> list1 = result.stream().filter(r -> r.getTask_status() < 5 && "MJXLTask".equals(r.getType())).collect(Collectors.toList());
|
List<TaskInfo> list1 = result.stream().filter(r -> r.getTask_status() < 5 && "MJXLTask".equals(r.getType())).collect(Collectors.toList());
|
||||||
extracted(list1, tbInProduction);
|
getProduction(list1, tbInProduction);
|
||||||
//生产完成的涂板任务
|
//生产完成的涂板任务
|
||||||
List<TaskInfo> list2 = result.stream().filter(r -> r.getTask_status() == 5 && "MJXLTask".equals(r.getType())).collect(Collectors.toList());
|
List<TaskInfo> list2 = result.stream().filter(r -> r.getTask_status() == 5 && "MJXLTask".equals(r.getType())).collect(Collectors.toList());
|
||||||
extracted(list2, tbEndProduction);
|
getProduction(list2, tbEndProduction);
|
||||||
//生产中的固化任务
|
//生产中的固化任务
|
||||||
List<TaskInfo> list3 = result.stream().filter(r -> "GHSFMTask".equals(r.getType())).collect(Collectors.toList());
|
List<TaskInfo> list3 = result.stream().filter(r -> "GHSFMTask".equals(r.getType())).collect(Collectors.toList());
|
||||||
extracted(list3, ghInProduction);
|
getProduction(list3, ghInProduction);
|
||||||
//生产完成的固化任务
|
//生产完成的固化任务
|
||||||
List<TaskInfo> list4 = result.stream().filter(r -> "GHSQHTask".equals(r.getType())).collect(Collectors.toList());
|
List<TaskInfo> list4 = result.stream().filter(r -> "GHSQHTask".equals(r.getType())).collect(Collectors.toList());
|
||||||
extracted(list4, ghEndProduction);
|
getProduction(list4, ghEndProduction);
|
||||||
tbx.put("device_code", "涂板");
|
tbx.put("device_code", "涂板");
|
||||||
tbx.put("a", tbInProduction[0]);
|
tbx.put("a", tbInProduction[0]);
|
||||||
tbx.put("b", tbEndProduction[0]);
|
tbx.put("b", tbEndProduction[0]);
|
||||||
@@ -570,7 +580,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void extracted(List<TaskInfo> list, Integer[] production) {
|
private static void getProduction(List<TaskInfo> list, Integer[] production) {
|
||||||
list.stream()
|
list.stream()
|
||||||
.peek(taskInfo -> {
|
.peek(taskInfo -> {
|
||||||
if (StringUtils.isBlank(taskInfo.getPoint_code1()) && StringUtils.isNotBlank(taskInfo.getPoint_code2())) {
|
if (StringUtils.isBlank(taskInfo.getPoint_code1()) && StringUtils.isNotBlank(taskInfo.getPoint_code2())) {
|
||||||
@@ -579,6 +589,9 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
})
|
})
|
||||||
.forEach(taskInfo -> {
|
.forEach(taskInfo -> {
|
||||||
int vehicleCount = taskInfo.getVehicle_code().split(",").length;
|
int vehicleCount = taskInfo.getVehicle_code().split(",").length;
|
||||||
|
if (vehicleCount > 1) {
|
||||||
|
int w = 0;
|
||||||
|
}
|
||||||
if ("A1".equals(taskInfo.getPoint_code1())) {
|
if ("A1".equals(taskInfo.getPoint_code1())) {
|
||||||
production[0] += vehicleCount;
|
production[0] += vehicleCount;
|
||||||
} else {
|
} else {
|
||||||
@@ -602,6 +615,7 @@ public class CockpitServiceImpl implements CockpitService {
|
|||||||
List<PointInfo> groupList = r.getValue();
|
List<PointInfo> groupList = r.getValue();
|
||||||
PointInfo point = groupList.get(0);
|
PointInfo point = groupList.get(0);
|
||||||
if (groupList.stream().anyMatch(g -> g.getMove() == 3)) {
|
if (groupList.stream().anyMatch(g -> g.getMove() == 3)) {
|
||||||
|
//极板三层架子有有一层有货
|
||||||
point.setMove(3);
|
point.setMove(3);
|
||||||
} else {
|
} else {
|
||||||
point.setMove(0);
|
point.setMove(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user