| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.mdc.dto.MdcEquDepDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; |
| | | import org.jeecg.modules.mdc.vo.*; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentProVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentVo; |
| | | import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo; |
| | | import org.jeecg.modules.system.entity.MdcEquipmentDepart; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper; |
| | | import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.modules.system.service.ISysUserDepartService; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private IEquipmentBaseInfoService equipmentBaseInfoService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | |
| | | @Override |
| | | public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) { |
| | |
| | | return this.baseMapper.pageList(page, mdcEquipment); |
| | | } |
| | | |
| | | /** |
| | | * 监控设备转速任务 |
| | | */ |
| | | @Override |
| | | public void monitoringSpeedProcess() { |
| | | List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC")); |
| | | //List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198")); |
| | | // 获取字典数据 |
| | | List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_OPERATING_SPEED_RANGE); |
| | | Integer range = 0; |
| | | if (dictModelList != null && !dictModelList.isEmpty()) { |
| | | range = Integer.valueOf(dictModelList.get(0).getValue()); |
| | | } |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | String saveTableName = mdcEquipment.getSaveTableName(); |
| | | //查询单表数据 |
| | | MdcEquipmentDto mdcEquipmentDto = this.baseMapper.getWorkLineLast(saveTableName); |
| | | if (mdcEquipmentDto != null) { |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("设备运行转速报警!"); |
| | | messageDTO.setCategory("预警消息"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | | Integer spindlespeed = Integer.valueOf(mdcEquipmentDto.getSpindlespeed()); |
| | | Integer actualspindlespeed = Integer.valueOf(mdcEquipmentDto.getActualspindlespeed()); |
| | | if (range.equals(0)) { |
| | | if (spindlespeed > actualspindlespeed) { |
| | | // 实际值大于设定值 高 |
| | | messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] 的设备运行转速高报警!"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } else if (spindlespeed < actualspindlespeed) { |
| | | // 实际值小于设定值 低 |
| | | messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] 的设备运行转速低报警!"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } else { |
| | | int max = actualspindlespeed + actualspindlespeed * (range / 100); |
| | | int min = actualspindlespeed - actualspindlespeed * (range / 100); |
| | | if (spindlespeed > max || spindlespeed < min) { |
| | | if (spindlespeed > actualspindlespeed) { |
| | | // 实际值大于设定值 高 |
| | | messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] 的设备运行转速高报警!"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } else if (spindlespeed < actualspindlespeed) { |
| | | // 实际值小于设定值 低 |
| | | messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] 的设备运行转速低报警!"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |