| | |
| | | package com.qianwen.smartman.modules.visual.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Timestamp; |
| | |
| | | import java.util.Objects; |
| | | import java.util.TreeMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.common.cache.cps.TimeSliceCache; |
| | | import com.qianwen.smartman.common.cache.cps.WorkstationCache; |
| | | import com.qianwen.smartman.common.constant.CalendarConstant; |
| | |
| | | import com.qianwen.smartman.common.enums.GlobalWcsTypeEnum; |
| | | import com.qianwen.smartman.common.enums.WcsDataTypeEnums; |
| | | import com.qianwen.smartman.common.enums.WorkstationParamTypeEnum; |
| | | import com.qianwen.smartman.common.utils.ExtraLambdaQueryWrapper; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.modules.cps.dto.CalendarShiftTimeSlicesDTO; |
| | | import com.qianwen.smartman.modules.cps.dto.WorkstationAlarmDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.GlobalWcs; |
| | | import com.qianwen.smartman.modules.cps.entity.Workstation; |
| | | import com.qianwen.smartman.modules.cps.entity.WorkstationWcs; |
| | | import com.qianwen.smartman.modules.cps.service.IGlobalWcsService; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationWcsService; |
| | |
| | | import com.qianwen.smartman.modules.visual.vo.VisualWorkStationStatusVO; |
| | | import com.qianwen.smartman.modules.visual.vo.WorkStationAlarmVO; |
| | | import com.qianwen.smartman.modules.visual.wrapper.StatusWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/visual/service/impl/VisualStatusServiceImpl.class */ |
| | |
| | | private final IGlobalWcsService globalWcsService; |
| | | private final IWorkstationWcsService workstationWcsService; |
| | | private final Integer OUT_OF_SHIFT = -1; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -557259320: |
| | | if (implMethodName.equals("getWorkstationId")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case -427996294: |
| | | if (implMethodName.equals("getDataType")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1431273455: |
| | | if (implMethodName.equals("getCollectSettingItem")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WorkstationWcs") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WorkstationWcs") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WorkstationWcs") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCollectSettingItem(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WorkstationWcs") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getDataType(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public VisualStatusServiceImpl(final ISuperAggregateStateService superAggregateStateService, final IWorkstationService workstationService, final StatusWrapper wrapper, final SuperAggregateStateMapper superAggregateStateMapper, final IGlobalWcsService globalWcsService, final IWorkstationWcsService workstationWcsService) { |
| | | this.superAggregateStateService = superAggregateStateService; |
| | |
| | | if (workStationList == null) { |
| | | workStationList = Collections.EMPTY_LIST; |
| | | } |
| | | List<ICard> list = (List) workStationList.stream().map(item -> { |
| | | List<ICard> list = workStationList.stream().map(item -> { |
| | | return this.workstationService.getDetail(item); |
| | | }).map(item2 -> { |
| | | return new VisualWorkStationStatusVO(item2.getId(), item2.getMachineId(), item2.getName(), null, item2.getAvatar()); |
| | |
| | | return res; |
| | | } |
| | | List<SuperAggregateState> states = Lists.newArrayList(); |
| | | Map<String, List<Workstation>> calendarCodeMap = (Map) workstations.stream().filter(c -> { |
| | | Map<String, List<Workstation>> calendarCodeMap = workstations.stream().filter(c -> { |
| | | return Func.isNotEmpty(c.getCalendarCode()); |
| | | }).collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getCalendarCode(); |
| | | })); |
| | | calendarCodeMap.forEach(calendarCode, workstationList -> { |
| | | calendarCodeMap.forEach((calendarCode, workstationList) -> { |
| | | CalendarShiftTimeSlicesDTO timeSliceShift = TimeSliceCache.getTimeSliceShift(calendarCode, DateUtil.now()); |
| | | List<Long> ids = (List) workstationList.stream().map((v0) -> { |
| | | List<Long> ids = workstationList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(timeSliceShift) && !this.OUT_OF_SHIFT.equals(timeSliceShift.getShiftIndex())) { |
| | |
| | | public ChartGanttStatusDataVO getEquipmentStatusRecord(VisualBaseVO visualBaseVO) { |
| | | List<Long> workStationIdList = visualBaseVO.getWorkStationIdList(); |
| | | List<SuperAggregateState> stateList = new ArrayList<>(); |
| | | List<Workstation> workstationList = this.workstationService.list(Wrappers.<Workstation>lambdaQuery().in(Workstation::getId, workStationIdList)); |
| | | /* |
| | | List<Workstation> workstationList = this.workstationService.list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, workStationIdList)); |
| | | }, workStationIdList));*/ |
| | | if (Func.isNotEmpty(workstationList)) { |
| | | Map<String, List<Workstation>> calendarCodeMap = (Map) workstationList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<String, List<Workstation>> calendarCodeMap = workstationList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getCalendarCode(); |
| | | })); |
| | | calendarCodeMap.forEach(k, v -> { |
| | | List<Long> workstationIds = (List) v.stream().map((v0) -> { |
| | | calendarCodeMap.forEach((k, v) -> { |
| | | List<Long> workstationIds = v.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | CalendarShiftTimeSlicesDTO timeSliceShift = TimeSliceCache.getTimeSliceShift(k, new Date()); |
| | |
| | | } |
| | | }); |
| | | } |
| | | List<SuperAggregateState> collect = (List) stateList.stream().peek(s -> { |
| | | List<SuperAggregateState> collect = stateList.stream().peek(s -> { |
| | | if (Func.isNull(s.getEndTime())) { |
| | | s.setEndTime(new Timestamp(DateUtil.now().getTime())); |
| | | } |
| | |
| | | LocalDateTime dayStart = LocalDateTimeUtils.getDayStart(now); |
| | | LocalDateTime dayEnd = LocalDateTimeUtils.getDayEnd(now); |
| | | List<SuperAggregateState> statusByCondition = this.superAggregateStateService.getStatusByCondition(vo.getWorkStationIdList(), dayStart, dayEnd); |
| | | List<SuperAggregateState> collect = (List) FilterOffUtils.filterOffDay(statusByCondition, OpenTypeEnums.OEE).stream().filter(s -> { |
| | | List<SuperAggregateState> collect = FilterOffUtils.filterOffDay(statusByCondition, OpenTypeEnums.OEE).stream().filter(s -> { |
| | | return s.getRps().intValue() > 0; |
| | | }).collect(Collectors.toList()); |
| | | return this.wrapper.entityToEfficiencyAverageVo(collect, productivityTypeEnum); |
| | |
| | | String timeLevel = timeStatusVO.getTimeLevel(); |
| | | VisualTimeDTO visualTimeDTO = VisualUtils.getTimeSectionByLevel(timeLevel); |
| | | List<SuperAggregateState> statusByCondition = this.superAggregateStateService.getStatusByTimeSection(timeStatusVO.getWorkStationIdList(), visualTimeDTO.getStartTime(), visualTimeDTO.getEndTime()); |
| | | List<SuperAggregateState> collect = (List) FilterOffUtils.filterOffDay(statusByCondition, OpenTypeEnums.OEE).stream().filter(s -> { |
| | | List<SuperAggregateState> collect = FilterOffUtils.filterOffDay(statusByCondition, OpenTypeEnums.OEE).stream().filter(s -> { |
| | | return s.getRps().intValue() > 0; |
| | | }).collect(Collectors.toList()); |
| | | return this.wrapper.entityToEfficiencyTopVo(collect, productivityTypeEnum, timeStatusVO.getTop(), workstations, StringUtil.format("近{}小时稼动率排名", new Object[]{timeLevel})); |
| | |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | List<Long> workIds = (List) workstations.stream().map((v0) -> { |
| | | List<Long> workIds = workstations.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | LocalDate now = LocalDate.now(); |
| | |
| | | } |
| | | |
| | | private ChartSeriesDataVO getChartSeriesDataVO(List<Workstation> workstations, Map<Long, Workstation> workstationMap, List<SuperAggregateState> data, String name) { |
| | | Map<Long, Long> workMap = (Map) data.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Long> workMap = data.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, TreeMap::new, Collectors.mapping((v0) -> { |
| | | return v0.getDurationCollect(); |
| | |
| | | return Long.sum(v0, v1); |
| | | })))); |
| | | List<Map.Entry<Long, Long>> list = Lists.newArrayList(workMap.entrySet()); |
| | | list.sort(o1, o2 -> { |
| | | list.sort((o1, o2) -> { |
| | | return Math.toIntExact(((Long) o2.getValue()).longValue() - ((Long) o1.getValue()).longValue()); |
| | | }); |
| | | WorkstationChartSeriesDataVO res = new WorkstationChartSeriesDataVO(); |
| | |
| | | res2.setSeries(Lists.newArrayList()); |
| | | return res2; |
| | | } |
| | | List<Long> workIds = (List) workstations.stream().map((v0) -> { |
| | | List<Long> workIds = workstations.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | List<SuperAggregateState> data = this.superAggregateStateService.getCurrWeekAlarmState(workIds, week, DefaultWcsEnum.ALARM.getCode()); |
| | | List<SuperAggregateState> data2 = FilterOffUtils.filterOffDay(data, OpenTypeEnums.TIME_USED_ANALYSIS); |
| | | Map<Long, Workstation> workstationMap = (Map) workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, Workstation> workstationMap = workstations.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, v -> { |
| | | return v; |
| | |
| | | |
| | | @Override // org.springblade.modules.visual.service.IVisualStatusService |
| | | public ChartNameValueDataVO getWorkstationRealStatusChart(VisualBaseVO vo) { |
| | | Map<Long, String> settings = this.workstationWcsService.list(Lambda.<WorkstationWcs>in(WorkstationWcs::getWorkstationId, vo.getWorkStationIdList()) |
| | | .eq(WorkstationWcs::getDataType, WcsDataTypeEnums.WcsDataType.STATE.getCode()).select(WorkstationWcs::getCollectSettingItem, WorkstationWcs::getWorkstationId )) |
| | | .stream().collect(Collectors.toMap(WorkstationWcs::getWorkstationId, WorkstationWcs::getCollectSettingItem)); |
| | | /* |
| | | Map<Long, String> settings = (Map) this.workstationWcsService.list(((ExtraLambdaQueryWrapper) Lambda.in((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, vo.getWorkStationIdList()).eq((v0) -> { |
| | |
| | | return v0.getWorkstationId(); |
| | | }, (v0) -> { |
| | | return v0.getCollectSettingItem(); |
| | | })); |
| | | Map<String, Long> statusCollect = (Map) vo.getWorkStationIdList().stream().map(id -> { |
| | | }));*/ |
| | | Map<String, Long> statusCollect = vo.getWorkStationIdList().stream().map(id -> { |
| | | return WorkstationCache.getWorkstationRealTime(id, (String) settings.getOrDefault(id, MdcConstant.DEVICE_STATUS)); |
| | | }).filter((v0) -> { |
| | | return Objects.nonNull(v0); |