opt:优化超威大屏接口。

This commit is contained in:
2024-10-24 15:41:13 +08:00
parent 517214a61a
commit 79858c4a37
2 changed files with 85 additions and 86 deletions

View File

@@ -251,17 +251,27 @@ public class CockpitServiceImpl implements CockpitService {
//涂板线
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> {
// todo 初始化点位所在排信息
// 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());
// for (SchBasePoint r : list1) {
// if (r.getRow_num() == 0) {
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
// .eq(SchBasePoint::getPoint_code, r.getPoint_code());
// String pointId = r.getPoint_code().substring(5, 9);
// updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
// schBasePoint.update(null, updateWrapper);
// }
// }
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());
for (SchBasePoint r : list1) {
if (r.getRow_num() == 0) {
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, r.getPoint_code());
String pointId = r.getPoint_code().substring(5, 9);
updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId));
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 未对接的涂板线数据
JSONObject tbx01 = new JSONObject();
tbx01.put("mode", "0");
@@ -448,16 +458,16 @@ public class CockpitServiceImpl implements CockpitService {
Integer[] ghEndProduction = {0, 0};
//生产中的涂板任务
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());
extracted(list2, tbEndProduction);
getProduction(list2, tbEndProduction);
//生产中的固化任务
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());
extracted(list4, ghEndProduction);
getProduction(list4, ghEndProduction);
tbx.put("device_code", "涂板");
tbx.put("a", tbInProduction[0]);
tbx.put("b", tbEndProduction[0]);
@@ -570,7 +580,7 @@ public class CockpitServiceImpl implements CockpitService {
return jsonObject;
}
private static void extracted(List<TaskInfo> list, Integer[] production) {
private static void getProduction(List<TaskInfo> list, Integer[] production) {
list.stream()
.peek(taskInfo -> {
if (StringUtils.isBlank(taskInfo.getPoint_code1()) && StringUtils.isNotBlank(taskInfo.getPoint_code2())) {
@@ -579,6 +589,9 @@ public class CockpitServiceImpl implements CockpitService {
})
.forEach(taskInfo -> {
int vehicleCount = taskInfo.getVehicle_code().split(",").length;
if (vehicleCount > 1) {
int w = 0;
}
if ("A1".equals(taskInfo.getPoint_code1())) {
production[0] += vehicleCount;
} else {
@@ -602,6 +615,7 @@ public class CockpitServiceImpl implements CockpitService {
List<PointInfo> groupList = r.getValue();
PointInfo point = groupList.get(0);
if (groupList.stream().anyMatch(g -> g.getMove() == 3)) {
//极板三层架子有有一层有货
point.setMove(3);
} else {
point.setMove(0);