zhanghl
2025-04-28 d7db245433f576affb379b82177762d80a2a842d
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java
@@ -185,8 +185,8 @@
                    // 上一道工序的结束时间 = 上一道工序的开始时间 + 上一道工序的总工时
                    if(apsGasPipingRouteStat.getProcessPlanStartDay()==null){
                        LocalDateTime previousProcessPlanStartDay = apsProcessRoutes.get(i - 1).getProcessPlanStartDay().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                        long previousProcessTotalTime = apsGasPipingRouteStatList.get(i - 1).getProcessTotalTime().longValue();
                        LocalDateTime currentProcessPlanStartDay = previousProcessPlanStartDay.plusHours(previousProcessTotalTime);
                        long seconds = apsGasPipingRouteStatList.get(i - 1).getProcessTotalTime().multiply(new BigDecimal(60)).multiply(new BigDecimal(60)).longValue();
                        LocalDateTime currentProcessPlanStartDay = previousProcessPlanStartDay.plusSeconds(seconds);
                        apsGasPipingRouteStat.setProcessPlanStartDay(Date.from(Timestamp.valueOf(currentProcessPlanStartDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))).toInstant()));
                    }
                    //插入 年 月 日
@@ -274,13 +274,13 @@
                apsResourceDateStat.setPlanDay(LocalDate.parse(planStartDate, formatter));
                apsResourceDateStat.setResourceName(apsGasPipingRouteStatTemp.getProcessName());
                //查询气柜管路产能规划表
                apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName())!=null?apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()).getDayProduceAllNum().intValue():0);
                apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName())!=null?apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()).getDayProduceAllNum():new BigDecimal(0));
                //查询料号工序产能表
                apsResourceDateStat.setRequireTimes(apsGasPipingRouteStatTemp.getProcessTotalTime().intValue());
                if(apsResourceDateStat.getDesignTimes()!=0){
                    apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStat.getRequireTimes())
                            .divide(BigDecimal.valueOf(apsResourceDateStat.getDesignTimes()), 2, RoundingMode.HALF_UP)
                            .multiply(BigDecimal.valueOf(100)));
                apsResourceDateStat.setRequireTimes(apsGasPipingRouteStatTemp.getProcessTotalTime());
                if(apsResourceDateStat.getDesignTimes().compareTo(BigDecimal.ZERO)>0){
                    apsResourceDateStat.setCapacityLoad(apsResourceDateStat.getRequireTimes()
                            .divide(apsResourceDateStat.getDesignTimes(), 2, RoundingMode.HALF_UP)
                            .multiply(new BigDecimal(100)));
                }else{
                    apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(0));
                }
@@ -298,14 +298,14 @@
                    startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString());
                    if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){
                        ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString());
                        apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0);
                        apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes());
                        if(apsResourceDateStatTemp.getDesignTimes()!=0){
                            apsResourceDateStat.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStat.getRequireTimes())
                                    .divide(BigDecimal.valueOf(apsResourceDateStat.getDesignTimes()), 2, RoundingMode.HALF_UP)
                                    .multiply(BigDecimal.valueOf(100)));
                        apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum():new BigDecimal(0));
                        apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes().add(apsResourceDateStat.getRequireTimes()));
                        if(apsResourceDateStatTemp.getDesignTimes().compareTo(BigDecimal.ZERO) > 0){
                            apsResourceDateStat.setCapacityLoad(apsResourceDateStat.getRequireTimes()
                                    .divide(apsResourceDateStat.getDesignTimes(), 2, RoundingMode.HALF_UP)
                                    .multiply(new BigDecimal(100)));
                        }else{
                            apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(0));
                            apsResourceDateStatTemp.setCapacityLoad(new BigDecimal(0));
                        }
                        apsResourceDateStatTemp.setResourceGroupName(processName);
                        apsResourceDateStatTemp.setPlanDay(apsResourceDateStat.getPlanDay());
@@ -394,8 +394,8 @@
                    dataRow.createCell(0).setCellValue(resourceName);
                    for (int j = 0; j < resourceDateStats.size(); j++) {
                        ApsResourceDateStat apsResourceDateStat = resourceDateStats.get(j);
                        dataRow.createCell(j*3+1).setCellValue(apsResourceDateStat.getDesignTimes());
                        dataRow.createCell(j*3+2).setCellValue(apsResourceDateStat.getRequireTimes());
                        dataRow.createCell(j*3+1).setCellValue(apsResourceDateStat.getDesignTimes().doubleValue());
                        dataRow.createCell(j*3+2).setCellValue(apsResourceDateStat.getRequireTimes().doubleValue());
                        if(apsResourceDateStat.getCapacityLoad()!=null){
                            dataRow.createCell(j*3+3).setCellValue(apsResourceDateStat.getCapacityLoad().doubleValue()+"%");
                        }else{