| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.tool.utils.DateTimeUtil; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import com.qianwen.smartman.modules.cps.entity.Workstation; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.smis.entity.Workstation; |
| | | import com.qianwen.smartman.modules.smis.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregate; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregateState; |
| | | import com.qianwen.smartman.modules.mdc.enums.OpenTypeEnums; |
| | |
| | | LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN); |
| | | //statusDataList = this.baseMapper.getStatusData(workstationIds, startDate,endDate.plusDays(1L)); |
| | | statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime); |
| | | statusDataList = this.baseMapper.getStatusData(workstationIds, DateTimeUtil.toDate(startTime),DateTimeUtil.toDate(endTime)); |
| | | } |
| | | return buildDuration(statusDataList); |
| | | } |
| | |
| | | @Override |
| | | public List<SuperAggregateState> getStatusDataWithFeedback(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate) { |
| | | //稼动率查询 |
| | | |
| | | //LocalDate startTime = LocalDateTime, LocalDate endDate |
| | | |
| | | List<SuperAggregateState> statusDataList; |
| | | if (StatisticalMethodEnum.SHIFT.equals(statisticalMethod) || StatisticalMethodEnum.DAY.equals(statisticalMethod) || StatisticalMethodEnum.WEEK.equals(statisticalMethod) || StatisticalMethodEnum.MONTH.equals(statisticalMethod)) { |
| | | //statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | |
| | | //statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN); |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, startTime,endTime); |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, DateTimeUtil.toDate(startTime),DateTimeUtil.toDate(endTime)); |
| | | } |
| | | return buildDuration(statusDataList); |
| | | } |
| | |
| | | @Override |
| | | public List<SuperAggregateState> getStatusByCondition(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime) { |
| | | //List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME)); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, DateTimeUtil.toDate(startTime), DateTimeUtil.toDate(endTime)); |
| | | return buildDuration(statusDataList); |
| | | } |
| | | |
| | | @Override |
| | | public List<SuperAggregateState> getStatusByTimeSection(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime) { |
| | | //List<SuperAggregateState> statusDataList = this.baseMapper.getStatusDataByTimeSection(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME)); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusDataByTimeSection(workstationIds, startTime, endTime); |
| | | |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusDataByTimeSection(workstationIds, DateTimeUtil.toDate(startTime), DateTimeUtil.toDate(endTime)); |
| | | return buildDuration(startTime, statusDataList); |
| | | } |
| | | |
| | |
| | | //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //endTimeD = new Date(124,8,3); |
| | | |
| | | |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, startTime, endTime, status); |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, DateTimeUtil.toDate(startTime), DateTimeUtil.toDate(endTime), status); |
| | | |
| | | List<SuperAggregateState> equipmentStatusDuration2 = FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS); |
| | | Map<Long, Long> timeMap = buildDuration(startTime, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | |
| | | //Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), null); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, startTime, endTime, null); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, DateTimeUtil.toDate(startTime), DateTimeUtil.toDate(endTime), null); |
| | | return buildDuration(startTime, FilterOffUtils.filterOffDay(statusDataList, OpenTypeEnums.OEE)); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<SuperAggregateState> getDataByMonth(List<Long> ids, Integer year, List<Integer> monthList) { |
| | | List<SuperAggregateState> data = this.baseMapper.getDataByMonth(ids, year, monthList); |
| | | |
| | | return buildDuration(data); |
| | | } |
| | | |