| | |
| | | @Resource |
| | | private IEquipmentRunningTraceService equipmentRunningTraceService; |
| | | |
| | | @Resource |
| | | private IMdcAlarmInfoService mdcAlarmInfoService; |
| | | |
| | | @Override |
| | | public List<MdcEquipmentRunningSectionDto> logList(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { |
| | | |
| | |
| | | List<MdcEquipmentRunningSection> running = loadEquipmentRunningTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr()); |
| | | //查询报警数据 |
| | | List<MdcEquipmentRunningSection> errs = loadEquipmentErrorTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr()); |
| | | Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, equipmentRunningSectionVo.getEquipmentId())); |
| | | if (!running.isEmpty()) { |
| | | MdcEquipmentRunningSectionDto dto; |
| | | Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, equipmentRunningSectionVo.getEquipmentId())); |
| | | String tableName = ""; |
| | | Boolean isTableExist = false; |
| | | if (equip != null) { |
| | |
| | | for (MdcEquipmentRunningSection entity : running) { |
| | | dto = new MdcEquipmentRunningSectionDto(); |
| | | BeanUtils.copyProperties(entity, dto); |
| | | if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber()) && isTableExist) { |
| | | if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber()) && isTableExist && !"ZUOLAN".equals(equip.getDrivetype())) { |
| | | List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(tableName, entity.getStartTime(), entity.getEndTime()); |
| | | if (esList != null && esList.size() > 1) { |
| | | dto.setSequenceNumber(esList.get(0).getSequencenumber()); |
| | |
| | | for (MdcEquipmentRunningSection entity : errs) { |
| | | dto = new MdcEquipmentRunningSectionDto(); |
| | | BeanUtils.copyProperties(entity, dto); |
| | | Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet(); |
| | | if (entity.getStatus() == 22 && set != null && !set.isEmpty()) { |
| | | Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator(); |
| | | //获取报警编号相同的报警信息 |
| | | while (iterator.hasNext()) { |
| | | TmpEquipmentAlarm next = iterator.next(); |
| | | if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) { |
| | | dto.setAlarmContent(next.getAlarmContent()); |
| | | if (entity.getStatus() == 22) { |
| | | if (equip != null) { |
| | | List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, equip.getDrivetype()).eq(MdcAlarmInfo::getAlarmCode, entity.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0)); |
| | | if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) { |
| | | dto.setAlarmContent(mdcAlarmInfo.get(0).getAlarmContent()); |
| | | } |
| | | } |
| | | } |
| | | // Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet(); |
| | | // if (entity.getStatus() == 22 && set != null && !set.isEmpty()) { |
| | | // Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator(); |
| | | // //获取报警编号相同的报警信息 |
| | | // while (iterator.hasNext()) { |
| | | // TmpEquipmentAlarm next = iterator.next(); |
| | | // if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) { |
| | | // dto.setAlarmContent(next.getAlarmContent()); |
| | | // } |
| | | // } |
| | | // } |
| | | dtos.add(dto); |
| | | } |
| | | } |
| | | return dtos; |
| | | |
| | | List<MdcEquipmentRunningSectionDto> result = new ArrayList<>(); |
| | | //合并相同状态数据 |
| | | for (int i = 0; i < dtos.size() - 1; i++) { |
| | | MdcEquipmentRunningSectionDto mdcEquipmentRunningSectionDto = dtos.get(i); |
| | | MdcEquipmentRunningSectionDto next = dtos.get(i + 1); |
| | | if (mdcEquipmentRunningSectionDto.getStatus().equals(next.getStatus()) && mdcEquipmentRunningSectionDto.getEndTime().equals(next.getStartTime())) { |
| | | MdcEquipmentRunningSectionDto equipmentRunningSectionDto = new MdcEquipmentRunningSectionDto(); |
| | | BeanUtils.copyProperties(mdcEquipmentRunningSectionDto, equipmentRunningSectionDto); |
| | | equipmentRunningSectionDto.setEndTime(next.getEndTime()); |
| | | equipmentRunningSectionDto.setDuration(mdcEquipmentRunningSectionDto.getDuration() + next.getDuration()); |
| | | result.add(equipmentRunningSectionDto); |
| | | i++; |
| | | } else { |
| | | result.add(mdcEquipmentRunningSectionDto); |
| | | } |
| | | } |
| | | if (dtos.size() > 1) { |
| | | MdcEquipmentRunningSectionDto a = dtos.get(dtos.size() - 2); |
| | | MdcEquipmentRunningSectionDto b = dtos.get(dtos.size() - 1); |
| | | if (!a.getStatus().equals(b.getStatus()) && a.getEndTime().equals(b.getStartTime())) { |
| | | result.add(dtos.get(dtos.size() - 1)); |
| | | } |
| | | } else if (dtos.size() == 1){ |
| | | result.addAll(dtos); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | //整合加工和待机时间小于n秒的数据 |
| | | erts = mergeLessMinTimeRecords(erts, null); |
| | | List<MdcEquipmentRunningSection> running = mergeRunningTrace(erts); |
| | | if (running != null || !running.isEmpty()) { |
| | | if (running != null && !running.isEmpty()) { |
| | | this.ergodicTrim(running); |
| | | } |
| | | return running; |
| | |
| | | return this.baseMapper.selectAlarmList(mdcAlarmAnalyzeQueryVo, startDate, endDate); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> getDataList(String equipmentId, Date date) { |
| | | return this.baseMapper.getDataList(equipmentId, date); |
| | | } |
| | | |
| | | private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); |