From c8673cbde4538b109e43042dc93cf33c46dca37e Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 31 十二月 2024 10:56:57 +0800 Subject: [PATCH] 每日排产计划修改 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java | 39 ++++++++++++++++++++------------------- 1 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java index 31f1291..8408f2a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java @@ -105,22 +105,22 @@ } queryWrapper.orderByAsc(MdcEquipment::getEquipmentName); List<MdcEquipment> equipmentList = mdcEquipmentService.list(queryWrapper); + + vo.setStartTime(DateUtils.format(DateUtils.toDate(vo.getStartTime(), DateUtils.STRDATE), DateUtils.STR_DATE)); + vo.setEndTime(DateUtils.format(DateUtils.toDate(vo.getEndTime(), DateUtils.STRDATE), DateUtils.STR_DATE)); //鏌ヨoee鏁版嵁 List<MdcOeeInfo> oeeList = this.baseMapper.oeeList(vo); //鏁版嵁澶勭悊 String shiftSubName = "鍏ㄩ儴"; - if (!StringUtils.isBlank(vo.getShiftId())) { - List<MdcShiftSub> mdcShiftSubList = new ArrayList<>(); - if (StringUtils.isNotBlank(vo.getShiftSubId())) { - mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getId, vo.getShiftSubId()).eq(MdcShiftSub::getShiftSubStatus, "1")); - oeeList = oeeList.stream().filter(mdcOeeInfo -> mdcOeeInfo.getShiftId().equals(vo.getShiftId()) && mdcOeeInfo.getShiftSubId().equals(vo.getShiftSubId())).collect(Collectors.toList()); - } else { - mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, vo.getShiftId()).eq(MdcShiftSub::getShiftSubStatus, "1")); - oeeList = oeeList.stream().filter(mdcOeeInfo -> mdcOeeInfo.getShiftId().equals(vo.getShiftId())).collect(Collectors.toList()); - } + List<MdcShiftSub> mdcShiftSubList = new ArrayList<>(); + if (StringUtils.isNotBlank(vo.getShiftSubId())) { + mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getId, vo.getShiftSubId()).eq(MdcShiftSub::getShiftSubStatus, "1")); + //oeeList = oeeList.stream().filter(mdcOeeInfo -> mdcOeeInfo.getShiftId().equals(vo.getShiftId()) && mdcOeeInfo.getShiftSubId().equals(vo.getShiftSubId())).collect(Collectors.toList()); List<String> shiftSubNames = mdcShiftSubList.stream().map(MdcShiftSub::getShiftSubName).collect(Collectors.toList()); shiftSubName = String.join(",", shiftSubNames); } + + for (MdcEquipment mdcEquipment : equipmentList) { MdcOeeListDto mdcOeeListDto = new MdcOeeListDto(); mdcOeeListDto.setEquipmentId(mdcEquipment.getEquipmentId()); @@ -137,7 +137,7 @@ BigDecimal oeeRate = BigDecimal.ZERO; if (!mdcOeeInfoList.isEmpty()) { BigDecimal count = mdcOeeInfoList.stream().map(MdcOeeInfo::getOeeRate).reduce(BigDecimal.ZERO, BigDecimal::add); - oeeRate = count.divide(new BigDecimal(mdcOeeInfoList.size()), 2, RoundingMode.HALF_UP); + oeeRate = count.divide(new BigDecimal(mdcOeeInfoList.size()), 4, RoundingMode.HALF_UP); mdcOeeResultDto.setOeeRate(oeeRate); } long rate = oeeRate.multiply(new BigDecimal("100")).longValue(); @@ -193,8 +193,8 @@ .eq(MdcProductDayschedule::getEquipmentId, equipment.getEquipmentid())); if (productDayScheduleList != null && !productDayScheduleList.isEmpty()) { MdcProductDayschedule mdcProductDayschedule; - MdcOeeInfo mdcOeeInfo = new MdcOeeInfo(); for (MdcShiftSub mdcShiftSub : mdcShiftSubList) { + MdcOeeInfo mdcOeeInfo = new MdcOeeInfo(); String id = mdcShiftSub.getId(); if (productDayScheduleList.stream().anyMatch(productDayschedule -> productDayschedule.getOrderId().substring(8, 10).equals(id))) { mdcOeeInfo.setEquipmentId(equipment.getEquipmentid()); @@ -207,7 +207,7 @@ //鑾峰彇璁惧杩愯鏁版嵁 MdcEquipmentStatisticalShiftInfo mdcEquipmentStatisticalShiftInfo = mdcEquipmentStatisticalShiftInfoService.getOne(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfo>() .eq(MdcEquipmentStatisticalShiftInfo::getEquipmentId, equipment.getEquipmentid()) - .eq(MdcEquipmentStatisticalShiftInfo::getTheDate, validDate) + .eq(MdcEquipmentStatisticalShiftInfo::getTheDate, validDate.replaceAll("-", "")) .eq(MdcEquipmentStatisticalShiftInfo::getShiftSubId, id)); if (mdcEquipmentStatisticalShiftInfo == null) { continue; @@ -217,7 +217,7 @@ mdcOeeInfo.setOpenLong(mdcEquipmentStatisticalShiftInfo.getOpenLong()); mdcOeeInfo.setCloseLong(mdcEquipmentStatisticalShiftInfo.getCloseLong()); //鑾峰彇璁惧鐢熶骇璁″垝 - mdcProductDayschedule = productDayScheduleList.stream().filter(productDayschedule -> productDayschedule.getOrderId().substring(8, 10).equals(id)).findAny().orElse(null); + mdcProductDayschedule = productDayScheduleList.stream().filter(productDayschedule -> productDayschedule.getOrderId().substring(productDayschedule.getOrderId().length() - 5, productDayschedule.getOrderId().length() - 3).equals(id)).findAny().orElse(null); if (mdcProductDayschedule == null) { continue; } @@ -244,11 +244,13 @@ continue; } mdcOeeInfo.setScheduleNum(mdcComponentInfo.getScheduleNum()); - - BigDecimal oeeRate = mdcOeeInfo.getProcessLong().multiply(new BigDecimal(mdcOeeInfo.getPlanNum())).multiply(new BigDecimal(mdcOeeInfo.getQualityNum())) - .divide(mdcEquipmentStatisticalShiftInfo.getTotalLong(), 2, RoundingMode.HALF_UP) - .divide(new BigDecimal(mdcOeeInfo.getScheduleNum()), 2, RoundingMode.HALF_UP) - .divide(new BigDecimal(mdcOeeInfo.getCompleteNum()), 2, RoundingMode.HALF_UP); + BigDecimal oeeRate = BigDecimal.ZERO; + if (!mdcOeeInfo.getCompleteNum().equals(0)) { + oeeRate = mdcOeeInfo.getProcessLong().multiply(new BigDecimal(mdcOeeInfo.getPlanNum())).multiply(new BigDecimal(mdcOeeInfo.getQualityNum())) + .divide(mdcEquipmentStatisticalShiftInfo.getTotalLong(), 4, RoundingMode.HALF_UP) + .divide(new BigDecimal(mdcOeeInfo.getScheduleNum()), 4, RoundingMode.HALF_UP) + .divide(new BigDecimal(mdcOeeInfo.getCompleteNum()), 4, RoundingMode.HALF_UP); + } mdcOeeInfo.setOeeRate(oeeRate); result.add(mdcOeeInfo); } @@ -259,5 +261,4 @@ this.saveBatch(result); } } - } -- Gitblit v1.9.3