| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.record.DVALRecord; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.FaultIntervalTime; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IFaultIntervalTimeService; |
| | | import org.jeecg.modules.eam.vo.EquipmentAvailabilityVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: mom_eam_fault_interval_time |
| | |
| | | @RequestMapping("/eam/faultIntervalTime") |
| | | @Slf4j |
| | | public class FaultIntervalTimeController extends JeecgController<FaultIntervalTime, IFaultIntervalTimeService> { |
| | | |
| | | @Autowired |
| | | private IFaultIntervalTimeService faultIntervalTimeService; |
| | | @Autowired |
| | | private IEamEquipmentService equipmentService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | return jsonObject; |
| | | } |
| | | |
| | | /** |
| | | * 生产设备平均故障间隔时间MTBF |
| | | */ |
| | | @GetMapping("/get2MTBF") |
| | | public JSONObject get2MTBF(@RequestParam Map<String, Object> query) throws ParseException { |
| | | String startTime = (String)query.get("startTime"); |
| | | String endTime = (String)query.get("endTime"); |
| | | if(StringUtils.isBlank(startTime) && StringUtils.isBlank(endTime)){ |
| | | Date dayAfter = DateUtils.getDayAfter(new Date(), -3); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));// 设置北京时区 |
| | | query.put("startTime",dateFormat.format(dayAfter)); |
| | | |
| | | String currentDateStr = DateUtils.getCurrentDateStr(); |
| | | query.put("endTime",currentDateStr); |
| | | } |
| | | |
| | | List<Map<String, Object>> equipmentList = faultIntervalTimeService.getEquipmentList(query); |
| | | List<FaultIntervalTime> faultIntervalTimeList = new ArrayList<>(); |
| | | for (Map<String, Object> map : equipmentList) { |
| | | query.put("equipmentId",map.get("id")); |
| | | |
| | | List<Map<String, Object>> equipmentMTBF = faultIntervalTimeService.getEquipmentMTBF(query); |
| | | |
| | | FaultIntervalTime faultIntervalTime = new FaultIntervalTime(); |
| | | faultIntervalTime.setEquipmentId((String)map.get("id")); |
| | | faultIntervalTime.setEquipmentNum((String)map.get("num")); |
| | | faultIntervalTime.setEquipmentName((String)map.get("name")); |
| | | faultIntervalTime.setEquipmentModel((String)map.get("model")); |
| | | faultIntervalTime.setUserDepart((String)map.get("departName")); |
| | | if(equipmentMTBF.size()>0){ |
| | | faultIntervalTime.setTotalAvailableTime(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | faultIntervalTime.setFaultTime(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | faultIntervalTime.setFaultNumber(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | faultIntervalTime.setRepairTime(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | //计算mttr MTTR:故障修复时间/故障次数 |
| | | BigDecimal repairTime = new BigDecimal(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | BigDecimal faultNumber = new BigDecimal(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | BigDecimal averageRepairTime; |
| | | if(new BigDecimal(0).compareTo(faultNumber) == 0){ |
| | | averageRepairTime = new BigDecimal(0); |
| | | }else{ |
| | | averageRepairTime = repairTime.divide(faultNumber, 2, RoundingMode.HALF_UP); |
| | | } |
| | | //计算mtbf |
| | | //MTBF:无故障时间/故障次数 |
| | | BigDecimal averageFaultIntervalTime; |
| | | BigDecimal totalAvailableTime = new BigDecimal(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | BigDecimal faultTime = new BigDecimal(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | BigDecimal noFaultTime = new BigDecimal(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | if(new BigDecimal(0).compareTo(faultNumber) == 0){ |
| | | averageFaultIntervalTime = new BigDecimal(0); |
| | | }else{ |
| | | // averageFaultIntervalTime = (noFaultTime.subtract(faultTime)).divide(faultNumber, 2, BigDecimal.ROUND_HALF_EVEN); |
| | | averageFaultIntervalTime = noFaultTime.divide(faultNumber, 2, RoundingMode.HALF_UP); |
| | | } |
| | | //计算完好率 完好率:无故障时间/总可利用时间 |
| | | // BigDecimal totalDay = new BigDecimal(equipmentMTBF.get(0).get("totalDay").toString()); |
| | | // BigDecimal repairDay = new BigDecimal(equipmentMTBF.get(0).get("repairDay").toString()); |
| | | |
| | | // BigDecimal serviceabilityRate = noFaultTime.divide(totalAvailableTime,2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); |
| | | BigDecimal serviceabilityRate = noFaultTime.divide(totalAvailableTime,2,RoundingMode.HALF_EVEN).multiply(new BigDecimal(100));; |
| | | //故障率 |
| | | // BigDecimal totalAvailableTime = new BigDecimal(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | // BigDecimal repairTime = new BigDecimal(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | BigDecimal startRate = faultTime.divide(totalAvailableTime,2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); |
| | | |
| | | |
| | | faultIntervalTime.setAverageRepairTime(averageRepairTime.toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(averageFaultIntervalTime.toString()); |
| | | faultIntervalTime.setServiceabilityRate(serviceabilityRate+"%"); |
| | | faultIntervalTime.setStartRate(startRate+"%"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getMTBFTotalAvailableTime(query); |
| | | if(query.get("startTime") != "" && query.get("endTime") != ""){ |
| | | faultIntervalTime.setTotalAvailableTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | }else{ |
| | | faultIntervalTime.setTotalAvailableTime("0"); |
| | | faultIntervalTime.setNoFaultTime("0"); |
| | | } |
| | | faultIntervalTime.setAverageFaultIntervalTime("0"); |
| | | faultIntervalTime.setFaultTime("0"); |
| | | faultIntervalTime.setFaultNumber("0"); |
| | | faultIntervalTime.setAverageRepairTime("0"); |
| | | faultIntervalTime.setRepairTime("0"); |
| | | faultIntervalTime.setServiceabilityRate("100%"); |
| | | faultIntervalTime.setStartRate("0.00%"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | } |
| | | |
| | | } |
| | | // Map<String,Object> result= new HashMap<>(); |
| | | // IPage<FaultIntervalTime> pageData = new Page<FaultIntervalTime>(); |
| | | // List<FaultIntervalTime> list = faultIntervalTimeService.getMTBF(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",faultIntervalTimeList); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * A类生产设备平均故障间隔时间MTBF |
| | | */ |
| | | @GetMapping("/getAMTBF") |
| | | public JSONObject getAMTBF(@RequestParam Map<String, Object> query) throws ParseException { |
| | | query.put("abc","A"); |
| | | List<Map<String, Object>> equipmentList = faultIntervalTimeService.getEquipmentList(query); |
| | | List<FaultIntervalTime> faultIntervalTimeList = new ArrayList<>(); |
| | | for (Map<String, Object> map : equipmentList) { |
| | | query.put("equipmentId",map.get("id")); |
| | | |
| | | List<Map<String, Object>> equipmentMTBF = faultIntervalTimeService.getEquipmentMTBF(query); |
| | | |
| | | FaultIntervalTime faultIntervalTime = new FaultIntervalTime(); |
| | | faultIntervalTime.setEquipmentId((String)map.get("id")); |
| | | faultIntervalTime.setEquipmentNum((String)map.get("num")); |
| | | faultIntervalTime.setEquipmentName((String)map.get("name")); |
| | | faultIntervalTime.setEquipmentModel((String)map.get("model")); |
| | | faultIntervalTime.setUserDepart((String)map.get("departName")); |
| | | if(equipmentMTBF.size()>0){ |
| | | faultIntervalTime.setTotalAvailableTime(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | faultIntervalTime.setFaultTime(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | faultIntervalTime.setFaultNumber(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | faultIntervalTime.setAverageRepairTime(equipmentMTBF.get(0).get("averageRepairTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(equipmentMTBF.get(0).get("averageFaultIntervalTime").toString()); |
| | | faultIntervalTime.setRepairTime(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getMTBFTotalAvailableTime(query); |
| | | if(query.get("startTime") != "" && query.get("endTime") != ""){ |
| | | faultIntervalTime.setTotalAvailableTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | }else{ |
| | | faultIntervalTime.setTotalAvailableTime("0"); |
| | | faultIntervalTime.setNoFaultTime("0"); |
| | | faultIntervalTime.setAverageFaultIntervalTime("0"); |
| | | } |
| | | faultIntervalTime.setFaultTime("0"); |
| | | faultIntervalTime.setFaultNumber("0"); |
| | | faultIntervalTime.setAverageRepairTime("0"); |
| | | faultIntervalTime.setRepairTime("0"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | } |
| | | |
| | | } |
| | | // Map<String,Object> result= new HashMap<>(); |
| | | // IPage<FaultIntervalTime> pageData = new Page<FaultIntervalTime>(); |
| | | // List<FaultIntervalTime> list = faultIntervalTimeService.getMTBF(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",faultIntervalTimeList); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 关键、重要生产设备平均故障间隔时间MTBF |
| | | */ |
| | | @GetMapping("/getGJZYMTBF") |
| | | public JSONObject getGJZYMTBF(@RequestParam Map<String, Object> query) throws ParseException { |
| | | query.put("specificEquipment","true"); |
| | | List<Map<String, Object>> equipmentList = faultIntervalTimeService.getEquipmentList(query); |
| | | List<FaultIntervalTime> faultIntervalTimeList = new ArrayList<>(); |
| | | for (Map<String, Object> map : equipmentList) { |
| | | query.put("equipmentId",map.get("id")); |
| | | |
| | | List<Map<String, Object>> equipmentMTBF = faultIntervalTimeService.getEquipmentMTBF(query); |
| | | |
| | | FaultIntervalTime faultIntervalTime = new FaultIntervalTime(); |
| | | faultIntervalTime.setEquipmentId((String)map.get("id")); |
| | | faultIntervalTime.setEquipmentNum((String)map.get("num")); |
| | | faultIntervalTime.setEquipmentName((String)map.get("name")); |
| | | faultIntervalTime.setEquipmentModel((String)map.get("model")); |
| | | faultIntervalTime.setUserDepart((String)map.get("departName")); |
| | | if(equipmentMTBF.size()>0){ |
| | | faultIntervalTime.setTotalAvailableTime(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | faultIntervalTime.setFaultTime(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | faultIntervalTime.setFaultNumber(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | faultIntervalTime.setAverageRepairTime(equipmentMTBF.get(0).get("averageRepairTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(equipmentMTBF.get(0).get("averageFaultIntervalTime").toString()); |
| | | faultIntervalTime.setRepairTime(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getMTBFTotalAvailableTime(query); |
| | | if(query.get("startTime") != "" && query.get("endTime") != ""){ |
| | | faultIntervalTime.setTotalAvailableTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | }else{ |
| | | faultIntervalTime.setTotalAvailableTime("0"); |
| | | faultIntervalTime.setNoFaultTime("0"); |
| | | faultIntervalTime.setAverageFaultIntervalTime("0"); |
| | | } |
| | | faultIntervalTime.setFaultTime("0"); |
| | | faultIntervalTime.setFaultNumber("0"); |
| | | faultIntervalTime.setAverageRepairTime("0"); |
| | | faultIntervalTime.setRepairTime("0"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | } |
| | | |
| | | } |
| | | // Map<String,Object> result= new HashMap<>(); |
| | | // IPage<FaultIntervalTime> pageData = new Page<FaultIntervalTime>(); |
| | | // List<FaultIntervalTime> list = faultIntervalTimeService.getMTBF(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",faultIntervalTimeList); |
| | | return jsonObject; |
| | | } |
| | | |
| | | /** |
| | | * 各生产单位 生产设备平均故障间隔时间MTBF |
| | | */ |
| | | @GetMapping("/getCenterMTBF") |
| | | public JSONObject getCenterMTBF(@RequestParam Map<String, Object> query) throws ParseException { |
| | | List<Map<String, Object>> workCenterList = faultIntervalTimeService.getWorkCenterList(query); |
| | | List<FaultIntervalTime> faultIntervalTimeList = new ArrayList<>(); |
| | | for (Map<String, Object> map : workCenterList) { |
| | | query.put("workCenterId",map.get("workCenterId")); |
| | | |
| | | List<Map<String, Object>> equipmentMTBF = faultIntervalTimeService.getCenterEquipmentMTBF(query); |
| | | |
| | | FaultIntervalTime faultIntervalTime = new FaultIntervalTime(); |
| | | // faultIntervalTime.setEquipmentId((String)map.get("id")); |
| | | // faultIntervalTime.setEquipmentNum((String)map.get("num")); |
| | | // faultIntervalTime.setEquipmentName((String)map.get("name")); |
| | | // faultIntervalTime.setEquipmentModel((String)map.get("model")); |
| | | faultIntervalTime.setUserDepart((String)map.get("workCenterName")); |
| | | if(equipmentMTBF.size()>0){ |
| | | faultIntervalTime.setTotalAvailableTime(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | faultIntervalTime.setFaultTime(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | faultIntervalTime.setFaultNumber(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | faultIntervalTime.setRepairTime(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | faultIntervalTime.setEquipmentNumer(equipmentMTBF.get(0).get("equipmentNumer").toString()); |
| | | |
| | | BigDecimal repairTime = new BigDecimal(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | BigDecimal faultNumber = new BigDecimal(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | BigDecimal totalAvailableTime = new BigDecimal(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | BigDecimal faultTime = new BigDecimal(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | BigDecimal equipmentNumer = new BigDecimal(equipmentMTBF.get(0).get("equipmentNumer").toString()); |
| | | BigDecimal totalDay = new BigDecimal(equipmentMTBF.get(0).get("totalDay").toString()); |
| | | BigDecimal repairDay = new BigDecimal(equipmentMTBF.get(0).get("repairDay").toString()); |
| | | //计算mttr 修复时间/故障次数 |
| | | BigDecimal averageRepairTime = repairTime.divide(faultNumber, 2, BigDecimal.ROUND_HALF_EVEN); |
| | | //计算mtbf (总可利用时间-故障时间)/故障次数 |
| | | BigDecimal averageFaultIntervalTime; |
| | | if(new BigDecimal(0).compareTo(faultNumber)==0){ |
| | | averageFaultIntervalTime = new BigDecimal("0.00").setScale(2, RoundingMode.HALF_UP); |
| | | }else{ |
| | | averageFaultIntervalTime = (totalAvailableTime.subtract(faultTime)).divide(faultNumber, 2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | //完好率 (统计天数*设备数量-故障天数)/(统计天数*设备数量) |
| | | BigDecimal serviceabilityRate = ((totalDay.multiply(equipmentNumer)).subtract(repairDay)).divide((totalDay.multiply(equipmentNumer)), 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100)); |
| | | //开动率 (总可利用时间-故障时间)/总可利用时间 |
| | | BigDecimal startRate = (totalAvailableTime.subtract(faultTime)).divide(totalAvailableTime, 2, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100)); |
| | | |
| | | faultIntervalTime.setAverageRepairTime(averageRepairTime.toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(averageFaultIntervalTime.toString()); |
| | | faultIntervalTime.setServiceabilityRate(serviceabilityRate+"%"); |
| | | faultIntervalTime.setStartRate(startRate+"%"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getCenterMTBFTotalAvailableTime(query); |
| | | if(query.get("startTime") != "" && query.get("endTime") != ""){ |
| | | faultIntervalTime.setTotalAvailableTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime("0.00"); |
| | | }else{ |
| | | faultIntervalTime.setTotalAvailableTime("0"); |
| | | faultIntervalTime.setNoFaultTime("0"); |
| | | faultIntervalTime.setAverageFaultIntervalTime("0.00"); |
| | | } |
| | | faultIntervalTime.setFaultTime("0"); |
| | | faultIntervalTime.setFaultNumber("0"); |
| | | faultIntervalTime.setEquipmentNumer("0"); |
| | | faultIntervalTime.setAverageRepairTime("0.00"); |
| | | faultIntervalTime.setRepairTime("0"); |
| | | faultIntervalTime.setServiceabilityRate("0.00%"); |
| | | faultIntervalTime.setStartRate("0.00%"); |
| | | faultIntervalTime.setStartTime("0"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | } |
| | | |
| | | } |
| | | // Map<String,Object> result= new HashMap<>(); |
| | | // IPage<FaultIntervalTime> pageData = new Page<FaultIntervalTime>(); |
| | | // List<FaultIntervalTime> list = faultIntervalTimeService.getMTBF(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",faultIntervalTimeList); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 各生产单位 A类设备平均故障间隔时间MTBF |
| | | */ |
| | | @GetMapping("/getCenterAMTBF") |
| | | public JSONObject getCenterAMTBF(@RequestParam Map<String, Object> query) throws ParseException { |
| | | query.put("abc","A"); |
| | | List<Map<String, Object>> workCenterList = faultIntervalTimeService.getWorkCenterList(query); |
| | | List<FaultIntervalTime> faultIntervalTimeList = new ArrayList<>(); |
| | | for (Map<String, Object> map : workCenterList) { |
| | | query.put("workCenterId",map.get("workCenterId")); |
| | | |
| | | List<Map<String, Object>> equipmentMTBF = faultIntervalTimeService.getCenterEquipmentMTBF(query); |
| | | |
| | | FaultIntervalTime faultIntervalTime = new FaultIntervalTime(); |
| | | // faultIntervalTime.setEquipmentId((String)map.get("id")); |
| | | // faultIntervalTime.setEquipmentNum((String)map.get("num")); |
| | | // faultIntervalTime.setEquipmentName((String)map.get("name")); |
| | | // faultIntervalTime.setEquipmentModel((String)map.get("model")); |
| | | faultIntervalTime.setUserDepart((String)map.get("workCenterName")); |
| | | if(equipmentMTBF.size()>0){ |
| | | faultIntervalTime.setTotalAvailableTime(equipmentMTBF.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(equipmentMTBF.get(0).get("noFaultTime").toString()); |
| | | faultIntervalTime.setFaultTime(equipmentMTBF.get(0).get("faultTime").toString()); |
| | | faultIntervalTime.setFaultNumber(equipmentMTBF.get(0).get("faultNumber").toString()); |
| | | faultIntervalTime.setAverageRepairTime(equipmentMTBF.get(0).get("averageRepairTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(equipmentMTBF.get(0).get("averageFaultIntervalTime").toString()); |
| | | faultIntervalTime.setRepairTime(equipmentMTBF.get(0).get("repairTime").toString()); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getCenterMTBFTotalAvailableTime(query); |
| | | if(query.get("startTime") != "" && query.get("endTime") != ""){ |
| | | faultIntervalTime.setTotalAvailableTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setNoFaultTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(mtbfTotalAvailableTime.get(0).get("totalAvailableTime").toString()); |
| | | }else{ |
| | | faultIntervalTime.setTotalAvailableTime("0"); |
| | | faultIntervalTime.setNoFaultTime("0"); |
| | | faultIntervalTime.setAverageFaultIntervalTime("0"); |
| | | } |
| | | faultIntervalTime.setFaultTime("0"); |
| | | faultIntervalTime.setFaultNumber("0"); |
| | | faultIntervalTime.setAverageRepairTime("0"); |
| | | faultIntervalTime.setRepairTime("0"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | } |
| | | |
| | | } |
| | | // Map<String,Object> result= new HashMap<>(); |
| | | // IPage<FaultIntervalTime> pageData = new Page<FaultIntervalTime>(); |
| | | // List<FaultIntervalTime> list = faultIntervalTimeService.getMTBF(query); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("data",faultIntervalTimeList); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |