| | |
| | | int actuateLong = loadLong - noPlanCloseLong; |
| | | mdcOeeInfo.setActuateLong(actuateLong); |
| | | // 时间开动率 --- 开动时间/负荷时间 |
| | | BigDecimal timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); |
| | | mdcOeeInfo.setTimeActuationRate(timeActuationRate); |
| | | BigDecimal timeActuationRate = BigDecimal.ZERO; |
| | | if (loadLong == 0) { |
| | | mdcOeeInfo.setTimeActuationRate(timeActuationRate); |
| | | } else { |
| | | timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); |
| | | mdcOeeInfo.setTimeActuationRate(timeActuationRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : timeActuationRate); |
| | | } |
| | | // 有效运行时间 --- 按需求维护零件加工总时长||系统主轴负载时间 |
| | | Integer effectiveRunLong = 0; |
| | | // Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate); |
| | | //查询设备运行时间 |
| | | effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", "")); |
| | | if (effectiveRunLong == null) { |
| | | effectiveRunLong = 0; |
| | | } |
| | | // if (totalProcessLong == 0) { |
| | | // |
| | | // } else { |
| | | // effectiveRunLong = totalProcessLong; |
| | | // } |
| | | mdcOeeInfo.setEffectiveRunLong(effectiveRunLong); |
| | | // 性能开动率 --- 有效运行时间/开动时间 |
| | | BigDecimal performanceRate = BigDecimal.ZERO; |
| | | if (effectiveRunLong != 0 && actuateLong != 0) { |
| | | performanceRate = new BigDecimal(effectiveRunLong).divide(new BigDecimal(actuateLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | mdcOeeInfo.setPerformanceRate(performanceRate); |
| | | mdcOeeInfo.setPerformanceRate(performanceRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : performanceRate); |
| | | // 加工零件数量 --- 按维护数据统计当天 |
| | | // Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate); |
| | | // mdcOeeInfo.setProcessCount(processCount); |
| | | // // 合格零件数量 --- 按维护数据统计当天 |
| | | // Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate); |
| | | // mdcOeeInfo.setPassCount(passCount); |
| | | // // 合格率 --- 合格数/加工数 |
| | | // BigDecimal passRate = BigDecimal.ZERO; |
| | | // if (processCount != 0 && passCount != 0) { |
| | | // passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); |
| | | // } |
| | | // 加工零件数量 |
| | | Integer processCount = mdcJcRcJobreportService.selectTotalProcessCount(equipmentId, validDate); |
| | | mdcOeeInfo.setProcessCount(processCount); |
| | |
| | | if (processCount != 0 && passCount != 0) { |
| | | passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | mdcOeeInfo.setPassRate(passRate); |
| | | mdcOeeInfo.setPassRate(passRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : passRate); |
| | | // OEE --- 时间开动率 * 性能开动率 * 一次合格率 |
| | | BigDecimal oee = BigDecimal.ZERO; |
| | | if (!timeActuationRate.equals(BigDecimal.ZERO) && !performanceRate.equals(BigDecimal.ZERO) && !passRate.equals(BigDecimal.ZERO)) { |
| | | oee = timeActuationRate.multiply(performanceRate).multiply(passRate).divide(new BigDecimal("1000000"), 4, RoundingMode.HALF_UP); |
| | | oee = timeActuationRate.multiply(performanceRate).multiply(passRate).divide(new BigDecimal("10000"), 4, RoundingMode.HALF_UP); |
| | | } |
| | | mdcOeeInfo.setOee(oee); |
| | | mdcOeeInfo.setOee(oee.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : oee); |
| | | result.add(mdcOeeInfo); |
| | | } |
| | | } |
| | |
| | | super.saveBatch(result); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcOeeInfo> findByEquIdsAndDate(List<String> equipmentIdList, String start, String end) { |
| | | return this.baseMapper.findByEquIdsAndDate(equipmentIdList, start, end); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcOeeInfo> findByEquIdAndDate(String equipmentId, String start, String end) { |
| | | return this.baseMapper.findByEquIdAndDate(equipmentId, start, end); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findByEquIdAndMonth(String equipmentId, String month) { |
| | | return this.baseMapper.findByEquIdAndMonth(equipmentId, month); |
| | | } |
| | | |
| | | } |