| | |
| | | package org.jeecg.modules.screen.service.impl; |
| | | |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.mdc.dto.MdcEfficiencyDto; |
| | | import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule; |
| | | import org.jeecg.modules.mdcJc.service.IMdcProductDayScheduleService; |
| | | import org.jeecg.modules.screen.dto.*; |
| | | import org.jeecg.modules.screen.mapper.MdcLargeScreenMapper; |
| | | import org.jeecg.modules.screen.service.MdcLargeScreenService; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private MdcLargeScreenMapper mdcLargeScreenMapper; |
| | | |
| | | private final String yesterday = LocalDate.now().plusDays(-1).toString(); |
| | | private final String yesterday = LocalDate.now().plusDays(-1).toString().replaceAll("-", ""); |
| | | |
| | | private final String today = LocalDate.now().toString(); |
| | | |
| | | @Resource |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | |
| | | /** |
| | |
| | | for (MdcProductDayschedule mdcProductDayschedule : list) { |
| | | TodayProductionPassRateDto todayProductionPassRateDto = new TodayProductionPassRateDto(); |
| | | todayProductionPassRateDto.setProductionName(mdcProductDayschedule.getProductName()); |
| | | todayProductionPassRateDto.setPassRate(new BigDecimal(mdcProductDayschedule.getQualifiedCount()).divide(new BigDecimal(mdcProductDayschedule.getCompletionCount()), 0, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | if (mdcProductDayschedule.getCompletionCount() != 0) { |
| | | todayProductionPassRateDto.setPassRate(new BigDecimal(mdcProductDayschedule.getQualifiedCount()).divide(new BigDecimal(mdcProductDayschedule.getCompletionCount()), 0, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | result.add(todayProductionPassRateDto); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public List<EquipmentRateDto> todayEquipmentRate() { |
| | | return null; |
| | | // return mdcLargeScreenMapper.todayEquipmentRate(); |
| | | List<EquipmentRateDto> result = new ArrayList<>(); |
| | | List<MdcEfficiencyDto> mdcEfficiencyDtoList = mdcLargeScreenMapper.efficiencyList(yesterday); |
| | | if (mdcEfficiencyDtoList != null && !mdcEfficiencyDtoList.isEmpty()) { |
| | | for (MdcEfficiencyDto mdcEfficiencyDto : mdcEfficiencyDtoList) { |
| | | EquipmentRateDto equipmentRateDto = new EquipmentRateDto(); |
| | | equipmentRateDto.setEquipmentId(mdcEfficiencyDto.getEquipmentId()); |
| | | equipmentRateDto.setEquipmentName(mdcEfficiencyDto.getEquipmentName()); |
| | | equipmentRateDto.setOpenRate(mdcEfficiencyDto.getOpenRate().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | equipmentRateDto.setUtilizationRate(mdcEfficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | if (!equipmentRateDto.getOpenRate().equals(BigDecimal.ZERO) || !equipmentRateDto.getUtilizationRate().equals(BigDecimal.ZERO)) { |
| | | result.add(equipmentRateDto); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 月利用率 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MonthEquipmentUtilizationRateDto> monthEquipmentUtilizationRate() { |
| | | List<MonthEquipmentUtilizationRateDto> result = new ArrayList<>(); |
| | | String startDate = LocalDate.now().plusDays(-32).toString().replaceAll("-", ""); |
| | | List<MdcEfficiencyDto> mdcEfficiencyDtoList = mdcLargeScreenMapper.efficiency(startDate, yesterday); |
| | | if (mdcEfficiencyDtoList != null && !mdcEfficiencyDtoList.isEmpty()) { |
| | | for (MdcEfficiencyDto mdcEfficiencyDto : mdcEfficiencyDtoList) { |
| | | MonthEquipmentUtilizationRateDto meu = new MonthEquipmentUtilizationRateDto(); |
| | | meu.setDate(new StringBuilder(mdcEfficiencyDto.getTheDate().substring(4, 8)).insert(2, "-").toString()); |
| | | BigDecimal equipmentCount = mdcLargeScreenMapper.findEquipmentCount(yesterday); |
| | | meu.setUtilizationRate(mdcEfficiencyDto.getProcessLong().divide(equipmentCount.multiply(new BigDecimal("86400")), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | if (!meu.getUtilizationRate().equals(BigDecimal.ZERO)) { |
| | | result.add(meu); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcProduction> productionList() { |
| | | return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, "3").eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | | } |
| | | |
| | | } |