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; //åå è®¡ç® 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,31 @@ @ApiModelProperty(value = "æåº") private Integer sort; @ApiModelProperty(value = "åç±»è®¾å¤æ°é") @TableField(exist = false) 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; } } 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); } } } 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; } } 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) modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/SimulatAssess.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.zt.common.constant.Bool; import com.zt.common.entity.BusiEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -36,7 +37,7 @@ private Integer simulatFrequency; @TableField(exist = false) private Long showProductId; private String showProductId; @TableField(exist = false) private String dataType; @@ -44,6 +45,9 @@ @TableField(exist = false) private Double taskDuration; @TableField(exist = false) private Boolean repairDiracFlag; @ApiModelProperty(value = "ä¼ ç»ç®æ³åºçxml") private String xml; modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelRbdNodeService.java
@@ -27,7 +27,7 @@ Long[] nodeArr = modelRbd.getNodeArr(); Map<Long,Integer> nodeMap = new HashMap<>(); for(Long nodeId :nodeArr){ if (nodeMap.get(nodeId)!=null) { if (nodeMap.get(nodeId) == null) { node.setId(UUIDUtil.generateId()); node.setNodeId(nodeId); baseDao.insert(node); 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); } @@ -1214,8 +1240,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 { @@ -1235,50 +1260,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(); } data.setMtbfTime(mtbfTime); data.setIsWeak(0); list.add(data); 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); } } } } 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()); } @@ -1380,7 +1401,7 @@ } } xmlJSONObj = XML.toJSONObject(xml); simulatAssess.setShowProductId(simulatAssess.getProductId()); simulatAssess.setShowProductId(simulatAssess.getProductId().toString()); SimulaDataDto data = this.getResultData(simulatAssess); return data; } @@ -1392,11 +1413,8 @@ 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())) { 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<>(); @@ -1435,7 +1453,7 @@ } data.setCurveParam(param); } } return data; } modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -26,9 +26,11 @@ WHEN b.product_type < 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 < 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 @@ -75,19 +77,22 @@ <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 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); 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) 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, 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 modules/mainPart/src/main/resources/²úÆ·½á¹¹Ê÷µ¼³öÄ£°å.xlsxBinary files differ
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 web/src/views/modules/taskReliability/SimulatAssess.vue
@@ -9,16 +9,19 @@ <zt-select v-model="dataForm.taskModelId" :datas="taskList" @change="onTaskSelected"/> </zt-form-item> <zt-form-item label="æ¶é´åç" prop="samplPeriod"> <el-input type="number" :min="1" v-model="dataForm.samplPeriod"> <el-input type="number" :min="1" v-model="dataForm.samplPeriod" style="width: 150px;vertical-align: baseline;"> <template slot="append">åé</template> </el-input> </zt-form-item> <zt-form-item label="ä»¿çæ¬¡æ°" prop="simulatFrequency"> <el-input type="number" :min="1" v-model="dataForm.simulatFrequency"> <el-input type="number" :min="1" v-model="dataForm.simulatFrequency" style="width: 150px;vertical-align: baseline;"> <template slot="append">次æ°</template> </el-input> </zt-form-item> <zt-form-item> <el-form-item prop="repairDiracFlag" label-width="150px" style="margin-left: 20px"> <el-checkbox v-model="dataForm.repairDiracFlag">å¯ä¿®è®¾å¤å¯é 度为1</el-checkbox> </el-form-item> <zt-form-item style="margin-left: 20px"> <zt-button @click="analyze()">仿çåæ</zt-button> </zt-form-item> </el-form> @@ -81,6 +84,7 @@ samplPeriod: '10', simulatFrequency: 500, simulatTime: '', repairDiracFlag: false }, dialogVisible: false, modelCheckResult: [], 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); } },