| | |
| | | List<ProductStatusDto> dbList = this.getProduct(productId, taskId); |
| | | List<ProductStatusDto> childList = new ArrayList<>(); |
| | | for (ProductStatusDto item : dbList) { |
| | | if (item.getSameSbNum() > 1) { |
| | | for (int i = 1; i <= item.getSameSbNum(); i++) { |
| | | try { |
| | | ProductStatusDto newRow = item.clone(); |
| | | int sameNum = item.getSameSbNum() == null ? 1 : item.getSameSbNum(); |
| | | for (int i = 1; i <= sameNum; i++) { |
| | | try { |
| | | ProductStatusDto newRow = null; |
| | | if (sameNum > 1) { |
| | | newRow = item.clone(); |
| | | } else |
| | | newRow = item; |
| | | if ("5".equals(newRow.getProductType())) { |
| | | newRow.setDeviceNo(i); |
| | | newRow.setName(item.getName() + "-" + i); |
| | | newRow.setDataId(item.getId().toString() + "-" + i); |
| | | childList.add(newRow); |
| | | } catch (CloneNotSupportedException e) { |
| | | e.printStackTrace(); |
| | | if (i > 1) { |
| | | newRow.setName(item.getName() + "-" + i); |
| | | } |
| | | } else { |
| | | newRow.setDeviceNo(0); |
| | | newRow.setDataId(item.getId().toString()); |
| | | } |
| | | childList.add(newRow); |
| | | } catch (CloneNotSupportedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | item.setDeviceNo(0); |
| | | item.setDataId(item.getId().toString()); |
| | | childList.add(item); |
| | | } |
| | | } |
| | | childList.sort(Comparator.comparing(ProductStatusDto::getDeviceNo, Comparator.naturalOrder())); |
| | |
| | | for (TaskPhaseModel taskPhaseModel : taskPhaseModelAll) { |
| | | Element taskTag = tasksTag.addElement("task"); |
| | | taskTag.addAttribute("duration", String.valueOf(taskPhaseModel.getOperatConditDuration())); |
| | | taskTag.addAttribute("model", taskPhaseModel.getOperatConditId().toString()); |
| | | // taskTag.addAttribute("model", taskPhaseModel.getOperatConditId().toString()); |
| | | taskTag.addAttribute("model", taskPhaseModel.getId().toString()); |
| | | if (null != taskPhaseModel.getPhaseConstraints() && taskPhaseModel.getPhaseConstraints().size() > 0) { |
| | | taskTag.addAttribute("NAM", |
| | | taskPhaseModel.getPhaseConstraints().stream().map(item -> |
| | |
| | | Element modelsTag = root.addElement("models"); |
| | | for (TaskPhaseModel taskPhaseModel : taskPhaseModelAll) { |
| | | Element modelTag = modelsTag.addElement("model"); |
| | | modelTag.addAttribute("name", taskPhaseModel.getOperatConditId().toString()); |
| | | // modelTag.addAttribute("name", taskPhaseModel.getOperatConditId().toString()); |
| | | modelTag.addAttribute("name", taskPhaseModel.getId().toString()); |
| | | List<OperatConditModel> gkModelsAssembled = operatConditModelDao.getGKModelAssembled( |
| | | taskPhaseModel.getOperatConditId()); |
| | | OperatConditModel gkModelTop = gkModelsAssembled.stream().filter(item -> |
| | |
| | | // 设备 |
| | | Integer deviceNo = node.getDeviceNo(); |
| | | Element nodeTag = parent.addElement("node"); |
| | | nodeTag.addAttribute("name", deviceNo == 0 ? dataId.toString() : dataId.toString() + "-" + deviceNo); |
| | | nodeTag.addAttribute("real_name", deviceNo == 0 ? product.getName() : product.getName() + "-" + deviceNo); |
| | | nodeTag.addAttribute("name", dataId.toString() + "-" + deviceNo); |
| | | nodeTag.addAttribute("real_name", product.getName() + "-" + deviceNo); |
| | | nodeTag.addAttribute("name_path", product.getNamePath()); |
| | | nodeTag.addAttribute("type", "node"); |
| | | |
| | | ParamData paramData = paramDataList.stream().filter(item -> |
| | | dataId.equals(item.getProductId())).collect(Collectors.toList()).get(0); |
| | | Double ratio = paramData.getTaskMtbcfOperatingRatio(); |
| | | if (null != ratio && ratio > 0) { |
| | | // if (null != ratio && ratio > 0) { |
| | | if (null != ratio && ratio != 1.0) { |
| | | // 间断型设备的处理 |
| | | double cycon = taskPhaseModel.getOperatConditDuration() * ratio; |
| | | double cycdown = taskPhaseModel.getOperatConditDuration() - cycon; |
| | |
| | | .filter(item -> taskId.equals(item.getTaskId())) |
| | | .filter(item -> taskPhaseModel.getPhaseId().equals(item.getPhaseId())) |
| | | .filter(item -> taskPhaseModel.getOperatConditId().equals(item.getOperatConditId())) |
| | | .filter(item -> modelId.equals(item.getModelId())) |
| | | // .filter(item -> modelId.equals(item.getModelId())) |
| | | .filter(item -> dataId.equals(item.getProductId())) |
| | | .collect(Collectors.toList()).get(0); |
| | | } |
| | |
| | | |
| | | public SimulaDataDto getResultXML(SimulatAssess simulatAssess) { |
| | | if (simulatAssess.getDataType() != null && simulatAssess.getDataType().equals("fz")) { |
| | | Integer num = this.getNumById(simulatAssess.getProductId(), simulatAssess.getTaskModelId()); |
| | | simulatAssess.setName("仿真记录" + (num + 1)); |
| | | simulatAssess.setName(simulatAssess.getName()); |
| | | this.update(simulatAssess); |
| | | } |
| | | String filePath = path + "/" + simulatAssess.getId() + "/" + "result.xml"; |
| | |
| | | String[] arr = availability.split(" "); |
| | | // 遍历子字符串数组,将每个元素转换为double并存储到double数组中 |
| | | Double j = 0.0; |
| | | for (int a = 0; a < arr.length; a++) { |
| | | Double b = 100.0; |
| | | for (int a = 0; a < arr.length - 1; a++) { |
| | | if (Convert.toDouble(arr[a]) < Convert.toDouble(arr[a+1])) { |
| | | System.out.println(arr[a]); |
| | | } |
| | | j = samplPeriod + j; |
| | | doubleArray.add(Double.parseDouble(arr[a])); |
| | | xList.add(j); |
| | |
| | | |
| | | SchemeComparCurve curve = new SchemeComparCurve(); |
| | | curve.setName(task.getTaskName()); |
| | | curve.setSymbol("none"); |
| | | curve.setSmooth(true); |
| | | curve.setType("line"); |
| | | curve.setData(resultData.getCurveParam().getYData()); |