jinlin
2024-08-12 658f06778c80893e8618d62357cebf49aea9346e
修改
4个文件已修改
1个文件已添加
268 ■■■■ 已修改文件
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/dto/ConditionDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/model/TestScheme.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/service/TestSchemeService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/PlanMake.vue 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/SchemeCompar.vue 206 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/dto/ConditionDto.java
@@ -3,13 +3,15 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ConditionDto {
    private String tjlx;
    private Double specifiedValue;
    private Double minAccepValue;
    private Double productionRisk;
    private Double userRisk;
    private BigDecimal productionRisk;
    private BigDecimal userRisk;
    private Integer showFailureTime;
}
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/model/TestScheme.java
@@ -7,6 +7,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
@@ -25,7 +26,7 @@
    private Integer pc;
    @ApiModelProperty(value = "")
    private Double pa;
    private BigDecimal pa;
    @ApiModelProperty(value = "")
    private Double value;
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/TestScheme/service/TestSchemeService.java
@@ -8,10 +8,13 @@
import org.springframework.stereotype.Service;
import com.zt.common.db.query.QueryFilter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@@ -46,11 +49,11 @@
    public List<ResultDto> getResult(ConditionDto dto) {
        List<ResultDto> result = new ArrayList<>();
        List<TestScheme> list = baseDao.getList();
        if (dto.getTjlx().equals("条件1")) {
        if (dto.getTjlx().equals("按风险名义值查询")) {
            result = this.getCondition1(dto, list);
        } else if (dto.getTjlx().equals("条件2")) {
        } else if (dto.getTjlx().equals("不限定生产方风险查询")) {
            result = this.getCondition2(dto, list);
        } else if (dto.getTjlx().equals("条件3")) {
        } else if (dto.getTjlx().equals("不限定规定值查询")) {
            result = this.getCondition3(dto, list);
        }
        return result;
@@ -63,7 +66,7 @@
        for (int i = 1; i <= 10; i++) {
            Integer finalI = i;
            TestScheme data1 = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).findFirst().get();//
            TestScheme data2 = list.stream().filter(k -> k.getPa().equals(1 - dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).findFirst().get();//
            TestScheme data2 = list.stream().filter(k -> k.getPa().equals(BigDecimal.ONE.subtract(dto.getUserRisk())) && k.getPc() == (2 * finalI + 2)).findFirst().get();//
            if (data1 != null && data2 != null) {
                Double value = data2.getValue() / data1.getValue();
                double strate = dto.getMinAccepValue() / dto.getSpecifiedValue();
@@ -82,11 +85,14 @@
        double TST1 = 0;  //T/θ1
        double TST0 = 0;  //T/θ0
        Integer finalC = C;
        TestScheme data3 = list.stream().filter(k -> k.getPa().equals(1 - dto.getUserRisk()) && k.getPc() == (2 * finalC + 2)).findFirst().get();//
        Stream<TestScheme> testSchemeStream = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalC + 2));
        TestScheme data3 = testSchemeStream.findFirst().get();
        if (data3 != null) {
            TST1 = data3.getValue() / 2; //T/θ1
            //TST1 = Convert.ToDouble(TST1.ToString("G2")); //取两位有效数字
            if (TST1 < 10) TST1 = TST1 + 0.1;
            if (TST1 < 10) {
                TST1 = TST1 + 0.1;
            }
            T = TST1 * dto.getMinAccepValue();  //总试验时间
            TST0 = T / dto.getSpecifiedValue(); //T/θ0    TST1 * minAccepValue / specifiedValue
        }
@@ -143,10 +149,10 @@
    private List<ResultDto> getCondition3(ConditionDto dto, List<TestScheme> list) {
        List<ResultDto> result = new ArrayList<>();
        for (int i = 0; i <= dto.getShowFailureTime(); i++) {
        for (int i = 0; i < dto.getShowFailureTime(); i++) {
            Integer finalI = i;
            List<TestScheme> data = list.stream().filter(k -> k.getPa().equals(dto.getUserRisk()) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());//
            List<TestScheme> data2 = list.stream().filter(k -> k.getPa().equals(1 - dto.getProductionRisk()) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());//
            List<TestScheme> data2 = list.stream().filter(k -> k.getPa().equals(BigDecimal.ONE.subtract(dto.getProductionRisk())) && k.getPc() == (2 * finalI + 2)).collect(Collectors.toList());//
            double T = 0;
            double TST1 = 0; //  T/θ1
            double TST0 = 0;//  T/θ0
@@ -168,7 +174,7 @@
                userRisk = userRisk + Math.pow(TST1, r) * Math.pow(e, -TST1) / getjc(r);
            }
            ResultDto resultDto = new ResultDto();
            resultDto.setAcceptNumber(i);
            resultDto.setAcceptNumber(i + 1);
            resultDto.setTotalTestTime(String.valueOf(Math.round(T)));
            resultDto.setNumber(String.valueOf(Math.round(ST0)));
            resultDto.setProductionRiskReal(new Formatter().format("%.2f", productionRisk * 100).toString());
web/src/views/modules/taskReliability/PlanMake.vue
@@ -1,11 +1,11 @@
<template>
  <div class="fa-card-b">
    <el-table ref="table" :data="tjDataList" height="230px" border>
      <el-table-column align="center" prop="tjlx" width="100" label="条件类型">
      <el-table-column align="center" prop="tjlx" label="查询类型">
      </el-table-column>
      <el-table-column align="center" prop="specifiedValue" label="已知规定值">
        <template v-slot="{ row }">
          <el-input v-model="row.specifiedValue" style="width:100%" :disabled="row.tjlx==='条件3'"></el-input>
          <el-input v-model="row.specifiedValue" style="width:100%" :disabled="row.tjlx==='不限定规定值查询'"></el-input>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="minAccepValue" label="最低可接受值">
@@ -16,7 +16,7 @@
      <el-table-column align="center" prop="productionRisk" label="生产方风险">
        <template v-slot="{ row }">
          <el-select style="width: 100%" :value-key="key" v-model="row.productionRisk"
                     @change="onChange()" :disabled="row.tjlx==='条件2'">
                     :disabled="row.tjlx==='不限定生产方风险查询'">
            <el-option v-for="item in riskList" :key="item.value" :label="item.label"
                       :value="item.value"></el-option>
          </el-select>
@@ -24,8 +24,7 @@
      </el-table-column>
      <el-table-column align="center" prop="userRisk" label="使用方风险">
        <template v-slot="{ row }">
          <el-select style="width: 100%" :value-key="key" v-model="row.userRisk"
                     @change="onChange()">
          <el-select style="width: 100%" :value-key="key" v-model="row.userRisk">
            <el-option v-for="item in riskList" :key="item.value" :label="item.label"
                       :value="item.value"></el-option>
          </el-select>
@@ -33,7 +32,7 @@
      </el-table-column>
      <el-table-column align="center" prop="showFailureTime" label="故障接受值最大显示">
        <template v-slot="{ row }">
          <el-input v-model="row.showFailureTime" style="width:100%" :disabled="row.tjlx==='条件1'"></el-input>
          <el-input v-model="row.showFailureTime" style="width:100%" :disabled="row.tjlx==='按风险名义值查询'"></el-input>
        </template>
      </el-table-column>
      <el-table-column align="center" width="100" label="操作">
@@ -69,7 +68,7 @@
        dataList: [],
        isShow: false,
        tjDataList: [{
          tjlx: '条件1',
          tjlx: '按风险名义值查询',
          specifiedValue: null,
          minAccepValue: null,
          productionRisk: null,
@@ -77,7 +76,7 @@
          showFailureTime: null
        },
          {
            tjlx: '条件2',
            tjlx: '不限定生产方风险查询',
            specifiedValue: null,
            minAccepValue: null,
            productionRisk: null,
@@ -85,7 +84,7 @@
            showFailureTime: null
          },
          {
            tjlx: '条件3',
            tjlx: '不限定规定值查询',
            specifiedValue: null,
            minAccepValue: null,
            productionRisk: null,
@@ -137,20 +136,20 @@
          this.$tip.alert("最低可接受值不能大于规定值")
          flag =false
        }
        if (row.tjlx === "条件1"){
          if (!row.specifiedValue ||!row.minAccepValue || !row.productionRisk||!userRisk) {
        if (row.tjlx === "按风险名义值查询"){
          if (!row.specifiedValue ||!row.minAccepValue || !row.productionRisk||!row.userRisk) {
            this.$tip.alert("有未填写的值")
            flag =false
          }
        }
        if (row.tjlx === "条件2"){
        if (row.tjlx === "不限定生产方风险查询"){
          if (!row.specifiedValue ||!row.minAccepValue || !row.showFailureTime||!row.userRisk) {
            this.$tip.alert("有未填写的值")
            flag =false
          }
        }
        if (row.tjlx === "条件3"){
          if (!row.showFailureTime ||!row.minAccepValue || !row.productionRisk||!userRisk) {
        if (row.tjlx === "不限定规定值查询"){
          if (!row.showFailureTime ||!row.minAccepValue || !row.productionRisk||!row.userRisk) {
            this.$tip.alert("有未填写的值")
            flag =false
          }
@@ -160,7 +159,7 @@
        }
        let res = await this.$http.get(`/TestScheme/TestScheme/condition`, {params: row})
        this.dataList = res.data
        if (row.tjlx === "条件3") {
        if (row.tjlx === "不限定规定值查询") {
          this.isShow = true
        }
      }
web/src/views/modules/taskReliability/SchemeCompar.vue
New file
@@ -0,0 +1,206 @@
<template>
  <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">
          <zt-form-item label="产品节点" prop="productId" width="100px">
            <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
          </zt-form-item>
          <zt-form-item label="可靠性方案" prop="taskModelId" width="500px">
            <zt-select style="width: 400px" v-model="dataForm.name" :datas="schemeList"
                       @change="onSchemeSelected" :multiple="true"/>
          </zt-form-item>
          <zt-form-item>
            <zt-button @click="compair()">方案对比</zt-button>
          </zt-form-item>
        </el-form>
        <div>
          <el-col :span="4">
            <div style="margin-right: 5px;height: calc(88vh - 100px)" v-if="isSelect">
              <product-model-tree @on-selected="onTreeSelected" showXdy="false"
                                  ref="ProductModelTree" :isShow="false" basic="4" :productId="dataForm.productId"/>
            </div>
          </el-col>
          <el-col :span="20">
            <div style="margin-top: 20px;position: relative;height: 600px">
              <div v-if="isShow">
                <el-button v-if="isZk" type="info" size="small" icon="el-icon-caret-bottom"
                           style="position: absolute;right: 10%;top: 10%;z-index: 1" @click="zk()"></el-button>
                <el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right"
                           style="position: absolute;right: 10%;top: 10%;z-index: 1" @click="zk()"></el-button>
                <div v-if="isZk" style="position: absolute;right: 10%;top: 15%">
                  <el-table :data="tableData" border style="width: 400px">
                    <el-table-column
                      prop="name"
                      label="方案名称"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="MTBF"
                      label="MTBF"
                      width="80px"
                      align="right">
                    </el-table-column>
                    <el-table-column
                      prop="MTTR"
                      label="MTTR"
                      width="80px"
                      align="right">
                    </el-table-column>
                    <el-table-column
                      prop="MSR"
                      label="MSR"
                      width="80px"
                      align="right">
                    </el-table-column>
                  </el-table>
                </div>
              </div>
              <div :disabled="isShow">
                <div class="echart" id="myChart" :style="myChartStyle"></div>
              </div>
            </div>
          </el-col>
        </div>
      </div>
    </el-row>
  </div>
</template>
<script>
  import ProductModelTree from "../basicInfo/ProductModelTree";
  import echart from "echarts";
  export default {
    data() {
      return {
        myChartStyle: {float: "left", width: "100%", height: "600px"}, //图表样式
        isSelect: false,
        isShow: false,
        isZk: true,
        productList: [],
        schemeList: [
          {
            id: 1,
            name: '方案一'
          }, {
            id: 2,
            name: '方案二'
          }, {
            id: 3,
            name: '方案三'
          }
        ],
        dataForm: {
          id: '',
          pid: '',
          productId: '',
          showProductId: '',
          taskModelId: '',
          dataType: 'fz',
        },
        tableData: [
          {
            name: '方案一',
            MTBF: '68.74',
            MTTR: '0.43',
            MSR: '0.85'
          }, {
            name: '方案二',
            MTBF: '78.74',
            MTTR: '0.52',
            MSR: '0.86'
          }, {
            name: '方案三',
            MTBF: '69.84',
            MTTR: '0.62',
            MSR: '0.88'
          }
        ],
      }
    },
    mounted() {
      this.getProductList()
    },
    components: {
      ProductModelTree,
    },
    methods: {
      onTreeSelected(data) {
        if (this.dataForm.id) {
          console.log(data, 'onProductSelected')
          this.dataForm.showProductId = data.id
          this.$refs.SimulatCurve.getProductEcharts(this.dataForm);
        }
      },
      // 获取信息
      onProductSelected(data) {
        this.isSelect = true
        console.log(data, ' onProductSelected(data)')
        this.dataForm.productId = data.id
        this.$nextTick(() => {
          this.$refs.ProductModelTree.getProductList()
        })
      },
      onSchemeSelected(data) {
        this.dataForm.id = data.id
      },
      zk() {
        this.isZk = !this.isZk;
      },
      async getProductList() {
        let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList')
        this.productList = res.data
        this.onProductSelected(this.productList[0])
      },
      compair() {
        this.isShow = true
        this.option = {
          xAxis: {
            data: [0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0, 450.0, 500.0, 550.0],
            name: '仿真总时长'
          },
          yAxis: {
            type: 'value',
            name: '可靠度',
          },
          legend: {
            data: ['方案一', '方案二', '方案三']
          },
          series: [
            {
              name: '方案一',
              type: 'line',
              smooth: true,
              data: [1.0, 0.6, 0.39, 0.39, 0.24, 0.14, 0.08, 0.06, 0.06, 0.04, 0.02, 0.01, 0.01, 0.0, 0.0]
            },
            {
              name: '方案二',
              type: 'line',
              smooth: true,
              data: [1.0, 0.8, 0.59, 0.58, 0.34, 0.35, 0.18, 0.16, 0.16, 0.04, 0.04, 0.02, 0.01, 0.1, 0.0]
            },
            {
              name: '方案三',
              type: 'line',
              smooth: true,
              data: [1.0, 0.7, 0.45, 0.44, 0.38, 0.38, 0.15, 0.08, 0.08, 0.02, 0.02, 0.01, 0.01, 0.1, 0.0]
            }
          ]
        };
        this.myChart = echart.init(document.getElementById("myChart"));
        console.log(this.option, ' this.option ')
        this.myChart.setOption(this.option);
        //随着屏幕大小调节图表
        window.addEventListener("resize", () => {
          this.myChart.resize();
        });
      }
    }
  }
</script>
<style>
</style>