modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/ParamDataController.java
@@ -41,7 +41,7 @@ @ApiImplicitParams({ @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), @ApiImplicitParam(name = "name", value = "名称", dataType = Constant.QT.STRING, format = "NAME^LK"), @ApiImplicitParam(name = "name", value = "名称", dataType = Constant.QT.STRING, format = "a.NAME^LK"), @ApiImplicitParam(name = "reliabDistribType", value = "可靠性分布", dataType = Constant.QT.STRING, format = "reliab_distrib_type^EQ"), @ApiImplicitParam(name = "repairDistribType", value = "维修分布", dataType = Constant.QT.STRING, format = "repair_distrib_type^EQ"), @ApiImplicitParam(name = "repairable", value = "可维修", dataType = Constant.QT.STRING, format = "repairable^EQ"), modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -105,12 +105,12 @@ @GetMapping("getProductList") public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) { if(productType==2){ shipId =null; if (productType == 2) { shipId = null; } List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1); if(productType == 5){ List<XhProductModel> list2 = xhProductModelService.getProductList(shipId, productType - 2); if (productType == 5) { List<XhProductModel> list2 = xhProductModelService.getProductList(shipId, productType - 2); list.addAll(list2); } return Result.ok(list); @@ -155,31 +155,7 @@ public Result insert(@RequestBody XhProductModel xhProductModel) { //效验数据 ValidatorUtils.validateEntity(xhProductModel, AddGroup.class, DefaultGroup.class); Integer no = xhProductModelService.getNo(xhProductModel.getPid(), xhProductModel.getProductType()); if (xhProductModel.getSort() == null || xhProductModel.getSort() < no) { xhProductModel.setSort(no + 1); } if (xhProductModel.getProductType().equals("2")) { Long id = UUIDUtil.generateId(); xhProductModel.setId(id); xhProductModel.setShipId(id); ParamData data = new ParamData(); data.setShipId(id); data.setProductId(id); paramDataService.insert(data); } xhProductModel.setNamePath(xhProductModel.getNamePath() + "," + xhProductModel.getName()); xhProductModelService.insert(xhProductModel); ParamData data = new ParamData(); data.setShipId(xhProductModel.getShipId()); data.setProductId(xhProductModel.getId()); paramDataService.insert(data); Map<Long, XhProductModel> imgMap = new HashMap<>(); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); xhProductModelService.insertProduct(xhProductModel); return Result.ok(); } @@ -206,11 +182,7 @@ public Result update(@RequestBody XhProductModel xhProductModel) { //效验数据 ValidatorUtils.validateEntity(xhProductModel, UpdateGroup.class, DefaultGroup.class); xhProductModelService.update(xhProductModel); Map<Long, XhProductModel> imgMap = new HashMap<>(); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); xhProductModelService.updateProduct(xhProductModel); return Result.ok(); } @@ -230,7 +202,7 @@ imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); for (Long id : ids) { Long[] list = xhProductModelService.getByPid(id); if (list.length > 0){ if (list.length > 0) { this.deleteByProduct(list); } imgMap.remove(id); modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -102,24 +102,32 @@ productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, Constant.Bool.NO).lt("product_type", 5).ne("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)).orderByAsc(Constant.TableColumn.SORT)); } else if (ztShow == 5) { List<XhProductModel> dbList = baseDao.getProductListByShip(productId,2,5); List<XhProductModel> dbList = baseDao.getProductListByShip(productId, 2, 5); for (XhProductModel row : dbList) { if (row.getSameSbNum()!=null && row.getSameSbNum() > 1) { for (int i = 1; i <= row.getSameSbNum(); i++) { try { XhProductModel newRow = row.clone(); newRow.setDeviceNo(i); newRow.setName(row.getName() + "-" + i); newRow.setDataId(row.getId().toString() + "-" + i); productList.add(newRow); } catch (CloneNotSupportedException e) { e.printStackTrace(); int sameNum = row.getSameSbNum() == null ? 1 : row.getSameSbNum(); for (int i = 1; i <= sameNum; i++) { try { XhProductModel newRow = null; if (sameNum > 1) { newRow = row.clone(); } else newRow = row; if ("5".equals(newRow.getProductType())){ newRow.setDeviceNo(i); newRow.setDataId(row.getId().toString() + "-" + i); if (i>1){ newRow.setName(row.getName() + "-" + i); } } else{ newRow.setDeviceNo(0); newRow.setDataId(row.getId().toString()); } productList.add(newRow); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } else { row.setDeviceNo(0); row.setDataId(row.getId().toString()); productList.add(row); } } productList.sort(Comparator.comparing(XhProductModel::getSort, Comparator.naturalOrder()) @@ -138,7 +146,7 @@ } public List<XhProductModel> getProductList(Long shipId, Integer type) { List<XhProductModel> ProductList = baseDao.getProductList(shipId,type); List<XhProductModel> ProductList = baseDao.getProductList(shipId, type); return TreeUtils.build(ProductList); } @@ -153,6 +161,7 @@ } public List<Map<String, Object>> importProductExcel(MultipartFile mutFile, String progressId, Long shipId) { Map<Long, XhProductModel> imgMap = new HashMap<>(); Date beginDate = new Date(); List<Map<String, Object>> list = new ArrayList<>();//存储所有的导入状态 Map<String, Object> map;//存储每一行的状态 @@ -319,6 +328,8 @@ xhProductModel.setOperatImg(defultImg); xhProductModel.setNamePath(curXtName); this.insert(xhProductModel); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); //导入预计参数 ParamData itemEntity = new ParamData(); @@ -339,6 +350,8 @@ xhProductModel.setOperatImg(defultImg); xhProductModel.setNamePath(fxtPath); this.insert(xhProductModel); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); //导入预计参数 ParamData itemEntity = new ParamData(); @@ -360,8 +373,12 @@ xhProductModel.setNamePath(sbPath); if (insertSb) { this.insert(xhProductModel); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); } else { this.update(xhProductModel); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); } //导入预计参数 @@ -471,106 +488,106 @@ String fxt = ""; String sb = ""; for (int i = 0; i < List.size(); i++) { num = num + 1; String[] parentList = List.get(i).getNamePath().split(","); Row row = sheet.createRow(sheet.getLastRowNum() + 1); // 创建新行 Cell cell = row.createCell(0); cell.setCellValue(num); num = num + 1; String[] parentList = List.get(i).getNamePath().split(","); Row row = sheet.createRow(sheet.getLastRowNum() + 1); // 创建新行 Cell cell = row.createCell(0); cell.setCellValue(num); if (!xt.equals(parentList[0])) { xt = parentList[0]; cell = row.createCell(1); cell.setCellValue(xt); } if (parentList.length > 2) { if (!fxt.equals(parentList[1])) { fxt = parentList[1]; cell = row.createCell(2); cell.setCellValue(fxt); } if (!sb.equals(parentList[2])) { sb = parentList[2]; cell = row.createCell(3); cell.setCellValue(sb); } } else { if (!sb.equals(parentList[1])) { sb = parentList[1]; cell = row.createCell(3); cell.setCellValue(sb); } if (parentList.length > 2) { if (!fxt.equals(parentList[1])) { fxt = parentList[1]; cell = row.createCell(2); cell.setCellValue(fxt); } cell = row.createCell(4); cell.setCellValue(List.get(i).getSameSbNum()); cell = row.createCell(5); if (StringUtils.isNotBlank(List.get(i).getEquipType())) { cell.setCellValue(List.get(i).getEquipType()); if (!sb.equals(parentList[2])) { sb = parentList[2]; cell = row.createCell(3); cell.setCellValue(sb); } cell = row.createCell(6); String type = reliabType.get(List.get(i).getReliabDistribType()); cell.setCellValue(type); cell = row.createCell(7); String isNot = isOrNot.get(List.get(i).getBasicJoinCompute()); cell.setCellValue(isNot); cell = row.createCell(8); if (List.get(i).getBasicMtbfRegulate() != null) { cell.setCellValue(List.get(i).getBasicMtbfRegulate()); } cell = row.createCell(9); if (List.get(i).getBasicMtbfRegulSuccRate() != null) { cell.setCellValue(List.get(i).getBasicMtbfRegulSuccRate()); } cell = row.createCell(10); if (List.get(i).getBasicMtbfOperatingRatio() != null) { cell.setCellValue(List.get(i).getBasicMtbfOperatingRatio()); } else { cell.setCellValue(1.0); } cell = row.createCell(11); if (List.get(i).getTaskMtbcfRegulate() != null) { cell.setCellValue(List.get(i).getTaskMtbcfRegulate()); } cell = row.createCell(12); if (List.get(i).getTaskMtbcfOtherParams2() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOtherParams2()); } cell = row.createCell(13); if (List.get(i).getTaskMtbcfOtherParams3() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOtherParams3()); } cell = row.createCell(14); if (List.get(i).getTaskMtbcfRegulSuccRate() != null) { cell.setCellValue(List.get(i).getTaskMtbcfRegulSuccRate()); } cell = row.createCell(15); if (List.get(i).getTaskMtbcfOperatingRatio() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOperatingRatio()); } else { cell.setCellValue(1.0); } cell = row.createCell(16); if (List.get(i).getRepairable() != null) { isNot = isOrNot.get(List.get(i).getRepairable()); cell.setCellValue(isNot); } cell = row.createCell(17); if (List.get(i).getRepairDistribType() != null) { type = repairType.get(List.get(i).getRepairDistribType()); cell.setCellValue(type); } cell = row.createCell(18); if (List.get(i).getRepairMttcr() != null) { cell.setCellValue(List.get(i).getRepairMttcr()); } cell = row.createCell(19); if (List.get(i).getRepairMttcrOtherParams2() != null) { cell.setCellValue(List.get(i).getRepairMttcrOtherParams2()); } cell = row.createCell(20); if (List.get(i).getRepairMttcrOtherParams3() != null) { cell.setCellValue(List.get(i).getRepairMttcrOtherParams3()); } else { if (!sb.equals(parentList[1])) { sb = parentList[1]; cell = row.createCell(3); cell.setCellValue(sb); } } cell = row.createCell(4); cell.setCellValue(List.get(i).getSameSbNum()); cell = row.createCell(5); if (StringUtils.isNotBlank(List.get(i).getEquipType())) { cell.setCellValue(List.get(i).getEquipType()); } cell = row.createCell(6); String type = reliabType.get(List.get(i).getReliabDistribType()); cell.setCellValue(type); cell = row.createCell(7); String isNot = isOrNot.get(List.get(i).getBasicJoinCompute()); cell.setCellValue(isNot); cell = row.createCell(8); if (List.get(i).getBasicMtbfRegulate() != null) { cell.setCellValue(List.get(i).getBasicMtbfRegulate()); } cell = row.createCell(9); if (List.get(i).getBasicMtbfRegulSuccRate() != null) { cell.setCellValue(List.get(i).getBasicMtbfRegulSuccRate()); } cell = row.createCell(10); if (List.get(i).getBasicMtbfOperatingRatio() != null) { cell.setCellValue(List.get(i).getBasicMtbfOperatingRatio()); } else { cell.setCellValue(1.0); } cell = row.createCell(11); if (List.get(i).getTaskMtbcfRegulate() != null) { cell.setCellValue(List.get(i).getTaskMtbcfRegulate()); } cell = row.createCell(12); if (List.get(i).getTaskMtbcfOtherParams2() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOtherParams2()); } cell = row.createCell(13); if (List.get(i).getTaskMtbcfOtherParams3() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOtherParams3()); } cell = row.createCell(14); if (List.get(i).getTaskMtbcfRegulSuccRate() != null) { cell.setCellValue(List.get(i).getTaskMtbcfRegulSuccRate()); } cell = row.createCell(15); if (List.get(i).getTaskMtbcfOperatingRatio() != null) { cell.setCellValue(List.get(i).getTaskMtbcfOperatingRatio()); } else { cell.setCellValue(1.0); } cell = row.createCell(16); if (List.get(i).getRepairable() != null) { isNot = isOrNot.get(List.get(i).getRepairable()); cell.setCellValue(isNot); } cell = row.createCell(17); if (List.get(i).getRepairDistribType() != null) { type = repairType.get(List.get(i).getRepairDistribType()); cell.setCellValue(type); } cell = row.createCell(18); if (List.get(i).getRepairMttcr() != null) { cell.setCellValue(List.get(i).getRepairMttcr()); } cell = row.createCell(19); if (List.get(i).getRepairMttcrOtherParams2() != null) { cell.setCellValue(List.get(i).getRepairMttcrOtherParams2()); } cell = row.createCell(20); if (List.get(i).getRepairMttcrOtherParams3() != null) { cell.setCellValue(List.get(i).getRepairMttcrOtherParams3()); } } response.setContentType("application/octet-stream;charset=UTF-8"); String encodedFilename = DownloadService.getNameEncoder(request, name + "_产品结构树.xlsx"); response.addHeader("Content-Disposition", "attachment;filename=" + encodedFilename); @@ -589,6 +606,7 @@ writeList(dto.getChildren(), List); } } public void refreshCache() { List<XhProductModel> productList = baseDao.getProductListAll(); Map<Long, XhProductModel> imgMap = new HashMap<>(); @@ -600,8 +618,54 @@ public void getImg(HttpServletResponse response, Long id) { Map<Long, XhProductModel> imgMap = new HashMap<>(); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache","sysImgCache"); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); XhProductModel product = imgMap.get(id); sysPictureBaseService.getSvgImage(response,product.getOperatImg()); sysPictureBaseService.getSvgImage(response, product.getOperatImg()); } public void insertProduct(XhProductModel xhProductModel) { Integer no = this.getNo(xhProductModel.getPid(), xhProductModel.getProductType()); if (xhProductModel.getSort() == null || xhProductModel.getSort() < no) { xhProductModel.setSort(no + 1); } if (xhProductModel.getProductType().equals("2")) { Long id = UUIDUtil.generateId(); xhProductModel.setId(id); xhProductModel.setShipId(id); ParamData data = new ParamData(); data.setShipId(id); data.setProductId(id); paramDataService.insert(data); } else { xhProductModel.setNamePath(xhProductModel.getNamePath() + "," + xhProductModel.getName()); this.insert(xhProductModel); ParamData data = new ParamData(); data.setShipId(xhProductModel.getShipId()); data.setProductId(xhProductModel.getId()); paramDataService.insert(data); } Map<Long, XhProductModel> imgMap = new HashMap<>(); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); } public void updateProduct(XhProductModel xhProductModel) { XhProductModel oldXh = this.get(xhProductModel.getId()); if (oldXh != null) { if (!oldXh.getPid().equals(xhProductModel.getPid())) { XhProductModel parentXh = this.get(xhProductModel.getPid()); if (parentXh.getProductType().equals("3")) { xhProductModel.setNamePath(parentXh.getName() + "," + xhProductModel.getName()); } else if (parentXh.getProductType().equals("4")) { xhProductModel.setNamePath(parentXh.getNamePath() + "," + xhProductModel.getName()); } } } this.update(xhProductModel); Map<Long, XhProductModel> imgMap = new HashMap<>(); imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); imgMap.put(xhProductModel.getId(), xhProductModel); } } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/TaskBinoParamController.java
@@ -12,6 +12,7 @@ import com.zt.common.validator.group.AddGroup; import com.zt.common.validator.group.DefaultGroup; import com.zt.common.validator.group.UpdateGroup; import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; import com.zt.life.modules.mainPart.taskReliability.model.TaskBinoParam; import com.zt.life.modules.mainPart.taskReliability.model.TaskPhaseModel; import com.zt.life.modules.mainPart.taskReliability.service.TaskBinoParamService; @@ -41,15 +42,17 @@ private TaskBinoParamService taskBinoParamService; @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), @ApiImplicitParam(name = "taskId", value = "任务Id", dataType = Constant.QT.STRING), }) public Result<List<TaskBinoParam>> page(@ApiIgnore @QueryParam QueryFilter queryFilter){ @ApiOperation("查询") public Result<List<TaskBinoParam>> page(Long taskId,Long productId){ return Result.ok(taskBinoParamService.page(queryFilter)); return Result.ok(taskBinoParamService.page(taskId,productId)); } @GetMapping("getSb") @ApiOperation("查询二项设备") public Result<List<XhProductModel>> getSb(Long shipId){ return Result.ok(taskBinoParamService.getSb(shipId)); } @GetMapping("{id}") modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dao/TaskBinoParamDao.java
@@ -1,6 +1,7 @@ package com.zt.life.modules.mainPart.taskReliability.dao; import com.zt.common.dao.BaseDao; import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; import com.zt.life.modules.mainPart.taskReliability.model.TaskBinoParam; import org.apache.ibatis.annotations.Mapper; @@ -18,7 +19,8 @@ @Mapper public interface TaskBinoParamDao extends BaseDao<TaskBinoParam> { List<TaskBinoParam> getList(Map<String, Object> params); List<TaskBinoParam> getList(Long taskId,Long productId); List<TaskBinoParam> getBinoParams(Long taskId); List<XhProductModel> getSb(Long shipId); } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/dto/ProductStatusDto.java
@@ -16,6 +16,7 @@ public class ProductStatusDto implements Cloneable{ private Long id ; private String name ; private String productType ; private Integer sort ; private Integer sameSbNum ; private Integer deviceNo ; modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
@@ -561,22 +561,30 @@ 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(); newRow.setDeviceNo(i); newRow.setName(item.getName() + "-" + i); newRow.setDataId(item.getId().toString() + "-" + i); childList.add(newRow); } catch (CloneNotSupportedException e) { e.printStackTrace(); 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.setDataId(item.getId().toString() + "-" + i); 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())); modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/TaskBinoParamService.java
@@ -1,6 +1,7 @@ package com.zt.life.modules.mainPart.taskReliability.service; import com.zt.common.service.BaseService; import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; import com.zt.life.modules.mainPart.taskReliability.dao.TaskBinoParamDao; import com.zt.life.modules.mainPart.taskReliability.model.TaskBinoParam; import org.springframework.stereotype.Service; @@ -21,12 +22,12 @@ /** * 分页查询 * * @param queryFilter * @param * @return */ public List<TaskBinoParam> page(QueryFilter queryFilter) { List<TaskBinoParam> page = baseDao.getList(queryFilter.getQueryParams()); return queryFilter.getPageList(page); public List<TaskBinoParam> page(Long taskId,Long productId) { List<TaskBinoParam> page = baseDao.getList(taskId,productId); return page; } /** @@ -39,4 +40,7 @@ } public List<XhProductModel> getSb(Long shipId) { return baseDao.getSb(shipId); } } modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -29,8 +29,8 @@ a.basic_unit_num * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate_tmp WHEN a.reliab_distrib_type = 3 THEN a.basic_unit_num * a.basic_mtbf_operating_ratio *(1-basic_mtbf_regul_succ_rate)/ a.basic_mtbf_regul_succ_rate a.basic_unit_num * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate_tmp ELSE 0 END ) AS WeightedFailure, sum( @@ -42,7 +42,7 @@ a.basic_mtbf_regulate_tmp WHEN a.repairable = 1 and a.reliab_distrib_type = 3 THEN a.basic_unit_num * a.basic_mtbf_operating_ratio * a.repair_mttcr / a.basic_mtbf_regul_succ_rate a.basic_mtbf_regulate_tmp ELSE 0 END ) AS WeightedMttr @@ -85,7 +85,7 @@ 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 SET basic_mtbf_regulate_tmp = basic_mtbf_regul_succ_rate/(1-basic_mtbf_regul_succ_rate) where b.ship_id = ${shipId} and reliab_distrib_type = 3 </update> modules/mainPart/src/main/resources/mapper/taskReliability/SimulatAssessDao.xml
@@ -27,12 +27,12 @@ <select id="getChildren" resultType="com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto"> select * from ( SELECT f.id, f.name, 0 as sort, 1 as sameSbNum SELECT f.id, f.name, 0 as sort, 1 as sameSbNum,f.product_type FROM product_model f WHERE f.id = ${productId} AND f.is_delete = 0 union SELECT f.id, f.name, f.sort, g.basic_unit_num as sameSbNum SELECT f.id, f.name, f.sort, g.basic_unit_num as sameSbNum,f.product_type FROM `task_phase` a, task_phase_model b, operat_condit c, modules/mainPart/src/main/resources/mapper/taskReliability/TaskBinoParamDao.xml
@@ -52,22 +52,31 @@ and g.product_id = f.id and g.is_delete = 0 and g.reliab_distrib_type = 3 and g.product_id = ${productId} ) a left join task_bino_param b on b.task_id = ${taskId} and b.phase_id = a.phase_id and b.operat_condit_id = a.operat_condit_id and b.model_id = a.model_id /*and b.model_id = a.model_id*/ and b.product_id = a.product_id order by a.phase_id, a.operat_condit_id, a.product_id </select> <select id="getBinoParams" resultType="com.zt.life.modules.mainPart.taskReliability.model.TaskBinoParam"> select a.* from task_bino_param a where a.IS_DELETE=0 and a.task_id = #{taskId} from task_bino_param a where a.IS_DELETE = 0 and a.task_id = #{taskId} </select> <select id="getSb" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> select a.id, a.name_path from product_model a left join param_data b on b.product_id = a.id where a.IS_DELETE = 0 and b.IS_DELETE = 0 and a.ship_id = ${shipId} and b.reliab_distrib_type = 3 order by sort </select> </mapper> web/src/views/modules/basicInfo/ParamData.vue
@@ -30,6 +30,9 @@ clearable></zt-dict> </el-form-item> <el-form-item> <el-input v-model="dataForm.name" placeholder="请输入名称" clearable></el-input> </el-form-item> <el-form-item> <zt-button v-if="dataForm.srcId" type="warning" @click="handleSaveRows">保存</zt-button> <zt-button v-if="dataForm.srcId" type="query" @click="table.query()"/> <!-- <zt-button type="add" v-if="dataForm.productType==='3'" @click="add()"/>--> web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -7,7 +7,7 @@ <zt-form-item label="名称" prop="name" rules="required"> <el-input v-model="dataForm.name"></el-input> </zt-form-item> <zt-form-item v-if="dataForm.productType==='5'" prop="equipType" label="设备类型" rules="required"> <zt-form-item v-if="dataForm.productType==='5'||dataForm.productType===5" prop="equipType" label="设备类型"> <el-input v-model="dataForm.equipType"></el-input> </zt-form-item> <zt-form-item label="节点类型" prop="productType" rules="required"> web/src/views/modules/taskReliability/Task.vue
@@ -23,9 +23,9 @@ <el-table-column prop="taskName" label="任务名称" align="center" /> <!--<el-table-column prop="taskSort" label="任务顺序" align="center"/>--> <el-table-column prop="taskDuration" label="任务总时长" align="right" /> <!-- <el-table-column prop="taskStaus" label="状态" align="center" >--> <!-- <el-table-column prop="taskStaus" label="状态" align="center" > </el-table-column> </el-table-column>--> <zt-table-column-handle :table="table" delete-perm="taskReliability::delete" width="100"/> </el-table> @@ -72,7 +72,7 @@ }, openDialog() { if (this.dataForm.id) { this.$refs.taskBinoParam.$refs.dialog.init(null, {taskId: this.dataForm.id}) this.$refs.taskBinoParam.$refs.dialog.init(null, {taskId: this.dataForm.id,shipId :this.dataForm.productId}) } else { this.$alert("请选择具体任务") } web/src/views/modules/taskReliability/TaskBinoParam.vue
@@ -1,52 +1,76 @@ <template> <zt-dialog ref="dialog" column="3" title="二项参数" @confirm="handleSaveRows" append-to-body :editAble="true" :hasConfirm="false"> <zt-table-wraper :paging='false' ref="tableObj" query-url="/taskReliability/TaskBinoParam/page" delete-url="/taskReliability/TaskBinoParam" v-slot="{ table }" > <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> </el-form> <el-table v-loading="table.dataLoading" :data="table.dataList" height="600px" border @selection-change="table.selectionChangeHandle" @cell-click="handleCellClick" :header-cell-style="{'text-align':'center'}"> <!-- <el-table-column type="selection" width="40"/>--> <el-table-column prop="phaseName" label="阶段" align="center" /> <el-table-column prop="operatConditName" label="工况" align="center"/> <el-table-column prop="productName" label="二项分布设备" align="center"/> <el-table-column prop="successRate" label="成功率" width="100" align="right"> <template slot-scope="scope" > <zt-dialog ref="dialog" column="3" title="二项参数" @confirm="handleSaveRows" append-to-body :editAble="true" :hasConfirm="false"> <el-row :gutter="5"> <el-col :span="6"> <el-form :inline="true" :model="dataForm" style="padding: 0"> <el-form-item style="margin: 0"> <span style="font-size: 17px">二项分布设备列表</span> </el-form-item> </el-form> <el-table :data="sbData" @row-click="selectSb" border highlight-current-row :header-cell-style="{'text-align':'center'}"> <el-table-column prop="namePath" label="二项分布设备" align="left"/> </el-table> </el-col> <el-col :span="18"> <el-form :inline="true" :model="dataForm" style="padding: 0"> <el-form-item style="margin: 0"> <span style="font-size: 17px">二项分布设备参数</span> </el-form-item> <el-form-item style="float: right;margin: 0"> <el-button type="primary" @click="tongXia()">与第一行总次数和成功次数相同</el-button> </el-form-item> </el-form> <el-table v-loading="loading" :data="tableData" border @cell-click="handleCellClick" height="600px" :header-cell-style="{'text-align':'center'}"> <!-- <el-table-column type="selection" width="40"/>--> <el-table-column prop="phaseName" label="阶段" align="center"/> <el-table-column prop="operatConditName" label="工况" align="center"/> <el-table-column prop="productName" label="二项分布设备" align="center"/> <el-table-column prop="successRate" label="成功率" width="100" align="right"> <template slot-scope="scope"> <span v-if="editingCell && editingCell.row === scope.row && editingCell.column.property === scope.column.property"> <el-input ref="editInput" autosize v-model="scope.row.successRate" placeholder="成功率" ></el-input> placeholder="成功率"></el-input> </span> <span v-else>{{scope.row.successRate}}</span> </template> </el-table-column> <el-table-column prop="simulatTimes" label="总次数" align="center" width="100"> <template slot-scope="scope"> <span v-else>{{scope.row.successRate}}</span> </template> </el-table-column> <el-table-column prop="simulatTimes" label="总次数" align="center" width="100"> <template slot-scope="scope"> <span v-if="editingCell && editingCell.row === scope.row && editingCell.column.property === scope.column.property"> <el-input ref="editInput" autosize v-model="scope.row.simulatTimes" placeholder="总次数"></el-input> </span> <span v-else>{{scope.row.simulatTimes}}</span> </template> </el-table-column> <el-table-column prop="successTimes" label="成功次数" align="center" width="100"> <template slot-scope="scope"> <span v-else>{{scope.row.simulatTimes}}</span> </template> </el-table-column> <el-table-column prop="successTimes" label="成功次数" align="center" width="100"> <template slot-scope="scope"> <span v-if="editingCell && editingCell.row === scope.row && editingCell.column.property === scope.column.property"> <el-input ref="editInput" autosize v-model="scope.row.successTimes" placeholder="成功次数"></el-input> </span> <span v-else>{{scope.row.successTimes}}</span> </template> </el-table-column> </el-table> </zt-table-wraper> <span v-else>{{scope.row.successTimes}}</span> </template> </el-table-column> <!-- <el-table-column>--> <!-- <template slot-scope="scope">--> <!-- <zt-table-button @click="tongXia(scope.row,scope.$index)">同下</zt-table-button>--> <!-- {{scope.$index+1}}--> <!-- </template>--> <!-- </el-table-column>--> </el-table> </el-col> </el-row> </zt-dialog> </template> @@ -58,24 +82,48 @@ dataForm: { id: '', taskId: '', shipId: '', successRate: '', simulatTimes: '', successTimes: '', dataThreeList:[] dataThreeList: [] }, loading: false, editingCell: null, tableData: [], dataList: [], sbData: [], originalTableData: [], originalData: null, } }, components: {}, methods: { init(id, row) { async init(id, row) { this.dataForm.taskId = row.taskId this.dataForm.shipId = row.shipId let params = { shipId: this.dataForm.shipId } let res = await this.$http.get('/taskReliability/TaskBinoParam/getSb', {params: params}) if (res.success) { this.sbData = res.data } }, async selectSb(row) { this.loading = true let params = { productId: row.id, taskId: this.dataForm.taskId } let res = await this.$http.get('/taskReliability/TaskBinoParam/page', {params: params}) if (res.success) { this.loading = false this.tableData = res.data } }, async handleSaveRows() { this.dataForm.dataThreeList = this.$refs.tableObj.dataList this.dataForm.dataThreeList = this.tableData console.log(this.dataForm, 'this.dataForm this.dataForm') let res = await this.$http.post('/taskReliability/TaskBinoParam/save', this.dataForm) if (res.success) { @@ -88,6 +136,15 @@ console.log(this.originalTableData, 'this.originalTableData 当前表格json数据') } }, tongXia(row,index){ console.log(this.tableData[0].simulatTimes,'this.tableData[0].simulatTimes') console.log(this.tableData[0].successTimes,'this.tableData[0].successTimes') for(let i=1;i<this.tableData.length; i++){ this.tableData[i].simulatTimes = this.tableData[0].simulatTimes this.tableData[i].successTimes = this.tableData[0].successTimes } this.handleSaveRows() }, handleCellClick(row, column) { this.editingCell = {row, column} this.$nextTick(() => { web/src/views/modules/taskReliability/TaskPhase.vue
@@ -25,9 +25,6 @@ <el-table-column prop="phaseName" label="阶段名称" align="center"/> <el-table-column prop="phaseDurationRate" label="阶段时长比" align="right" width="120"/> <el-table-column prop="remark" label="备注" align="center" width="100"/> <!-- <el-table-column prop="phaseSpeed" label="阶段时速" align="right"/>--> <!--<el-table-column prop="phaseSort" label="阶段顺序" align="center"/>--> <!--<el-table-column prop="operatConditDuration" label="工况时长分配" align="center"/>--> <zt-table-column-handle :table="table" edit-perm="testReviewComment:update" delete-perm="taskReliability::delete" width="100"> <template v-slot="{row}">