From 3c54f403c6c9756725f9d016e7ff05c5b64327d0 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 22 十月 2024 14:36:53 +0800
Subject: [PATCH] 关于修改可靠性产品重复
---
web/src/views/modules/basicInfo/XhProductModel.vue | 17
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java | 3
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java | 2
web/src/views/modules/taskReliability/SchemeCompar.vue | 108 +++++
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java | 3
web/src/views/modules/basicInfo/ParamData.vue | 4
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/SimulatAssessDao.java | 13
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 339 ++++++++++++++-----
web/src/views/modules/taskReliability/RBD-edit-img.vue | 67 ++-
web/public/产品结构树导入模板.xlsx | 0
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java | 260 +++++++++++---
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java | 78 +++-
modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml | 44 ++
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 6
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml | 37 ++
web/src/views/modules/taskReliability/SimulatAssess.vue | 14
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 | 13
modules/mainPart/src/main/resources/产品结构树导出模板.xlsx | 0
19 files changed, 778 insertions(+), 232 deletions(-)
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
index 9c43884..b71e115 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -32,6 +32,8 @@
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -123,8 +125,8 @@
@GetMapping("exportData")
@ApiOperation("瀵煎嚭浜у搧妯″瀷")
@LogOperation("瀵煎嚭浜у搧妯″瀷")
- public Result exportDataExcel(Long shipId) {
- xhProductModelService.exportDataExcel(shipId);
+ public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId,String fileName) {
+ xhProductModelService.exportDataExcel(request,response,shipId,fileName);
return null;
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
index 932c99a..25ab7c6 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -1,6 +1,7 @@
package com.zt.life.modules.mainPart.basicInfo.dao;
import com.zt.common.dao.BaseDao;
+import com.zt.life.modules.mainPart.basicInfo.dto.ProductDto;
import com.zt.life.modules.mainPart.basicInfo.model.ProductImg;
import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel;
import org.apache.ibatis.annotations.Mapper;
@@ -43,5 +44,5 @@
Long[] getByPid(Long id);
- void getProductByShip(Long shipId);
+ List<ProductDto> getProductByShip(Long shipId);
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java
index 576e0bf..7eb7d1d 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/ProductImg.java
@@ -38,6 +38,8 @@
@TableField(exist = false)
private String dataId;
@TableField(exist = false)
+ private Integer basicUnitNum;
+ @TableField(exist = false)
private String statusImg;
@TableField(exist = false)
private String productType;
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 b62fc7b..f9a0192 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
@@ -1,5 +1,7 @@
package com.zt.life.modules.mainPart.basicInfo.service;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zt.common.constant.Constant;
import com.zt.common.service.BaseService;
@@ -8,14 +10,17 @@
import com.zt.common.utils.TreeUtils;
import com.zt.common.utils.UUIDUtil;
import com.zt.core.shiro.ImportUtil;
+import com.zt.life.export.service.DownloadService;
import com.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao;
+import com.zt.life.modules.mainPart.basicInfo.dto.ProductDto;
import com.zt.life.modules.mainPart.basicInfo.model.ParamData;
import com.zt.life.modules.mainPart.basicInfo.model.ProductImg;
import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel;
import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService;
-import com.zt.modules.sys.dto.DictTypeDto;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -25,6 +30,9 @@
import com.zt.common.db.query.QueryFilter;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
import java.util.*;
@@ -194,23 +202,37 @@
String xt = com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern); //绯荤粺
String fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern);
String sb = com.zt.core.shiro.ImportUtil.getCellValue(row, 3, pattern); //璁惧
- String sameSbName = com.zt.core.shiro.ImportUtil.getCellValue(row, 4, pattern); //鍚岀被璁惧鍚嶇О
+ String sameSbNumStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 4, pattern); //鍚岀被璁惧鏁伴噺
String equipType = com.zt.core.shiro.ImportUtil.getCellValue(row, 5, pattern); //璁惧绫诲瀷
String reliabDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 6, pattern); //鍙潬鎬у垎甯冪被鍨�
String basicJoinCompute = com.zt.core.shiro.ImportUtil.getCellValue(row, 7, pattern); //鍙傚姞璁$畻
- String basicMtbfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 8, pattern); //mtbf
- String basicMtbfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 9, pattern); //鎴愬姛鐜�
- String basicMtbfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 10, pattern); //杩愯姣�
- String taskMtbcfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 11, pattern); //mtbcf
- String taskMtbcfOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 12, pattern); //mtbcf鍏朵粬鍙傛暟2
- String taskMtbcfOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 13, pattern); //mtbcf鍏朵粬鍙傛暟3
- String taskMtbcfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 14, pattern); //mtbcf鎴愬姛鐜�
- String taskMtbcfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 15, pattern); //mtbcf杩愯姣�
+ String basicMtbfRegulateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 8, pattern); //mtbf
+ String basicMtbfRegulSuccRateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 9, pattern); //鎴愬姛鐜�
+ String basicMtbfOperatingRatioStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 10, pattern); //杩愯姣�
+ String taskMtbcfRegulateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 11, pattern); //mtbcf
+ String taskMtbcfOtherParams2Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 12, pattern); //mtbcf鍏朵粬鍙傛暟2
+ String taskMtbcfOtherParams3Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 13, pattern); //mtbcf鍏朵粬鍙傛暟3
+ String taskMtbcfRegulSuccRateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 14, pattern); //mtbcf鎴愬姛鐜�
+ String taskMtbcfOperatingRatioStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 15, pattern); //mtbcf杩愯姣�
String repairable = com.zt.core.shiro.ImportUtil.getCellValue(row, 16, pattern); //鏄惁鍙淮淇�
String repairDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 17, pattern); //缁翠慨鍙戝竷绫诲瀷
- String repairMttcr = com.zt.core.shiro.ImportUtil.getCellValue(row, 18, pattern); //mttcr
- String repairMttcrOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 19, pattern); //mttcr鍏朵粬鍙傛暟2
- String repairMttcrOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 20, pattern); //mttcr鍏朵粬鍙傛暟3
+ String repairMttcrStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 18, pattern); //mttcr
+ String repairMttcrOtherParams2Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 19, pattern); //mttcr鍏朵粬鍙傛暟2
+ String repairMttcrOtherParams3Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 20, pattern); //mttcr鍏朵粬鍙傛暟3
+
+ Integer sameSbNum = StringUtils.isNotBlank(sameSbNumStr) ? Integer.parseInt(sameSbNumStr) : 1;
+ Double basicMtbfRegulate = StringUtils.isNotBlank(basicMtbfRegulateStr) ? Double.valueOf(basicMtbfRegulateStr) : null;
+ Double basicMtbfRegulSuccRate = StringUtils.isNotBlank(basicMtbfRegulSuccRateStr) ? Double.valueOf(basicMtbfRegulSuccRateStr) : null;
+ Double basicMtbfOperatingRatio = StringUtils.isNotBlank(basicMtbfOperatingRatioStr) ? Double.parseDouble(basicMtbfOperatingRatioStr) : 1.0;
+ Double taskMtbcfRegulate = StringUtils.isNotBlank(taskMtbcfRegulateStr) ? Double.parseDouble(taskMtbcfRegulateStr) : null;
+ Double taskMtbcfOtherParams2 = StringUtils.isNotBlank(taskMtbcfOtherParams2Str) ? Double.parseDouble(taskMtbcfOtherParams2Str) : null;
+ Double taskMtbcfOtherParams3 = StringUtils.isNotBlank(taskMtbcfOtherParams3Str) ? Double.parseDouble(taskMtbcfOtherParams3Str) : null;
+ Double taskMtbcfRegulSuccRate = StringUtils.isNotBlank(taskMtbcfRegulSuccRateStr) ? Double.parseDouble(taskMtbcfRegulSuccRateStr) : null;
+ Double taskMtbcfOperatingRatio = StringUtils.isNotBlank(taskMtbcfOperatingRatioStr) ? Double.parseDouble(taskMtbcfOperatingRatioStr) : 1.0;
+ Double repairMttcr = StringUtils.isNotBlank(repairMttcrStr) ? Double.parseDouble(repairMttcrStr) : null;
+ Double repairMttcrOtherParams2 = StringUtils.isNotBlank(repairMttcrOtherParams2Str) ? Double.parseDouble(repairMttcrOtherParams2Str) : null;
+ Double repairMttcrOtherParams3 = StringUtils.isNotBlank(repairMttcrOtherParams3Str) ? Double.parseDouble(repairMttcrOtherParams3Str) : null;
+
if (StringUtils.isBlank(sb))
continue;
@@ -253,10 +275,6 @@
} else {
curSbId = modelMap.get(sbPath).getId();
paramId = modelMap.get(sbPath).getParamId();
- }
-
- if(StringUtils.isBlank(sameSbName)){
- sameSbName = sb;
}
if (StringUtils.isEmpty(sb)) {
@@ -311,7 +329,7 @@
xhProductModel.setPid(curFxtId == null ? curXtId : curFxtId);
xhProductModel.setId(curSbId);
xhProductModel.setName(sb);
- xhProductModel.setSameSbName(sameSbName);
+ //xhProductModel.setSameSbName(sameSbName);
xhProductModel.setEquipType(equipType);
xhProductModel.setProductType("5");
xhProductModel.setSort(Integer.valueOf(sort));
@@ -320,7 +338,7 @@
xhProductModel.setNamePath(sbPath);
if (insertSb) {
this.insert(xhProductModel);
- }else{
+ } else {
this.update(xhProductModel);
}
@@ -331,45 +349,21 @@
itemEntity.setProductId(curSbId);
itemEntity.setReliabDistribType(reliabType.get(reliabDistribType));
itemEntity.setBasicJoinCompute(isOrNot.get(basicJoinCompute));
- if (StringUtils.isNotBlank(basicMtbfRegulate)) {
- itemEntity.setBasicMtbfRegulate(Double.valueOf(basicMtbfRegulate));
- }
- if (StringUtils.isNotBlank(basicMtbfRegulSuccRate)) {
- itemEntity.setBasicMtbfRegulSuccRate(Double.valueOf(basicMtbfRegulSuccRate));
- }
- if (StringUtils.isNotBlank(basicMtbfOperatingRatio)) {
- itemEntity.setBasicMtbfOperatingRatio(Double.valueOf(basicMtbfOperatingRatio));
- } else {
- itemEntity.setBasicMtbfOperatingRatio(1.0);
- }
- if (StringUtils.isNotBlank(taskMtbcfRegulate)) {
- itemEntity.setTaskMtbcfRegulate(Double.valueOf(taskMtbcfRegulate));
- }
- if (StringUtils.isNotBlank(taskMtbcfOtherParams2)) {
- itemEntity.setTaskMtbcfOtherParams2(Double.valueOf(taskMtbcfOtherParams2));
- }
- if (StringUtils.isNotBlank(taskMtbcfOtherParams3)) {
- itemEntity.setTaskMtbcfOtherParams3(Double.valueOf(taskMtbcfOtherParams3));
- }
- if (StringUtils.isNotBlank(taskMtbcfRegulSuccRate)) {
- itemEntity.setTaskMtbcfRegulSuccRate(Double.valueOf(taskMtbcfRegulSuccRate));
- }
- if (StringUtils.isNotBlank(taskMtbcfOperatingRatio)) {
- itemEntity.setTaskMtbcfOperatingRatio(Double.valueOf(taskMtbcfOperatingRatio));
- } else {
- itemEntity.setTaskMtbcfOperatingRatio(1.0);
- }
+ itemEntity.setBasicUnitNum(sameSbNum);
+ itemEntity.setBasicMtbfRegulate(basicMtbfRegulate);
+ itemEntity.setBasicMtbfRegulSuccRate(basicMtbfRegulSuccRate);
+ itemEntity.setBasicMtbfOperatingRatio(basicMtbfOperatingRatio);
+ itemEntity.setTaskMtbcfRegulate(taskMtbcfRegulate);
+ itemEntity.setTaskMtbcfOtherParams2(taskMtbcfOtherParams2);
+ itemEntity.setTaskMtbcfOtherParams3(taskMtbcfOtherParams3);
+ itemEntity.setTaskMtbcfRegulSuccRate(taskMtbcfRegulSuccRate);
+ itemEntity.setTaskMtbcfOperatingRatio(taskMtbcfOperatingRatio);
itemEntity.setRepairable(isOrNot.get(repairable));
itemEntity.setRepairDistribType(repairType.get(repairDistribType));
- if (StringUtils.isNotBlank(repairMttcr)) {
- itemEntity.setRepairMttcr(Double.valueOf(repairMttcr));
- }
- if (StringUtils.isNotBlank(repairMttcrOtherParams2)) {
- itemEntity.setRepairMttcrOtherParams2(Double.valueOf(repairMttcrOtherParams2));
- }
- if (StringUtils.isNotBlank(repairMttcrOtherParams3)) {
- itemEntity.setRepairMttcrOtherParams3(Double.valueOf(repairMttcrOtherParams3));
- }
+ itemEntity.setRepairMttcr(repairMttcr);
+ itemEntity.setRepairMttcrOtherParams2(repairMttcrOtherParams2);
+ itemEntity.setRepairMttcrOtherParams3(repairMttcrOtherParams3);
+
if (modelMap.get(sbPath) == null) {
paramDataService.insert(itemEntity);
} else {
@@ -414,7 +408,157 @@
return baseDao.getByPid(id);
}
- public void exportDataExcel(Long shipId) {
- baseDao.getProductByShip(shipId);
+ public void exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId, String name) {
+ Map<Integer, String> reliabType = new HashMap<>();
+ reliabType.put(1, "鎸囨暟鍒嗗竷");
+ reliabType.put(3, "浜岄」鍒嗗竷");
+ reliabType.put(2, "濞佸竷灏斿垎甯�");
+ Map<Integer, String> repairType = new HashMap<>();
+ repairType.put(1, "鎸囨暟鍒嗗竷");
+ repairType.put(2, "濞佸竷灏斿垎甯�");
+ Map<Integer, String> isOrNot = new HashMap<>();
+ isOrNot.put(1, "鏄�");
+ isOrNot.put(0, "鍚�");
+
+ List<ProductDto> data = baseDao.getProductByShip(shipId);
+ data = TreeUtils.build(data);
+ List<ProductDto> List = new ArrayList<>();
+ this.writeExcel(data, List);
+ // 璇诲彇妯℃澘鏂囦欢
+ try (InputStream inputStream = getClass().getResourceAsStream("/浜у搧缁撴瀯鏍戝鍑烘ā鏉�.xlsx")) {
+ Workbook workbook = new XSSFWorkbook(inputStream);
+ // 鑾峰彇绗竴涓伐浣滆〃
+ Sheet sheet = workbook.getSheetAt(0);
+ int num = 0;
+ String xt = "";
+ String fxt = "";
+ String sb = "";
+ for (int i = 0; i < List.size(); i++) {
+ if (List.get(i).getProductType() == 5) {
+ num = num + 1;
+ String[] parentList = List.get(i).getNamePath().split(",");
+ Row row = sheet.createRow(sheet.getLastRowNum() + 1); // 鍒涘缓鏂拌
+ Cell cell = row.createCell(0);
+ cell.setCellValue(num);
+ if (parentList.length > 2) {
+ if (!xt.equals(parentList[0])) {
+ xt = parentList[0];
+ cell = row.createCell(1);
+ cell.setCellValue(xt);
+ }
+ if (!fxt.equals(parentList[1])) {
+ fxt = parentList[1];
+ cell = row.createCell(2);
+ cell.setCellValue(fxt);
+ }
+ if (!sb.equals(parentList[2])) {
+ sb = parentList[2];
+ cell = row.createCell(3);
+ cell.setCellValue(sb);
+ }
+ } else {
+ if (!xt.equals(parentList[0])) {
+ xt = parentList[0];
+ cell = row.createCell(1);
+ cell.setCellValue(xt);
+ }
+
+ if (!sb.equals(parentList[1])) {
+ sb = parentList[1];
+ cell = row.createCell(3);
+ cell.setCellValue(sb);
+ }
+ }
+ cell = row.createCell(4);
+ if (StringUtils.isNotBlank(List.get(i).getSameSbName())) {
+ cell.setCellValue(List.get(i).getSameSbName());
+ }
+ cell = row.createCell(5);
+ if (StringUtils.isNotBlank(List.get(i).getEquipType())) {
+ cell.setCellValue(List.get(i).getEquipType());
+ }
+ cell = row.createCell(6);
+ String type = reliabType.get(List.get(i).getReliabDistribType());
+ cell.setCellValue(type);
+ cell = row.createCell(7);
+ String isNot = isOrNot.get(List.get(i).getBasicJoinCompute());
+ cell.setCellValue(isNot);
+ cell = row.createCell(8);
+ if (List.get(i).getBasicMtbfRegulate() != null) {
+ cell.setCellValue(List.get(i).getBasicMtbfRegulate());
+ }
+ cell = row.createCell(9);
+ if (List.get(i).getBasicMtbfRegulSuccRate() != null) {
+ cell.setCellValue(List.get(i).getBasicMtbfRegulSuccRate());
+ }
+ cell = row.createCell(10);
+ if (List.get(i).getBasicMtbfOperatingRatio() != null) {
+ cell.setCellValue(List.get(i).getBasicMtbfOperatingRatio());
+ } else {
+ cell.setCellValue(1.0);
+ }
+ cell = row.createCell(11);
+ if (List.get(i).getTaskMtbcfRegulate() != null) {
+ cell.setCellValue(List.get(i).getTaskMtbcfRegulate());
+ }
+ cell = row.createCell(12);
+ if (List.get(i).getTaskMtbcfOtherParams2() != null) {
+ cell.setCellValue(List.get(i).getTaskMtbcfOtherParams2());
+ }
+ cell = row.createCell(13);
+ if (List.get(i).getTaskMtbcfOtherParams3() != null) {
+ cell.setCellValue(List.get(i).getTaskMtbcfOtherParams3());
+ }
+ cell = row.createCell(14);
+ if (List.get(i).getTaskMtbcfRegulSuccRate() != null) {
+ cell.setCellValue(List.get(i).getTaskMtbcfRegulSuccRate());
+ }
+ cell = row.createCell(15);
+ if (List.get(i).getTaskMtbcfOperatingRatio() != null) {
+ cell.setCellValue(List.get(i).getTaskMtbcfOperatingRatio());
+ } else {
+ cell.setCellValue(1.0);
+ }
+ cell = row.createCell(16);
+ if (List.get(i).getRepairable() != null) {
+ isNot = isOrNot.get(List.get(i).getRepairable());
+ cell.setCellValue(isNot);
+ }
+ cell = row.createCell(17);
+ if (List.get(i).getRepairDistribType() != null) {
+ type = repairType.get(List.get(i).getRepairDistribType());
+ cell.setCellValue(type);
+ }
+ cell = row.createCell(18);
+ if (List.get(i).getRepairMttcr() != null) {
+ cell.setCellValue(List.get(i).getRepairMttcr());
+ }
+ cell = row.createCell(19);
+ if (List.get(i).getRepairMttcrOtherParams2() != null) {
+ cell.setCellValue(List.get(i).getRepairMttcrOtherParams2());
+ }
+ cell = row.createCell(20);
+ if (List.get(i).getRepairMttcrOtherParams3() != null) {
+ cell.setCellValue(List.get(i).getRepairMttcrOtherParams3());
+ }
+ }
+ }
+ response.setContentType("application/octet-stream;charset=UTF-8");
+ String encodedFilename = DownloadService.getNameEncoder(request, name + "_浜у搧缁撴瀯鏍�.xlsx");
+ response.addHeader("Content-Disposition", "attachment;filename=" + encodedFilename);
+ workbook.write(response.getOutputStream());
+
+ } catch (
+ IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ private void writeExcel(List<ProductDto> data, List<ProductDto> List) {
+ for (ProductDto dto : data) {
+ List.add(dto);
+ writeExcel(dto.getChildren(), List);
+ }
}
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
index 3b3c1ba..ee2d484 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java
@@ -13,10 +13,7 @@
import com.zt.common.validator.group.UpdateGroup;
import com.zt.life.modules.mainPart.async.PythonLib;
import com.zt.life.modules.mainPart.taskReliability.dto.*;
-import com.zt.life.modules.mainPart.taskReliability.model.CurveParam;
-import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess;
-import com.zt.life.modules.mainPart.taskReliability.model.Task;
-import com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram;
+import com.zt.life.modules.mainPart.taskReliability.model.*;
import com.zt.life.modules.mainPart.taskReliability.service.SimulatAssessService;
import com.zt.life.modules.mainPart.taskReliability.service.TaskService;
import io.swagger.annotations.Api;
@@ -52,12 +49,6 @@
@Autowired
private RedisTemplate redisTemplate;
- @Autowired
- private PythonLib pythonLib;
-
- @Autowired
- private TaskService taskService;
-
@Autowired
private SimulatAssessService simulatAssessService;
@@ -85,13 +76,26 @@
return Result.ok(data);
}
+ @GetMapping("verify")
+ public Result<String> verify(Long taskId) {
+ String result = simulatAssessService.verify(taskId);
+ result = result.replaceAll("\n", "<br>");
+ return Result.ok(result);
+ }
+
@PostMapping("analyze")
- public Result<Long> analyze(@RequestBody SimulatAssess simulatAssess) {
+ public Result<Object> analyze(@RequestBody SimulatAssess simulatAssess) {
//鏁堥獙鏁版嵁
// Result result = pythonLib.callPython(simulatAssess);
- Result result = simulatAssessService.simulate(simulatAssess);
-
- return result;
+ List<TaskModelCheckResultDto> result = simulatAssessService.simulateChecK(simulatAssess);
+ if (result != null) {
+ return Result.ok(result);
+ }
+ Boolean result2 = simulatAssessService.simulate(simulatAssess);
+ if (result2)
+ return Result.ok();
+ else
+ return Result.error();
}
@PostMapping("getResultXML")
@@ -107,8 +111,8 @@
}
@GetMapping("getStatus")
- public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth,double minPointNum) {
- TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth,minPointNum);
+ public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth, double minPointNum) {
+ TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth, minPointNum);
return Result.ok(data);
}
@@ -137,14 +141,31 @@
}
@GetMapping("getCalcProgress")
- public Result getCalcProgress(Long taskId) {
- String key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS;
- String progress = (String) redisTemplate.opsForValue().get(key);
- if (progress == null) progress = "0";
- if (Objects.equals(progress, "100")) {
- simulatAssessService.deleteSimInfoInRedis(taskId);
+ public Result getCalcProgress(@RequestParam("taskList[]") Long[] taskList) {
+ Integer progress = 0;
+ String progress2 = "";
+ String key = null;
+ if (taskList.length == 1) {
+ key = taskList[0].toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS;
+ progress2 = (String) redisTemplate.opsForValue().get(key);
+ progress = Integer.parseInt(progress2);
+ if (progress == null) progress = 0;
+ if (progress == 100) {
+ //simulatAssessService.deleteSimInfoInRedis(taskId);
+ }
+ } else {
+ for (Long taskId : taskList) {
+ key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS;
+ progress2 = (String) redisTemplate.opsForValue().get(key);
+ progress = progress + Integer.parseInt(progress2);
+ }
+ progress = progress / taskList.length;
+ if (progress == 100) {
+ //simulatAssessService.deleteSimInfoInRedis(taskId);
+ }
}
- return Result.ok(progress);
+
+ return Result.ok(progress.toString());
}
@GetMapping("ReliabilityWeakness")
@@ -154,13 +175,16 @@
}
@GetMapping("SchemeCompar")
- public Result<SchemeComparDto> SchemeCompar(@RequestParam("taskList[]") String[] taskList,Long showProductId) {
- SchemeComparDto data = simulatAssessService.SchemeCompar(taskList,showProductId);
+ public Result<SimulatResult> SchemeCompar(@RequestParam("taskList[]") String[] taskList, Long showProductId, Integer samplPeriod, Integer simulatFrequency) {
+ SimulatResult data = simulatAssessService.SchemeCompar(taskList, showProductId, samplPeriod, simulatFrequency);
return Result.ok(data);
}
-
-
+ @GetMapping("getEcharts")
+ public Result<SchemeComparDto> getEcharts(@RequestParam("taskList[]") String[] taskList, Long showProductId) {
+ SchemeComparDto data = simulatAssessService.getEcharts(taskList, showProductId);
+ return Result.ok(data);
+ }
@PutMapping
@ApiOperation("淇敼")
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/SimulatAssessDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/SimulatAssessDao.java
index f6641dd..eb69acb 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/SimulatAssessDao.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/SimulatAssessDao.java
@@ -1,13 +1,10 @@
package com.zt.life.modules.mainPart.taskReliability.dao;
import com.zt.common.dao.BaseDao;
-import com.zt.life.modules.mainPart.taskReliability.dto.ModelDto;
import com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto;
import com.zt.life.modules.mainPart.taskReliability.dto.WeakDto;
-import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd;
-import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess;
-import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssessTaskPhaseModel;
-import com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram;
+import com.zt.life.modules.mainPart.taskReliability.dto.verifyDto;
+import com.zt.life.modules.mainPart.taskReliability.model.*;
import org.apache.ibatis.annotations.Mapper;
@@ -44,4 +41,10 @@
List<WeakDto> getProductList(Long taskId, Long productId);
SimulatAssess getByTaskId(Long taskModelId);
+
+ List<OperatConditModel> getModel(Long taskId);
+
+ List<verifyDto> getNode(Long modelId);
+
+ Integer getVoteNum(Long id);
}
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java
index f06ca16..9c06c38 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/OperatConditModel.java
@@ -61,4 +61,7 @@
@TableField(exist = false)
private Long iid;
+ @TableField(exist = false)
+ private String content;
+
}
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 40c49cb..e005bea 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
@@ -42,7 +42,7 @@
private String dataType;
@TableField(exist = false)
- private Integer taskDuration;
+ private Double taskDuration;
@ApiModelProperty(value = "浼犵粰绠楁硶搴撶殑xml")
private String xml;
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 83db7f2..27bfa88 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
@@ -6,6 +6,9 @@
import com.zt.life.modules.mainPart.taskReliability.model.*;
import org.springframework.stereotype.Service;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* model_line
@@ -22,10 +25,14 @@
node.setProductId(modelRbd.getProductId());
node.setModelId(modelRbd.getId());
Long[] nodeArr = modelRbd.getNodeArr();
+ Map<Long,Integer> nodeMap = new HashMap<>();
for(Long nodeId :nodeArr){
- node.setId(UUIDUtil.generateId());
- node.setNodeId(nodeId);
- baseDao.insert(node);
+ if (nodeMap.get(nodeId)!=null) {
+ node.setId(UUIDUtil.generateId());
+ node.setNodeId(nodeId);
+ baseDao.insert(node);
+ 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 f6132a6..e9557ad 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
@@ -24,6 +24,7 @@
import com.zt.life.modules.mainPart.taskReliability.dto.TaskPhaseConstraintDto;
import com.zt.life.modules.mainPart.taskReliability.model.*;
import com.zt.life.modules.mainPart.utils.GetStringSpace;
+import io.swagger.models.auth.In;
import org.apache.commons.io.IOUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
@@ -43,7 +44,10 @@
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
+import java.nio.file.FileAlreadyExistsException;
import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -196,9 +200,9 @@
double pointNumPerHour = 60.0 / simulatAssess.getSamplPeriod();
//鏃跺簭鍥剧嚎
- List<List<TimeDiagramStatusDto>> lineArray = new ArrayList();
+ List<TimeDiagramStatusDto> statusDtoList = new ArrayList<>();
+ List<TimeDiagramStatusDto> statusDtoListOld = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
- List<TimeDiagramStatusDto> statusDtoList = new ArrayList<>();
x1 = 0;
groupY = groupHeight * i;
ProductStatusDto dto = list.get(i);
@@ -228,7 +232,11 @@
break;
}
x2 = x1 + status.getTimes() * pointNumPerHour + 5;
- statusDtoList.add(new TimeDiagramStatusDto(x1, x2, status2));
+ if (i == 0) {
+ statusDtoList.add(new TimeDiagramStatusDto(x1, x2, status2));
+ } else {
+ statusDtoListOld.add(new TimeDiagramStatusDto(x1, x2, status2));
+ }
JSONObject lineJson = new JSONObject(templetsStrMap.get(status.getStatus()));
setlineXy(lineJson, x1, y, x2, y, "");
JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus());
@@ -239,8 +247,6 @@
x1 = x2 - 5;
jsonArray.add(lineJson);
}
- lineArray.add(statusDtoList);
-
JSONObject textJson = new JSONObject(templetsStrMap.get("text"));
JsonUtils2.setJsonValueByPath(textJson, "id".split("/"), UUIDUtil.generateId().toString());
JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), dto.getName());
@@ -324,67 +330,73 @@
curPointHour += periodHour;
}
+ List<TimeDiagramStatusDto> statusDtoListNew = new ArrayList<>();
+ while (statusDtoListOld.size() > 0) {
+ statusDtoListOld.stream().sorted(Comparator.comparing(TimeDiagramStatusDto::getX1)).collect(Collectors.toList());
+ TimeDiagramStatusDto nextStatusDto = statusDtoListOld.get(0);
+ if (statusDtoListNew.size() == 0) {
+ statusDtoListNew.add(nextStatusDto);
+ } else {
+ TimeDiagramStatusDto currentStatusDto = statusDtoListNew.get(statusDtoListNew.size() - 1);
+ if (nextStatusDto.getStatus() < currentStatusDto.getStatus()) {
+ if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() == currentStatusDto.getX2()) {
+ currentStatusDto.setStatus(nextStatusDto.getStatus());
+ } else if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() < currentStatusDto.getX2()) {
+ statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus()));
+ currentStatusDto.setStatus(nextStatusDto.getStatus());
+ currentStatusDto.setX2(nextStatusDto.getX2());
+ } else if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() > currentStatusDto.getX2()) {
+ currentStatusDto.setStatus(nextStatusDto.getStatus());
+ currentStatusDto.setX2(nextStatusDto.getX2());
+ } else if (nextStatusDto.getX1() > currentStatusDto.getX1() && nextStatusDto.getX2() >= currentStatusDto.getX2()) {
+ currentStatusDto.setX2(nextStatusDto.getX1());
+ statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
+ } else if (nextStatusDto.getX1() > currentStatusDto.getX1() && nextStatusDto.getX2() < currentStatusDto.getX2()) {
+ currentStatusDto.setX2(nextStatusDto.getX1());
+ statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
+ statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus()));
+ }
+ } else {
+ if (nextStatusDto.getX2() > currentStatusDto.getX2()) {
+ statusDtoListOld.add(new TimeDiagramStatusDto(currentStatusDto.getX2(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
+ }
+ }
+ }
+ statusDtoListOld.remove(0);
+ }
timeDiagramDto.setTotalWidth(x2);
double pointRate = timeDiagramDto.getTotalWidth() / timeDiagramDto.getSmallWidth();
- List<TimeDiagramStatusDto> subStatusDtoList = new ArrayList<>();
- int lastStatus = 5;
- boolean isFirst = true;
- x1 = 0;
- for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) {
- int netStatus = 5;
- for (int j = 1; j < list.size(); j++) {
- if (i >= 448) {
- System.out.println(111);
- }
- int tmpStatus = getPointStatus(lineArray.get(j), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1);
- if (tmpStatus < netStatus) {
- netStatus = tmpStatus;
- }
- }
- if (!isFirst) {
- if (lastStatus != netStatus) {
- subStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
- lastStatus = netStatus;
- x1 = i;
- }
- } else {
- lastStatus = netStatus;
- isFirst = false;
- }
- x2 = i + timeDiagramDto.getMinPointNum() - 1;
- }
- subStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
+ List<List<TimeDiagramStatusDto>> lineArray = new ArrayList();
+ lineArray.add(statusDtoList);
+ lineArray.add(statusDtoListNew);
- List<TimeDiagramStatusDto> parentStatusDtoList = new ArrayList<>();
- lastStatus = 5;
- isFirst = true;
- x1 = 0;
- for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) {
- if (i >= 448) {
- System.out.println(111);
- }
- int netStatus = getPointStatus(lineArray.get(0), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1);
- if (!isFirst) {
- if (lastStatus != netStatus) {
- parentStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
+ List<List<TimeDiagramStatusDto>> smallStatusDtoList = new ArrayList<>();
+ for (int j = 0; j < lineArray.size(); j++) {
+ List<TimeDiagramStatusDto> tmpStatusDtoList = new ArrayList<>();
+ int lastStatus = 5;
+ Boolean isFirst = true;
+ x1 = 0;
+ for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) {
+ int netStatus = getPointStatus(lineArray.get(j), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1);
+ if (!isFirst) {
+ if (lastStatus != netStatus) {
+ tmpStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
+ lastStatus = netStatus;
+ x1 = i;
+ }
+ } else {
lastStatus = netStatus;
- x1 = i;
+ isFirst = false;
}
- } else {
- lastStatus = netStatus;
- isFirst = false;
+ x2 = i + timeDiagramDto.getMinPointNum() - 1;
}
- x2 = i + timeDiagramDto.getMinPointNum() - 1;
+ tmpStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
+ smallStatusDtoList.add(tmpStatusDtoList);
}
- parentStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus));
JSONObject jsonObject2 = new JSONObject(modelStr2);
JSONArray jsonArray2 = jsonObject2.getJSONArray("cells");
- List<List<TimeDiagramStatusDto>> smallStatusDtoList = new ArrayList<>();
- smallStatusDtoList.add(parentStatusDtoList);
- smallStatusDtoList.add(subStatusDtoList);
-
y = 10;
for (int i = 0; i < smallStatusDtoList.size(); i++) {
for (TimeDiagramStatusDto status : smallStatusDtoList.get(i)) {
@@ -606,16 +618,20 @@
}
@Transactional(rollbackFor = Exception.class)
- public Result simulate(SimulatAssess simulatAssess) {
- Result result = null;
+ public List<TaskModelCheckResultDto> simulateChecK(SimulatAssess simulatAssess) {
+ List<TaskModelCheckResultDto> result = null;
// 1. 妫�鏌ユā鍨嬪畬鏁存��
List<TaskModelCheckResultDto> chkResult = taskService.checkTaskModel(simulatAssess.getProductId(),
simulatAssess.getTaskModelId());
if (chkResult.size() > 0) {
- result = Result.ok(chkResult);
- return result;
+ return chkResult;
}
+ return result;
+ }
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean simulate(SimulatAssess simulatAssess) {
+ Boolean result = false;
// 2. 缁勮渚涚畻娉曞簱浠跨湡鐨勬ā鍨媥ml
assembleModelXml(simulatAssess);
@@ -625,8 +641,8 @@
return result;
}
- private Result callReliaSimLib(SimulatAssess simulatAssess) {
- Result result = null;
+ private Boolean callReliaSimLib(SimulatAssess simulatAssess) {
+ Boolean result = false;
InputStream is = null;
BufferedReader br = null;
try {
@@ -658,7 +674,7 @@
ReliaSimLibResult rtn = com.alibaba.fastjson.JSONObject.parseObject(line, ReliaSimLibResult.class);
if ("0".equals(rtn.getCode())) {
logger.info("鍚姩鍙潬鎬т豢鐪熻瘎浼扮畻娉曞簱鎴愬姛銆�");
- result = Result.ok();
+ result = true;
} else {
String errorMsg = rtn.getErrorMsg();
throw new RenException("鍚姩鍙潬鎬т豢鐪熻瘎浼扮畻娉曞簱澶辫触: errorMsg=" + errorMsg);
@@ -720,6 +736,9 @@
List<ParamData> paramDataList = paramDataDao.getDeviceParams(productId);
Long taskId = simulatAssess.getTaskModelId();
Task task = taskService.get(taskId);
+ if (simulatAssess.getTaskDuration() != null) {
+ task.setTaskDuration(simulatAssess.getTaskDuration());
+ }
List<TaskBinoParam> binoParams = taskBinoParamDao.getBinoParams(taskId);
// 1. 璁$畻鍚勪换鍔¢樁娈电殑杩愯鏃堕暱
@@ -1248,43 +1267,55 @@
}
}
- public SchemeComparDto SchemeCompar(String[] taskList, Long showProductId) {
- SchemeComparDto dto = new SchemeComparDto();
+ public SimulatResult SchemeCompar(String[] taskList, Long showProductId, Integer samplPeriod, Integer simulatFrequency) {
+ SimulatResult simulatResult = new SimulatResult();
+ List<Long> idList = new ArrayList<>();
+ List<TaskModelCheckResultDto> result = null;
+/* SchemeComparDto dto = new SchemeComparDto();
List<SimulaDataDto> dataDtoList = new ArrayList<>();
List<SchemeComparCurve> curveList = new ArrayList<>();
List<Double> xData = new ArrayList<>();
- SimulatAssess simulatAssess;
- SimulaDataDto data;
+
+ SimulaDataDto data;*/
+
+ List<SimulatAssess> simulatAssessList = new ArrayList<>();
Task task;
+ double maxTaskDuration = 0.0;
for (String taskId : taskList) {
- Long taskModelId = Long.parseLong(taskId);
- task = taskService.get(taskModelId);
- simulatAssess = this.getByTaskId(taskModelId);
- SimulaDataDto resultData;
- if (showProductId != null) {
- simulatAssess.setProductId(showProductId);
- resultData = this.getResultXML(simulatAssess);
- } else {
- resultData = this.getResultXML(simulatAssess);
+ task = taskService.get(Long.parseLong(taskId));
+ if (task.getTaskDuration() > maxTaskDuration) {
+ maxTaskDuration = task.getTaskDuration();
}
- data = resultData;
- data.setName(task.getTaskName());
- dataDtoList.add(data);
- xData = resultData.getCurveParam().getXData();
+ SimulatAssess simulatAssess = new SimulatAssess();
+ Long id = UUIDUtil.generateId();
+ simulatAssess.setId(id);
+ simulatAssess.setName("");
+ simulatAssess.setProductId(showProductId);
+ simulatAssess.setSamplPeriod(samplPeriod);
+ simulatAssess.setSimulatFrequency(simulatFrequency);
+ simulatAssess.setTaskDuration(maxTaskDuration);
+ simulatAssess.setTaskModelId(Long.parseLong(taskId));
- SchemeComparCurve curve = new SchemeComparCurve();
- curve.setName(task.getTaskName());
- curve.setSmooth(true);
- curve.setType("line");
- curve.setData(resultData.getCurveParam().getYData());
- curveList.add(curve);
+ simulatAssessList.add(simulatAssess);
+ result = simulateChecK(simulatAssess);
+ if (result!=null){
+ simulatResult.setType("errorList");
+ simulatResult.setErrList(result);
+ return simulatResult;
+ }
+ idList.add(id);
}
- dto.setXDataList(xData);
- dto.setDataList(dataDtoList);
- dto.setCurveList(curveList);
- return dto;
+
+ for (SimulatAssess simulatAssess : simulatAssessList) {
+ simulatAssess.setTaskDuration(maxTaskDuration);
+ this.simulate(simulatAssess);
+ }
+
+ simulatResult.setType("idList");
+ simulatResult.setIdList(idList);
+ return simulatResult;
}
public SimulaDataDto getResultXML(SimulatAssess simulatAssess) {
@@ -1371,4 +1402,134 @@
}
return data;
}
+
+ public String verify(Long taskId) {
+ StringBuilder result = new StringBuilder();
+ Task task = taskService.get(taskId);
+ double taskTime = task.getTaskDuration();
+ List<OperatConditModel> list = baseDao.getModel(taskId);
+ List<Double> reliabiyList = new ArrayList<>();
+ String modelStr2 = "";
+ for (OperatConditModel model : list) {
+ if (model.getProductId().equals(task.getProductId())) {
+ modelStr2 = model.getContent();
+ continue;
+ }
+ List<verifyDto> listNodes = baseDao.getNode(model.getModelId());
+ for (verifyDto node : listNodes) {
+ //lmd,reliabiy,failRate
+ double lmd = 1 / node.getMtbf();
+ double reliabiy = Math.exp(-1 * lmd * taskTime);
+ double failRate = 1 - reliabiy;
+ node.setLmd(lmd);
+ node.setReliabiy(reliabiy);
+ node.setFailRate(failRate);
+ }
+ int total = listNodes.size();
+ String modelStr = model.getContent();
+ //鎵惧埌琛ㄥ喅鏁伴噺
+
+ if (modelStr.contains("switch")) {
+ double a = 0;
+ double lmd = listNodes.get(0).getLmd();
+ result.append("\n").append(total).append("涓浉鍚岃澶囨梺鑱�,3閫�1,MTTBCF鏄�").append(listNodes.get(0).getMtbf()).append("\n");
+ for (int i = 0; i <= total - 1; i++) {
+ double ijc = getjc(i);
+ double b = Math.pow(taskTime * lmd, i) * Math.exp(-1 * lmd * taskTime) / ijc;
+ a = a + b;
+ result.append("鏈�").append(i + 1).append("涓澶囧ソ鐨勭殑姒傜巼涓�").append(b).append("\n");
+ }
+ result.append("鏁翠釜鏃佽仈绯荤粺鐨勫彲闈犲害涓�").append(new Formatter().format("%.4f", a)).append("\n");
+ reliabiyList.add(a);
+ } else if (modelStr.contains("parallel")) {
+ double a = 1;
+ result.append("\n骞惰仈璁惧鏈�").append(total).append("涓猏n");
+ for (int i = 0; i < listNodes.size(); i++) {
+ a = a * listNodes.get(i).getFailRate();
+ result.append("绗�").append(i + 1).append("涓澶囩殑MTBCF涓�").append(listNodes.get(i).getMtbf()).append(",").append(i + 1).append("涓澶囧苟鑱旂殑澶辨晥鐜囦负").append(a).append("\n");
+ }
+ double reliabiy = 1 - a;
+ result.append("鏁翠釜骞惰仈绯荤粺鐨勫け鏁堢巼涓�").append(a).append("鏁翠釜骞惰仈绯荤粺鐨勫彲闈犲害涓�").append(new Formatter().format("%.4f", reliabiy)).append("\n");
+ reliabiyList.add(reliabiy);
+ } else if (modelStr.contains("vote")) {
+ Integer voteNum = baseDao.getVoteNum(model.getModelId());
+ if (voteNum != null) {
+ result.append("\n").append(total).append("涓浉鍚岃澶囪〃鍐�,MTBCF涓�").append(listNodes.get(0).getMtbf()).append("琛ㄥ喅鏁伴噺涓�").append(voteNum).append("涓猏n");
+ double a = 0;
+ double zjc = getjc(total);
+ double reliabiy = listNodes.get(0).getReliabiy();
+ for (int i = voteNum; i <= total; i++) {
+ double ijc = getjc(i);
+ double nijc = getjc(total - i);
+ double b = (zjc / (ijc * nijc)) * Math.pow(reliabiy, i) * Math.pow(1 - reliabiy, total - i);
+ a = a + b;
+ result.append("鏈�").append(i).append("涓澶囨槸濂界殑姒傜巼涓�").append(b).append("\n");
+ }
+ result.append("鏁翠釜琛ㄥ喅绯荤粺鐨勫彲闈犲害涓�").append(new Formatter().format("%.4f", a)).append("\n");
+ reliabiyList.add(a);
+ }
+
+ }
+ }
+ double totalReliabiy = 1;
+ if (modelStr2.contains("parallel")) {
+ for (Double reliabiy : reliabiyList) {
+ totalReliabiy = totalReliabiy * (1 - reliabiy);
+ }
+ totalReliabiy = 1 - totalReliabiy;
+ } else {
+ for (Double reliabiy : reliabiyList) {
+ totalReliabiy = totalReliabiy * reliabiy;
+ }
+ }
+ result.append("\n鏁翠釜鎬讳綋绯荤粺鐨勫彲闈犲害涓�").append(totalReliabiy).append("\n");
+ return String.valueOf(result);
+ }
+
+ Double getjc(int a) {
+ double result = 1.0;
+ for (int i = a; i > 0; i--)
+ result = result * i;
+ return result;
+ }
+
+ public SchemeComparDto getEcharts(String[] taskList, Long showProductId) {
+ SchemeComparDto dto = new SchemeComparDto();
+ List<SimulaDataDto> dataDtoList = new ArrayList<>();
+ List<SchemeComparCurve> curveList = new ArrayList<>();
+ List<Double> xData = new ArrayList<>();
+ SimulatAssess simulatAssess;
+ SimulaDataDto data;
+
+ Task task;
+ for (String taskId : taskList) {
+ Long taskModelId = Long.parseLong(taskId);
+ task = taskService.get(taskModelId);
+ simulatAssess = this.getByTaskId(taskModelId);
+ simulatAssess.setDataType("fz");
+ SimulaDataDto resultData;
+ if (showProductId != null) {
+ simulatAssess.setProductId(showProductId);
+ resultData = this.getResultXML(simulatAssess);
+ } else {
+ resultData = this.getResultXML(simulatAssess);
+ }
+
+ data = resultData;
+ data.setName(task.getTaskName());
+ dataDtoList.add(data);
+ xData = resultData.getCurveParam().getXData();
+
+ SchemeComparCurve curve = new SchemeComparCurve();
+ curve.setName(task.getTaskName());
+ curve.setSmooth(true);
+ curve.setType("line");
+ curve.setData(resultData.getCurveParam().getYData());
+ curveList.add(curve);
+ }
+ dto.setXDataList(xData);
+ dto.setDataList(dataDtoList);
+ dto.setCurveList(curveList);
+ return dto;
+ }
}
diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
index d14dfec..85de5ba 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -73,7 +73,8 @@
p.repair_mttcr as repairMttcr,
p.repair_mttcr_other_params2 as repairMttcrOtherParams2,
p.repair_mttcr_other_params3 as repairMttcrOtherParams3,
- p.task_mtbcf_regul_succ_rate as success_rate
+ p.task_mtbcf_regul_succ_rate as success_rate,
+ p.basic_unit_num as basicUnitNum
FROM product_model a
left join sys_dict_data d on d.DICT_VALUE = a.product_type and dict_type_id = '1728965873022050306'
left join param_data p on p.product_id = a.id
@@ -151,6 +152,38 @@
<select id="getByPid" resultType="java.lang.Long">
select id
from product_model
- where IS_DELETE=0 and PID=${id}
+ where IS_DELETE = 0
+ and PID = ${id}
+ </select>
+ <select id="getProductByShip" resultType="com.zt.life.modules.mainPart.basicInfo.dto.ProductDto">
+ select a.id,
+ a.pid,
+ a.name,
+ a.product_type,
+ a.name_path,
+ a.same_sb_name,
+ a.equip_type,
+ b.reliab_distrib_type,
+ b.basic_join_compute,
+ b.basic_mtbf_regulate,
+ b.basic_mtbf_regul_succ_rate,
+ b.basic_mtbf_operating_ratio,
+ b.task_mtbcf_regulate,
+ b.task_mtbcf_other_params2,
+ b.task_mtbcf_other_params3,
+ b.task_mtbcf_regul_succ_rate,
+ b.task_mtbcf_operating_ratio,
+ b.repairable,
+ b.repair_distrib_type,
+ b.repair_mttcr,
+ b.repair_mttcr_other_params2,
+ b.repair_mttcr_other_params3
+ from product_model a,
+ param_data b
+ where a.IS_DELETE = 0
+ and b.IS_DELETE = 0
+ and a.ship_id = ${shipId}
+ AND a.id <> a.ship_id
+ and a.id = b.product_id
</select>
</mapper>
diff --git a/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml b/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
index fe82e4a..2aa391c 100644
--- a/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
@@ -186,4 +186,48 @@
order by CREATE_DATE desc
limit 1
</select>
+ <select id="getModel" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel">
+ SELECT d.product_id,
+ d.model_id,
+ e.content
+ FROM task a,
+ task_phase b,
+ `task_phase_model` c,
+ operat_condit_model d,
+ model_rbd e
+ WHERE a.id = ${taskId}
+ AND a.IS_DELETE = 0
+ AND b.task_id = a.id
+ AND b.IS_DELETE = 0
+ AND c.phase_id = b.id
+ AND c.operat_condit_duration_rate > 0
+ AND c.IS_DELETE = 0
+ AND d.operat_condit_id = c.operat_condit_id
+ AND d.IS_DELETE = 0
+ AND e.id = d.model_id
+ AND e.IS_DELETE = 0
+ </select>
+ <select id="getNode" resultType="com.zt.life.modules.mainPart.taskReliability.dto.verifyDto">
+ SELECT c.`NAME`,
+ c.id,
+ b.task_mtbcf_regulate as mtbf
+ FROM `model_rbd_node` a,
+ param_data b,
+ product_model c
+ WHERE a.node_id = c.id
+ and a.model_id = ${modelId}
+ AND c.id = b.product_id
+ AND a.is_delete = 0
+ AND b.is_delete = 0
+ AND c.is_delete = 0
+ </select>
+ <select id="getVoteNum" resultType="java.lang.Integer">
+ select vote_num
+ from algorithm
+ where is_delete = 0
+ and model_id = ${modelId}
+ and model_type = 'vote'
+ and vote_num is not null
+ limit 1
+ </select>
</mapper>
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"
new file mode 100644
index 0000000..cfdd333
--- /dev/null
+++ "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/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
index 16e9415..1744f00 100644
--- "a/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
+++ "b/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
diff --git a/web/src/views/modules/basicInfo/ParamData.vue b/web/src/views/modules/basicInfo/ParamData.vue
index 5519625..646faae 100644
--- a/web/src/views/modules/basicInfo/ParamData.vue
+++ b/web/src/views/modules/basicInfo/ParamData.vue
@@ -120,12 +120,12 @@
<span v-else v-text="scope.row.basicMtbfAcceptSuccRate"></span>
</template>
</el-table-column>-->
- <!-- <el-table-column prop="basicUnitNum" label="鍗曞厓鏁伴噺" :key="11" width="100" align="center">
+ <el-table-column prop="basicUnitNum" label="鍗曞厓鏁伴噺" :key="11" width="100" align="center">
<template slot-scope="scope">
<el-input v-if="scope.row.isEdit" v-model="scope.row.basicUnitNum"></el-input>
<span v-else v-text="scope.row.basicUnitNum"></span>
</template>
- </el-table-column>-->
+ </el-table-column>
<el-table-column prop="basicRunsNum" label="杩愯娆℃暟" :key="12" width="100" align="center">
<template slot-scope="scope">
<el-input v-if="scope.row.isEdit" v-model="scope.row.basicRunsNum"></el-input>
diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue
index 3673ff5..e564467 100644
--- a/web/src/views/modules/basicInfo/XhProductModel.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel.vue
@@ -69,6 +69,7 @@
import Cookies from "js-cookie";
import TyProductModel from "./TyProductModel-AddOrUpdate";
import ProductImport from "./ProductImport";
+ import qs from 'qs'
export default {
data() {
@@ -81,7 +82,8 @@
type: '',
pid: '',
srcId: '',
- }
+ },
+ productType:''
}
},
components: {
@@ -146,10 +148,15 @@
this.$refs.ProductImport.$refs.dialog.init(row)
},
async exportData(row) {
- let params = {
- shipId:row.id
- }
- let res = await this.$http.get(`/basicInfo/XhProductModel/exportData`,{params:params})
+ console.log(row)
+ let params = qs.stringify({
+ 'token': Cookies.get('token'),
+ shipId:row.id,
+ fileName:row.name
+ })
+ let apiURL = `/basicInfo/XhProductModel/exportData`
+ window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
+
},
diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index b96eb43..e0edfc2 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -514,6 +514,7 @@
},
data() {
return {
+ canAdd: true,
nodeX: '',
nodeY: '',
isFirstLoad: true,
@@ -905,26 +906,46 @@
})
this.graph.centerContent()
const stencil = new Addon.Stencil({
- getDragNode: (node) => node.clone({keepId: true}),
+ //getDragNode: (node) => node.clone({keepId: true}),
getDropNode: (node) => {
+ this.canAdd = true
const {width, height} = node.size()
- if (node.getData().type && node.getData().nodeType === 'dashedBox') {
- return node.clone().size(60, 40)
- }
if (node.getData().type && node.getData().type === 'imageNodes2') {
- return node.clone({keepId: true})
- } else {
- return node.clone()
- }
- },
- validateNode: (node) => {
- const existingNodes = this.graph.getNodes(); // 鑾峰彇鐢诲竷涓婃墍鏈夎妭鐐�
- for (const existingNode of existingNodes) {
- if (existingNode.id === node.id) {
- this.$message({message: '璇ヨ澶囪妭鐐瑰凡鍦ㄧ敾甯冧笂锛屾棤娉曞啀娆$粯鍒�', type: 'warning'})
- return false; // 鍙栨秷娣诲姞鑺傜偣鎿嶄綔
+ const nodes = this.graph.getNodes()
+ let deviceNoArr = []
+ // 妫�鏌ラ櫎褰撳墠鑺傜偣涔嬪鐨勬墍鏈夎妭鐐圭殑鍖呭洿妗嗘槸鍚︾浉浜�
+ for (const node2 of nodes) {
+ console.log(node2, 'saveDiagram node')
+ if (node2.getData().nodeType == 'node' && node2.getData().dataId) {
+ if (node2.getData().dataId == node.getData().dataId) {
+ deviceNoArr.push(node2.getData().deviceNo)
+ }
+ }
+ }
+ let no = 0
+ console.log(node, 'node')
+ console.log(deviceNoArr, 'deviceNoArr')
+ for (let i = 1; i <= node.getData().basicUnitNum; i++) {
+ if (deviceNoArr.findIndex(item => item === i) === -1) {
+ no = i
+ node.getData().deviceNo = i
+ node.attr('text/text', node.attr('text/text') + '-' + i)
+ break
+ }
+ }
+ if (no === 0) {
+ this.canAdd = false
}
}
+ return node.clone()
+
+ },
+ validateNode: (node) => {
+ if (!this.canAdd) {
+ this.$message({message: '璇ヨ澶囪妭鐐瑰凡鍦ㄧ敾甯冧笂锛屾棤娉曞啀娆$粯鍒�', type: 'warning'})
+ return false
+ }
+
},
title: '',
target: this.graph,
@@ -1003,10 +1024,12 @@
//imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`,
width: 60,
height: 60,
- id: item.dataId, // 鎵嬪姩璁剧疆鑺傜偣鐨� ID
+ //id: item.dataId, // 鎵嬪姩璁剧疆鑺傜偣鐨� ID
data: {
type: 'imageNodes2',
dataId: item.dataId,
+ basicUnitNum: item.basicUnitNum,
+ deviceNo: 0,
nodeType: item.nodeType,
nodeTypeExt: item.nodeTypeExt,
productType: item.productType,
@@ -1174,7 +1197,7 @@
}
const nodeType = node.getData().nodeType; // 鑾峰彇鑺傜偣鐨勭被鍨�
const nodeObj = node
- console.log(123)
+ console.log(node.id, 'node.id')
let intersectNode = this.findIntersectsNode(node)
if (intersectNode) { // 褰撴湁鑺傜偣鐩镐氦 ==>骞惰
this.addBranch(intersectNode, nodeObj)
@@ -1941,12 +1964,12 @@
createParallelBrach(x, y, dragNode) {
dragNode.position(x + 320, y - dragNode.size().height / 2)
const connectNode = this.createConnectNode(x + 50, y)
- this.createBrach(dragNode,connectNode,x,y-50)
- this.createBrach(dragNode,connectNode,x,y+50)
+ this.createBrach(dragNode, connectNode, x, y - 50)
+ this.createBrach(dragNode, connectNode, x, y + 50)
return {newStartNode: connectNode, newEndNode: dragNode}
},
- createBrach(dragNode,connectNode,x,y){
+ createBrach(dragNode, connectNode, x, y) {
const dashedBox = this.createDashedBox(x + 150, y)
dragNode.setData({startNodeId: connectNode.id})
@@ -1956,7 +1979,7 @@
router: {
name: 'manhattan',
args: {
- startDirections: ['top','bottom'], // 浠庝笅鏂瑰紑濮�
+ startDirections: ['top', 'bottom'], // 浠庝笅鏂瑰紑濮�
endDirections: ['left'], // 鍚戝乏鏂圭粨鏉�
},
},
@@ -1970,7 +1993,7 @@
name: 'manhattan',
args: {
startDirections: ['right'], // 浠庝笅鏂瑰紑濮�
- endDirections: ['top','bottom'], // 鍚戝乏鏂圭粨鏉�
+ endDirections: ['top', 'bottom'], // 鍚戝乏鏂圭粨鏉�
},
},
connector: {name: 'rounded'},
diff --git a/web/src/views/modules/taskReliability/SchemeCompar.vue b/web/src/views/modules/taskReliability/SchemeCompar.vue
index 6504887..8db5fa8 100644
--- a/web/src/views/modules/taskReliability/SchemeCompar.vue
+++ b/web/src/views/modules/taskReliability/SchemeCompar.vue
@@ -9,10 +9,21 @@
<zt-select style="width: 400px" v-model="dataForm.taskModelId" :datas="schemeList"
@change="onTaskSelected" :multiple="true"/>
</zt-form-item>
+ <zt-form-item label="鏃堕棿鍒嗙墖" prop="samplPeriod">
+ <el-input type="number" :min="1" v-model="dataForm.samplPeriod">
+ <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">
+ <template slot="append">娆℃暟</template>
+ </el-input>
+ </zt-form-item>
<zt-form-item>
<zt-button @click="compair()">鏂规瀵规瘮</zt-button>
</zt-form-item>
</el-form>
+ <el-progress v-if="isShow" :percentage="percentage"></el-progress>
<el-col :span="4">
<div style="margin-right: 5px;height: calc(100vh - 230px)" v-if="isSelect">
<product-model-tree @on-selected="onTreeSelected" showXdy="false"
@@ -21,7 +32,7 @@
</el-col>
<el-col :span="20">
<div class="fa-card-a" style="position: relative;height: calc(100vh - 230px)">
- <div v-if="isShow">
+ <div v-if="Show">
<el-button v-if="isZk" type="info" size="small" icon="el-icon-caret-bottom"
style="position: absolute;right: 10%;top: 9%;z-index: 1" @click="zk()"></el-button>
<el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right"
@@ -39,7 +50,7 @@
width="100px"
align="right">
<template slot-scope="scope">
- <span>{{ keepNumber(scope.row.mtbf) }}</span>
+ <span>{{ keepNumberBy2(scope.row.mtbf) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -48,7 +59,7 @@
width="100px"
align="right">
<template slot-scope="scope">
- <span>{{ keepNumber(scope.row.mttr) }}</span>
+ <span>{{ keepNumberBy2(scope.row.mttr) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -57,7 +68,7 @@
width="100px"
align="right">
<template slot-scope="scope">
- <span>{{ keepNumber(scope.row.mttr) }}</span>
+ <span>{{ keepNumberBy4(scope.row.msr) }}</span>
</template>
</el-table-column>
</el-table>
@@ -69,6 +80,24 @@
</div>
</el-col>
</el-row>
+ <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�"
+ width="60%" @close="dialogVisible = false">
+ <el-tag type="danger" style="margin-bottom: 10px">妯″瀷瀹氫箟/鍙傛暟閰嶇疆閲屽瓨鍦ㄤ互涓嬮棶棰橈細</el-tag>
+ <el-table :data="modelCheckResult" height="350"
+ :header-cell-style="{'text-align':'center'}">
+ <el-table-column prop="category" label="妫�鏌ョ粨鏋�" align="center" width="150"/>
+ <el-table-column prop="taskName" label="浠诲姟鍚嶇О" align="center"/>
+ <el-table-column prop="taskPhaseName" label="浠诲姟闃舵鍚嶇О" align="center"/>
+ <el-table-column prop="gkName" label="宸ュ喌鍚嶇О" align="center"/>
+ <el-table-column prop="nodeName" label="鑺傜偣鍚嶇О" align="center"/>
+ <el-table-column prop="modelName" label="妯″瀷鍚嶇О" align="center"/>
+ <el-table-column prop="deviceName" label="璁惧鍚嶇О" align="center"/>
+ <el-table-column prop="paramName" label="鍙傛暟鍚嶇О" align="center"/>
+ </el-table>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="primary" @click="dialogVisible = false">鍏� 闂�</el-button>
+ </div>
+ </el-dialog>
</div>
</template>
@@ -83,6 +112,7 @@
myChartStyle: {float: "left", width: "100%", height: "600px"}, //鍥捐〃鏍峰紡
isSelect: false,
isShow: false,
+ Show: false,
isZk: true,
productList: [],
schemeList: [],
@@ -92,20 +122,32 @@
productId: '',
showProductId: '',
dataType: 'fz',
+ samplPeriod: '10',
+ simulatFrequency: 500,
},
+ percentage: 2,
xDataList: [],
seriesList: [],
tableData: [],
taskList: [],
+ fzIdList: [],
+ dialogVisible: false,
+ modelCheckResult: [],
}
},
mounted() {
this.getProductList()
},
computed: {
- keepNumber() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+ keepNumberBy4() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
return function (val) { // 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
const numM = Number(val).toFixed(5);
+ return numM.substring(0, numM.length - 1);
+ }
+ },
+ keepNumberBy2() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+ return function (val) { // 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
+ const numM = Number(val).toFixed(3);
return numM.substring(0, numM.length - 1);
}
},
@@ -113,7 +155,13 @@
components: {
ProductModelTree,
},
-
+ watch: {
+ percentage() {
+ if (this.percentage === 100) {
+ this.getEcharts();
+ }
+ }
+ },
methods: {
onTreeSelected(data) {
if (this.dataForm.taskModelId.length > 0) {
@@ -121,7 +169,7 @@
console.log(data, 'onProductSelected')
this.dataForm.showProductId = data.id
this.$nextTick(() => {
- this.compair()
+ this.getEcharts()
})
}
},
@@ -157,19 +205,59 @@
console.log(res.data)
this.schemeList = res.data
},
+ getStroke() {
+ if (this.percentage < 100) {
+ let param = {
+ taskList: this.fzIdList
+ }
+ this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress`, {params: param}).then(
+ res => {
+ if (res.data) {
+ this.percentage = parseFloat(res.data)
+ }
+ }
+ )
+ } else {
+ clearInterval(this.timers)
+ this.percentage = 0
+ }
+ },
async compair() {
+ this.isShow = true
+ this.dialogVisible = false
+ this.modelCheckResult = []
+ let params = {
+ taskList: this.dataForm.taskModelId,
+ showProductId: this.dataForm.productId,
+ samplPeriod: this.dataForm.samplPeriod,
+ simulatFrequency: this.dataForm.simulatFrequency
+ }
+ console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId')
+ let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params})
+ console.log(res.data, "res")
+ if (res.success) {
+ if (res.data.type=="errorList") {
+ this.modelCheckResult = res.data.errList
+ this.dialogVisible = true
+ this.isShow = false
+ } else {
+ this.fzIdList = res.data.idList
+ this.timers = window.setInterval(this.getStroke, 1000)
+ }
+ }
+ },
+ async getEcharts() {
let params = {
taskList: this.dataForm.taskModelId,
showProductId: this.dataForm.showProductId
}
- console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId')
- let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params})
+ let res = await this.$http.get('/taskReliability/SimulatAssess/getEcharts', {params: params})
console.log(res.data, "res")
this.xDataList = res.data.xdataList
this.seriesList = res.data.curveList
this.tableData = res.data.dataList
- this.isShow = true
+ this.Show = true
this.option = {
xAxis: {
data: this.xDataList,
diff --git a/web/src/views/modules/taskReliability/SimulatAssess.vue b/web/src/views/modules/taskReliability/SimulatAssess.vue
index e957d47..a864ee6 100644
--- a/web/src/views/modules/taskReliability/SimulatAssess.vue
+++ b/web/src/views/modules/taskReliability/SimulatAssess.vue
@@ -35,9 +35,9 @@
</div>
</el-col>
</el-row>
- <el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�" width="60%" @close="dialogVisible = false">
- <el-tag type="danger">妯″瀷瀹氫箟/鍙傛暟閰嶇疆閲屽瓨鍦ㄤ互涓嬮棶棰橈細</el-tag>
- <el-table :data="modelCheckResult" height="100px" v-adaptive="{bottomOffset:30}"
+ <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�" width="60%" @close="dialogVisible = false">
+ <el-tag type="danger" style="margin-bottom: 10px">妯″瀷瀹氫箟/鍙傛暟閰嶇疆閲屽瓨鍦ㄤ互涓嬮棶棰橈細</el-tag>
+ <el-table :data="modelCheckResult" height="350"
:header-cell-style="{'text-align':'center'}">
<el-table-column prop="category" label="妫�鏌ョ粨鏋�" align="center" width="150"/>
<el-table-column prop="taskName" label="浠诲姟鍚嶇О" align="center"/>
@@ -115,6 +115,7 @@
console.log(data, ' onProductSelected(data)')
this.dataForm.productId = data.id
this.getTaskList()
+ this.dataForm.taskModelId = ''
this.$nextTick(() => {
this.$refs.ProductModelTree.getProductList()
})
@@ -138,7 +139,10 @@
},
getStroke() {
if (this.percentage < 100) {
- this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress?taskId=${this.dataForm.id}`).then(
+ let param = {
+ taskList: [this.dataForm.id]
+ }
+ this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress`, {params: param}).then(
res => {
if (res.data) {
this.percentage = parseFloat(res.data)
@@ -159,7 +163,7 @@
let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm)
if (res.success) {
console.log(res.data)
- if (res.data != null && res.data.length > 0) {
+ if (res.data && res.data.length > 0) {
this.modelCheckResult = res.data
this.dialogVisible = true
} else {
--
Gitblit v1.9.1