|
@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.nl.common.utils.RedisUtils; |
|
|
import org.nl.common.utils.RedisUtils; |
|
@ -13,7 +11,6 @@ import org.nl.wms.cockpit.service.CockpitService; |
|
|
import org.nl.wms.cockpit.service.dao.PointInfo; |
|
|
import org.nl.wms.cockpit.service.dao.PointInfo; |
|
|
import org.nl.wms.cockpit.service.dao.TaskInfo; |
|
|
import org.nl.wms.cockpit.service.dao.TaskInfo; |
|
|
import org.nl.wms.cockpit.service.mapper.CockpitMapper; |
|
|
import org.nl.wms.cockpit.service.mapper.CockpitMapper; |
|
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
|
|
|
|
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl; |
|
|
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
@ -250,28 +247,29 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
//涂板线
|
|
|
//涂板线
|
|
|
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<Map<String, Object>>> task1 = CompletableFuture.supplyAsync(() -> { |
|
|
// todo 初始化点位所在排信息
|
|
|
long startTime1 = System.currentTimeMillis(); |
|
|
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> list = schBasePoint.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getIs_used, 1));
|
|
|
for (SchBasePoint r : list1) { |
|
|
// 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());
|
|
|
if (r.getRow_num() == 0) { |
|
|
// for (SchBasePoint r : list1) {
|
|
|
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>() |
|
|
// if (r.getRow_num() == 0) {
|
|
|
.eq(SchBasePoint::getPoint_code, r.getPoint_code()); |
|
|
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
|
|
String pointId = r.getPoint_code().substring(5, 9); |
|
|
// .eq(SchBasePoint::getPoint_code, r.getPoint_code());
|
|
|
updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId)); |
|
|
// String pointId = r.getPoint_code().substring(5, 9);
|
|
|
schBasePoint.update(null, updateWrapper); |
|
|
// 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)) { |
|
|
// List<SchBasePoint> basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList());
|
|
|
if ("A1".equals(basePointList.get(0).getWorkshop_code())) { |
|
|
// if (ObjectUtil.isNotEmpty(basePointList)) {
|
|
|
List<String> regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2")); |
|
|
// if ("A1".equals(basePointList.get(0).getWorkshop_code())) {
|
|
|
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>() |
|
|
// List<String> regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2"));
|
|
|
.in(SchBasePoint::getRegion_code, regionList); |
|
|
// LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>()
|
|
|
updateWrapper.set(SchBasePoint::getWorkshop_code, "A2"); |
|
|
// .in(SchBasePoint::getRegion_code, regionList);
|
|
|
schBasePoint.update(null, updateWrapper); |
|
|
// 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"); |
|
@ -297,6 +295,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
} else { |
|
|
} else { |
|
|
jsonObject.put("9", new JSONArray()); |
|
|
jsonObject.put("9", new JSONArray()); |
|
|
} |
|
|
} |
|
|
|
|
|
log.info("读取涂板线设备缓存信息耗时{}", System.currentTimeMillis() - startTime1); |
|
|
return null; |
|
|
return null; |
|
|
}, pool); |
|
|
}, pool); |
|
|
task1.exceptionally((e) -> { |
|
|
task1.exceptionally((e) -> { |
|
@ -304,6 +303,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
CompletableFuture<List<Map<String, Object>>> task2 = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<Map<String, Object>>> task2 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
long startTime2 = System.currentTimeMillis(); |
|
|
JSONArray ghs1 = (JSONArray) redisUtils.get("ghsList1"); |
|
|
JSONArray ghs1 = (JSONArray) redisUtils.get("ghsList1"); |
|
|
List<JSONObject> ghsList1 = getSortedList(ghs1); |
|
|
List<JSONObject> ghsList1 = getSortedList(ghs1); |
|
|
JSONArray ghs2 = (JSONArray) redisUtils.get("ghsList2"); |
|
|
JSONArray ghs2 = (JSONArray) redisUtils.get("ghsList2"); |
|
@ -318,6 +318,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
} else { |
|
|
} else { |
|
|
jsonObject.put("11", new JSONArray()); |
|
|
jsonObject.put("11", new JSONArray()); |
|
|
} |
|
|
} |
|
|
|
|
|
log.info("读取固化室设备缓存信息{}", System.currentTimeMillis() - startTime2); |
|
|
return null; |
|
|
return null; |
|
|
}, pool); |
|
|
}, pool); |
|
|
task2.exceptionally((e) -> { |
|
|
task2.exceptionally((e) -> { |
|
@ -325,6 +326,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
CompletableFuture<List<Map<String, Object>>> task3 = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<Map<String, Object>>> task3 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
long startTime3 = System.currentTimeMillis(); |
|
|
JSONArray bpjList = (JSONArray) redisUtils.get("bpjList"); |
|
|
JSONArray bpjList = (JSONArray) redisUtils.get("bpjList"); |
|
|
List<JSONObject> bpjList1 = getSortedList(bpjList); |
|
|
List<JSONObject> bpjList1 = getSortedList(bpjList); |
|
|
if (ObjectUtil.isNotEmpty(bpjList1)) { |
|
|
if (ObjectUtil.isNotEmpty(bpjList1)) { |
|
@ -336,6 +338,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
JSONArray deviceA2 = (JSONArray) redisUtils.get("deviceA2"); |
|
|
JSONArray deviceA2 = (JSONArray) redisUtils.get("deviceA2"); |
|
|
jsonObject.put("17", deviceA1); |
|
|
jsonObject.put("17", deviceA1); |
|
|
jsonObject.put("19", deviceA2); |
|
|
jsonObject.put("19", deviceA2); |
|
|
|
|
|
log.info("读取包片机设备缓存信息{}", System.currentTimeMillis() - startTime3); |
|
|
return null; |
|
|
return null; |
|
|
}, pool); |
|
|
}, pool); |
|
|
task3.exceptionally((e) -> { |
|
|
task3.exceptionally((e) -> { |
|
@ -343,6 +346,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
CompletableFuture<List<Map<String, Object>>> task4 = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<Map<String, Object>>> task4 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
long startTime4 = System.currentTimeMillis(); |
|
|
//正极板空架回收位
|
|
|
//正极板空架回收位
|
|
|
JSONArray zjbKjHswList = (JSONArray) redisUtils.get("zjbKjHswList"); |
|
|
JSONArray zjbKjHswList = (JSONArray) redisUtils.get("zjbKjHswList"); |
|
|
List<JSONObject> zjbKjHswList1 = getSortedList(zjbKjHswList); |
|
|
List<JSONObject> zjbKjHswList1 = getSortedList(zjbKjHswList); |
|
@ -367,6 +371,7 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
} else { |
|
|
} else { |
|
|
jsonObject.put("15", new JSONArray()); |
|
|
jsonObject.put("15", new JSONArray()); |
|
|
} |
|
|
} |
|
|
|
|
|
log.info("读取包片机设备缓存信息耗时{}", System.currentTimeMillis() - startTime4); |
|
|
return null; |
|
|
return null; |
|
|
}, pool); |
|
|
}, pool); |
|
|
task4.exceptionally((e) -> { |
|
|
task4.exceptionally((e) -> { |
|
@ -374,68 +379,33 @@ public class CockpitServiceImpl implements CockpitService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
CompletableFuture<JSONArray> task5 = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> task5 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
long startTime5 = System.currentTimeMillis(); |
|
|
JSONArray jsonArray = cockpitMapper.getZCList(); |
|
|
JSONArray jsonArray = cockpitMapper.getZCList(); |
|
|
List<PointInfo> pointInfoList = jsonArray.stream() |
|
|
List<PointInfo> pointInfoList = jsonArray.stream() |
|
|
.map(r -> JSON.parseObject(r.toString(), PointInfo.class)) |
|
|
.map(r -> JSON.parseObject(r.toString(), PointInfo.class)) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
//正极板空固化架缓存区A1
|
|
|
//正极板空固化架缓存区A1
|
|
|
List<PointInfo> hcq6 = pointInfoList.stream().filter(r -> "HCQ6".equals(r.getRegion_code())).sorted(Comparator.comparing(PointInfo::getRow_num)).collect(Collectors.toList()); |
|
|
List<PointInfo> hcq6 = pointInfoList.stream().filter(r -> "HCQ6".equals(r.getRegion_code())).sorted(Comparator.comparing(PointInfo::getRow_num)).collect(Collectors.toList()); |
|
|
AtomicReference<List<PointInfo>> list1 = new AtomicReference<>(); |
|
|
//边负极板缓存区
|
|
|
CompletableFuture<List<Map<String, Object>>> task01 = CompletableFuture.supplyAsync(() -> { |
|
|
List<PointInfo> list1 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
//边负极板缓存区
|
|
|
//负极板缓存区
|
|
|
List<PointInfo> hcq1 = pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
List<PointInfo> list2 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
list1.set(getPointInfoList(hcq1)); |
|
|
//负极板空架缓存区
|
|
|
return null; |
|
|
List<PointInfo> list3 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
}, pool); |
|
|
//正极板缓存区
|
|
|
AtomicReference<List<PointInfo>> list2 = new AtomicReference<>(); |
|
|
List<PointInfo> list4 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
CompletableFuture<List<Map<String, Object>>> task02 = CompletableFuture.supplyAsync(() -> { |
|
|
//正极板空固化架缓存区
|
|
|
//边负极板缓存区
|
|
|
List<PointInfo> list5 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
//负极板缓存区
|
|
|
//涂板线空固化架缓存区
|
|
|
List<PointInfo> hcq2 = pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
List<PointInfo> list7 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList())); |
|
|
list2.set(getPointInfoList(hcq2)); |
|
|
|
|
|
return null; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
AtomicReference<List<PointInfo>> list3 = new AtomicReference<>(); |
|
|
|
|
|
CompletableFuture<List<Map<String, Object>>> task03 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
//负极板空架缓存区
|
|
|
|
|
|
List<PointInfo> hcq3 = pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
|
|
|
list3.set(getPointInfoList(hcq3)); |
|
|
|
|
|
return null; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
AtomicReference<List<PointInfo>> list4 = new AtomicReference<>(); |
|
|
|
|
|
CompletableFuture<List<Map<String, Object>>> task04 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
//正极板缓存区
|
|
|
|
|
|
List<PointInfo> hcq4 = pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
|
|
|
list4.set(getPointInfoList(hcq4)); |
|
|
|
|
|
return null; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
AtomicReference<List<PointInfo>> list5 = new AtomicReference<>(); |
|
|
|
|
|
CompletableFuture<List<Map<String, Object>>> task05 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
//正极板空固化架缓存区
|
|
|
|
|
|
List<PointInfo> hcq5 = pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
|
|
|
list5.set(getPointInfoList(hcq5)); |
|
|
|
|
|
return null; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
AtomicReference<List<PointInfo>> list7 = new AtomicReference<>(); |
|
|
|
|
|
CompletableFuture<List<Map<String, Object>>> task07 = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
//涂板线空固化架缓存区
|
|
|
|
|
|
List<PointInfo> hcq7 = pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList()); |
|
|
|
|
|
list7.set(getPointInfoList(hcq7)); |
|
|
|
|
|
return null; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
CompletableFuture<Void> allQuery = CompletableFuture.allOf(task01, task02, task03, task04, task05, task07); |
|
|
|
|
|
CompletableFuture<JSONObject> future = allQuery.thenApply((result) -> jsonObject).exceptionally((e) -> { |
|
|
|
|
|
log.error(e.getMessage(), e); |
|
|
|
|
|
return null; |
|
|
|
|
|
}); |
|
|
|
|
|
future.join(); |
|
|
|
|
|
jsonObject.put("8", hcq6); |
|
|
jsonObject.put("8", hcq6); |
|
|
jsonObject.put("4", list1.get()); |
|
|
jsonObject.put("4", list1); |
|
|
jsonObject.put("5", list2.get()); |
|
|
jsonObject.put("5", list2); |
|
|
jsonObject.put("6", list3.get()); |
|
|
jsonObject.put("6", list3); |
|
|
jsonObject.put("12", list4.get()); |
|
|
jsonObject.put("12", list4); |
|
|
jsonObject.put("10", list5.get()); |
|
|
jsonObject.put("10", list5); |
|
|
jsonObject.put("3", list7.get()); |
|
|
jsonObject.put("3", list7); |
|
|
|
|
|
log.info("读取缓冲库信息耗时: {}", System.currentTimeMillis() - startTime5); |
|
|
return null; |
|
|
return null; |
|
|
}, pool); |
|
|
}, pool); |
|
|
task5.exceptionally((e) -> { |
|
|
task5.exceptionally((e) -> { |
|
|