| | |
| | | filterChainDefinitionMap.put("/eam/faultIntervalTime/**","anon"); |
| | | //设å¤å¯å¼å¨çæ¥è¡¨æé¤ |
| | | filterChainDefinitionMap.put("/eam/repairOrder/getStartRate", "anon"); |
| | | filterChainDefinitionMap.put("/eam/faultIntervalTime/get2MTBF", "anon"); |
| | | //大屿¨¡æ¿ä¾å |
| | | filterChainDefinitionMap.put("/test/bigScreen/**", "anon"); |
| | | filterChainDefinitionMap.put("/bigscreen/template1/**", "anon"); |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sun.org.apache.regexp.internal.RE; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.mapper.RepairOrderMapper; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.RepairReportExportVo; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | |
| | | private String upLoadPath; |
| | | @Autowired |
| | | private IRepairOrderService repairOrderService; |
| | | |
| | | @Autowired |
| | | private RepairOrderMapper repairOrderMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @PutMapping("/accept") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result<?> accept(@RequestBody EquipmentReportRepair equipmentReportRepair ){ |
| | | if(equipmentReportRepair.getErrUda4().equals("1")){ |
| | | if(equipmentReportRepair.getErrUda1().equals("yes")){ |
| | |
| | | equipmentReportRepairService.updateById(equipmentReportRepair); |
| | | RepairOrder repairOrder = repairOrderService.getOne(new QueryWrapper<RepairOrder>().eq("report_repair_id",equipmentReportRepair.getId()),false); |
| | | if(ObjectUtils.isNotNull(repairOrder)){ |
| | | repairOrder.setStatus("3"); |
| | | repairOrderService.updateById(repairOrder); |
| | | |
| | | repairOrderMapper.updateRepair(repairOrder.getId()); |
| | | // repairOrder.setStatus("3"); |
| | | // repairOrder.setActualEndTime(null); |
| | | // repairOrderService.updateById(repairOrder); |
| | | } |
| | | return Result.OK("已驳å"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | |
| | | 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); |
| | | Date dayAfter = DateUtils.getDayAfter(new Date(), -2); |
| | | 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) { |
| | |
| | | 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+"%"); |
| | | faultIntervalTime.setAverageRepairTime(equipmentMTBF.get(0).get("mttr").toString()); |
| | | faultIntervalTime.setAverageFaultIntervalTime(equipmentMTBF.get(0).get("mtbf").toString()); |
| | | faultIntervalTime.setServiceabilityRate(equipmentMTBF.get(0).get("serviceabilityRate").toString()+"%"); |
| | | faultIntervalTime.setStartRate(equipmentMTBF.get(0).get("startRate").toString()+"%"); |
| | | faultIntervalTimeList.add(faultIntervalTime); |
| | | }else{ |
| | | List<Map<String, Object>> mtbfTotalAvailableTime = faultIntervalTimeService.getMTBFTotalAvailableTime(query); |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.entity.Mtbf; |
| | | import org.jeecg.modules.eam.service.IMtbfService; |
| | | import org.jeecg.modules.eam.vo.MtbfVo; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.unit.DataUnit; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 430MTBFæ¯æ¥æ§è¡ä¸æ¬¡è®°å½æ
éæ
éè®¾å¤æ
éæ¶é´ãæ æ
éæ¶é´ |
| | | */ |
| | | @Slf4j |
| | | public class MtbfJob implements Job { |
| | | |
| | | @Autowired |
| | | private IMtbfService mtbfService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | |
| | | LocalDate yesterday = LocalDate.now().minusDays(1); |
| | | List<MtbfVo> reportRepairTimeList = mtbfService.getReportRepairTimeList(yesterday.toString()); |
| | | } |
| | | } |
| | |
| | | List<Map<String, Object>> getEquipmentFaultCause(@Param("params") Map<String,Object> params); |
| | | |
| | | IPage<Map<String, Object>> getMTPF(IPage<Map> pageData,@Param("params") Map<String,Object> params); |
| | | |
| | | boolean updateRepair(@Param("id")String id); |
| | | } |
| | |
| | | <if test="params.useDepartName != null and params.useDepartName != ''"> |
| | | and t2.name =#{params.useDepartName} |
| | | </if> |
| | | <if test="params.useDepartName == '' "> |
| | | and t1.work_center_id is not null |
| | | </if> |
| | | <if test="params.abc != null and params.abc != ''"> |
| | | and t1.equipment_importance_id =#{params.abc} |
| | | </if> |
| | |
| | | <if test="params.equipmentNum != null and params.equipmentNum != ''"> |
| | | and t1.num =#{params.equipmentNum} |
| | | </if> |
| | | ORDER BY t2.name ASC |
| | | |
| | | <!-- <if test="params.workCenterIds != null">--> |
| | | <!-- and t1.work_center_id in--> |
| | | <!-- <foreach collection="params.workCenterIds" open="(" separator="," close=")" item="workCenterId">--> |
| | | <!-- #{workCenterId}--> |
| | | <!-- </foreach>--> |
| | | <!-- </if>--> |
| | | ORDER BY t2.name DESC |
| | | </select> |
| | | |
| | | <select id="getWorkCenterList" parameterType="Map" resultType="Map"> |
| | |
| | | |
| | | <select id="getEquipmentMTBF" parameterType="Map" resultType="Map"> |
| | | SELECT |
| | | tt.equipmentId, |
| | | COUNT(tt.equipmentId) AS faultNumber, |
| | | tt.totalAvailableTime, |
| | | SUM(tt.faultTime) AS faultTime, |
| | | SUM(tt.repairTime) AS repairTime, |
| | | tt.totalAvailableTime - SUM(tt.faultTime) AS noFaultTime |
| | | STR(SUM(tt.faultTime), 10, 2) AS faultTime, |
| | | STR(SUM(tt.repairTime), 10, 2) AS repairTime, |
| | | STR(tt.totalAvailableTime - SUM(tt.faultTime), 10, 2) AS noFaultTime, |
| | | STR(case when COUNT(tt.equipmentId) = 0 THEN '0' WHEN COUNT(tt.equipmentId) > 0 THEN (tt.totalAvailableTime - SUM(tt.faultTime))/COUNT(tt.equipmentId) end, 10, 2) as mtbf, |
| | | STR(case when COUNT(tt.equipmentId) = 0 THEN '0' WHEN COUNT(tt.equipmentId) > 0 THEN SUM(tt.repairTime)/COUNT(tt.equipmentId) end, 10, 2) as mttr, |
| | | STR((tt.totalAvailableTime - SUM(tt.faultTime))/tt.totalAvailableTime*100, 10, 2) as serviceabilityRate, |
| | | STR(SUM(tt.faultTime)/tt.totalAvailableTime*100, 10, 2) as startRate |
| | | FROM( |
| | | SELECT |
| | | t1.equipment_id AS equipmentId, |
| | | datediff( HOUR, #{params.startTime}, #{params.endTime} ) + 24 AS totalAvailableTime, |
| | | datediff( HOUR, isnull( t1.fault_time, GETDATE( ) ), isnull( t2.actual_end_time, GETDATE( ) ) ) AS faultTime, |
| | | case when t2.create_time is null THEN '0' WHEN t2.create_time is not null THEN datediff( HOUR,t2.create_time, isnull( t2.actual_end_time, GETDATE( ) ) ) end AS repairTime |
| | | CAST( DATEDIFF_BIG ( MILLISECOND, isnull( t1.fault_time, GETDATE( ) ), isnull( t2.actual_end_time, (SELECT #{params.endTime}+' '+FORMAT(GETDATE(), 'HH:mm:ss') ) ) ) AS FLOAT ) / 3600000 AS faultTime, |
| | | case when t2.create_time is null THEN '0' WHEN t2.create_time is not null THEN CAST( DATEDIFF_BIG ( MILLISECOND, t2.create_time, isnull( t2.actual_end_time, (SELECT #{params.endTime}+' '+FORMAT(GETDATE(), 'HH:mm:ss') ) ) ) AS FLOAT ) / 3600000 end AS repairTime |
| | | FROM |
| | | mom_eam_equipment_report_repair t1 |
| | | LEFT JOIN mom_eam_repair_order t2 ON t2.report_repair_id = t1.id |
| | |
| | | GROUP BY |
| | | tt.equipmentId,tt.totalAvailableTime |
| | | </select> |
| | | <!-- datediff( HOUR, isnull( t1.fault_time, GETDATE( ) ), isnull( t2.actual_end_time, GETDATE( ) ) ) AS faultTime,--> |
| | | <!-- SUM(tt.repairTime) /COUNT(tt.equipmentId) AS averageRepairTime,--> |
| | | <!-- SUM(tt.noFaultTime) /(COUNT(tt.equipmentId) + 1) AS averageFaultIntervalTime,--> |
| | | <!-- (sum(tt.totalDay) - sum(tt.repairDay))/sum(tt.totalDay) as serviceabilityRate,--> |
| | |
| | | ) t4 ON t3.item_value = t4.repair_order_fault_analysis_uda2 |
| | | group by t3.item_text |
| | | </select> |
| | | |
| | | <update id="updateRepair" parameterType="String"> |
| | | UPDATE mom_eam_repair_order |
| | | SET actual_end_time = null, |
| | | status = '3' |
| | | WHERE id = #{id} |
| | | </update> |
| | | </mapper> |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.entity.FaultIntervalTime; |
| | | import org.jeecg.modules.eam.vo.EquipmentAvailabilityVo; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.EquipmentReportRepair; |
| | |
| | | import org.jeecg.modules.eam.service.IFaultIntervalTimeService; |
| | | import org.jeecg.modules.eam.service.IRepairOrderService; |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | private IRepairOrderService repairOrderService; |
| | | @Autowired |
| | | private ISysDepartService departService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | public List<FaultIntervalTime> getMTBF(Map<String, String> query) throws ParseException { |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getEquipmentList(Map<String, Object> params) { |
| | | // LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // SysUser sysUser = sysUserService.getById(user.getId()); |
| | | // String areaId = sysUser.getAreaId(); |
| | | // List<String> workCenterIds = null; |
| | | // if(StringUtils.isNotBlank(areaId)){ |
| | | // String[] split = areaId.split(","); |
| | | // workCenterIds = Arrays.asList(split); |
| | | // params.put("workCenterIds",workCenterIds); |
| | | // } |
| | | return this.baseMapper.getEquipmentList(params); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class MtbfVo { |
| | | |
| | | /**æ
éæ¶é´*/ |
| | | @Excel(name = "ç»è®¡æ¶é´", width = 15, format = "yyyy-MM-dd") |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd") |
| | | @ApiModelProperty(value = "ç»è®¡æ¶é´") |
| | | private java.util.Date faultData; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @Excel(name = "å建æ¶é´", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private java.util.Date createTime; |
| | | |
| | | /**æ
éæ¥ä¿®åç¼å·*/ |
| | | @Excel(name = "æ
éæ¥ä¿®åç¼å·", width = 15) |
| | | @ApiModelProperty(value = "æ
éæ¥ä¿®åç¼å·") |
| | | private java.lang.String reportRepairNum; |
| | | /**设å¤id*/ |
| | | @Excel(name = "设å¤id", width = 15) |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private java.lang.String equipmentId; |
| | | /**æ»å¯å©ç¨æ¶é´*/ |
| | | @Excel(name = "æ»å¯å©ç¨æ¶é´", width = 15) |
| | | @ApiModelProperty(value = "æ»å¯å©ç¨æ¶é´") |
| | | private java.math.BigDecimal totalAvailableTime; |
| | | /**æ
éæ¶é¿*/ |
| | | @Excel(name = "æ
éæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ
éæ¶é¿") |
| | | private java.math.BigDecimal faultTime; |
| | | /**ç»´ä¿®æ¶é¿*/ |
| | | @Excel(name = "ç»´ä¿®æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "ç»´ä¿®æ¶é¿") |
| | | private java.math.BigDecimal repairTime; |
| | | /**æ æ
éæ¶é¿*/ |
| | | @Excel(name = "æ æ
éæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ æ
éæ¶é¿") |
| | | private java.math.BigDecimal noFaultTime; |
| | | |
| | | /**ç¶æ 1æ¥ä¿® 2ç»´ä¿® 4 宿 */ |
| | | @TableField(exist = false) |
| | | private String Status; |
| | | |
| | | /**æ
éå¼å§æ¶é´*/ |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(exist = false) |
| | | private Date faultStartTime; |
| | | |
| | | /**ç»´ä¿®å¼å§æ¶é´*/ |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(exist = false) |
| | | private Date repairStartTime; |
| | | |
| | | /**ç»´ä¿®å®ææ¶é´*/ |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(exist = false) |
| | | private Date repairEndTime; |
| | | } |