| | |
| | | import org.apache.poi.xssf.streaming.SXSSFRow; |
| | | import org.apache.poi.xssf.streaming.SXSSFSheet; |
| | | import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | } |
| | | apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(apsGasPipingRouteStat); |
| | | ApsGasPipingRouteStat queryStatParam = new ApsGasPipingRouteStat(); |
| | | BeanUtils.copyProperties(apsGasPipingRouteStat,queryStatParam); |
| | | queryStatParam.setMajor(""); |
| | | apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(queryStatParam); |
| | | //根据开工日进行升序排序 |
| | | apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay())); |
| | | //工序开工日期 |
| | | String planStartDate = ""; |
| | | //统计所有工序对应的开工时间 |
| | | for (ApsGasPipingRouteStat apsGasPipingRouteStatTemp : apsGasPipingRouteStats) { |
| | | planStartDate = simpleDateFormat.format(apsGasPipingRouteStatTemp.getProcessPlanStartDay()); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | planStartDate = planStartDate+"-01"; |
| | | } |
| | | ApsResourceDateStat apsResourceDateStat = new ApsResourceDateStat(); |
| | | apsResourceDateStat.setPlanDay(LocalDate.parse(planStartDate, formatter)); |
| | | apsResourceDateStat.setResourceName(apsGasPipingRouteStatTemp.getProcessName()); |
| | | //查询气柜管路产能规划表 |
| | | apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()+"-"+planStartDate.substring(0, 7))!=null?apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()+"-"+planStartDate.substring(0, 7)).getDayProduceAllNum():new BigDecimal(0)); |
| | | //查询料号工序产能表 |
| | | 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)); |
| | | } |
| | | List<ApsResourceDateStat> apsResourceDateStatList = new ArrayList<>(); |
| | | if(processMap.containsKey(apsGasPipingRouteStatTemp.getProcessName())){ |
| | | apsResourceDateStatList = processMap.get(apsGasPipingRouteStatTemp.getProcessName()); |
| | | planStartDate = simpleDateFormat.format(apsGasPipingRouteStatTemp.getProcessPlanStartDay()); |
| | | if("month".equals(apsGasPipingRouteStat.getSearchType())){ |
| | | planStartDate = planStartDate+"-01"; |
| | | } |
| | | ApsResourceDateStat apsResourceDateStat = new ApsResourceDateStat(); |
| | | apsResourceDateStat.setPlanDay(LocalDate.parse(planStartDate, formatter)); |
| | | apsResourceDateStat.setResourceName(apsGasPipingRouteStatTemp.getProcessName()); |
| | | //查询气柜管路产能规划表 |
| | | apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()+"-"+planStartDate.substring(0, 7))!=null?apsGasPipingPlanMap.get(apsGasPipingRouteStatTemp.getProcessName()+"-"+planStartDate.substring(0, 7)).getDayProduceAllNum():new BigDecimal(0)); |
| | | //查询料号工序产能表 |
| | | 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)); |
| | | } |
| | | // apsResourceDateStatList = new ArrayList<>(); |
| | | |
| | | List<ApsResourceDateStat> apsResourceDateStatList = processMap.get(apsGasPipingRouteStatTemp.getProcessName()); |
| | | apsResourceDateStatList.add(apsResourceDateStat); |
| | | processMap.put(apsGasPipingRouteStatTemp.getProcessName(), apsResourceDateStatList); |
| | | } |
| | | apsResourceDateStatList.add(apsResourceDateStat); |
| | | processMap.put(apsGasPipingRouteStatTemp.getProcessName(), apsResourceDateStatList); |
| | | |
| | | } |
| | | //聚合每道工序的开工时间和产能 |
| | | processMap.forEach((processName, apsResourceDateStatList) -> { |
| | |
| | | } |
| | | } |
| | | if(stat.getProcessPlanStartDay()!=null){ |
| | | Date processPlanStartDay = stat.getProcessPlanStartDay(); |
| | | stat.setPlanStartYear(processPlanStartDay.getYear()+""); |
| | | stat.setPlanStartMonth(processPlanStartDay.getMonth()+""); |
| | | stat.setPlanStartDay(processPlanStartDay.getDay()+""); |
| | | String[] strNow = new SimpleDateFormat("yyyy-MM-dd").format(stat.getProcessPlanStartDay()).toString().split("-"); |
| | | stat.setPlanStartYear(strNow[0]); |
| | | stat.setPlanStartMonth(strNow[1]); |
| | | stat.setPlanStartDay(strNow[2]); |
| | | } |
| | | last = stat; |
| | | cptStateList.add(stat); |