| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | |
| | | import com.aps.core.mapper.ApsGasPipingRouteStatMapper; |
| | | import com.aps.core.service.IApsGasMaterialUsageService; |
| | | import com.aps.core.service.IApsGasPipingRouteStatService; |
| | | import com.aps.core.service.IApsStandardProcessService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.*; |
| | |
| | | |
| | | @Autowired |
| | | private IApsGasMaterialUsageService apsGasMaterialUsageService; |
| | | |
| | | @Autowired |
| | | private IApsStandardProcessService apsStandardProcessService; |
| | | |
| | | /** |
| | | * 查询气体管路产能负载统计 |
| | |
| | | public JSONObject getCapacityPlanData(ApsGasPipingRouteStat apsGasPipingRouteStat) { |
| | | JSONObject result = new JSONObject(); |
| | | HashSet<String> startPlanTimeSet = new HashSet<>(); |
| | | JSONArray processData = new JSONArray(); |
| | | //工序分组统计 |
| | | LinkedHashMap<String, List<ApsResourceDateStat>> processMap = new LinkedHashMap<>(); |
| | | 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); |
| | | apsStandardProcessList.sort((a, b)->a.getProcessName().compareTo(b.getProcessName())); |
| | | for(ApsStandardProcess temp:apsStandardProcessList){ |
| | | processMap.put(temp.getProcessName(), new ArrayList<ApsResourceDateStat>()); |
| | | } |
| | | //获取工序计划产能数据 |
| | | HashMap<String, ApsGasPipelineCapacityPlan> apsGasPipingPlanMap = new HashMap<>(); |
| | | List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlanList = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(new ApsGasPipelineCapacityPlan()); |
| | |
| | | apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(apsGasPipingRouteStat); |
| | | //根据开工日进行升序排序 |
| | | apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay())); |
| | | //工序分组统计 |
| | | HashMap<String, List<ApsResourceDateStat>> processMap = new HashMap<>(); |
| | | List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>(); |
| | | //工序开工日期 |
| | | String planStartDate = ""; |
| | | //统计所有工序对应的开工时间 |
| | |
| | | dayMap.forEach((key, value) -> { |
| | | tempList.add(value); |
| | | }); |
| | | // processMap.put(processName, tempList); |
| | | HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); |
| | | temp.put(processName, tempList); |
| | | processNameList.remove(processName); |
| | | 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); |