|
@@ -1789,18 +1789,80 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
|
|
|
//已排产 待生产
|
|
|
List<ChfTwoDatas> pendProduct = baseMapper.getProduct("1");
|
|
|
+ // 维保
|
|
|
+ List<ChfTwoDatas> repairProduct = baseMapper.getRepairProduct();
|
|
|
+ // 机床状态
|
|
|
+ List<ChfTwoDatas> onlineProduct = baseMapper.getOnlineStatus();
|
|
|
+
|
|
|
+
|
|
|
+ List<ToolCostomAddressHistory> minProduct = baseMapper.getMin();
|
|
|
+
|
|
|
+ List<ToolCostomAddressHistory> maxProduct = baseMapper.getMax();
|
|
|
+
|
|
|
+ Map<String,Integer> useMap=new HashMap<>();
|
|
|
+
|
|
|
+ minProduct.forEach(vo->{
|
|
|
+ cn.hutool.json.JSONObject jsonObject=new cn.hutool.json.JSONObject(vo.getValue());
|
|
|
+ JSONArray minJsonArray = JSONArray.parseArray(jsonObject.get("values").toString());
|
|
|
+ String min = minJsonArray.get(101).toString();
|
|
|
+ Optional<ToolCostomAddressHistory> first = maxProduct.stream().filter(it -> it.getIp().equals(vo.getIp())).findFirst();
|
|
|
+ String value = first.get().getValue();
|
|
|
+ cn.hutool.json.JSONObject maxJsonObject=new cn.hutool.json.JSONObject(value);
|
|
|
+ JSONArray maxJsonArray = JSONArray.parseArray(maxJsonObject.get("values").toString());
|
|
|
+ String max = maxJsonArray.get(101).toString();
|
|
|
+ // 转换为 double
|
|
|
+ double value1 = Double.parseDouble(max);
|
|
|
+ double value2 = Double.parseDouble(min);
|
|
|
+
|
|
|
+ // 计算差值
|
|
|
+ double difference = value1 - value2;
|
|
|
+
|
|
|
+ // 计算结果
|
|
|
+ double result = (difference / (16 * 3600)) * 100;
|
|
|
+
|
|
|
+ // 转换为整数
|
|
|
+ int finalResult = (int) Math.round(result);
|
|
|
+
|
|
|
+ if("10.161.30.245".equals(vo.getIp())){
|
|
|
+ useMap.put("GMU800AVI-1",finalResult);
|
|
|
+ }else if("10.161.30.246".equals(vo.getIp())){
|
|
|
+ useMap.put("GMU800AVI-2",finalResult);
|
|
|
+ }else{
|
|
|
+ useMap.put("GMU800AVI-3",finalResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
Set<Map.Entry<String, ChfProduct>> entries = map.entrySet();
|
|
|
entries.stream().forEach(vo->{
|
|
|
ChfProduct chfProduct=new ChfProduct();
|
|
|
List<ChfTwoDatas> collect = product.stream().filter(it -> it.getName().equals(vo.getKey())).collect(Collectors.toList());
|
|
|
- if(collect.size() > 0){
|
|
|
- chfProduct.setChfTwoDatas(collect.get(0));
|
|
|
- }
|
|
|
+ chfProduct.setChfTwoDatas(collect);
|
|
|
+
|
|
|
List<ChfTwoDatas> pendingCollect = pendProduct.stream().filter(it -> it.getName().equals(vo.getKey())).collect(Collectors.toList());
|
|
|
chfProduct.setChfTwoDatasList(pendingCollect);
|
|
|
|
|
|
+ List<ChfTwoDatas> repairCollect = repairProduct.stream().filter(it -> it.getName().equals(vo.getKey())).collect(Collectors.toList());
|
|
|
+ chfProduct.setRepairList(repairCollect);
|
|
|
+
|
|
|
+
|
|
|
+ List<ChfTwoDatas> onlineCollect = onlineProduct.stream().filter(it -> it.getName().equals(vo.getKey())).collect(Collectors.toList());
|
|
|
+ ChfTwoDatas chfTwoDatas = onlineCollect.get(0);
|
|
|
+ if("0".equals(chfTwoDatas.getOnlineStatus())){
|
|
|
+ chfProduct.setOnlineStatus(chfTwoDatas.getOnlineStatus());
|
|
|
+ }else if(collect.size()>0){
|
|
|
+ chfProduct.setOnlineStatus("2");
|
|
|
+ }else{
|
|
|
+ chfProduct.setOnlineStatus("1");
|
|
|
+ }
|
|
|
+ chfProduct.setUseRadio(useMap.get(vo.getKey()));
|
|
|
+
|
|
|
map.put(vo.getKey(),chfProduct);
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
|
|
|
return map;
|