| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | LocalDateTime previousProcessPlanStartDay = apsProcessRoutes.get(i - 1).getProcessPlanStartDay().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | 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())); |
| | | apsGasPipingRouteStat.setProcessPlanStartDay(Date.from(currentProcessPlanStartDay.atZone(ZoneId.systemDefault()).toInstant())); |
| | | } |
| | | //插入 年 月 日 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>(); |
| | | try { |
| | | //获取标准工序名称 |
| | | List<String> processNameList = new ArrayList<>(); |
| | | ApsStandardProcess apsStandardProcess = new ApsStandardProcess(); |
| | | apsStandardProcess.setMajor(apsGasPipingRouteStat.getMajor().equals("gas")?"气柜":"管路"); |
| | | List<ApsStandardProcess> apsStandardProcessList = apsStandardProcessService.selectApsStandardProcessList(apsStandardProcess); |
| | |
| | | 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():new BigDecimal(0)); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum():new BigDecimal(0)); |
| | | }else{ |
| | | apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getDayProduceAllNum():new BigDecimal(0)); |
| | | } |
| | | apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes().add(apsResourceDateStat.getRequireTimes())); |
| | | if(apsResourceDateStatTemp.getDesignTimes().compareTo(BigDecimal.ZERO) > 0){ |
| | | apsResourceDateStat.setCapacityLoad(apsResourceDateStat.getRequireTimes() |
| | |
| | | }); |
| | | HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | temp.put(processName, tempList); |
| | | processNameList.remove(processName); |
| | | processList.add(temp); |
| | | }); |
| | | //排序时间标题 |
| | | List<String> sortedStartPlanTimeList = new ArrayList<>(startPlanTimeSet); |
| | | Collections.sort(sortedStartPlanTimeList); |
| | | for (int i=0;i<processList.size();i++){ |
| | | HashMap<String, List<ApsResourceDateStat>> temp = processList.get(i); |
| | | for (Map.Entry<String, List<ApsResourceDateStat>> entry : temp.entrySet()){ |
| | | List<ApsResourceDateStat> apsResourceDateStatList = entry.getValue(); |
| | | if(apsResourceDateStatList.size()<=0){ |
| | | for(String tempTime:sortedStartPlanTimeList){ |
| | | ApsResourceDateStat apsResourceDateStat = new ApsResourceDateStat(); |
| | | apsResourceDateStat.setPlanDay(LocalDate.parse(tempTime, formatter)); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey())!=null?apsGasPipingPlanMap.get(entry.getKey()).getMonthProduceAllNum():new BigDecimal(0)); |
| | | }else{ |
| | | apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey())!=null?apsGasPipingPlanMap.get(entry.getKey()).getDayProduceAllNum():new BigDecimal(0)); |
| | | } |
| | | apsResourceDateStat.setRequireTimes(new BigDecimal(0)); |
| | | apsResourceDateStat.setCapacityLoad(new BigDecimal(0)); |
| | | apsResourceDateStat.setResourceName(entry.getKey()); |
| | | apsResourceDateStat.setResourceGroupName(entry.getKey()); |
| | | apsResourceDateStatList.add(apsResourceDateStat); |
| | | } |
| | | temp.put(entry.getKey(), apsResourceDateStatList); |
| | | processList.set(i, temp); |
| | | } |
| | | } |
| | | } |
| | | result.put("planTable", processList); |
| | | result.put("planTitle", sortedStartPlanTimeList); |
| | | } catch (Exception e) { |