| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import org.jeecg.common.api.CommonAPI; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentRepairStatus; |
| | | import org.jeecg.modules.eam.constant.MaintenanceCategoryEnum; |
| | | import org.jeecg.modules.mdc.constant.MdcConstant; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | import org.jeecg.modules.mdc.entity.MdcOeeInfo; |
| | | import org.jeecg.modules.mdc.dto.EamEquipmentExtendDto; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcBoardMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcBoardEquRealTImeVo; |
| | | import org.jeecg.modules.mdc.vo.MdcBoardRateVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentStatusVo; |
| | | import org.jeecg.modules.mdcJc.service.IMdcJcRcJobreportService; |
| | |
| | | |
| | | @Resource |
| | | private IMdcJcRcJobreportService mdcJcRcJobreportService; |
| | | |
| | | @Resource |
| | | private CommonAPI commonAPI; |
| | | |
| | | @Resource |
| | | private IEquipmentLogService equipmentLogService; |
| | | |
| | | @Resource |
| | | private IEquipmentWorkLineService equipmentWorkLineService; |
| | | |
| | | @Resource |
| | | private MdcBoardMapper mdcBoardMapper; |
| | | |
| | | /** |
| | | * 设备状态 |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 设备实时信息 |
| | | */ |
| | | @Override |
| | | public MdcBoardEquRealTImeVo equipmentRealTimeDetail(String equipmentId) { |
| | | MdcBoardEquRealTImeVo mdcBoardEquRealTImeVo = mdcEquipmentService.getByEquipmentId(equipmentId); |
| | | if (mdcBoardEquRealTImeVo == null) { |
| | | return new MdcBoardEquRealTImeVo(); |
| | | } |
| | | //设备管理员翻译 |
| | | String realName = commonAPI.translateDictFromTable("sys_user", "realname", "username", mdcBoardEquRealTImeVo.getEquipmentManager()); |
| | | mdcBoardEquRealTImeVo.setEquipmentManager(realName); |
| | | mdcBoardEquRealTImeVo.setAlarm("无"); |
| | | if (mdcBoardEquRealTImeVo.getOporation() != null) { |
| | | switch (mdcBoardEquRealTImeVo.getOporation()) { |
| | | case 1: |
| | | case 2: |
| | | mdcBoardEquRealTImeVo.setOporationDict("待机"); |
| | | break; |
| | | case 3: |
| | | mdcBoardEquRealTImeVo.setOporationDict("运行"); |
| | | break; |
| | | case 22: |
| | | mdcBoardEquRealTImeVo.setOporationDict("报警"); |
| | | // 查询报警号 |
| | | EquipmentLog equipmentLog = equipmentLogService.findAlarmByEquId(equipmentId); |
| | | if (equipmentLog != null && StringUtils.isNotBlank(equipmentLog.getAlarm())) { |
| | | mdcBoardEquRealTImeVo.setAlarm(equipmentLog.getAlarm()); |
| | | } |
| | | break; |
| | | default: |
| | | mdcBoardEquRealTImeVo.setOporationDict("关机"); |
| | | break; |
| | | } |
| | | } else { |
| | | mdcBoardEquRealTImeVo.setOporationDict("关机"); |
| | | mdcBoardEquRealTImeVo.setOporation(0); |
| | | } |
| | | //设备运行数据 |
| | | Map<String, Object> mapData = equipmentWorkLineService.getDataList(mdcBoardEquRealTImeVo.getSaveTableName()); |
| | | if (mapData != null) { |
| | | if (mapData.containsKey("Sequencenumber")) { |
| | | Object object = mapData.get("Sequencenumber"); |
| | | mdcBoardEquRealTImeVo.setSequenceNumber(object == null ? "" : object.toString()); |
| | | } |
| | | if (mapData.containsKey("spindlespeed")) { |
| | | Object object = mapData.get("spindlespeed"); |
| | | mdcBoardEquRealTImeVo.setSpindleSpeed(object == null ? "" : object.toString()); |
| | | } |
| | | if (mapData.containsKey("spindleload")) { |
| | | Object object = mapData.get("spindleload"); |
| | | mdcBoardEquRealTImeVo.setSpindleLoad(object == null ? "" : object.toString()); |
| | | } |
| | | if (mapData.containsKey("spindlebeilv")) { |
| | | Object object = mapData.get("spindlebeilv"); |
| | | mdcBoardEquRealTImeVo.setSpindlebeilv(object == null ? "" : object.toString()); |
| | | } |
| | | if (mapData.containsKey("feedbeilv")) { |
| | | Object object = mapData.get("feedbeilv"); |
| | | mdcBoardEquRealTImeVo.setFeedbeilv(object == null ? "" : object.toString()); |
| | | } |
| | | } |
| | | // 维保状态 |
| | | EamEquipmentExtendDto eamEquipmentExtendDto = mdcBoardMapper.findEquExtend(equipmentId); |
| | | mdcBoardEquRealTImeVo.setMaintenanceStatus("正常"); |
| | | mdcBoardEquRealTImeVo.setReportRepairStatus("无"); |
| | | if (eamEquipmentExtendDto != null) { |
| | | if (!EquipmentRepairStatus.NORMAL.name().equals(eamEquipmentExtendDto.getRepairStatus())) { |
| | | mdcBoardEquRealTImeVo.setMaintenanceStatus("维修"); |
| | | } else { |
| | | if (EquipmentMaintenanceStatus.UNDER_INSPECTION.name().equals(eamEquipmentExtendDto.getMaintenanceStatus()) || EquipmentMaintenanceStatus.INSPECTION_CONFIRM.name().equals(eamEquipmentExtendDto.getMaintenanceStatus())) { |
| | | mdcBoardEquRealTImeVo.setMaintenanceStatus("点检"); |
| | | } else if (EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name().equals(eamEquipmentExtendDto.getMaintenanceStatus()) || EquipmentMaintenanceStatus.WAIT_CONFIRM.name().equals(eamEquipmentExtendDto.getMaintenanceStatus())) { |
| | | mdcBoardEquRealTImeVo.setMaintenanceStatus("周报"); |
| | | } |
| | | } |
| | | } |
| | | // 报修情况 |
| | | String repairStatus = mdcBoardMapper.findReportRepairStatus(equipmentId); |
| | | if (repairStatus != null) { |
| | | String reportRepair = commonAPI.translateDict("report_repair_status", repairStatus); |
| | | mdcBoardEquRealTImeVo.setReportRepairStatus(reportRepair); |
| | | } else { |
| | | mdcBoardEquRealTImeVo.setReportRepairStatus("无"); |
| | | } |
| | | // 下次点检下次保养 |
| | | Date nextInspection = mdcBoardMapper.findInsOrMain(equipmentId, MaintenanceCategoryEnum.POINT_INSPECTION.name()); |
| | | if (nextInspection != null) { |
| | | mdcBoardEquRealTImeVo.setNextInspection(nextInspection); |
| | | } |
| | | Date nextMaintenance = mdcBoardMapper.findInsOrMain(equipmentId, MaintenanceCategoryEnum.WEEK_MAINTENANCE.name()); |
| | | if (nextMaintenance != null) { |
| | | mdcBoardEquRealTImeVo.setNextMaintenance(nextMaintenance); |
| | | } |
| | | return mdcBoardEquRealTImeVo; |
| | | } |
| | | |
| | | } |