lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalInfoDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ package org.jeecg.modules.mdc.dto; import lombok.Data; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; /** * @author Lius * @date 2024/4/18 9:38 */ @Data public class MdcEquipmentStatisticalInfoDto extends MdcEquipmentStatisticalInfo { private String equipmentName; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java
@@ -82,13 +82,10 @@ for (MdcEquipment mdcEquipment : mdcEquipmentList) { String saveTableName = mdcEquipment.getSaveTableName(); MdcEquipmentDto mdcEquipmentDto = new MdcEquipmentDto(); try { //æ¥è¯¢åè¡¨æ°æ® mdcEquipmentDto = mdcEquipmentService.getWorkLineLast(saveTableName); } catch (Exception e) { log.error("æ¥è¯¢åè¡¨æ°æ®å¤±è´¥!", e); } //æ¥è¯¢åè¡¨æ°æ® mdcEquipmentDto = mdcEquipmentService.getWorkLineLast(saveTableName); if (mdcEquipmentDto != null && StringUtils.isNotBlank(mdcEquipmentDto.getSpindlespeed()) && StringUtils.isNotBlank(mdcEquipmentDto.getActualspindlespeed())) { MessageDTO messageDTO = new MessageDTO(); messageDTO.setTitle("设å¤è¿è¡è½¬éæ¥è¦ï¼"); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java
@@ -2,6 +2,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalInfoDto; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; @@ -86,7 +87,7 @@ /** * æ¥è¯¢åä¸å¤©å©ç¨ç */ List<MdcEquipmentStatisticalInfo> getEquipmentSevenUtilizationStatistics(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end); List<MdcEquipmentStatisticalInfoDto> getEquipmentSevenUtilizationStatistics(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end); List<MdcEquipment> getEquipmentList(@Param("productionId") String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml
@@ -123,13 +123,15 @@ the_date </select> <select id="getEquipmentSevenUtilizationStatistics" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> <select id="getEquipmentSevenUtilizationStatistics" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalInfoDto"> SELECT equipment_id, t1.equipment_id, t2.equipment_name, SUM ( process_long ) processLong, SUM ( open_long ) openLong FROM mdc_equipment_statistical_info mdc_equipment_statistical_info t1 LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id <where> AND the_date BETWEEN #{start} AND #{end} <if test="equipmentIdList != null and equipmentIdList.size() > 0 "> @@ -140,7 +142,7 @@ </if> </where> GROUP BY equipment_id t1.equipment_id,t2.equipment_name </select> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
@@ -1,6 +1,7 @@ package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalInfoDto; import org.jeecg.modules.mdc.entity.EquipmentLog; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; @@ -144,6 +145,9 @@ result.add(mdcCommonVo); } } if (!result.isEmpty()) { result.sort(Comparator.comparing(MdcCommonVo::getValue).reversed()); } return result; } @@ -249,12 +253,13 @@ String end = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE), DateUtils.STRDATE); if (equipmentIdList != null && !equipmentIdList.isEmpty()) { result.put("equipmentIdList", equipmentIdList); List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end); List<MdcEquipmentStatisticalInfoDto> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end); List<EquipmentDayUtilizationVo> dataList = new ArrayList<>(); if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) { for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) { for (MdcEquipmentStatisticalInfoDto mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) { EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo(); equipmentDayUtilizationVo.setEquipmentId(mdcEquipmentStatisticalInfo.getEquipmentId()); equipmentDayUtilizationVo.setEquipmentName(mdcEquipmentStatisticalInfo.getEquipmentName()); equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)); if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) { equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -846,7 +846,11 @@ */ @Override public MdcEquipmentDto getWorkLineLast(String tableName) { return this.baseMapper.findWorkLineLast(tableName); try { return this.baseMapper.findWorkLineLast(tableName); } catch (Exception e) { return null; } } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDayUtilizationVo.java
@@ -15,6 +15,10 @@ */ private String equipmentId; /** * 设å¤åç§° */ private String equipmentName; /** * å©ç¨ç */ private BigDecimal utilizationRate = BigDecimal.ZERO;