From b311c61c729f02db40dfa51dbfe81892112535b1 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期三, 23 十月 2024 09:57:04 +0800
Subject: [PATCH] 关于修改可靠性产品重复

---
 web/src/views/modules/taskReliability/SimulatHistory.vue                                                      |    2 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dto/ProductDto.java                     |    1 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java         |   15 ++
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java |  182 ++++++++++++++++-------------
 web/src/views/modules/taskReliability/RBD-edit-img.vue                                                        |    2 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java      |   40 +++++-
 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml                              |   25 ++-
 modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml                               |    9 +
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/WeakDto.java                  |    2 
 modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml                                    |    2 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java               |   24 +++
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java          |    2 
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java  |   10 
 modules/mainPart/src/main/resources/产品结构树导出模板.xlsx                                                            |    0 
 14 files changed, 199 insertions(+), 117 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dto/ProductDto.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dto/ProductDto.java
index 0a3f721..db3ee37 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dto/ProductDto.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dto/ProductDto.java
@@ -19,6 +19,7 @@
     private Long id;
     private Long pid;
     private String sameSbName;
+    private Integer sameSbNum;
     private String equipType; //璁惧绫诲瀷
     private Integer reliabDistribType; //鍙潬鎬у垎甯冪被鍨�
     private Integer basicJoinCompute; //鍙傚姞璁$畻
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java
index 9c37bbf..fecdf9a 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java
@@ -4,6 +4,8 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.zt.common.entity.BusiEntity;
 import com.zt.common.entity.TreeNode;
+import com.zt.common.utils.UUIDUtil;
+import com.zt.life.core.model.ZtProduct;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -22,7 +24,7 @@
 @Data
 @EqualsAndHashCode(callSuper=false)
 @TableName("product_model")
-public class XhProductModel extends BusiEntity implements TreeNode<XhProductModel> {
+public class XhProductModel extends BusiEntity implements TreeNode<XhProductModel>,Cloneable {
 	private static final long serialVersionUID = 1L;
 
 	@ApiModelProperty(value = "涓婄骇ID")
@@ -57,10 +59,30 @@
 	@ApiModelProperty(value = "鎺掑簭")
 	private Integer sort;
 
+	@ApiModelProperty(value = "鍚岀被璁惧鏁伴噺")
+	private Integer sameSbNum;
+
+
+	@ApiModelProperty(value = "鍚岀被璁惧搴忓彿")
+	@TableField(exist = false)
+	private Integer deviceNo;
+
+	@ApiModelProperty(value = "鍚岀被璁惧搴忓彿")
+	@TableField(exist = false)
+	private String dataId;
+
 	@ApiModelProperty(value = "瀛愯妭鐐�")
 	@TableField(exist = false)
 	private List<XhProductModel> children = new ArrayList<>();
 
 	@TableField(exist = false)
 	private Long paramId;
+
+	@Override
+	public XhProductModel clone() throws CloneNotSupportedException {
+		XhProductModel product = (XhProductModel) super.clone();
+		product.children = new ArrayList<>();
+		product.setId(UUIDUtil.generateId());
+		return product;
+	}
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
index f9a0192..d0f96b8 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -70,7 +70,7 @@
     }
 
     public List<XhProductModel> getAllTree(Boolean showXdy, Integer ztShow, Long productId) {
-        List<XhProductModel> productList = null;
+        List<XhProductModel> productList = new ArrayList<>();
         if (showXdy) {
             if (productId != null) {
                 productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
@@ -102,8 +102,29 @@
                     productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
                             Constant.Bool.NO).lt("product_type", 5).ne("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)).orderByAsc(Constant.TableColumn.SORT));
                 } else if (ztShow == 5) {
-                    productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
-                            Constant.Bool.NO).gt("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)).orderByAsc(Constant.TableColumn.SORT));
+                    List<XhProductModel> dbList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
+                            Constant.Bool.NO).gt("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)));
+                    for (XhProductModel row : dbList) {
+                        if (row.getSameSbNum() > 1) {
+                            for (int i = 1; i <= row.getSameSbNum(); i++) {
+                                try {
+                                    XhProductModel newRow = row.clone();
+                                    newRow.setDeviceNo(i);
+                                    newRow.setName(row.getName() + "-" + i);
+                                    newRow.setDataId(row.getId().toString() + "-" + i);
+                                    productList.add(newRow);
+                                } catch (CloneNotSupportedException e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        } else {
+                            row.setDeviceNo(0);
+                            row.setDataId(row.getId().toString());
+                            productList.add(row);
+                        }
+                    }
+                    productList.sort(Comparator.comparing(XhProductModel::getSort, Comparator.naturalOrder())
+                            .thenComparing(XhProductModel::getDeviceNo, Comparator.naturalOrder()));
                 }
             }
         }
@@ -329,7 +350,7 @@
                     xhProductModel.setPid(curFxtId == null ? curXtId : curFxtId);
                     xhProductModel.setId(curSbId);
                     xhProductModel.setName(sb);
-                    //xhProductModel.setSameSbName(sameSbName);
+                    xhProductModel.setSameSbNum(sameSbNum);
                     xhProductModel.setEquipType(equipType);
                     xhProductModel.setProductType("5");
                     xhProductModel.setSort(Integer.valueOf(sort));
@@ -423,7 +444,7 @@
         List<ProductDto> data = baseDao.getProductByShip(shipId);
         data = TreeUtils.build(data);
         List<ProductDto> List = new ArrayList<>();
-        this.writeExcel(data, List);
+        this.writeList(data, List);
         // 璇诲彇妯℃澘鏂囦欢
         try (InputStream inputStream = getClass().getResourceAsStream("/浜у搧缁撴瀯鏍戝鍑烘ā鏉�.xlsx")) {
             Workbook workbook = new XSSFWorkbook(inputStream);
@@ -470,9 +491,8 @@
                         }
                     }
                     cell = row.createCell(4);
-                    if (StringUtils.isNotBlank(List.get(i).getSameSbName())) {
-                        cell.setCellValue(List.get(i).getSameSbName());
-                    }
+                    cell.setCellValue(List.get(i).getSameSbNum());
+
                     cell = row.createCell(5);
                     if (StringUtils.isNotBlank(List.get(i).getEquipType())) {
                         cell.setCellValue(List.get(i).getEquipType());
@@ -555,10 +575,10 @@
 
     }
 
-    private void writeExcel(List<ProductDto> data, List<ProductDto> List) {
+    private void writeList(List<ProductDto> data, List<ProductDto> List) {
         for (ProductDto dto : data) {
             List.add(dto);
-            writeExcel(dto.getChildren(), List);
+            writeList(dto.getChildren(), List);
         }
     }
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java
index 5794f5b..51a856b 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java
@@ -1,6 +1,8 @@
 package com.zt.life.modules.mainPart.taskReliability.dto;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.zt.common.utils.UUIDUtil;
+import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel;
 import com.zt.life.modules.mainPart.taskReliability.model.CurveParam;
 import com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,9 +13,20 @@
 import java.util.Map;
 
 @Data
-public class ProductStatusDto {
+public class ProductStatusDto implements Cloneable{
     private Long id ;
     private String name ;
     private Integer sort ;
+    private Integer sameSbNum ;
+    private Integer deviceNo ;
+    private String dataId ;
     private List<StatusDto> statusList = new ArrayList<>();
+
+    @Override
+    public ProductStatusDto clone() throws CloneNotSupportedException {
+        ProductStatusDto product = (ProductStatusDto) super.clone();
+        product.statusList = new ArrayList<>();
+        product.setId(UUIDUtil.generateId());
+        return product;
+    }
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/WeakDto.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/WeakDto.java
index ead4971..43cf13f 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/WeakDto.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/WeakDto.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.zt.common.entity.BusiEntity;
 import com.zt.common.entity.TreeNode;
+import com.zt.common.utils.UUIDUtil;
 import com.zt.life.modules.mainPart.basicInfo.model.ParamData;
 import com.zt.life.modules.mainPart.taskReliability.model.CurveParam;
 import io.swagger.annotations.ApiModelProperty;
@@ -24,7 +25,6 @@
     private Long id;
     private Long pid;
     private Integer sort;
-
 
     @ApiModelProperty(value = "瀛愯妭鐐�")
     @TableField(exist = false)
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java
index e005bea..c45cf74 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java
@@ -36,7 +36,7 @@
 	private Integer simulatFrequency;
 
 	@TableField(exist = false)
-	private Long showProductId;
+	private String showProductId;
 
 	@TableField(exist = false)
 	private String dataType;
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java
index 27bfa88..b57857b 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java
@@ -13,7 +13,7 @@
 /**
  * model_line
  *
- * @author zt generator 
+ * @author zt generator
  * @since 1.0.0 2024-02-28
  */
 @Service
@@ -25,13 +25,13 @@
         node.setProductId(modelRbd.getProductId());
         node.setModelId(modelRbd.getId());
         Long[] nodeArr = modelRbd.getNodeArr();
-        Map<Long,Integer> nodeMap = new HashMap<>();
-        for(Long nodeId :nodeArr){
-            if (nodeMap.get(nodeId)!=null) {
+        Map<Long, Integer> nodeMap = new HashMap<>();
+        for (Long nodeId : nodeArr) {
+            if (nodeMap.get(nodeId) == null) {
                 node.setId(UUIDUtil.generateId());
                 node.setNodeId(nodeId);
                 baseDao.insert(node);
-                nodeMap.put(nodeId,1);
+                nodeMap.put(nodeId, 1);
             }
         }
     }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
index 81c21ba..d8696a3 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
@@ -26,6 +26,7 @@
 import com.zt.life.modules.mainPart.utils.GetStringSpace;
 import io.swagger.models.auth.In;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
@@ -332,7 +333,8 @@
 
         List<TimeDiagramStatusDto> statusDtoListNew = new ArrayList<>();
         while (statusDtoListOld.size() > 0) {
-            statusDtoListOld.stream().sorted(Comparator.comparing(TimeDiagramStatusDto::getX1)).collect(Collectors.toList());
+            //statusDtoListOld.stream().sorted(Comparator.comparing(TimeDiagramStatusDto::getX1)).collect(Collectors.toList());
+            statusDtoListOld.sort(Comparator.comparing(TimeDiagramStatusDto::getX1, Comparator.naturalOrder()));
             TimeDiagramStatusDto nextStatusDto = statusDtoListOld.get(0);
             if (statusDtoListNew.size() == 0) {
                 statusDtoListNew.add(nextStatusDto);
@@ -357,7 +359,9 @@
                         statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus()));
                     }
                 } else {
-                    if (nextStatusDto.getX2() > currentStatusDto.getX2()) {
+                    if (nextStatusDto.getX1() >= currentStatusDto.getX2()) {
+                        statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
+                    } else if (nextStatusDto.getX2() > currentStatusDto.getX2()) {
                         statusDtoListOld.add(new TimeDiagramStatusDto(currentStatusDto.getX2(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
                     }
                 }
@@ -548,9 +552,31 @@
     }
 
     public List<ProductStatusDto> getStatusData(Long productId, Long taskId) {
-        List<ProductStatusDto> childList = this.getProduct(productId, taskId);
+
+        List<ProductStatusDto> dbList = this.getProduct(productId, taskId);
+        List<ProductStatusDto> childList = new ArrayList<>();
+        for (ProductStatusDto item : dbList) {
+            if (item.getSameSbNum() > 1) {
+                for (int i = 1; i <= item.getSameSbNum(); i++) {
+                    try {
+                        ProductStatusDto newRow = item.clone();
+                        newRow.setDeviceNo(i);
+                        newRow.setName(item.getName() + "-" + i);
+                        newRow.setDataId(item.getId().toString() + "-" + i);
+                        childList.add(newRow);
+                    } catch (CloneNotSupportedException e) {
+                        e.printStackTrace();
+                    }
+                }
+            } else {
+                item.setDeviceNo(0);
+                item.setDataId(item.getId().toString());
+                childList.add(item);
+            }
+        }
+        childList.sort(Comparator.comparing(ProductStatusDto::getDeviceNo, Comparator.naturalOrder()));
         for (ProductStatusDto item : childList) {
-            JSONArray jsonArray = dialgramJson.getJSONArray(String.valueOf(item.getId()));
+            JSONArray jsonArray = dialgramJson.getJSONArray(item.getDataId());
             if (jsonArray != null) {
                 this.processJSONArray(jsonArray, item, taskId);
             }
@@ -1029,8 +1055,8 @@
                 // 璁惧
                 Integer deviceNo = node.getDeviceNo();
                 Element nodeTag = parent.addElement("node");
-                nodeTag.addAttribute("name", deviceNo == 0 ? dataId.toString() : dataId.toString()+"-"+deviceNo);
-                nodeTag.addAttribute("real_name", deviceNo == 0 ? product.getName() : product.getName()+"-"+deviceNo);
+                nodeTag.addAttribute("name", deviceNo == 0 ? dataId.toString() : dataId.toString() + "-" + deviceNo);
+                nodeTag.addAttribute("real_name", deviceNo == 0 ? product.getName() : product.getName() + "-" + deviceNo);
                 nodeTag.addAttribute("name_path", product.getNamePath());
                 nodeTag.addAttribute("type", "node");
 
@@ -1179,8 +1205,7 @@
 
     public List<WeakDto> getReliabilityWeakness(Long fzId, Long taskId, Long productId) {
         String filePath = path + "/" + fzId + "/" + "result.xml";
-        List<WeakDto> list = new ArrayList<>();
-        Map<Long, WeakDto> map = new HashMap<>();
+
         String xml;
         InputStream in = null;
         try {
@@ -1200,50 +1225,46 @@
 
         }
 
-        List<WeakDto> productList = baseDao.getProductList(taskId, productId);
-        for (WeakDto dto : productList) {
-            map.put(dto.getId(), dto);
-        }
+        Map<Long, WeakDto> map = new HashMap<>();
         JSONObject xmlJSONObj = XML.toJSONObject(xml);
         JSONArray jsonArray = xmlJSONObj.getJSONObject("ResultNodes").getJSONArray("ResultNode");
         for (int i = 0; i < jsonArray.size(); i++) {
             WeakDto data = new WeakDto();
             Long productId1;
-            Object nameValue = jsonArray.getJSONObject(i).get("name");
-            if (nameValue instanceof Long) {
-                productId1 = (Long) nameValue;
-                if (map.get(productId1) != null) {
-                    WeakDto weakDto = map.get(productId1);
-                    Double mtbfTime = null;
+            String nameValue = jsonArray.getJSONObject(i).get("name").toString();
+            if (StringUtils.isNotBlank(nameValue)) {
+                productId1 = Convert.toLong(nameValue.split("-")[0]);
 
-                    Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf");
-                    Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr");
-                    Double msr = (Double) jsonArray.getJSONObject(i).get("msr");
-
-                    data.setMtbf(mtbf);
-                    data.setMttr(mttr);
-                    data.setMsr(msr);
-
-                    if (weakDto != null) {
-                        data.setId(weakDto.getId());
-                        data.setSort(weakDto.getSort());
-                        data.setPid(weakDto.getPid());
-                        data.setName(weakDto.getName());
-                        data.setProductType(weakDto.getProductType());
-                        data.setTimeRate(weakDto.getTimeRate());
-                        mtbfTime = mtbf / weakDto.getTimeRate();
+                Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf");
+                Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr");
+                Double msr = (Double) jsonArray.getJSONObject(i).get("msr");
+                WeakDto weakDto = new WeakDto();
+                weakDto.setId(productId1);
+                weakDto.setMtbf(mtbf);
+                weakDto.setMttr(mttr);
+                weakDto.setMsr(msr);
+                if (map.get(productId1) == null) {
+                    map.put(productId1, weakDto);
+                } else {
+                    if (weakDto.getMsr() < map.get(productId1).getMsr()) {
+                        map.put(productId1, weakDto);
                     }
-
-                    data.setMtbfTime(mtbfTime);
-                    data.setIsWeak(0);
-
-                    list.add(data);
                 }
             }
         }
+        List<WeakDto> productList = baseDao.getProductList(taskId, productId);
+        for (WeakDto item : productList) {
+            WeakDto dto = map.get(item.getId());
+            item.setMtbf(dto.getMtbf());
+            item.setMttr(dto.getMttr());
+            item.setMsr(dto.getMsr());
+            item.setMtbfTime(dto.getMtbf() / item.getTimeRate());
+            item.setIsWeak(0);
+        }
+
         List<WeakDto> treeList = new ArrayList<>();
-        if (list.size() > 0) {
-            treeList = TreeUtils.build(list);
+        if (productList.size() > 0) {
+            treeList = TreeUtils.build(productList);
             this.getIsweak(treeList.get(0).getChildren());
         }
 
@@ -1301,7 +1322,7 @@
 
             simulatAssessList.add(simulatAssess);
             result = simulateChecK(simulatAssess);
-            if (result!=null){
+            if (result != null) {
                 simulatResult.setType("errorList");
                 simulatResult.setErrList(result);
                 return simulatResult;
@@ -1345,7 +1366,7 @@
             }
         }
         xmlJSONObj = XML.toJSONObject(xml);
-        simulatAssess.setShowProductId(simulatAssess.getProductId());
+        simulatAssess.setShowProductId(simulatAssess.getProductId().toString());
         SimulaDataDto data = this.getResultData(simulatAssess);
         return data;
     }
@@ -1357,50 +1378,47 @@
         samplPeriod = samplPeriod / 60;
         JSONArray jsonArray = xmlJSONObj.getJSONObject("ResultNodes").getJSONArray("ResultNode");
         for (int i = 0; i < jsonArray.size(); i++) {
-            Long productId = null;
-            Object nameValue = jsonArray.getJSONObject(i).get("name");
-            if (nameValue instanceof Long) {
-                productId = (Long) nameValue;
-                if (productId.equals(simulatAssess.getShowProductId())) {
-                    Object object = jsonArray.getJSONObject(i).get("phase");
-                    List<Double> doubleArray = new ArrayList<>();
-                    List<Double> xList = new ArrayList<>();
-                    String availability = null;
-                    if (object instanceof JSONArray) {
-                        JSONArray jsonArray2 = jsonArray.getJSONObject(i).getJSONArray("phase");
-                        for (int j = 0; j < jsonArray2.size(); j++) {
-                            if (availability != null) {
-                                availability = availability + " " + jsonArray2.getJSONObject(j).get("availability");
-                            } else {
-                                availability = (String) jsonArray2.getJSONObject(j).get("availability");
-                            }
+            String nameValue = jsonArray.getJSONObject(i).get("name").toString();
+            if (nameValue.equals(simulatAssess.getShowProductId())) {
+                Object object = jsonArray.getJSONObject(i).get("phase");
+                List<Double> doubleArray = new ArrayList<>();
+                List<Double> xList = new ArrayList<>();
+                String availability = null;
+                if (object instanceof JSONArray) {
+                    JSONArray jsonArray2 = jsonArray.getJSONObject(i).getJSONArray("phase");
+                    for (int j = 0; j < jsonArray2.size(); j++) {
+                        if (availability != null) {
+                            availability = availability + " " + jsonArray2.getJSONObject(j).get("availability");
+                        } else {
+                            availability = (String) jsonArray2.getJSONObject(j).get("availability");
                         }
-                    } else {
-                        JSONObject jsonObject2 = jsonArray.getJSONObject(i).getJSONObject("phase");
-                        availability = (String) jsonObject2.get("availability");
                     }
-
-                    String[] arr = availability.split(" ");
-                    // 閬嶅巻瀛愬瓧绗︿覆鏁扮粍锛屽皢姣忎釜鍏冪礌杞崲涓篸ouble骞跺瓨鍌ㄥ埌double鏁扮粍涓�
-                    Double j = 0.0;
-                    for (int a = 0; a < arr.length; a++) {
-                        j = samplPeriod + j;
-                        doubleArray.add(Double.parseDouble(arr[a]));
-                        xList.add(j);
-                    }
-
-                    param.setXData(xList);
-                    param.setYData(doubleArray);
-                    Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf");
-                    Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr");
-                    Double msr = (Double) jsonArray.getJSONObject(i).get("msr");
-                    data.setMtbf(mtbf);
-                    data.setMttr(mttr);
-                    data.setMsr(msr);
+                } else {
+                    JSONObject jsonObject2 = jsonArray.getJSONObject(i).getJSONObject("phase");
+                    availability = (String) jsonObject2.get("availability");
                 }
-                data.setCurveParam(param);
+
+                String[] arr = availability.split(" ");
+                // 閬嶅巻瀛愬瓧绗︿覆鏁扮粍锛屽皢姣忎釜鍏冪礌杞崲涓篸ouble骞跺瓨鍌ㄥ埌double鏁扮粍涓�
+                Double j = 0.0;
+                for (int a = 0; a < arr.length; a++) {
+                    j = samplPeriod + j;
+                    doubleArray.add(Double.parseDouble(arr[a]));
+                    xList.add(j);
+                }
+
+                param.setXData(xList);
+                param.setYData(doubleArray);
+                Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf");
+                Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr");
+                Double msr = (Double) jsonArray.getJSONObject(i).get("msr");
+                data.setMtbf(mtbf);
+                data.setMttr(mttr);
+                data.setMsr(msr);
             }
+            data.setCurveParam(param);
         }
+
         return data;
     }
 
diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index 9f9eb6e..572c271 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -26,9 +26,11 @@
                                             WHEN b.product_type &lt; 5 THEN
                                                 1 * 1 / basic_mtbf_regulate_tmp
                                             WHEN a.reliab_distrib_type = 1 THEN
-                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate_tmp
+                                                    a.basic_unit_num * a.basic_mtbf_operating_ratio /
+                                                    a.basic_mtbf_regulate_tmp
                                             WHEN a.reliab_distrib_type = 3 THEN
-                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
+                                                    a.basic_unit_num * a.basic_mtbf_operating_ratio /
+                                                    a.basic_mtbf_regul_succ_rate
                                             ELSE 0 END
                                     ) AS WeightedFailure,
                                 sum(
@@ -36,10 +38,10 @@
                                             WHEN b.product_type &lt; 5 THEN
                                                 1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate_tmp
                                             WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
-                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_unit_num * a.basic_mtbf_operating_ratio * a.repair_mttcr /
                                                     a.basic_mtbf_regulate_tmp
                                             WHEN a.repairable = 1 and a.reliab_distrib_type = 3 THEN
-                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_unit_num * a.basic_mtbf_operating_ratio * a.repair_mttcr /
                                                     a.basic_mtbf_regul_succ_rate
                                             ELSE 0
                                             END
@@ -68,26 +70,29 @@
                      ) c
             ) d
         set f.basic_mtbf_regulate_tmp = d.basic_mtbf_regulate_tmp,
-            f.repair_mttcr        = d.repair_mttcr
+            f.repair_mttcr            = d.repair_mttcr
         where f.product_id = d.id;
     </update>
 
     <update id="compute1">
         UPDATE param_data a, product_model b
         SET repair_mttcr = 0
-        where b.ship_id = ${shipId} and repair_mttcr is null;
+        where b.ship_id = ${shipId}
+          and repair_mttcr is null;
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate_tmp = basic_mtbf_regulate
         where b.ship_id = ${shipId};
         UPDATE param_data a, product_model b
-        SET basic_mtbf_regulate_tmp = basic_runs_num /basic_mtbf_regul_succ_rate
-        where b.ship_id = ${shipId} and reliab_distrib_type = 3
+        SET basic_mtbf_regulate_tmp = basic_runs_num / basic_mtbf_regul_succ_rate
+        where b.ship_id = ${shipId}
+          and reliab_distrib_type = 3
     </update>
 
     <update id="compute2">
         UPDATE param_data a, product_model b
-        SET  basic_mtbf_regulate = basic_mtbf_regulate_tmp
-        where b.ship_id = ${shipId} and (reliab_distrib_type = 1 or reliab_distrib_type is null);
+        SET basic_mtbf_regulate = basic_mtbf_regulate_tmp
+        where b.ship_id = ${shipId}
+          and (reliab_distrib_type = 1 or reliab_distrib_type is null);
 
         UPDATE param_data a, product_model b
         SET ai = basic_mtbf_regulate_tmp / (basic_mtbf_regulate_tmp + repair_mttcr)
diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
index 85de5ba..6355eb0 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -161,7 +161,7 @@
                a.name,
                a.product_type,
                a.name_path,
-               a.same_sb_name,
+               b.basic_unit_num as sameSbNum,
                a.equip_type,
                b.reliab_distrib_type,
                b.basic_join_compute,
diff --git a/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml b/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
index 2aa391c..870c6b1 100644
--- a/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
@@ -27,18 +27,19 @@
     <select id="getChildren" resultType="com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto">
         select *
         from (
-                 SELECT f.id, f.name, 0 as sort
+                 SELECT f.id, f.name, 0 as sort, 1 as sameSbNum
                  FROM product_model f
                  WHERE f.id = ${productId}
                    AND f.is_delete = 0
                  union
-                 SELECT f.id, f.name, f.sort
+                 SELECT f.id, f.name, f.sort, g.basic_unit_num as sameSbNum
                  FROM `task_phase` a,
                       task_phase_model b,
                       operat_condit c,
                       operat_condit_model d,
                       model_rbd_node e,
-                      product_model f
+                      product_model f,
+                      param_data g
                  WHERE a.task_id = ${taskId}
                    and d.product_id = ${productId}
                    AND a.is_delete = 0
@@ -51,6 +52,8 @@
                    AND e.is_delete = 0
                    AND f.id = e.node_id
                    AND f.is_delete = 0
+                   AND g.product_id = f.id
+                   AND g.is_delete = 0
                  GROUP BY f.id, f.name, f.sort
              ) as f
         ORDER BY f.sort
diff --git "a/modules/mainPart/src/main/resources/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\207\272\346\250\241\346\235\277.xlsx" "b/modules/mainPart/src/main/resources/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\207\272\346\250\241\346\235\277.xlsx"
index cfdd333..205a4a3 100644
--- "a/modules/mainPart/src/main/resources/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\207\272\346\250\241\346\235\277.xlsx"
+++ "b/modules/mainPart/src/main/resources/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\207\272\346\250\241\346\235\277.xlsx"
Binary files differ
diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index accfeeb..9326360 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -928,8 +928,8 @@
               for (let i = 1; i <= node.getData().basicUnitNum; i++) {
                 if (deviceNoArr.findIndex(item => item === i) === -1) {
                   no = i
-                  node.getData().deviceNo = i
                   if (node.getData().basicUnitNum>1){
+                    node.getData().deviceNo = i
                     node.attr('text/text', node.attr('text/text') + '-' + i)
                   }
                   break
diff --git a/web/src/views/modules/taskReliability/SimulatHistory.vue b/web/src/views/modules/taskReliability/SimulatHistory.vue
index 842b32a..8a3bd42 100644
--- a/web/src/views/modules/taskReliability/SimulatHistory.vue
+++ b/web/src/views/modules/taskReliability/SimulatHistory.vue
@@ -97,7 +97,7 @@
       onTreeSelected(data) {
         if (this.dataForm.id) {
           console.log(data, 'onProductSelected')
-          this.dataForm.showProductId = data.id
+          this.dataForm.showProductId = data.dataId
           this.$refs.SimulatCurve.getProductEcharts(this.dataForm);
         }
       },

--
Gitblit v1.9.1