| | |
| | | int groupHeight = 20; |
| | | |
| | | double pointNumPerHour = 60.0 / simulatAssess.getSamplPeriod(); |
| | | |
| | | //时序图线 |
| | | for (int i = 0; i < list.size(); i++) { |
| | | x1 = 0; |
| | | groupY = groupHeight * i; |
| | | ProductStatusDto dto = list.get(i); |
| | | double startTime = 0.0; |
| | | for (StatusDto status : dto.getStatusList()) { |
| | | switch (status.getStatus()) { |
| | | case "O": |
| | |
| | | JSONObject lineJson = new JSONObject(templetsStrMap.get(status.getStatus())); |
| | | setlineXy(lineJson, x1, y, x2, y, ""); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus()); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/startTimes".split("/"), String.format("%.4f", x1)); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/endTimes".split("/"), String.format("%.4f", x1 + status.getTimes())); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/startTimes".split("/"), String.format("%.1f", startTime)); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/endTimes".split("/"), String.format("%.1f", startTime + status.getTimes())); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString()); |
| | | startTime = startTime + status.getTimes(); |
| | | x1 = x2 - 5; |
| | | jsonArray.add(lineJson); |
| | | } |
| | |
| | | JSONObject textJson = new JSONObject(templetsStrMap.get("text")); |
| | | JsonUtils2.setJsonValueByPath(textJson, "data/dataId".split("/"), modelId); |
| | | JsonUtils2.setJsonValueByPath(textJson, "id".split("/"), UUIDUtil.generateId().toString()); |
| | | JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), "模型"+(i+1)); |
| | | JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), "模型" + (i + 1)); |
| | | JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/modelName".split("/"), modelName); |
| | | |
| | | JsonUtils2.setJsonValueByPath(textJson, "size/width".split("/"), mapSpace.get("width")+10); |
| | | JsonUtils2.setJsonValueByPath(textJson, "size/width".split("/"), mapSpace.get("width") + 10); |
| | | |
| | | double x11 = x1 + ((gkPoint - mapSpace.get("width")+12) / 2); |
| | | double x11 = x1 + ((gkPoint - mapSpace.get("width") + 12) / 2); |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), x11); |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y1-10); |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y1 - 10); |
| | | jsonArray.add(textJson); |
| | | x1 = x2; |
| | | } |
| | |
| | | |
| | | double x11 = x - mapSpace.get("width") / 2 - 5; |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), x11); |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y2-10); |
| | | JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y2 - 10); |
| | | jsonArray.add(textJson); |
| | | |
| | | curPointHour += periodHour; |
| | |
| | | } |
| | | |
| | | public void addTasksTag(List<TaskPhaseModel> taskPhaseModelAll, |
| | | Element root) { |
| | | Element root) { |
| | | Element tasksTag = root.addElement("tasks"); |
| | | for (TaskPhaseModel taskPhaseModel : taskPhaseModelAll) { |
| | | Element taskTag = tasksTag.addElement("task"); |
| | |
| | | } |
| | | |
| | | public void calcTaskPhaseModelDuration(TaskPhase taskPhase, |
| | | List<TaskPhaseModel> taskPhaseModelAll) { |
| | | List<TaskPhaseModel> taskPhaseModelAll) { |
| | | List<TaskPhaseModel> taskPhaseModels = taskPhaseModelDao.getListByPhaseId(taskPhase.getId()); |
| | | double totalRate = taskPhaseModels.stream().mapToDouble(TaskPhaseModel::getOperatConditDurationRate).sum(); |
| | | double sum = 0.0; |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | List<WeakDto> productList = baseDao.getProductList(taskId, productId); |
| | |
| | | Object nameValue = jsonArray.getJSONObject(i).get("name"); |
| | | if (nameValue instanceof Long) { |
| | | productId1 = (Long) nameValue; |
| | | WeakDto weakDto = map.get(productId1); |
| | | Double mtbfTime = null; |
| | | if (map.get(productId1) != null) { |
| | | WeakDto weakDto = map.get(productId1); |
| | | Double mtbfTime = null; |
| | | |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | |
| | | data.setMtbf(mtbf); |
| | | data.setMttr(mttr); |
| | | data.setMsr(msr); |
| | | data.setMtbf(mtbf); |
| | | data.setMttr(mttr); |
| | | data.setMsr(msr); |
| | | |
| | | if (weakDto != null) { |
| | | data.setId(weakDto.getId()); |
| | | data.setSort(weakDto.getSort()); |
| | | data.setPid(weakDto.getPid()); |
| | | data.setName(weakDto.getName()); |
| | | data.setProductType(weakDto.getProductType()); |
| | | data.setTimeRate(weakDto.getTimeRate()); |
| | | mtbfTime = mtbf / weakDto.getTimeRate(); |
| | | if (weakDto != null) { |
| | | data.setId(weakDto.getId()); |
| | | data.setSort(weakDto.getSort()); |
| | | data.setPid(weakDto.getPid()); |
| | | data.setName(weakDto.getName()); |
| | | data.setProductType(weakDto.getProductType()); |
| | | data.setTimeRate(weakDto.getTimeRate()); |
| | | mtbfTime = mtbf / weakDto.getTimeRate(); |
| | | } |
| | | |
| | | data.setMtbfTime(mtbfTime); |
| | | data.setIsWeak(0); |
| | | |
| | | list.add(data); |
| | | } |
| | | |
| | | data.setMtbfTime(mtbfTime); |
| | | data.setIsWeak(0); |
| | | |
| | | list.add(data); |
| | | } |
| | | } |
| | | List<WeakDto> treeList = TreeUtils.build(list); |
| | | this.getIsweak(treeList.get(0).getChildren()); |
| | | List<WeakDto> treeList = new ArrayList<>(); |
| | | if (list.size() > 0) { |
| | | treeList = TreeUtils.build(list); |
| | | this.getIsweak(treeList.get(0).getChildren()); |
| | | } |
| | | |
| | | return treeList; |
| | | } |
| | | |
| | |
| | | task = taskService.get(taskModelId); |
| | | simulatAssess = this.getByTaskId(taskModelId); |
| | | SimulaDataDto resultData; |
| | | if (showProductId!=null){ |
| | | if (showProductId != null) { |
| | | simulatAssess.setProductId(showProductId); |
| | | resultData =this.getResultXML(simulatAssess); |
| | | }else{ |
| | | resultData = this.getResultXML(simulatAssess); |
| | | } else { |
| | | resultData = this.getResultXML(simulatAssess); |
| | | } |
| | | |