yangys
2025-11-21 e8ed1a91c77ab62a924f12acd55777f227bacd7e
smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/StatusRecordServiceImpl.java
@@ -39,10 +39,10 @@
import com.qianwen.smartman.common.utils.CommonUtil;
import com.qianwen.smartman.common.utils.ListUtils;
import com.qianwen.smartman.common.utils.LocalDateTimeUtils;
import com.qianwen.smartman.modules.cps.entity.GlobalWcs;
import com.qianwen.smartman.modules.cps.entity.Workstation;
import com.qianwen.smartman.modules.cps.enums.WorkstationTypeEnum;
import com.qianwen.smartman.modules.cps.service.IWorkstationService;
import com.qianwen.smartman.modules.smis.entity.GlobalWcs;
import com.qianwen.smartman.modules.smis.entity.Workstation;
import com.qianwen.smartman.modules.smis.enums.WorkstationTypeEnum;
import com.qianwen.smartman.modules.smis.service.IWorkstationService;
import com.qianwen.smartman.modules.mdc.convert.StatusRecordConvert;
import com.qianwen.smartman.modules.mdc.dto.GroupWorkDTO;
import com.qianwen.smartman.modules.mdc.dto.ShiftIndexNameDTO;
@@ -91,7 +91,7 @@
        List<StatusRecordDateVO> result = new ArrayList<>();
        List<WorkstationInfoVO> workstationList = statusRecordDateSelectVO.getWorkstationInfoList();
        if (Func.isEmpty(workstationList)) {
           workstationList = (List<WorkstationInfoVO>)this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> {
           workstationList = this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> {
                WorkstationInfoVO workstationInfoVO = new WorkstationInfoVO();
                workstationInfoVO.setId(s.getId());
                workstationInfoVO.setName(s.getName());
@@ -113,13 +113,10 @@
        }
        page.setTotal(workstationList.size());
        List<WorkstationInfoVO> workstationList2 = workstationList.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList());
        List<Long> workstationIdList = workstationList2.stream().map((v0) -> {
            return v0.getId();
        }).collect(Collectors.toList());
        List<Long> workstationIdList = workstationList2.stream().map(WorkstationInfoVO::getId).collect(Collectors.toList());
        List<SuperAggregateState> superAggregateStateList = this.superAggregateStateService.getStatusData(workstationIdList, null, statusRecordDateSelectVO.getDate(), statusRecordDateSelectVO.getDate());
        Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy((v0) -> {
            return v0.getWorkstationId();
        }));
        Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy(SuperAggregateState::getWorkstationId));
        workstationList2.forEach(x -> {
            StatusRecordDateVO statusRecord = new StatusRecordDateVO().setWorkstationInfo(x).setStatusRecordList(StatusRecordConvert.INSTANCE.convert(workstationStatusMap.get(x.getId())));
            result.add(statusRecord);
@@ -169,12 +166,16 @@
    public List<ChartDataVO> getEquipmentEfficiency(StatusRecordDetailSelectVO statusRecordDetailSelectVO) {
        List<ChartDataVO> result = new ArrayList<>();
        List<SuperAggregateState> superAggregateStateList = this.superAggregateStateService.getStatusData(Arrays.asList(statusRecordDetailSelectVO.getWorkstationId()), null, statusRecordDetailSelectVO.getDate(), statusRecordDetailSelectVO.getDate());
        List<SuperAggregateState> oeeAggregateStateList = this.superAggregateStateService.getStatusDataWithFeedback(Arrays.asList(statusRecordDetailSelectVO.getWorkstationId()), null, statusRecordDetailSelectVO.getDate(), statusRecordDetailSelectVO.getDate());
        //下面一行不用了,应为稼动率再分析设置界面和这里不相符,我们同意使用状态数据,不用feedback的
        //List<SuperAggregateState> oeeAggregateStateList = this.superAggregateStateService.getStatusDataWithFeedback(Arrays.asList(statusRecordDetailSelectVO.getWorkstationId()), null, statusRecordDetailSelectVO.getDate(), statusRecordDetailSelectVO.getDate());
        ProductivityTypeEnum[] values = ProductivityTypeEnum.values();
        int length = values.length;
        for (int i = 0; i < length; i++) {
            ProductivityTypeEnum productivityTypeEnum = values[i];
            ChartDataVO chartData = new ChartDataVO().setName(productivityTypeEnum.getMessage()).setValue(EifficiencyUtils.calculationResults(productivityTypeEnum == ProductivityTypeEnum.OEE ? oeeAggregateStateList : superAggregateStateList, productivityTypeEnum));
            //ChartDataVO chartData = new ChartDataVO().setName(productivityTypeEnum.getMessage()).setValue(EifficiencyUtils.calculationResults(productivityTypeEnum == ProductivityTypeEnum.OEE ? oeeAggregateStateList : superAggregateStateList, productivityTypeEnum));
            //上面一行,去掉oee的传值
            ChartDataVO chartData = new ChartDataVO().setName(productivityTypeEnum.getMessage()).setValue(EifficiencyUtils.calculationResults(superAggregateStateList, productivityTypeEnum));
            result.add(chartData);
        }
        return result;
@@ -227,7 +228,7 @@
                HashMap<String, String> hashMap = new HashMap<>(16);
                hashMap.put("shiftIndex", x.getShiftIndex() + "");
                hashMap.put("shiftIndexName", x.getShiftIndexName());
                List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex());
                List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex());//null
                if (Func.isNotEmpty(shiftIndexStatusList)) {
                    hashMap.put("oee", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.OEE) + "");
                    hashMap.put("fault", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.ALARM) + "");
@@ -315,7 +316,7 @@
        MultipartFile multipartFile = ExcelUtil.exportToMultipartFile(fileName, ExcelConstant.STATUS_RECORD, exportList, StatusRecordExport.class);
        return this.ossBuilder.tempTemplate().putFile(multipartFile.getOriginalFilename(), multipartFile);
    }
    /*
    @Override
    public List<List<SuperAggregateStateVO>> crossDayState(CrossDayStateVO vo) {
        LocalDate date = vo.getDate();
@@ -334,7 +335,7 @@
        }).collect(Collectors.toList());
        this.superAggregateStateService.saveState(collect);
        return list;
    }
    }*/
    @Override
    public IPage<StatusRecordDateVO> getStatusRecordByDates(IPage<StatusRecordDateVO> page, StatusRecordDateTimeSelectVO statusRecordDateTimeSelectVO) {