| | |
| | | } |
| | | apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(apsGasPipingRouteStat); |
| | | //根据开工日进行升序排序 |
| | | apsGasPipingRouteStats.sort((a, b)->a.getPlanStartDay().compareTo(b.getPlanStartDay())); |
| | | apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay())); |
| | | //工序分组统计 |
| | | HashMap<String, List<ApsResourceDateStat>> processMap = new HashMap<>(); |
| | | List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>(); |
| | | HashMap<String, List<ApsResourceDateStat>> processMapMonth = new HashMap<>(); |
| | | List<HashMap<String, List<ApsResourceDateStat>>> processListMonth = new ArrayList<>(); |
| | | //工序开工日期 |
| | | String planStartDate = ""; |
| | | //统计所有工序对应的开工时间 |
| | | for (ApsGasPipingRouteStat apsGasPipingRouteStatTemp : apsGasPipingRouteStats) { |
| | | planStartDate = simpleDateFormat.format(apsGasPipingRouteStatTemp.getProcessPlanStartDay()); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | |
| | | apsResourceDateStatList.add(apsResourceDateStat); |
| | | processMap.put(apsGasPipingRouteStatTemp.getProcessName(), apsResourceDateStatList); |
| | | } |
| | | //聚合每道工序的开工时间和产能 |
| | | processMap.forEach((processName, apsResourceDateStatList) -> { |
| | | HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>(); |
| | | LinkedHashMap<String, ApsResourceDateStat> dayMap = new LinkedHashMap<>(); |
| | | apsResourceDateStatList.forEach(apsResourceDateStat -> { |
| | | startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | 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); |
| | |
| | | }else{ |
| | | dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat); |
| | | } |
| | | } |
| | | }); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | List<ApsResourceDateStat> tempList = new ArrayList<>(); |
| | | dayMap.forEach((key, value) -> { |
| | | tempList.add(value); |
| | | }); |
| | | processMapMonth.put(processName, tempList); |
| | | } |
| | | // processMap.put(processName, tempList); |
| | | HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | temp.put(processName, tempList); |
| | | processList.add(temp); |
| | | }); |
| | | // for (String key : processMap.keySet()) { |
| | | // HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | // temp.put(key, processMap.get(key)); |
| | | // processList.add(temp); |
| | | // } |
| | | //排序时间标题 |
| | | List<String> sortedStartPlanTimeList = new ArrayList<>(startPlanTimeSet); |
| | | Collections.sort(sortedStartPlanTimeList); |
| | | // processMap.forEach((processName, apsResourceDateStatList) -> { |
| | | // HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>(); |
| | | // apsResourceDateStatList.forEach(apsResourceDateStat -> { |
| | | // startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); |
| | | // if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){ |
| | | // ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString()); |
| | | // if("day".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | // apsResourceDateStatTemp.setDesignTimes(apsResourceDateStatTemp.getDesignTimes()+apsResourceDateStat.getDesignTimes()); |
| | | // }else if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | // apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0); |
| | | // } |
| | | // apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes()); |
| | | // if(apsResourceDateStatTemp.getDesignTimes()!=0){ |
| | | // apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L)); |
| | | // } |
| | | // apsResourceDateStatTemp.setResourceGroupName(processName); |
| | | // dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp); |
| | | // }else{ |
| | | // dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat); |
| | | // } |
| | | // }); |
| | | // JSONArray tempList = new JSONArray(); |
| | | // dayMap.forEach((key, value) -> { |
| | | // JSONObject temp = new JSONObject(); |
| | | // temp.put("planDay", key); |
| | | // temp.put("designTimes", value.getDesignTimes()); |
| | | // temp.put("requireTimes", value.getRequireTimes()); |
| | | // temp.put("capacityLoad", value.getCapacityLoad()); |
| | | // temp.put("resourceGroupName", value.getResourceGroupName()); |
| | | // tempList.add(temp); |
| | | // }); |
| | | // processData.add(new JSONObject().put(processName, tempList)); |
| | | // }); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | for (String key : processMapMonth.keySet()) { |
| | | HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | temp.put(key, processMapMonth.get(key)); |
| | | processListMonth.add(temp); |
| | | } |
| | | result.put("planTable", processListMonth); |
| | | }else{ |
| | | for (String key : processMap.keySet()) { |
| | | HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | temp.put(key, processMap.get(key)); |
| | | processList.add(temp); |
| | | } |
| | | result.put("planTable", processList); |
| | | } |
| | | result.put("planTitle", sortedStartPlanTimeList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |