From 5cea5dff7f0d73c1b172252936b393fb390ab669 Mon Sep 17 00:00:00 2001 From: xyc <jc_xiong@hotmail.com> Date: 星期六, 12 十月 2024 09:31:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramStatusDto.java | 16 ++ web/src/views/modules/taskReliability/ConfigNode/configNode.vue | 8 web/src/views/modules/basicInfo/XhProductModel.vue | 11 + web/src/views/modules/taskReliability/TimeDiagram.vue | 81 +++------ modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java | 1 web/src/views/modules/taskReliability/SchemeCompar.vue | 2 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java | 2 web/src/views/modules/baseReliability/ParamDataBasic.vue | 22 ++ web/src/views/modules/basicInfo/ParamData.vue | 12 - modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/dao/ParamDataBasicDao.java | 2 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 174 +++++++++++++++++++-- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramDto.java | 13 + web/src/views/modules/taskReliability/RBD-edit-img.vue | 23 +- web/public/产品结构树导入模板.xlsx | 0 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java | 4 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/SimulatAssessController.java | 6 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java | 1 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml | 45 ++++- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 35 ++- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/TimeDiagram.java | 2 web/src/views/modules/taskReliability/SimulatCurve.vue | 4 21 files changed, 330 insertions(+), 134 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/dao/ParamDataBasicDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/dao/ParamDataBasicDao.java index 668bcf3..5714ed4 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/dao/ParamDataBasicDao.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/dao/ParamDataBasicDao.java @@ -23,4 +23,6 @@ void compute(Long shipId,Integer productType); void compute2(Long shipId); + + void compute1(Long shipId); } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java index 6868f9d..1dade4f 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/baseReliability/service/ParamDataBasicService.java @@ -46,6 +46,7 @@ } public void compute(Long shipId) { + baseDao.compute1(shipId); baseDao.compute(shipId, 4); baseDao.compute(shipId, 3); baseDao.compute(shipId, 2); 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 e9b3576..9c43884 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 @@ -69,8 +69,8 @@ } @GetMapping("tree") - public Result<List<XhProductModel>> getTreeList(Boolean showXdy, Integer ztShow,Long productId) { - List<XhProductModel> list = xhProductModelService.getAllTree(showXdy, ztShow,productId); + public Result<List<XhProductModel>> getTreeList(Boolean showXdy, Integer ztShow, Long productId) { + List<XhProductModel> list = xhProductModelService.getAllTree(showXdy, ztShow, productId); return Result.ok(list); } @@ -120,6 +120,15 @@ return result; } + @GetMapping("exportData") + @ApiOperation("瀵煎嚭浜у搧妯″瀷") + @LogOperation("瀵煎嚭浜у搧妯″瀷") + public Result exportDataExcel(Long shipId) { + xhProductModelService.exportDataExcel(shipId); + + return null; + } + @PostMapping @ApiOperation("鏂板") @@ -132,12 +141,12 @@ if (xhProductModel.getSort() == null || xhProductModel.getSort() < no) { xhProductModel.setSort(no + 1); } - if (xhProductModel.getProductType().equals("2")){ + if (xhProductModel.getProductType().equals("2")) { Long id = UUIDUtil.generateId(); xhProductModel.setId(id); xhProductModel.setShipId(id); - ParamData data =new ParamData(); + ParamData data = new ParamData(); data.setShipId(id); data.setProductId(id); @@ -156,10 +165,10 @@ xhProductModel.setId(null); xhProductModel.setSort(xhProductModel.getSort()); xhProductModel.setProductType(xhProductModel.getNodeType()); - if (xhProductModel.getNamePath()==null){ + if (xhProductModel.getNamePath() == null) { xhProductModel.setNamePath(xhProductModel.getName()); - }else{ - xhProductModel.setNamePath(xhProductModel.getNamePath()+","+xhProductModel.getName()); + } else { + xhProductModel.setNamePath(xhProductModel.getNamePath() + "," + xhProductModel.getName()); } this.insert(xhProductModel); } @@ -188,18 +197,18 @@ return Result.ok(); } - private void deleteByProduct(Long[] ids){ - for(Long id : ids){ + private void deleteByProduct(Long[] ids) { + for (Long id : ids) { XhProductModel data = xhProductModelService.get(id); - if (data.getProductType().equals("1")||data.getProductType().equals("3")||data.getProductType().equals("4")){ + if (data.getProductType().equals("1") || data.getProductType().equals("3") || data.getProductType().equals("4")) { xhProductModelService.deleteLogic(id); /* List<Long> list =xhProductModelService.getByPid(id); Long[] L = list.stream().toArray(Long[]::new);*/ - Long[] list =xhProductModelService.getByPid(id); + Long[] list = xhProductModelService.getByPid(id); this.deleteByProduct(list); - }else if(data.getProductType().equals("2")){ + } else if (data.getProductType().equals("2")) { xhProductModelService.deleteByShipId(data.getShipId()); - }else if(data.getProductType().equals("5")){ + } else if (data.getProductType().equals("5")) { xhProductModelService.deleteLogic(id); } } 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 57671ea..932c99a 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 @@ -42,4 +42,6 @@ void deleteByPid(Long id); Long[] getByPid(Long id); + + void getProductByShip(Long shipId); } 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 f4ceb65..b62fc7b 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 @@ -413,4 +413,8 @@ public Long[] getByPid(Long id) { return baseDao.getByPid(id); } + + public void exportDataExcel(Long shipId) { + baseDao.getProductByShip(shipId); + } } diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java index 4e53127..432d7b2 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java @@ -127,6 +127,7 @@ return result ? Result.ok() : Result.error("瑙f瀽澶辫触"); } + @PostMapping("layout") @ApiOperation("鑷姩鎺掔増") @LogOperation("鑷姩鎺掔増") 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 6b5e710..3b3c1ba 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 @@ -107,8 +107,8 @@ } @GetMapping("getStatus") - public Result<String> getTimeDiagram(Long productId, Long taskId, Long fzId) { - String data = simulatAssessService.getTimeDiagram(productId, taskId, fzId); + 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); } @@ -160,6 +160,8 @@ } + + @PutMapping @ApiOperation("淇敼") @LogOperation("淇敼") diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramDto.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramDto.java new file mode 100644 index 0000000..27b93b7 --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramDto.java @@ -0,0 +1,13 @@ +package com.zt.life.modules.mainPart.taskReliability.dto; + +import lombok.Data; + +@Data +public class TimeDiagramDto { + private double smallWidth; + private double totalWidth; + private double minPointNum; + private String smallDiagramJson; + private String diagramJson; + private String textDiagramJson; +} diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramStatusDto.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramStatusDto.java new file mode 100644 index 0000000..ddb8aa5 --- /dev/null +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/TimeDiagramStatusDto.java @@ -0,0 +1,16 @@ +package com.zt.life.modules.mainPart.taskReliability.dto; + +import lombok.Data; + +@Data +public class TimeDiagramStatusDto { + private double x1; + private double x2; + private int status; + + public TimeDiagramStatusDto(double x1, double x2, int status) { + this.x1 = x1; + this.x2 = x2; + this.status = status; + } +} diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/TimeDiagram.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/TimeDiagram.java index ebeeade..fedc9bf 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/TimeDiagram.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/TimeDiagram.java @@ -22,6 +22,8 @@ @ApiModelProperty(value = "xml鏂囨。") private String content; + @ApiModelProperty(value = "xml鏂囨。") + private String content2; @ApiModelProperty(value = "鍙戝竷鏂囨。") private String publishContent; @ApiModelProperty(value = "鍙戝竷鐘舵��") 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 0ba3797..e3f3517 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 @@ -107,6 +107,7 @@ String templetStr = "{\"cells\":[]}"; Map<String, JSONObject> templetsMap = new HashMap<>(); Map<String, String> templetsStrMap = new HashMap<>(); + Map<Integer, String> templetsStrMap2 = new HashMap<>(); private JSONObject xmlJSONObj; @@ -150,7 +151,10 @@ return baseDao.getChildren(productId, taskId); } - public String getTimeDiagram(Long productId, Long taskId, Long fzId) { + public TimeDiagramDto getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth, double minPointNum) { + TimeDiagramDto timeDiagramDto = new TimeDiagramDto(); + timeDiagramDto.setSmallWidth(smallWidth); + timeDiagramDto.setMinPointNum(minPointNum); String filePath = path + "/" + fzId + "/" + "status.json"; ObjectMapper mapper = new ObjectMapper(); String jsonStr = null; @@ -178,7 +182,10 @@ JSONObject jsonObject = new JSONObject(templetStr); JSONArray jsonArray = jsonObject.getJSONArray("cells"); - this.getPetsInfo(); + JSONObject jsonObject3 = new JSONObject(templetStr); + JSONArray jsonArray3 = jsonObject3.getJSONArray("cells"); + + String modelStr2 = this.getPetsInfo(); double x1 = 0; double x2 = 0; int y = -10; @@ -189,26 +196,39 @@ double pointNumPerHour = 60.0 / simulatAssess.getSamplPeriod(); //鏃跺簭鍥剧嚎 + List<List<TimeDiagramStatusDto>> lineArray = 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); double startTime = 0.0; + int status2 = 5; for (StatusDto status : dto.getStatusList()) { switch (status.getStatus()) { case "O": y = groupY; + status2 = 5; break; case "F": y = groupY;// + spaceHeight; + status2 = 1; break; case "I": + y = groupY;// + spaceHeight; + status2 = 3; + break; case "S": + y = groupY;// + spaceHeight; + status2 = 2; + break; case "M": y = groupY;// + 2 * spaceHeight; + status2 = 4; break; } x2 = x1 + status.getTimes() * pointNumPerHour + 5; + statusDtoList.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()); @@ -219,34 +239,22 @@ 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()); JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), 20); JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y - 15); - jsonArray.add(textJson); - } - - //鍥句緥 - int spaceWitdth = 80; - x1 = -spaceWitdth; - x2 = -11; - y = -110; - String[] tlArr = "O,F,I,S,M".split(","); - for (String s : tlArr) { - JSONObject f = templetsMap.get(s); - x1 = x1 + spaceWitdth; - x2 = x2 + spaceWitdth; - setlineXy(f, x1, y, x2, y, null); - jsonArray.add(f); + jsonArray3.add(textJson); } //闃舵妯″瀷鍙婂埢搴� x1 = 0; x2 = 0; - double y1 = -80; - y = -60; - double y2 = -50; + double y1 = -60; + y = -40; + double y2 = -30; JSONObject modelJson = new JSONObject(templetsStrMap.get("model")); setlineXy(modelJson, 1, y1, 1, y2, null); @@ -288,6 +296,7 @@ jsonArray.add(textJson); x1 = x2; } + JSONObject modelJson3 = new JSONObject(templetsStrMap.get("model")); setlineXy(modelJson3, 0, y, x2, y, null); jsonArray.add(modelJson3); @@ -315,9 +324,122 @@ curPointHour += periodHour; } + timeDiagramDto.setTotalWidth(x2); + double pointRate = timeDiagramDto.getTotalWidth() / timeDiagramDto.getSmallWidth(); - return jsonObject.toString(); + 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<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)); + lastStatus = netStatus; + x1 = i; + } + } else { + lastStatus = netStatus; + isFirst = false; + } + x2 = i + timeDiagramDto.getMinPointNum() - 1; + } + 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)) { + JSONObject lineJson = new JSONObject(templetsStrMap2.get(status.getStatus())); + setlineXy(lineJson, status.getX1(), y, status.getX2() + 5, y, ""); + JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus()); + JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString()); + jsonArray2.add(lineJson); + } + y = y + 25; + } + + //鍥句緥 + int spaceWitdth = 80; + x1 = 0; + x2 = spaceWitdth - 11; + y = 60; + String[] tlArr = "O,F,I,S,M".split(","); + for (String s : tlArr) { + JSONObject f = templetsMap.get(s); + x1 = x1 + spaceWitdth; + x2 = x2 + spaceWitdth; + setlineXy(f, x1, y, x2, y, null); + jsonArray2.add(f); + } + timeDiagramDto.setDiagramJson(jsonObject.toString()); + timeDiagramDto.setSmallDiagramJson(jsonObject2.toString()); + timeDiagramDto.setTextDiagramJson(jsonObject3.toString()); + + return timeDiagramDto; } + + private int getPointStatus(List<TimeDiagramStatusDto> dtoList, double x1, double x2) { + int status = 5; + boolean findStart = false; + for (int i = 0; i < dtoList.size(); i++) { + if (x2 <= dtoList.get(i).getX1()) { + break; + } + + if (!findStart) { + if (dtoList.get(i).getX1() >= x1 && x1 <= dtoList.get(i).getX2()) { + status = dtoList.get(i).getStatus(); + findStart = true; + } + } + + if (dtoList.get(i).getX2() >= x2) { + if (dtoList.get(i).getStatus() < status) + status = dtoList.get(i).getStatus(); + } + } + return status; + } + public void setlineXy(JSONObject lineJson, double x1, double y1, double x2, double y2, String text) { JsonUtils2.setJsonValueByPath(lineJson, "source/x".split("/"), x1); @@ -330,12 +452,14 @@ } } - public void getPetsInfo() { + public String getPetsInfo() { Map<String, Object> params = new HashMap<String, Object>(); params.put("projectId", 10000); params.put("diagramId", 10000); + String modelStr2 = ""; List<TimeDiagram> list_style = baseDao.getTimeDiagram(params); if (list_style.size() > 0) { + modelStr2 = list_style.get(0).getContent2(); String modelStr = list_style.get(0).getContent(); JSONObject modelJson = new JSONObject(modelStr); JSONArray modelJsonArray = modelJson.getJSONArray("cells"); @@ -349,22 +473,27 @@ if ("杩愯".equals(nodeMarker)) { templetsMap.put("O", jsonObject); templetsStrMap.put("O", jsonObject.toString()); + templetsStrMap2.put(5, jsonObject.toString()); } if ("鏁呴殰".equals(nodeMarker)) { templetsMap.put("F", jsonObject); templetsStrMap.put("F", jsonObject.toString()); + templetsStrMap2.put(1, jsonObject.toString()); } if ("绌洪棽".equals(nodeMarker)) { templetsMap.put("I", jsonObject); templetsStrMap.put("I", jsonObject.toString()); + templetsStrMap2.put(3, jsonObject.toString()); } if ("澶囦唤".equals(nodeMarker)) { templetsMap.put("S", jsonObject); templetsStrMap.put("S", jsonObject.toString()); + templetsStrMap2.put(2, jsonObject.toString()); } if ("鏈敤".equals(nodeMarker)) { templetsMap.put("M", jsonObject); templetsStrMap.put("M", jsonObject.toString()); + templetsStrMap2.put(4, jsonObject.toString()); } if ("妯″瀷".equals(nodeMarker)) { JsonUtils2.setJsonValueByPath(tmpJSONObject, "attrs/text/text".split("/"), ""); @@ -403,6 +532,7 @@ } } } + return modelStr2; } public List<ProductStatusDto> getStatusData(Long productId, Long taskId) { diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml index d35bb9e..9f9eb6e 100644 --- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml +++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml @@ -11,7 +11,7 @@ AND WeightedFailure > 0 THEN 1 / WeightedFailure ELSE 0 - END AS basic_mtbf_regulate, + END AS basic_mtbf_regulate_tmp, CASE WHEN WeightedFailure IS NOT NULL AND WeightedFailure > 0 THEN @@ -24,21 +24,21 @@ sum( CASE WHEN b.product_type < 5 THEN - 1 * 1 / basic_mtbf_regulate + 1 * 1 / basic_mtbf_regulate_tmp WHEN a.reliab_distrib_type = 1 THEN - 1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate - WHEN a.reliab_distrib_type = 2 THEN + 1 * 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 ELSE 0 END ) AS WeightedFailure, sum( CASE WHEN b.product_type < 5 THEN - 1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate + 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_mtbf_regulate - WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN + 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_mtbf_regul_succ_rate ELSE 0 @@ -59,23 +59,40 @@ AND ((b.product_type = 5 AND a.basic_join_compute = 1 and (( a.reliab_distrib_type = 1 - AND a.basic_mtbf_regulate > 0 + AND a.basic_mtbf_regulate_tmp > 0 ) - OR (a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0)) + OR (a.reliab_distrib_type = 3 AND a.basic_mtbf_regul_succ_rate > 0)) ) - || (b.product_type < 5 AND a.basic_mtbf_regulate > 0)) + || (b.product_type < 5 AND a.basic_mtbf_regulate_tmp > 0)) GROUP BY c.id, c.name ) c ) d - set f.basic_mtbf_regulate = d.basic_mtbf_regulate, + set f.basic_mtbf_regulate_tmp = d.basic_mtbf_regulate_tmp, 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; + 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 + </update> + <update id="compute2"> UPDATE param_data a, product_model b - SET ai = basic_mtbf_regulate / (basic_mtbf_regulate + repair_mttcr) + 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) where b.ship_id = ${shipId} + </update> <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData"> @@ -85,7 +102,9 @@ b.ai, b.basic_mtbf_regulate, b.repair_mttcr, - b.basic_mtbf_operating_ratio + b.basic_mtbf_operating_ratio, + b.basic_mtbf_regul_succ_rate, + b.basic_runs_num FROM product_model a LEFT JOIN param_data b ON b.product_id = a.id and b.is_delete = 0 where a.is_delete = 0 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 5fcba44..16e9415 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/baseReliability/ParamDataBasic.vue b/web/src/views/modules/baseReliability/ParamDataBasic.vue index 11869d5..81726fd 100644 --- a/web/src/views/modules/baseReliability/ParamDataBasic.vue +++ b/web/src/views/modules/baseReliability/ParamDataBasic.vue @@ -39,6 +39,16 @@ <span>{{ keepNumber(scope.row.repairMttcr) }}</span> </template> </el-table-column> + <el-table-column prop="basicMtbfRegulSuccRate" label="鎴愬姛鐜�" align="right"> + <template slot-scope="scope"> + <span>{{keepNumber(scope.row.basicMtbfRegulSuccRate) }}</span> + </template> + </el-table-column> + <el-table-column prop="basicRunsNum" label="杩愯娆℃暟" align="right"> + <template slot-scope="scope"> + <span>{{scope.row.basicRunsNum}}</span> + </template> + </el-table-column> <el-table-column prop="basicMtbfOperatingRatio" label="杩愯姣�" align="right"> <template slot-scope="scope"> <span>{{keepNumber(scope.row.basicMtbfOperatingRatio) }}</span> @@ -68,7 +78,9 @@ basicMtbfRegulate: '', repairMttcr: '', basicMtbfOperatingRatio: '', - ai: '' + ai: '', + basicMtbfRegulSuccRate:'', + basicRunsNum:'' }, defultKey: [] } @@ -79,8 +91,12 @@ computed: { keepNumber() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁� return function (val) { // 瀵硅绠楀睘鎬ц繘琛屼紶鍙� - const numM = Number(val).toFixed(5); - return numM.substring(0, numM.length - 1); + let numM = 0.0 + if (val){ + numM = Number(val).toFixed(4); + numM.substring(0, numM.length - 1) + } + return numM; } }, }, diff --git a/web/src/views/modules/basicInfo/ParamData.vue b/web/src/views/modules/basicInfo/ParamData.vue index 3b04333..fe90112 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> @@ -336,13 +336,9 @@ value: 1, label: '鎸囨暟鍒嗗竷' }, { - value: 2, - label: '浜岄」鍒嗗竷' - }, - { value: 3, - label: '濞佸竷灏斿垎甯�' - }, + label: '浜岄」鍒嗗竷' + } ], // editingCell:null, dataList: [], diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue index 5fba66b..3673ff5 100644 --- a/web/src/views/modules/basicInfo/XhProductModel.vue +++ b/web/src/views/modules/basicInfo/XhProductModel.vue @@ -45,6 +45,9 @@ <zt-table-button v-if="productType==='1'" size="small" type="primary" @click="importData(row)">瀵煎叆 </zt-table-button> + <zt-table-button v-if="productType==='1'" size="small" type="primary" + @click="exportData(row)">瀵煎嚭 + </zt-table-button> </template> </zt-table-column-handle> </el-table> @@ -142,6 +145,14 @@ importData(row) { 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}) + + + }, exportProduct() { window.location.href = './浜у搧缁撴瀯鏍戝鍏ユā鏉�.xlsx' }, diff --git a/web/src/views/modules/taskReliability/ConfigNode/configNode.vue b/web/src/views/modules/taskReliability/ConfigNode/configNode.vue index c96307c..c1da7d3 100644 --- a/web/src/views/modules/taskReliability/ConfigNode/configNode.vue +++ b/web/src/views/modules/taskReliability/ConfigNode/configNode.vue @@ -8,11 +8,12 @@ <el-form-item v-show="shape!=='custom-circle1'" label="鑺傜偣鍚嶇О" prop="nodeText" label-width="80px"> <el-input v-model="globalGridAttr.nodeText" style="width:100%" @change="onTextChange"></el-input> </el-form-item> - <el-form-item v-show="nodeType=='vote' || (nodeType=='node' && showNumberInput)" label="琛ㄥ喅鏁伴噺" prop="voteNum" + <el-form-item v-show="showNumberInput" :label='nodeType=="vote"?"琛ㄥ喅鏁伴噺":"澶囦唤鏁伴噺"' prop="voteNum" label-width="80px"> <el-input type="number" v-model="globalGridAttr.voteNum" @change="onNumberInputValue" placeholder="璇疯緭鍏ユ暟瀛�"></el-input> </el-form-item> + <div v-show="globalGridAttr.productType!=='product_xdy'"> <el-form-item v-show="nodeType=='node'" label="鍙潬鎬у垎甯冪被鍨�" prop="reliabDistribType" label-width="125px"> <zt-dict style="width: 100%" v-model="globalGridAttr.reliabDistribType" @input="onReliabDistribType" @@ -175,7 +176,8 @@ this.curCel.attr('text/text', this.text) }, onNodeTypeExtChange(e) { - if (this.globalGridAttr.nodeTypeExt === 'vote') { + alert(this.globalGridAttr.nodeTypeExt) + if (this.globalGridAttr.nodeTypeExt === 'vote' || this.globalGridAttr.nodeTypeExt === 'switch') { this.showNumberInput = true; } else { this.showNumberInput = false; @@ -406,7 +408,7 @@ this.globalGridAttr.successRate = cell.getData().successRate this.globalGridAttr.simulatTimes = cell.getData().simulatTimes this.globalGridAttr.successTimes = cell.getData().successTimes - if (this.nodeType === 'vote' || this.globalGridAttr.nodeTypeExt === 'vote' || (cell.getData().voteNum !== undefined && cell.getData().voteNum !== '')) { + if (this.nodeType === 'vote' || this.nodeType === 'switch') { console.log(cell.getData().voteNum, 'cell.getData().voteNum') this.showNumberInput = true } diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue index df81713..925aada 100644 --- a/web/src/views/modules/taskReliability/RBD-edit-img.vue +++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue @@ -1926,6 +1926,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) + + return {newStartNode: connectNode, newEndNode: dragNode} + }, + createBrach(dragNode,connectNode,x,y){ const dashedBox = this.createDashedBox(x + 150, y) dragNode.setData({startNodeId: connectNode.id}) @@ -1935,7 +1941,7 @@ router: { name: 'manhattan', args: { - startDirections: ['right'], // 浠庝笅鏂瑰紑濮� + startDirections: ['top','bottom'], // 浠庝笅鏂瑰紑濮� endDirections: ['left'], // 鍚戝乏鏂圭粨鏉� }, }, @@ -1949,25 +1955,12 @@ name: 'manhattan', args: { startDirections: ['right'], // 浠庝笅鏂瑰紑濮� - endDirections: ['left'], // 鍚戝乏鏂圭粨鏉� + endDirections: ['top','bottom'], // 鍚戝乏鏂圭粨鏉� }, }, connector: {name: 'rounded'}, zIndex: -1 }) - return {newStartNode: connectNode, newEndNode: dragNode} - /* this.graph.addEdge({ - source: {cell: startNode, port: 'right1'}, - target: {cell: connectNode, port: 'left1'}, - router: {name: 'manhattan'}, - connector: {name: 'rounded'} - }) - this.graph.addEdge({ - source: {cell: dragNode, port: 'right1'}, - target: {cell: endNode, port: 'left1'}, - router: {name: 'manhattan'}, - connector: {name: 'rounded'} - })*/ }, createBridgeConnection(x, y, dragNode) { console.log(x, y, 'leftX centerY') diff --git a/web/src/views/modules/taskReliability/SchemeCompar.vue b/web/src/views/modules/taskReliability/SchemeCompar.vue index ca52f87..6504887 100644 --- a/web/src/views/modules/taskReliability/SchemeCompar.vue +++ b/web/src/views/modules/taskReliability/SchemeCompar.vue @@ -35,7 +35,7 @@ </el-table-column> <el-table-column prop="mtbf" - label="MTBF" + label="MTTF" width="100px" align="right"> <template slot-scope="scope"> diff --git a/web/src/views/modules/taskReliability/SimulatCurve.vue b/web/src/views/modules/taskReliability/SimulatCurve.vue index 063cc18..835cab1 100644 --- a/web/src/views/modules/taskReliability/SimulatCurve.vue +++ b/web/src/views/modules/taskReliability/SimulatCurve.vue @@ -36,7 +36,7 @@ } this.option = { title: { - text: "mtbf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, + text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, textStyle: { // 涓绘爣棰樻枃鏈牱寮弡"fontSize": 18,"fontWeight": "bolder","color": "#333"} fontFamily: 'Arial', fontSize: 30, @@ -94,7 +94,7 @@ } this.option = { title: { - text: "mtbf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, + text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, textStyle: { // 涓绘爣棰樻枃鏈牱寮弡"fontSize": 18,"fontWeight": "bolder","color": "#333"} fontFamily: 'Arial', fontSize: 30, diff --git a/web/src/views/modules/taskReliability/TimeDiagram.vue b/web/src/views/modules/taskReliability/TimeDiagram.vue index ca52c0e..e7b0071 100644 --- a/web/src/views/modules/taskReliability/TimeDiagram.vue +++ b/web/src/views/modules/taskReliability/TimeDiagram.vue @@ -2,7 +2,7 @@ <div class="fa-card-a"> <el-row :gutter="5"> <div class="mod-taskReliability-simulatAssess"> - <el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" > + <el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled"> <zt-form-item label="浜у搧鑺傜偣" prop="productId"> <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/> </zt-form-item> @@ -21,8 +21,8 @@ <el-input v-model="dataForm.simulatFrequency" readonly="false"> </el-input> </zt-form-item> - <zt-form-item > - <zt-button @click="getDiagram()">鏌ョ湅鏃跺簭鍥�</zt-button> + <zt-form-item> + <zt-button @click="getDiagram(null)">鏌ョ湅鏃跺簭鍥�</zt-button> </zt-form-item> </el-form> <div> @@ -58,8 +58,8 @@ export default { data() { return { - title:'', - knob:HTMLDivElement, + title: '', + knob: HTMLDivElement, dialogVisible2: false, timers: '', shape: '', @@ -173,7 +173,7 @@ data: { id: '', status: '', - startTime:'', + startTime: '', endTime: '', }, attrs: { @@ -192,7 +192,7 @@ }, keyboard: true, }) - this.knob = document.createElement('div',false) + this.knob = document.createElement('div', false) this.knob.style.position = 'absolute' document.getElementById('timeDiagram').appendChild(this.knob) this.graph.centerContent() @@ -446,7 +446,7 @@ id: node.getData().dataId, modelName: node.attr('label/textWrap/modelName'), } - this.title=node.attr('label/textWrap/modelName') + "妯″瀷璁捐" + this.title = node.attr('label/textWrap/modelName') + "妯″瀷璁捐" this.$nextTick(() => { this.$refs.modelView.init(param) }) @@ -461,22 +461,22 @@ }) // 榧犳爣绉诲叆edge鑺傜偣 - this.graph.on('edge:mouseenter', ({edge,e}) => { + this.graph.on('edge:mouseenter', ({edge, e}) => { const style = this.knob.style // e.stopPropagation() console.log('edge:mouseenter') if (e && edge.data) { - if (edge.getData().status==='F') { + if (edge.getData().status === 'F') { //console.log(edge.getData(),"eee edge.getData()") let startTimes = edge.getData().startTimes let endTimes = edge.getData().endTimes //console.log(e,'eee') const p = this.graph.clientToGraph(e.clientX, e.clientY) - setTimeout(()=>{ + setTimeout(() => { style.display = 'block' style.left = `${p.x}px` style.top = `${p.y}px` - style.width = 200+ 'px' + style.width = 200 + 'px' style.height = 80 + 'px' style.textAlign = 'center' style.background = '#000' @@ -484,9 +484,9 @@ style.lineHeight = (40 + 'px') style.zIndex = 100 this.knob.innerText = `寮�濮嬫椂闂达細${startTimes}\n缁撴潫鏃堕棿锛�${endTimes}` - },0) - console.log(p,'p p p') - console.log(style,this.knob,'style style') + }, 0) + console.log(p, 'p p p') + console.log(style, this.knob, 'style style') } } }) @@ -518,37 +518,7 @@ console.log(res.data) this.simulatList = res.data }, - async onTreeSelected(data) { - this.graph.unfreeze() - if (!this.dataForm.taskModelId) { - this.$alert("璇峰厛閫夋嫨鍏蜂綋浠诲姟") - return - } - if (!this.dataForm.id) { - this.$alert("璇峰厛閫夋嫨鍏蜂綋浠跨湡璁板綍") - return - } - let params = { - productId: data.id, - taskId: this.dataForm.taskModelId, - fzId: this.dataForm.id - } - let res = await this.$http.get('/taskReliability/SimulatAssess/getStatus', {params: params}) - if (res.data !== null) { - this.diagramJson = JSON.parse(res.data) - console.log(this.diagramJson, 'this.Diagram json') - this.graph.fromJSON(this.diagramJson) - this.graph.positionContent('left') - //this.graph.zoomToFit() - this.graph.freeze() - } else { - this.graph.fromJSON(this.emptyJson) - //this.graph.centerContent() - //this.graph.zoomToFit() - this.graph.freeze() - } - console.log(res.data) - }, + // 鑾峰彇淇℃伅 onProductSelected(data) { this.isSelect = true @@ -578,25 +548,30 @@ this.dataForm.samplPeriod = result.data.samplPeriod this.dataForm.simulatFrequency = result.data.simulatFrequency }, - async getDiagram() { + async onTreeSelected(data) { + await this.getDiagram(data.id) + }, + async getDiagram(productId) { this.graph.unfreeze() let params = { - productId: this.dataForm.productId, + productId: productId ? productId : this.dataForm.productId, taskId: this.dataForm.taskModelId, - fzId: this.dataForm.id + fzId: this.dataForm.id, + smallWidth: 1200, + minPointNum: 5 } let res = await this.$http.get('/taskReliability/SimulatAssess/getStatus', {params: params}) if (res.data !== null) { - this.diagramJson = JSON.parse(res.data) + this.diagramJson = JSON.parse(res.data.smallDiagramJson) console.log(this.diagramJson, 'this.Diagram json') this.graph.fromJSON(this.diagramJson) this.graph.centerContent() - this.graph.zoomToFit() + //this.graph.zoomToFit() this.graph.freeze() } else { this.graph.fromJSON(this.emptyJson) this.graph.centerContent() - this.graph.zoomToFit() + //this.graph.zoomToFit() this.graph.freeze() } console.log(res.data) @@ -610,9 +585,11 @@ border: 1px solid #dfe3e8; width: 100% !important; } + #timeDiagram .x6-cell.x6-node { cursor: inherit; } + .x6-graph-scroller.x6-graph-scroller-pannable { width: 100% !important; } -- Gitblit v1.9.1