| | |
| | | String workstationId = vo.getWorkstationId(); |
| | | Integer flag = vo.getFlag(); |
| | | String item = vo.getItem(); |
| | | long total = ((Long) Optional.ofNullable(this.parameterMapper.countProcessParameter(item, Long.valueOf(startTime), Long.valueOf(endTime), workstationId)).orElse(0L)).longValue(); |
| | | Page page = new Page(current, size, total); |
| | | long total = Optional.ofNullable(this.parameterMapper.countProcessParameter(item, Long.valueOf(startTime), Long.valueOf(endTime), workstationId)).orElse(0L).longValue(); |
| | | Page<ProcessParameterRealVO> page = new Page<>(current, size, total); |
| | | if (total == 0) { |
| | | return page; |
| | | } |
| | | List<ProcessParameterVO> res = this.parameterMapper.pageProcessParameter(Integer.valueOf(size), Integer.valueOf((current - 1) * size), Long.valueOf(startTime), Long.valueOf(endTime), item, workstationId); |
| | | Map<String, String> map = getWcsMap(); |
| | | List<ProcessParameterRealVO> collect = (List) res.stream().map(c -> { |
| | | List<ProcessParameterRealVO> collect = res.stream().map(c -> { |
| | | String value; |
| | | if (MdcConstant.FLAG.equals(flag)) { |
| | | value = (String) map.get(c.getValue()); |
| | |
| | | |
| | | @Override // org.springblade.modules.mdc.service.IProcessParameterService |
| | | public List<WorkstationWcsDmpDTO> processParam(String workstationId) { |
| | | List<WorkstationWcsDmpDTO> vos = (List) WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | List<WorkstationWcsDmpDTO> vos =WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | return v0.getProcessParameter(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isEmpty(vos)) { |
| | |
| | | |
| | | @Override // org.springblade.modules.mdc.service.IProcessParameterService |
| | | public BladeFile exportProcessParam(ProcessParamExcelVO vo) { |
| | | return exportByHour(vo); |
| | | try { |
| | | return exportByHour(vo); |
| | | } catch (Exception e) { |
| | | log.error("exportProcessParam异常",e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @Override // org.springblade.modules.mdc.service.IProcessParameterService |
| | |
| | | Map<String, String> nameMap = Maps.newHashMap(); |
| | | Set<String> codes = Sets.newHashSet(); |
| | | buildWcsMap(colorMap, nameMap, codes); |
| | | List<StatusDTO> collect = (List) processParameterList.stream().filter(c -> { |
| | | List<StatusDTO> list = processParameterList.stream().filter(c -> codes.contains(c.getValue())).map(param -> StatusDTO.builder().time(DateUtil.formatDateTime(DateUtil.fromMilliseconds(param.getRealTime().longValue()))).name((String)nameMap.get(param.getValue())).color((String)colorMap.get(param.getValue())).value(param.getValue()).build()).collect(Collectors.toList()); |
| | | /* |
| | | List<StatusDTO> collect = processParameterList.stream().filter(c -> { |
| | | return codes.contains(c.getValue()); |
| | | }).map(param -> { |
| | | return StatusDTO.builder().time(DateUtil.formatDateTime(DateUtil.fromMilliseconds(param.getRealTime().longValue()))).name((String) nameMap.get(param.getValue())).color((String) colorMap.get(param.getValue())).value(param.getValue()).build(); |
| | | }).collect(Collectors.toList()); |
| | | return CollectParamResVO.builder().collectItem(dmpDTO.getDescription()).collectRealItem(dmpDTO.getName()).data(collect).build(); |
| | | }).collect(Collectors.toList());*/ |
| | | return CollectParamResVO.<StatusDTO>builder() |
| | | .collectItem(dmpDTO.getDescription()) |
| | | .collectRealItem(dmpDTO.getName()) |
| | | .data(list) |
| | | .build(); |
| | | //return CollectParamResVO.builder().collectItem(dmpDTO.getDescription()).collectRealItem(dmpDTO.getName()).data(list).build(); |
| | | } |
| | | List<ParamDTO> collect = processParameterList.stream().map(param -> ParamDTO.builder().time(DateUtil.formatDateTime(DateUtil.fromMilliseconds(param.getRealTime().longValue()))).value(param.getValue()).build()).collect(Collectors.toList()); |
| | | return CollectParamResVO.<ParamDTO>builder() |
| | | .collectItem(dmpDTO.getDescription()) |
| | | .collectRealItem(dmpDTO.getName()) |
| | | .data(collect) |
| | | .build(); |
| | | /* |
| | | List<ParamDTO> collect2 = (List) processParameterList.stream().map(param2 -> { |
| | | return ParamDTO.builder().time(DateUtil.formatDateTime(DateUtil.fromMilliseconds(param2.getRealTime().longValue()))).value(param2.getValue()).build(); |
| | | }).collect(Collectors.toList()); |
| | | return CollectParamResVO.builder().collectItem(dmpDTO.getDescription()).collectRealItem(dmpDTO.getName()).data(collect2).build(); |
| | | */ |
| | | } |
| | | |
| | | private void buildWcsMap(Map<String, String> colorMap, Map<String, String> nameMap, Set<String> codes) { |
| | |
| | | LocalDate lastDays = ((LocalDate) ListUtils.getLast(dates)).plusDays(1L); |
| | | dates.add(firstDays); |
| | | dates.add(lastDays); |
| | | List<ShiftTimeDetailVO> shiftDetailDates = this.calendarService.getShiftDetailDates(workstation.getCalendarCode(), (List) dates.stream().distinct().collect(Collectors.toList())); |
| | | List<ShiftTimeDetailVO> shiftDetailDates = this.calendarService.getShiftDetailDates(workstation.getCalendarCode(), dates.stream().distinct().collect(Collectors.toList())); |
| | | if (Func.isEmpty(shiftDetailDates)) { |
| | | return Lists.newArrayList(); |
| | | } |
| | | return (List) shiftDetailDates.stream().map(shiftTime -> { |
| | | return shiftDetailDates.stream().map(shiftTime -> { |
| | | LocalDate date = shiftTime.getCalendarDate(); |
| | | LocalDateTime startTime = LocalDateTime.of(date, LocalTime.MIN).plusMinutes(shiftTime.getShiftStartTime().intValue()); |
| | | LocalDateTime endTime = LocalDateTime.of(date, LocalTime.MIN).plusMinutes(shiftTime.getShiftEndTime().intValue()); |
| | |
| | | throw new ServiceException(MessageUtils.message("mdc.process.time.not.null", new Object[0])); |
| | | } |
| | | String workstationId = vo.getWorkstationId(); |
| | | List<WorkstationWcsDmpDTO> vos = (List) WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | List<WorkstationWcsDmpDTO> vos = WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | return v0.getProcessParameter(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isEmpty(vos)) { |
| | | return new ProcessParameterResVO(); |
| | | } |
| | | Map<String, WorkstationWcsDmpDTO> collectItemMap = (Map) vos.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WorkstationWcsDmpDTO> collectItemMap = vos.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getName(); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | log.info("工位的采集项:{}", vos); |
| | | WorkstationWcsDmpDTO wcs = WorkstationCache.getDmpStatus(workstationId); |
| | | List<String> collectItems = (List) vos.stream().map((v0) -> { |
| | | List<String> collectItems = vos.stream().map((v0) -> { |
| | | return v0.getName(); |
| | | }).collect(Collectors.toList()); |
| | | List<ProcessParameterVO> dtoList = oldProcessParameterList(startTime, endTime, collectItems, workstationId); |
| | |
| | | if (Func.isNull(workstation)) { |
| | | return new ProcessParameterResVO(); |
| | | } |
| | | List<WorkstationWcsDmpDTO> vos = (List) WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | List<WorkstationWcsDmpDTO> vos = WorkstationCache.getWorkstationWcsList(workstationId).stream().filter((v0) -> { |
| | | return v0.getProcessParameter(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isEmpty(vos)) { |
| | | return new ProcessParameterResVO(); |
| | | } |
| | | Map<String, WorkstationWcsDmpDTO> collectItemMap = (Map) vos.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WorkstationWcsDmpDTO> collectItemMap = vos.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getName(); |
| | | }, v -> { |
| | | return v; |
| | |
| | | return (ProcessParameterResVO) Optional.ofNullable(timeSliceShift).map(time -> { |
| | | Date startTime = time.getStartTime(); |
| | | Date endTime = time.getEndTime(); |
| | | List<String> collectItems = (List) vos.stream().map((v0) -> { |
| | | List<String> collectItems = vos.stream().map((v0) -> { |
| | | return v0.getName(); |
| | | }).collect(Collectors.toList()); |
| | | List<ProcessParameterVO> parameterList = oldProcessParameterList(startTime, endTime, collectItems, workstationId); |
| | |
| | | } |
| | | List<WorkstationWcsDmpDTO> vos = getWorkstationWcsDmpDTO(isFilterProcessParameter, workstationId); |
| | | if (isFilterProcessParameter.booleanValue()) { |
| | | vos = (List) vos.stream().filter((v0) -> { |
| | | vos = vos.stream().filter((v0) -> { |
| | | return v0.getProcessParameter(); |
| | | }).collect(Collectors.toList()); |
| | | } |
| | |
| | | } |
| | | |
| | | private List<List<Object>> buildExcelContentByHour(List<WorkstationWcsDmpDTO> collectItem, List<NewParamDTO> parameterList, WorkstationWcsDmpDTO wcs, Workstation workstation, String groupName, List<CalendarShiftDTO> timeShiftAll) { |
| | | List<Tuple> times = (List) timeShiftAll.stream().map(calendarShiftDTO -> { |
| | | List<Tuple> times = timeShiftAll.stream().map(calendarShiftDTO -> { |
| | | Date startTime = DateUtil.plusMinutes(DateUtil.parse(calendarShiftDTO.getCalendarDate(), DateConstant.PATTERN_DATE), calendarShiftDTO.getShiftStartTime().intValue()); |
| | | Date endTime = DateUtil.plusMinutes(DateUtil.parse(calendarShiftDTO.getCalendarDate(), DateConstant.PATTERN_DATE), calendarShiftDTO.getShiftEndTime().intValue()); |
| | | long start = startTime.getTime(); |
| | |
| | | parameterList.forEach(dto -> { |
| | | Long time = dto.getTs(); |
| | | Map<String, Object> valueMap = JsonUtil.toMap(dto.getV()); |
| | | ArrayList newArrayList = Lists.newArrayList(); |
| | | ArrayList<Object> newArrayList = Lists.newArrayList(); |
| | | newArrayList.add(groupName); |
| | | newArrayList.add(code); |
| | | newArrayList.add(name); |
| | |
| | | nameMap.put(globalWcs.getCode(), globalWcs.getName()); |
| | | codes.add(globalWcs.getCode()); |
| | | } |
| | | Map<String, List<ProcessParameterVO>> map = (Map) dtoList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<String, List<ProcessParameterVO>> map = dtoList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getCollectItem(); |
| | | })); |
| | | List<ProParamResDTO> res = Lists.newArrayList(); |
| | | map.forEach(k, v -> { |
| | | map.forEach((k, v) -> { |
| | | ProParamResDTO dto; |
| | | if (Func.isNotEmpty(wcs) && wcs.getName().equals(k)) { |
| | | List<ProcessWcsDTO> collect = (List) v.stream().filter(c -> { |
| | | List<ProcessWcsDTO> collect = v.stream().filter(c -> { |
| | | return codes.contains(c.getValue()); |
| | | }).map(c2 -> { |
| | | return ProcessWcsDTO.builder().realTime(c2.getRealTime()).time(DateUtil.format(c2.getTime(), "yyyy-MM-dd HH:mm:ss.SSS")).name((String) nameMap.get(c2.getValue())).value(c2.getValue()).color((String) colorMap.get(c2.getValue())).build(); |
| | |
| | | })).collect(Collectors.toList()); |
| | | dto = ProParamResDTO.builder().collectRealItem(k).collectItem(wcs.getDescription()).dataType(wcs.getWcsDataType()).statusData(collect).build(); |
| | | } else { |
| | | List<ProcessParameterRealVO> collect2 = (List) v.stream().map(c3 -> { |
| | | List<ProcessParameterRealVO> collect2 = v.stream().map(c3 -> { |
| | | return ProcessParameterRealVO.builder().realTime(c3.getRealTime()).time(DateUtil.format(c3.getTime(), "yyyy-MM-dd HH:mm:ss.SSS")).collectItem(c3.getCollectItem()).value(c3.getValue()).build(); |
| | | }).sorted(Comparator.comparing((v0) -> { |
| | | return v0.getTime(); |
| | |
| | | Long time = dto.getTs(); |
| | | Map<String, Object> valueMap = JsonUtil.toMap(dto.getV()); |
| | | String firstContent = DateUtil.format(DateUtil.fromMilliseconds(time.longValue()), "yyyy-MM-dd HH:mm:ss.SSS"); |
| | | ArrayList newArrayList = Lists.newArrayList(new Object[]{firstContent}); |
| | | ArrayList<Object> newArrayList = Lists.newArrayList(new Object[]{firstContent}); |
| | | buildContent(vos, valueMap, wcs, wcsMap, newArrayList); |
| | | res.add(newArrayList); |
| | | }); |
| | |
| | | |
| | | private Map<String, String> getWcsMap() { |
| | | List<GlobalWcs> globalWcs = listGlobalWcs(); |
| | | return (Map) globalWcs.stream().collect(Collectors.toMap((v0) -> { |
| | | return globalWcs.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | |
| | | private List<WorkstationWcsDmpDTO> getWorkstationWcsDmpDTO(Boolean isFilterProcessParameter, String workstationId) { |
| | | List<WorkstationWcsDmpDTO> vos = WorkstationCache.getWorkstationWcsList(workstationId); |
| | | if (isFilterProcessParameter.booleanValue()) { |
| | | vos = (List) vos.stream().filter((v0) -> { |
| | | vos = vos.stream().filter((v0) -> { |
| | | return v0.getProcessParameter(); |
| | | }).collect(Collectors.toList()); |
| | | } |