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); } 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); modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -120,6 +120,15 @@ return result; } @GetMapping("exportData") @ApiOperation("导åºäº§å模å") @LogOperation("导åºäº§å模å") public Result exportDataExcel(Long shipId) { xhProductModelService.exportDataExcel(shipId); return null; } @PostMapping @ApiOperation("æ°å¢") 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); } 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); } } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java
@@ -127,6 +127,7 @@ return result ? Result.ok() : Result.error("è§£æå¤±è´¥"); } @PostMapping("layout") @ApiOperation("èªå¨æç") @LogOperation("èªå¨æç") 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("ä¿®æ¹") 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; @@ -189,26 +193,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,6 +236,7 @@ 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()); @@ -227,26 +245,12 @@ 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); } //é¶æ®µæ¨¡ååå»åº¦ 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 +292,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 +320,120 @@ 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(templetStr); 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(), y, ""); JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus()); JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString()); jsonArray2.add(lineJson); } y = y + 20; } //å¾ä¾ int spaceWitdth = 80; x1 = 0; x2 = spaceWitdth - 11; 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()); 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); @@ -349,22 +465,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("/"), ""); 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 web/public/²úÆ·½á¹¹Ê÷µ¼ÈëÄ£°å.xlsxBinary files differ
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; } }, }, 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: [], 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' }, 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"> 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, web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -583,11 +583,13 @@ let params = { productId: this.dataForm.productId, taskId: this.dataForm.taskModelId, fzId: this.dataForm.id fzId: this.dataForm.id, smallWidth:1000, 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()