From f68809ce9f7755daaafe9e451c80e91859cc5313 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 25 十一月 2025 14:37:06 +0800
Subject: [PATCH] 提交

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java | 1679 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 1,490 insertions(+), 189 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
index 55e7edd..76a1175 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -1,18 +1,38 @@
 
 package com.example.erp.service.pp;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.example.erp.common.AsyncQueryExecutor;
+import com.example.erp.entity.sd.*;
+import com.example.erp.tools.AreaComputed.*;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.example.erp.dto.pp.*;
 import com.example.erp.entity.pp.DamageDetails;
 import com.example.erp.entity.pp.Report;
-import com.example.erp.mapper.pp.ProductionSchedulingMapper;
-import com.example.erp.mapper.pp.ReportMapper;
-import com.example.erp.mapper.sd.OrderProcessDetailMapper;
+import com.example.erp.mapper.pp.*;
+import com.example.erp.mapper.sd.*;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
 import java.sql.Date;
+import java.sql.SQLOutput;
 import java.time.LocalDate;
 import java.util.*;
+import java.util.concurrent.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toDouble;
+import static com.example.erp.tools.AreaComputed.computeArea;
 
 @Service
 @DS("pp")
@@ -22,255 +42,824 @@
     private final OrderProcessDetailMapper orderProcessDetailMapper;
     private final ProductionSchedulingMapper productionSchedulingMapper;
 
+    private final OrderGlassDetailMapper orderGlassDetailMapper;
+    private final BasicDataMapper basicDataMapper;
+    private final ProductDetailMapper productDetailMapper;
+    private final OrderDetailMapper orderDetailMapper;
+    private final DamageDetailsMapper damageDetailsMapper;
 
-    public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper,ProductionSchedulingMapper productionSchedulingMapper) {
+    FlowCardMapper flowCardMapper;
+    private ReportingWorkMapper reportingWorkMapper;
+    private final OrderMapper orderMapper;
+
+    @Resource
+    private AsyncQueryExecutor asyncExecutor;
+
+
+    //涓婂伐搴忔姤宸ョ彮缁�
+    private void mergeTeamsGroupsName( List<WorkInProgressDTO> dataList1,List<WorkInProgressDTO> dataList2) {
+        for (WorkInProgressDTO dto1 : dataList1) {
+            //鏍规嵁褰撳墠宸ュ簭鑾峰彇 鏄惁涓哄崟鐗囥�佸す鑳躲�佹垨鑰呭叏閮�
+          BasicData basicData =  basicDataMapper.
+                  selectOne(new QueryWrapper<BasicData>()
+                          .eq("basic_name", dto1.getThisProcess())
+                          .last("limit 1")
+                  );
+
+          OrderDetail orderDetail = orderDetailMapper
+                .selectOne(
+                        new QueryWrapper<OrderDetail>()
+                                .eq("order_id", dto1.getOrderId())
+                                .eq("order_number", dto1.getOrderNumber())
+                );
+
+          //濡傛灉涓哄崟鐗囷紝鍒欐牴鎹骇鍝佸悕绉板拰宸ヨ壓缂栧彿鑾峰彇鐜荤拑鍚嶇О
+          if(basicData.getNickname()==null || basicData.getNickname().isEmpty()){
+              ProductDetail productDetail = productDetailMapper.
+                      selectOne(new QueryWrapper<ProductDetail>()
+                              .eq("prod_id", orderDetail.getProductId())
+                              .eq("glass_sort",dto1.getTechnologyNumber())
+                      );
+              if(productDetail!=null){
+                  dto1.setGlassName(productDetail.getDetail());
+              }
+
+            //basicData.getNickname().equals("stepC")
+          }else if(basicData.getNickname().equals("stepC")){
+              OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
+                      .selectOne(new QueryWrapper<OrderGlassDetail>()
+                              .eq("order_id", dto1.getOrderId())
+                              .eq("order_number", dto1.getOrderNumber())
+                              .eq("technology_number",dto1.getTechnologyNumber())
+                      );
+
+              String glassName = productDetailMapper.getGlassNameByGroup(
+                      orderDetail.getProductId(),
+                      orderGlassDetailMapper.getMinTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup())),
+                      orderGlassDetailMapper.getMaxTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup()))
+              );
+              dto1.setGlassName(glassName);
+
+          }else{
+              dto1.setGlassName(dto1.getProductName());
+          }
+
+        }
+
+        Function<WorkInProgressDTO, String> keyFn = dto ->
+                dto.getProcessId() + "|" +
+                        dto.getOrderNumber() + "|" +
+                        dto.getTechnologyNumber();
+
+        Map<String, WorkInProgressDTO> map2 = dataList2.stream()
+                .collect(Collectors.toMap(
+                        keyFn,
+                        Function.identity(),
+                        (existing, replacement) -> existing
+                ));
+
+        for (WorkInProgressDTO dto1 : dataList1) {
+            WorkInProgressDTO dto2 = map2.get(keyFn.apply(dto1));
+            if (dto2 != null) {
+                String tgn = dto2.getTeamsGroupsName();
+                if (StringUtils.hasText(tgn)) {
+                    dto1.setTeamsGroupsName(tgn);
+                }
+            }
+        }
+    }
+
+
+    public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper,
+                         ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper,
+                         OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper,
+                         ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper,
+                         ReportingWorkMapper reportingWorkMapper, DamageDetailsMapper damageDetailsMapper, OrderMapper orderMapper) {
         this.reportMapper = reportMapper;
         this.orderProcessDetailMapper = orderProcessDetailMapper;
         this.productionSchedulingMapper = productionSchedulingMapper;
+        this.flowCardMapper = flowCardMapper;
+        this.orderGlassDetailMapper = orderGlassDetailMapper;
+        this.basicDataMapper = basicDataMapper;
+        this.productDetailMapper = productDetailMapper;
+        this.orderDetailMapper = orderDetailMapper;
+        this.reportingWorkMapper = reportingWorkMapper;
+        this.damageDetailsMapper = damageDetailsMapper;
+        this.orderMapper = orderMapper;
     }
 
     //娴佺▼鍗¤繘搴︽柟娉�
-    public Map<String, Object> processCardProgressSv(String orderId, List<Integer> columns) {
+    public Map<String, Object> processCardProgressSv(String orderId, List<String> columns) {
         Map<String, Object> map = new HashMap<>();
         //鑾峰彇琛ㄦ牸鍐呭鏁版嵁
-        map.put("data", reportMapper.processCardProgressMp(orderId));
+        List<Map<String, String>> dataList = reportMapper.processCardProgressMp(orderId);
+
 
         //鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
-        List<Map<String,String>> processFilterList = orderProcessDetailMapper.filterOrderProcess(orderId);
-        List<Map<String,String>> processList = processFilterList;
+        List<Map<String, String>> uniqueList = orderProcessDetailMapper.filterOrderProcess(orderId);
 
-        List<String> filterList = new ArrayList<>();
-        //寰幆閬嶅巻鏁扮粍锛屽垽鏂搴忓彿褰撳墠鐨勫伐搴�
-        for (int i = 1; i < processFilterList.size(); i++) {
-            filterList.add(processFilterList.get(i).get("process"));
-            List<Map<String,String>> lastProcessList =
-                    orderProcessDetailMapper.filterLastProcess(
-                            orderId,
-                            String.valueOf(processFilterList.get(i).get("order_number")),
-                            String.valueOf(processFilterList.get(i).get("technology_number")),
-                            String.valueOf(processFilterList.get(i).get("id"))
-                            );
-            if(!lastProcessList.isEmpty()){
-                int finalI = i;
-                lastProcessList.forEach(lastProcess -> {
-                    if(filterList.contains(lastProcess.get("process"))){
-                        processList.add(lastProcess);
-                    }
-                });
+        map.put("title", uniqueList);
+        Map<String,Integer> clos = new HashMap<>();
+        HashMap<String,HashMap<String,Map<String, Integer>>> rowCount = new HashMap<String,HashMap<String,Map<String, Integer>>>();
+        for (int i=0;i<uniqueList.size();i++){
+            //鏍规嵁娴佺▼鏌ヨ鍩虹鏁版嵁
+            BasicData basicData =  basicDataMapper.selectOne(
+                    new QueryWrapper<BasicData>()
+                            .eq("basic_category","process")
+                            .eq("basic_name",uniqueList.get(i).get("process"))
+                            .last("limit 1")
+            );
+
+            //鍒ゆ柇澶硅兌鍜屽す鑳跺悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")
+            if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){
+                clos.put(uniqueList.get(i).get("process"), 14+i);
             }
-
-        }
-        // 浣跨敤HashSet鏉ヨ褰曞凡缁忛亣鍒扮殑value鍊�
-        Set<String> seenValues = new HashSet<>();
-        // 鍒涘缓涓�涓柊鐨凩ist鏉ュ瓨鍌ㄧ粨鏋�
-        List<Map<String, String>> uniqueList = new ArrayList<>();
-
-        // 鍙嶅悜閬嶅巻鍘熷List
-        for (int i = processList.size() - 1; i >= 0; i--) {
-            Map<String, String> maps = processList.get(i);
-            String value = maps.values().iterator().next(); // 鍋囪姣忎釜Map鍙湁涓�涓獀alue
-
-            // 濡傛灉value杩樻病鏈夎鐪嬪埌杩囷紝灏辨坊鍔犲埌缁撴灉List鍜孒ashSet涓�
-            if (!seenValues.contains(value)) {
-                uniqueList.add(0, maps); // 娣诲姞鍒扮粨鏋淟ist鐨勫紑澶达紝浠ヤ繚鎸佸師椤哄簭
-                seenValues.add(value);
+            //鍒ゆ柇涓┖鍜屼腑绌哄悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")
+            if(Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")){
+                columns.add("reportWorkQuantity."+uniqueList.get(i).get("process"));
             }
         }
-        map.put("title", uniqueList );
 
 
-
-
-        List<Map<String,Integer>> getRowCount =  orderProcessDetailMapper.getGlassLRow(orderId);
-        List<Map<String,Integer>> rowCount = new ArrayList<>();
-        columns.forEach(col ->{
-            getRowCount.forEach(row ->{
-                Map<String,Integer>  getRow = new HashMap<>();
-                // { row: 0, col: 1, rowspan: 3, colspan: 0},
-                getRow.put("row",row.get("RowNum"));
-                getRow.put("col",col);
-                getRow.put("rowspan",row.get("rowCount"));
-                getRow.put("colspan",0);
-                rowCount.add(getRow);
-            });
+        List<Map<String, Object>> getRowCount = orderProcessDetailMapper.getGlassLRow(orderId);
+        HashMap<Integer,Map<String, Object>> getRowCountMap = new HashMap<>();
+        getRowCount.forEach(col -> {
+            Integer getRowCountOrderNumber = ((Number) col.get("order_number")).intValue();
+            getRowCountMap.put(getRowCountOrderNumber, col);
         });
 
+        //寰幆缁撴灉
+        for (int i=0;i<dataList.size();i++ ) {
+            Integer orderNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("order_number")));
+            Integer technologyNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")));
+            int finalI1 = i;
+            columns.forEach(col -> {
+                if(rowCount.get(col) == null){
+                    rowCount.put(col, new HashMap<String,Map<String,Integer>>());
+                }
 
-        map.put("mergeCells",rowCount);
+                if(getRowCountMap.get(orderNumber) != null){
+                    Map<String,Object> row = getRowCountMap.get(orderNumber);
+                    Map<String, Integer> getRow = new HashMap<>();
+                    //鍒ゆ柇褰撳墠姝ゆ 鏄惁涓虹涓�琛� 骞朵笖鐩稿悓搴忓彿
+                    if(technologyNumber==1){
+                        getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
+                        getRow.put("colspan", 1);
+                    }else{
+                        getRow.put("rowspan", 0);
+                        getRow.put("colspan", 0);
+                    }
+                    rowCount.get(col).put(finalI1+"_"+col, getRow);
+                }
+
+
+            });
+
+
+            Map<String, String> data = JSON.parseObject(dataList.get(i).get("reportWorkQuantity"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            Map<String, String> dataShow = JSON.parseObject(dataList.get(i).get("reportWorkQuantityShow"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+           //鍒ゆ柇鍚庡伐搴忔娴佺▼鍗″彿鏄惁鏈夋鐮�
+            List<DamageDetails> hasBreak = damageDetailsMapper
+                    .getNotReview(dataList.get(i).get("processId"),
+                            String.valueOf(dataList.get(i).get("order_number")),
+                            String.valueOf(dataList.get(i).get("technology_number"))
+                    );
+
+
+
+
+
+            if(!hasBreak.isEmpty()){
+                int finalI = i;
+                data.forEach((thisProcess, index)->{
+                    String behindProcess = orderProcessDetailMapper.getBehindProcess(
+                            dataList.get(finalI).get("processId"),
+                            String.valueOf(dataList.get(finalI).get("order_number")),
+                            String.valueOf(dataList.get(finalI).get("technology_number")),
+                            thisProcess,
+                            orderId
+                    );
+
+                    if(behindProcess!=null &&!behindProcess.isEmpty()){
+                        Integer behindDamageSum = damageDetailsMapper.getBehindDamageSum(
+                                dataList.get(finalI).get("processId"),
+                                String.valueOf(dataList.get(finalI).get("order_number")),
+                                String.valueOf(dataList.get(finalI).get("technology_number")),
+                                behindProcess,1
+                        );
+                        if(behindDamageSum>0){
+                            data.put(thisProcess, String.valueOf(Integer.parseInt(data.get(thisProcess) )- behindDamageSum));
+                            dataShow.put(thisProcess, String.valueOf(Integer.parseInt(dataShow.get(thisProcess) )- behindDamageSum));
+                        }
+
+                    }
+                });
+
+            }
+            //澶硅兌宸ュ簭鍒ゆ柇鍚堝苟琛屾暟
+            if(!clos.isEmpty()){
+
+                Integer max = orderGlassDetailMapper
+                        .getMaxTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+                Integer min = orderGlassDetailMapper
+                        .getMinTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+
+                for (String key : clos.keySet()) {
+                    if(data.get(key) != null){
+                        if (rowCount.get("reportWorkQuantity."+key)==null){
+                            rowCount.put("reportWorkQuantity."+key, new HashMap<String,Map<String,Integer>>());
+                        }
+                        Map<String, Integer> getRow = new HashMap<>();
+                       if(min == Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")))  ){
+
+                           // { row: 0, col: 1, rowspan: 3, colspan: 0},
+                           //getRow.put("row", i );
+                           getRow.put("rowspan", max-min+1);
+                           getRow.put("colspan", 1);
+
+                        }else{
+                           getRow.put("rowspan", 0);
+                           getRow.put("colspan", 0);
+                           data.put(key,"0");
+                       }
+                        rowCount.get("reportWorkQuantity."+key).put(i+"_reportWorkQuantity."+key, getRow);
+                    }
+                }
+            }
+            dataList.get(i).put("reportWorkQuantity",JSON.toJSONString(data));
+            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
+
+        }
+
+
+        map.put("data",dataList );
+        map.put("mergeCells", rowCount);
 
         return map;
     }
 
-    public Map<String,Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize, List<String> selectDate, DamageDetails damageDetails) {
-        Integer offset = (pageNum-1)*pageSize;
-        String endDate = LocalDate.now().toString();
-        String startDate = LocalDate.now().minusDays(15).toString();
-        if(selectDate !=null && selectDate.size()==2){
-            if(!selectDate.get(0).isEmpty()){
-                startDate = selectDate.get(0);
+//    public Map<String, Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize, List<String> selectDate, CrossProcessBreakingDTO crossProcessBreakingDTO) {
+//        Integer offset = (pageNum - 1) * pageSize;
+//        String endDate = LocalDate.now().toString();
+//        String startDate = LocalDate.now().minusDays(15).toString();
+//        if (selectDate != null && selectDate.size() == 2) {
+//            if (!selectDate.get(0).isEmpty()) {
+//                startDate = selectDate.get(0);
+//            }
+//            if (!selectDate.get(1).isEmpty()) {
+//                endDate = selectDate.get(1);
+//            }
+//        }
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("data", reportMapper.getProcessBreaking(offset, pageSize, startDate, endDate, crossProcessBreakingDTO));
+//        map.put("total", reportMapper.getProcessBreakingTotal(offset, pageSize, startDate, endDate, crossProcessBreakingDTO));
+//        List<String> list = new ArrayList<>();
+//        list.add(startDate);
+//        list.add(endDate);
+//        map.put("selectDate", list);
+//        return map;
+//    }
+
+    private static String to080000(String s) {
+        if (s == null || s.isEmpty()) return null;
+        String v = s.trim();
+        // 鍙繚鐣欐棩鏈熼儴鍒嗭紙鍓�10浣� yyyy-MM-dd锛�
+        String datePart = v.length() >= 10 ? v.substring(0, 10) : v;
+        return datePart + " 08:00:00";
+    }
+    //璺ㄥ伐搴忔鐮�
+    public Map<String, Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize,
+                                                      List<String> selectDate,
+                                                      CrossProcessBreakingDTO crossProcessBreakingDTO) {
+        Integer offset = (pageNum - 1) * pageSize;
+
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
+        String startDate = to080000(LocalDate.now().minusDays(15).toString());
+        String endDate   = to080000(LocalDate.now().toString());
+
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = to080000(selectDate.get(0));
             }
-            if(!selectDate.get(1).isEmpty()){
-                endDate = selectDate.get(1);
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = to080000(selectDate.get(1));
             }
         }
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.getProcessBreaking(offset, pageSize, startDate, endDate, damageDetails));
-        map.put("total",reportMapper.getProcessBreakingTotal(offset, pageSize, startDate, endDate, damageDetails));
+
+        Map<String, Object> result = new HashMap<>();
+
+        // 浣跨敤寮傛绾跨▼姹�
+        String finalEndDate = endDate;
+        String finalStartDate = startDate;
+        System.out.println(finalEndDate+"==="+finalStartDate);
+        CompletableFuture<List<CrossProcessBreakingDTO>> dataFuture = asyncExecutor.runAsync(() ->
+                reportMapper.getProcessBreaking(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO));
+
+        CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() ->
+                reportMapper.getProcessBreakingTotal(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO));
+
+        // 绛夊緟涓や釜浠诲姟鎵ц瀹屾瘯
+        CompletableFuture.allOf(dataFuture, totalFuture).join();
+
+        try {
+            result.put("data", dataFuture.get());
+            result.put("total", totalFuture.get());
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
+        }
+
         List<String> list = new ArrayList<>();
         list.add(startDate);
         list.add(endDate);
-        map.put("selectDate",list);
-//        map.put("total",orderMapper.getPageTotal(offset, pageSize, startDate, endDate, orderDetail));
-        return map;
+        result.put("selectDate", list);
+
+        return result;
     }
 
-    public Map<String,Object> workInProgressSv(Date selectTime1, Date selectTime2, String orderId, String inputProject, String selectProcesses, Report report) {
+    //闈炶法宸ュ簭娆$牬
+    public Map<String, Object> notCrossProcessBreakingSv(Integer pageNum, Integer pageSize,
+                                                      List<String> selectDate,
+                                                      CrossProcessBreakingDTO crossProcessBreakingDTO) {
+        Integer offset = (pageNum - 1) * pageSize;
 
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
+        String startDate = to080000(LocalDate.now().minusDays(15).toString());
+        String endDate   = to080000(LocalDate.now().toString());
+
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = to080000(selectDate.get(0));
+            }
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = to080000(selectDate.get(1));
+            }
+        }
+
+        Map<String, Object> result = new HashMap<>();
+
+        // 浣跨敤寮傛绾跨▼姹�
+        String finalEndDate = endDate;
+        String finalStartDate = startDate;
+        CompletableFuture<List<CrossProcessBreakingDTO>> dataFuture = asyncExecutor.runAsync(() ->
+                reportMapper.getNotProcessBreaking(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO));
+
+        CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() ->
+                reportMapper.getNotProcessBreakingTotal(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO));
+
+        // 绛夊緟涓や釜浠诲姟鎵ц瀹屾瘯
+        CompletableFuture.allOf(dataFuture, totalFuture).join();
+
+        try {
+            result.put("data", dataFuture.get());
+            result.put("total", totalFuture.get());
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
+        }
+
+        List<String> list = new ArrayList<>();
+        list.add(startDate);
+        list.add(endDate);
+        result.put("selectDate", list);
+
+        return result;
+    }
+
+//    public Map<String, Object> workInProgressSv(Integer pageNum, Integer pageSize, String orderId, String inputProject, String selectProcesses, String optionVal, WorkInProgressDTO workInProgressDTO) {
+//        Integer offset = (pageNum - 1) * pageSize;
+//        if ("null".equals(orderId)) {
+//            orderId = "";
+//        }
+//        if ("null".equals(inputProject)) {
+//            inputProject = "";
+//        }
+//        if ("null".equals(optionVal)) {
+//            optionVal = ("");
+//        }
+//        if (selectProcesses.equals("all")){
+//            selectProcesses="";
+//        }
+//        String laminating = reportMapper.getLaminating(selectProcesses);
+//        Map<String, Object> map = new HashMap<>();
+//        List<WorkInProgressDTO> dataList2  =reportMapper.workInProgressMpdataList2(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
+//        if (optionVal.equals("1")){
+//            /* 鏍规嵁閿�鍞崟鍙锋眹鎬�*/
+//            List<WorkInProgressDTO> dataList1  =reportMapper.workInProgressOrderMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
+//            mergeTeamsGroupsName(dataList1, dataList2);
+//            map.put("data",dataList1);
+//            map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO));
+//        }else if(optionVal.equals("2")){
+//            /* 鏍规嵁娴佺▼鍗″彿姹囨��*/
+//            List<WorkInProgressDTO> dataList1  =reportMapper.workInProgressProcessMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
+//            mergeTeamsGroupsName(dataList1, dataList2);
+//            map.put("data",dataList1);
+//            map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO));
+//
+//        } else if (optionVal.equals("3")) {
+//
+//        } else {
+//            //娌℃湁閫夋嫨鍒嗙粍
+//            List<WorkInProgressDTO> dataList1  =reportMapper.workInProgressMpdataList1(offset, pageSize, orderId, inputProject, selectProcesses,laminating, workInProgressDTO);
+//            mergeTeamsGroupsName(dataList1, dataList2);
+//            map.put("data",dataList1);
+//            map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO));
+//
+//        }
+//        map.put("process", productionSchedulingMapper.selectProcess());
+//        return map;
+//    }
+
+    public Map<String, Object> workInProgressSv(
+            Integer pageNum, Integer pageSize,
+            String orderId, String inputProject, String selectProcesses,
+            String optionVal,String terminationVals, WorkInProgressDTO workInProgressDTO) {
+
+        Integer offset = (pageNum - 1) * pageSize;
+
+        if ("null".equals(orderId)) orderId = "";
+        if ("null".equals(inputProject)) inputProject = "";
+        if ("null".equals(optionVal)) optionVal = "";
+        if ("null".equals(terminationVals)) terminationVals = "";
+        if ("all".equals(selectProcesses)) selectProcesses = "";
+
+        String laminating = reportMapper.getLaminating(selectProcesses);
+        Map<String, Object> result = new HashMap<>();
+
+        try {
+            // dataList2 鏄墍鏈夊垎缁勪笅鐨勫熀纭�鏁版嵁锛岀嫭绔嬫墽琛�
+            String finalOrderId = orderId;
+            String finalInputProject = inputProject;
+            String finalSelectProcesses = selectProcesses;
+            String finalTerminationVals = terminationVals;
+            CompletableFuture<List<WorkInProgressDTO>> dataList2Future =
+                    asyncExecutor.runAsync(() ->
+                            reportMapper.workInProgressMpdataList2(
+                                    offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+
+            CompletableFuture<List<WorkInProgressDTO>> dataList1Future;
+            CompletableFuture<Map<String, Float>> totalFuture;
+
+            // 鏍规嵁 optionVal 鍐冲畾鏌ヨ绫诲瀷
+            if ("1".equals(optionVal)) {
+                // 閿�鍞崟鍙锋眹鎬�
+                dataList1Future = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressOrderMpList1(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+
+                totalFuture = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressOrderFootSum(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
+
+            } else if ("2".equals(optionVal)) {
+                // 娴佺▼鍗″彿姹囨��
+                dataList1Future = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressProcessMpList1(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+
+                totalFuture = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressOrderFootSum(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
+
+            } else if ("3".equals(optionVal)) {
+                dataList1Future = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressMpdataList1(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
+                totalFuture = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressOrderFootSum(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
+
+            } else {
+                // 涓嶅垎缁�
+                dataList1Future = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressMpdataList1(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
+
+                totalFuture = asyncExecutor.runAsync(() ->
+                        reportMapper.workInProgressOrderFootSum(
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
+            }
+
+            // 绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
+            CompletableFuture.allOf(dataList1Future, dataList2Future, totalFuture).join();
+
+            List<WorkInProgressDTO> dataList1 = dataList1Future.get();
+            List<WorkInProgressDTO> dataList2 = dataList2Future.get();
+            mergeTeamsGroupsName(dataList1, dataList2);
+
+            result.put("data", dataList1);
+            result.put("total", totalFuture.get());
+
+            // 骞惰鏌ヨ宸ュ簭淇℃伅
+            List<Map<String, String>> process = productionSchedulingMapper.selectProcess();
+            result.put("process", process);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("骞惰鏌ヨ鍦ㄥ埗鍝佷俊鎭紓甯革細" + e.getMessage(), e);
+        }
+
+        return result;
+    }
+
+
+    public Map<String, Object> selectProcessToBeCompletedSv(Date selectTime1, Date selectTime2, String orderId, String inputProject, String selectProcesses, Report report) {
         if ("null".equals(orderId)) {
             orderId = "";
         }
         if ("null".equals(inputProject)) {
             inputProject = "";
         }
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.workInProgressMp( selectTime1, selectTime2,orderId,inputProject,selectProcesses,report));
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.processToBeCompletedMp(selectTime1, selectTime2, orderId, inputProject, selectProcesses, report));
         map.put("process", productionSchedulingMapper.selectProcess());
+        map.put("footSum" ,reportMapper.processToBeCompletedFootSum(selectTime1, selectTime2, orderId, inputProject, selectProcesses, report));
+
         return map;
     }
 
-    public Map<String,Object> selectProcessToBeCompletedSv(Date selectTime1, Date selectTime2, String orderId, String inputProject, String selectProcesses, Report report) {
-        if ("null".equals(orderId)) {
-            orderId = "";
+//    public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize, String selectTime1, String selectTime2, DamageReportDTO damageReportDTO) {
+//        Integer offset = (pageNum - 1) * pageSize;
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("data", reportMapper.selectDamageReportMp(offset, pageSize, selectTime1, selectTime2, damageReportDTO));
+//        map.put("total", reportMapper.getDamageReportPageTotal(offset, pageSize, selectTime1, selectTime2, damageReportDTO));
+//        map.put("footSum" ,reportMapper.damageReportFootSum(selectTime1, selectTime2, damageReportDTO));
+//        return map;
+//    }
+
+    public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize,
+                                                    List<String> selectDate,
+                                                    DamageReportDTO damageReportDTO) {
+        Integer offset = (pageNum - 1) * pageSize;
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
+        String startDate = to080000(LocalDate.now().minusDays(15).toString());
+        String endDate   = to080000(LocalDate.now().toString());
+
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = to080000(selectDate.get(0));
+            }
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = to080000(selectDate.get(1));
+            }
         }
-        if ("null".equals(inputProject)) {
-            inputProject = "";
+        Map<String, Object> result = new HashMap<>();
+        String finalEndDate = endDate;
+        String finalStartDate = startDate;
+        // 寮傛浠诲姟瀹氫箟
+
+        CompletableFuture<List<DamageReportDTO>> dataFuture = asyncExecutor.runAsync(() ->
+                reportMapper.selectDamageReportMp(offset, pageSize, finalStartDate, finalEndDate, damageReportDTO));
+
+        CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() ->
+                reportMapper.getDamageReportPageTotal(offset, pageSize, finalStartDate, finalEndDate, damageReportDTO));
+
+        CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() ->
+                reportMapper.damageReportFootSum(finalStartDate, finalEndDate, damageReportDTO));
+
+        //绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
+        CompletableFuture.allOf(dataFuture, totalFuture, footSumFuture).join();
+
+        try {
+            result.put("data", dataFuture.get());
+            result.put("total", totalFuture.get());
+            result.put("footSum", footSumFuture.get());
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
         }
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.processToBeCompletedMp( selectTime1, selectTime2,orderId,inputProject,selectProcesses,report));
+        List<String> list = new ArrayList<>();
+        list.add(startDate);
+        list.add(endDate);
+        result.put("selectDate", list);
+
+        return result;
+    }
+
+    public Map<String, Object> splittingDetailsOutsideSv(String orderId, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.splittingDetailsOutsideMp(orderId, report));
+        map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney());
+        return map;
+    }
+
+    public Map<String, Object> qualityReportSv(Date selectTime1, Date selectTime2, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.qualityReportMp(selectTime1, selectTime2, report));
+        return map;
+    }
+
+    public Map<String, Object> yieldSv(String selectTime1, String selectTime2, String selectProcesses, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.yieldMp(selectTime1, selectTime2, selectProcesses, report));
         map.put("process", productionSchedulingMapper.selectProcess());
         return map;
     }
 
-    public Map<String,Object> selectDamageReportSv(Date selectTime1, Date selectTime2, Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.selectDamageReportMp( selectTime1, selectTime2,report));
-        return map;
-    }
+    public Map<String, Object> productionScheduleSv(String orderId, List<String> columns) {
 
-    public Map<String,Object> splittingDetailsOutsideSv(String orderId, Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.splittingDetailsOutsideMp( orderId,report));
-        return map;
-    }
 
-    public Map<String,Object> qualityReportSv(Date selectTime1, Date selectTime2, Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.qualityReportMp( selectTime1,selectTime2,report));
-        return map;
-    }
-
-    public Map<String,Object> yieldSv(Date selectTime1, Date selectTime2, String selectProcesses, Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.yieldMp( selectTime1,selectTime2,selectProcesses,report));
-        map.put("process", productionSchedulingMapper.selectProcess());
-        return map;
-    }
-
-    public Map<String, Object> productionScheduleSv(String orderId, List<Integer> columns) {
         Map<String, Object> map = new HashMap<>();
         //鑾峰彇琛ㄦ牸鍐呭鏁版嵁
-        map.put("data", reportMapper.productionScheduleMp(orderId));
+        List<Map<String, String>> dataList = reportMapper.productionScheduleMp(orderId);
+
 
         //鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
-        List<Map<String,String>> processFilterList = orderProcessDetailMapper.filterOrderProcess(orderId);
-        List<Map<String,String>> processList = processFilterList;
+        List<Map<String, String>> uniqueList = orderProcessDetailMapper.filterOrderProcess(orderId);
 
-        List<String> filterList = new ArrayList<>();
-        //寰幆閬嶅巻鏁扮粍锛屽垽鏂搴忓彿褰撳墠鐨勫伐搴�
-        for (int i = 1; i < processFilterList.size(); i++) {
-            filterList.add(processFilterList.get(i).get("process"));
-            List<Map<String,String>> lastProcessList =
-                    orderProcessDetailMapper.filterLastProcess(
-                            orderId,
-                            String.valueOf(processFilterList.get(i).get("order_number")),
-                            String.valueOf(processFilterList.get(i).get("technology_number")),
-                            String.valueOf(processFilterList.get(i).get("id"))
-                    );
-            if(!lastProcessList.isEmpty()){
-                int finalI = i;
-                lastProcessList.forEach(lastProcess -> {
-                    if(filterList.contains(lastProcess.get("process"))){
-                        processList.add(lastProcess);
-                    }
-                });
+        map.put("title", uniqueList);
+        Map<String,Integer> clos = new HashMap<>();
+        HashMap<String,HashMap<String,Map<String, Integer>>> rowCount = new HashMap<String,HashMap<String,Map<String, Integer>>>();
+        for (int i=0;i<uniqueList.size();i++){
+            //鏍规嵁娴佺▼鏌ヨ鍩虹鏁版嵁
+            BasicData basicData =  basicDataMapper.selectOne(
+                    new QueryWrapper<BasicData>()
+                            .eq("basic_category","process")
+                            .eq("basic_name",uniqueList.get(i).get("process"))
+                            .last("limit 1")
+            );
+
+            //鍒ゆ柇澶硅兌鍜屽す鑳跺悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")
+            if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){
+                clos.put(uniqueList.get(i).get("process"), 14+i);
             }
-
-        }
-        // 浣跨敤HashSet鏉ヨ褰曞凡缁忛亣鍒扮殑value鍊�
-        Set<String> seenValues = new HashSet<>();
-        // 鍒涘缓涓�涓柊鐨凩ist鏉ュ瓨鍌ㄧ粨鏋�
-        List<Map<String, String>> uniqueList = new ArrayList<>();
-
-        // 鍙嶅悜閬嶅巻鍘熷List
-        for (int i = processList.size() - 1; i >= 0; i--) {
-            Map<String, String> maps = processList.get(i);
-            String value = maps.values().iterator().next(); // 鍋囪姣忎釜Map鍙湁涓�涓獀alue
-
-            // 濡傛灉value杩樻病鏈夎鐪嬪埌杩囷紝灏辨坊鍔犲埌缁撴灉List鍜孒ashSet涓�
-            if (!seenValues.contains(value)) {
-                uniqueList.add(0, maps); // 娣诲姞鍒扮粨鏋淟ist鐨勫紑澶达紝浠ヤ繚鎸佸師椤哄簭
-                seenValues.add(value);
+            //鍒ゆ柇涓┖鍜屼腑绌哄悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")
+            if(Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")){
+                columns.add("reportWorkQuantity."+uniqueList.get(i).get("process"));
             }
         }
-        map.put("title", uniqueList );
 
 
-
-
-        List<Map<String,Integer>> getRowCount =  orderProcessDetailMapper.getGlassLRow(orderId);
-        List<Map<String,Integer>> rowCount = new ArrayList<>();
-        columns.forEach(col ->{
-            getRowCount.forEach(row ->{
-                Map<String,Integer>  getRow = new HashMap<>();
-                // { row: 0, col: 1, rowspan: 3, colspan: 0},
-                getRow.put("row",row.get("RowNum"));
-                getRow.put("col",col);
-                getRow.put("rowspan",row.get("rowCount"));
-                getRow.put("colspan",0);
-                rowCount.add(getRow);
-            });
+        List<Map<String, Object>> getRowCount = orderProcessDetailMapper.getGlassLRow(orderId);
+        HashMap<Integer,Map<String, Object>> getRowCountMap = new HashMap<>();
+        getRowCount.forEach(col -> {
+            Integer getRowCountOrderNumber = ((Number) col.get("order_number")).intValue();
+            getRowCountMap.put(getRowCountOrderNumber, col);
         });
 
+        //寰幆缁撴灉
+        for (int i=0;i<dataList.size();i++ ) {
+            Integer orderNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("order_number")));
+            Integer technologyNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")));
+            int finalI1 = i;
+            columns.forEach(col -> {
+                if(rowCount.get(col) == null){
+                    rowCount.put(col, new HashMap<String,Map<String,Integer>>());
+                }
 
-        map.put("mergeCells",rowCount);
+                if(getRowCountMap.get(orderNumber) != null){
+                    Map<String,Object> row = getRowCountMap.get(orderNumber);
+                    Map<String, Integer> getRow = new HashMap<>();
+                    //鍒ゆ柇褰撳墠姝ゆ 鏄惁涓虹涓�琛� 骞朵笖鐩稿悓搴忓彿
+                    if(technologyNumber==1){
+                        getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
+                        getRow.put("colspan", 1);
+                    }else{
+                        getRow.put("rowspan", 0);
+                        getRow.put("colspan", 0);
+                    }
+                    rowCount.get(col).put(finalI1+"_"+col, getRow);
+                }
+
+
+            });
+
+
+            Map<String, String> data = JSON.parseObject(dataList.get(i).get("reportWorkQuantity"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            Map<String, String> dataShow = JSON.parseObject(dataList.get(i).get("reportWorkQuantityShow"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            //鍒ゆ柇鍚庡伐搴忔娴佺▼鍗″彿鏄惁鏈夋鐮�
+            List<DamageDetails> hasBreak = damageDetailsMapper
+                    .getNotReview(dataList.get(i).get("processId"),
+                            String.valueOf(dataList.get(i).get("order_number")),
+                            String.valueOf(dataList.get(i).get("technology_number"))
+                    );
+
+
+
+
+
+            if(!hasBreak.isEmpty()){
+                int finalI = i;
+                data.forEach((thisProcess, index)->{
+                    String behindProcess = orderProcessDetailMapper.getBehindProcess(
+                            dataList.get(finalI).get("processId"),
+                            String.valueOf(dataList.get(finalI).get("order_number")),
+                            String.valueOf(dataList.get(finalI).get("technology_number")),
+                            thisProcess,
+                            orderId
+                    );
+
+                    if(behindProcess!=null &&!behindProcess.isEmpty()){
+                        Integer behindDamageSum = damageDetailsMapper.getBehindDamageSum(
+                                dataList.get(finalI).get("processId"),
+                                String.valueOf(dataList.get(finalI).get("order_number")),
+                                String.valueOf(dataList.get(finalI).get("technology_number")),
+                                behindProcess,1
+                        );
+                        if(behindDamageSum>0){
+                            data.put(thisProcess, String.valueOf(Integer.parseInt(data.get(thisProcess) )- behindDamageSum));
+                            dataShow.put(thisProcess, String.valueOf(Integer.parseInt(dataShow.get(thisProcess) )- behindDamageSum));
+                        }
+
+                    }
+                });
+
+            }
+            //澶硅兌宸ュ簭鍒ゆ柇鍚堝苟琛屾暟
+            if(!clos.isEmpty()){
+
+                Integer max = orderGlassDetailMapper
+                        .getMaxTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+                Integer min = orderGlassDetailMapper
+                        .getMinTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+
+                for (String key : clos.keySet()) {
+                    if(data.get(key) != null){
+                        if (rowCount.get("reportWorkQuantity."+key)==null){
+                            rowCount.put("reportWorkQuantity."+key, new HashMap<String,Map<String,Integer>>());
+                        }
+                        Map<String, Integer> getRow = new HashMap<>();
+                        if(min == Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")))  ){
+
+                            // { row: 0, col: 1, rowspan: 3, colspan: 0},
+                            //getRow.put("row", i );
+                            getRow.put("rowspan", max-min+1);
+                            getRow.put("colspan", 1);
+
+                        }else{
+                            getRow.put("rowspan", 0);
+                            getRow.put("colspan", 0);
+                            data.put(key,"0");
+                        }
+                        rowCount.get("reportWorkQuantity."+key).put(i+"_reportWorkQuantity."+key, getRow);
+                    }
+                }
+            }
+            dataList.get(i).put("reportWorkQuantity",JSON.toJSONString(data));
+            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
+
+        }
+
+
+
+
+        map.put("data",dataList );
+        map.put("mergeCells", rowCount);
 
         return map;
     }
 
-    public Map<String, Object> taskCompletionStatusSv(Date selectTime1, Date selectTime2, List<Integer> columns) {
+    public Map<String, Object> taskCompletionStatusSv(Date selectTime1, Date selectTime2, String orderId, List<Integer> columns) {
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
         Map<String, Object> map = new HashMap<>();
         //鑾峰彇琛ㄦ牸鍐呭鏁版嵁
-        map.put("data", reportMapper.taskCompletionStatusMp(selectTime1,selectTime2));
+        map.put("data", reportMapper.taskCompletionStatusMp(selectTime1, selectTime2,orderId));
 
         //鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
-        List<Map<String,String>> processFilterList = orderProcessDetailMapper.filterOrderProcessCollect(selectTime1,selectTime2);
-        List<Map<String,String>> processList = processFilterList;
+        List<Map<String, String>> processFilterList = orderProcessDetailMapper.filterOrderProcessCollect(selectTime1, selectTime2,orderId);
+        List<Map<String, String>> processList = processFilterList;
 
         List<String> filterList = new ArrayList<>();
         //寰幆閬嶅巻鏁扮粍锛屽垽鏂搴忓彿褰撳墠鐨勫伐搴�
         for (int i = 1; i < processFilterList.size(); i++) {
             filterList.add(processFilterList.get(i).get("process"));
-            List<Map<String,String>> lastProcessList =
+            List<Map<String, String>> lastProcessList =
                     orderProcessDetailMapper.filterLastProcess(
                             String.valueOf(processFilterList.get(i).get("order_id")),
                             String.valueOf(processFilterList.get(i).get("order_number")),
                             String.valueOf(processFilterList.get(i).get("technology_number")),
                             String.valueOf(processFilterList.get(i).get("id"))
                     );
-            if(!lastProcessList.isEmpty()){
+            if (!lastProcessList.isEmpty()) {
                 int finalI = i;
                 lastProcessList.forEach(lastProcess -> {
-                    if(filterList.contains(lastProcess.get("process"))){
+                    if (filterList.contains(lastProcess.get("process"))) {
                         processList.add(lastProcess);
                     }
                 });
@@ -293,44 +882,756 @@
                 seenValues.add(value);
             }
         }
-        map.put("title", uniqueList );
+        map.put("title", uniqueList);
 
-
-
-
-        List<Map<String,Integer>> getRowCount =  orderProcessDetailMapper.getGlassLRowCollect(selectTime1,selectTime2);
-        List<Map<String,Integer>> rowCount = new ArrayList<>();
-        columns.forEach(col ->{
-            getRowCount.forEach(row ->{
-                Map<String,Integer>  getRow = new HashMap<>();
+        List<Map<String, Integer>> getRowCount = orderProcessDetailMapper.getGlassLRowCollect(selectTime1, selectTime2,orderId);
+        List<Map<String, Integer>> rowCount = new ArrayList<>();
+        columns.forEach(col -> {
+            getRowCount.forEach(row -> {
+                Map<String, Integer> getRow = new HashMap<>();
                 // { row: 0, col: 1, rowspan: 3, colspan: 0},
-                getRow.put("row",row.get("RowNum"));
-                getRow.put("col",col);
-                getRow.put("rowspan",row.get("rowCount"));
-                getRow.put("colspan",0);
+                Object rowNumObj = row.get("RowNum");
+                if (rowNumObj instanceof Double) {
+                    getRow.put("row", ((Double) rowNumObj).intValue());
+                } else if (rowNumObj instanceof Integer) {
+                    getRow.put("row", (Integer) rowNumObj);
+                }
+                getRow.put("col", col);
+                getRow.put("rowspan", row.get("rowCount"));
+                getRow.put("colspan", 0);
                 rowCount.add(getRow);
             });
         });
-
-
-        map.put("mergeCells",rowCount);
+        map.put("mergeCells", rowCount);
 
         return map;
     }
 
-    public Map<String,Object> orderPlanDecompositionSv(Date selectTime1, Date selectTime2,Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.orderPlanDecompositionMp( selectTime1,selectTime2,report));
+    public Map<String, Object> orderPlanDecompositionSv(Date selectTime1, Date selectTime2, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.orderPlanDecompositionMp(selectTime1, selectTime2, report));
         return map;
     }
 
-    public Map<String,Object> rawMaterialRequisitionSv(Date selectTime1, Date selectTime2, Report report) {
-        Map<String,Object> map = new HashMap<>();
-        map.put("data",reportMapper.rawMaterialRequisitionMp( selectTime1,selectTime2,report));
+    public Map<String, Object> orderReportingWorks(Date selectTime1, Date selectTime2, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.orderReportingWorks(selectTime1, selectTime2, report));
+        return map;
+    }
+
+    public Map<String, Object> rawMaterialRequisitionSv(Date selectTime1, Date selectTime2, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.rawMaterialRequisitionMp(selectTime1, selectTime2, report));
         return map;
     }
 
     public List exportCrossProcessBreakingSv(List<LocalDate> dates) {
         return reportMapper.exportCrossProcessBreakingMp(dates);
     }
+
+    public List exportNotCrossProcessBreakingSv(List<LocalDate> dates) {
+        return reportMapper.exportNotCrossProcessBreakingMp(dates);
+    }
+
+    //    public List exportTeamOutputSv(Map<String, Object> dates) {
+//        List<LocalDate> date= (List<LocalDate>) dates.get("date");
+//        String process= (String) dates.get("processes");
+//        if (process.equals("鍏ㄩ儴")){
+//            process="";
+//        }
+//        String laminating = reportMapper.getLaminating(process);
+//        return reportMapper.exportTeamOutputMp(date,process,laminating);
+//    }
+    public List exportDamageReportSv(Map<String, Object> dates) {
+        List<LocalDate> date= (List<LocalDate>) dates.get("date");
+        return reportMapper.exportDamageReportMp(date);
+    }
+
+    public List exportOrderPlanDecompositionSv(List<LocalDate> dates) {
+        return reportMapper.exportOrderPlanDecompositionMp(dates);
+    }
+
+    public List exportProcessToBeCompletedSv(Map<String, Object> dates) {
+        List<LocalDate> date= (List<LocalDate>) dates.get("date");
+        String process= (String) dates.get("processes");
+        String inputVal= (String) dates.get("inputVal");
+        String project= (String) dates.get("project");
+        if ("null".equals(inputVal)) {
+            inputVal = "";
+        }
+        if ("null".equals(project)) {
+            project = "";
+        }
+        return reportMapper.exportProcessToBeCompletedMp(date,process,inputVal,project);
+    }
+
+    public List exportWorkInProgressSv(Map<String, Object> dates) {
+        String process= (String) dates.get("processes");
+        if (process.equals("all")){
+            process="";
+        }
+        String inputVal= (String) dates.get("inputVal");
+        String project= (String) dates.get("project");
+        String terminationVals= dates.get("terminationVals").toString();
+        if (inputVal==null) {
+            inputVal = "";
+        }
+        if (project==null) {
+            project = "";
+        }
+        if (terminationVals==null) {
+            terminationVals = "";
+        }
+        List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project,terminationVals);
+        List<WorkInProgressDTO> dataList2  =reportMapper.exportWorkInProgressMpdataList2(process);
+
+        mergeTeamsGroupsName(dataList1, dataList2);
+        return dataList1;
+    }
+
+    public List exportTaskCompletionStatusSv(Map<String, Object> dates) {
+        return reportMapper.exportTaskCompletionStatusMp(dates);
+    }
+
+    public List exportRawMaterialRequisitionSv(List<LocalDate> dates) {
+        return reportMapper.exportRawMaterialRequisitionMp(dates);
+    }
+
+    public List exportQualityReportSv(List<LocalDate> dates) {
+        return reportMapper.exportQualityReportSv(dates);
+    }
+
+    public List exportYieldSv(Map<String, Object> dates) {
+        List<LocalDate> date= (List<LocalDate>) dates.get("date");
+        String process= (String) dates.get("processes");
+        return reportMapper.exportYieldMp(date,process);
+    }
+
+//    public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize, String selectTime1, String selectTime2, String selectProcesses, TeamOutputDTO teamOutputDTO) {
+//        if (selectProcesses.equals("all")){
+//            selectProcesses="";
+//        }
+//        Integer offset = (pageNum - 1) * pageSize;
+//        Map<String, Object> map = new HashMap<>();
+//        String laminating = reportMapper.getLaminating(selectProcesses);
+//
+//        map.put("data", reportMapper.teamOutputMp(offset, pageSize, selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO));
+//        map.put("process", productionSchedulingMapper.selectProcess());
+//        map.put("total", reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO));
+//        map.put("footSum" ,reportMapper.teamOutputFootSum(selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO));
+//        return map;
+//    }
+
+    public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize,
+                                            String selectTime1, String selectTime2,
+                                            String selectProcesses, TeamOutputDTO teamOutputDTO) {
+        if ("all".equals(selectProcesses)) {
+            selectProcesses = "";
+        }
+
+        Integer offset = (pageNum - 1) * pageSize;
+        Map<String, Object> result = new HashMap<>();
+
+        String laminating = reportMapper.getLaminating(selectProcesses);
+
+        String finalSelectProcesses = selectProcesses;
+        CompletableFuture<List<TeamOutputDTO>> dataFuture = asyncExecutor.runAsync(() ->
+                reportMapper.teamOutputMp(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO));
+
+        CompletableFuture<List<Map<String, String>>> processFuture = asyncExecutor.runAsync(() ->
+                productionSchedulingMapper.selectProcess());
+
+        CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() ->
+                reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO));
+
+
+        CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() ->
+                reportMapper.teamOutputFootSum(selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO));
+
+        // 绛夊緟鎵�鏈変换鍔″畬鎴�
+        CompletableFuture.allOf(dataFuture, processFuture, totalFuture, footSumFuture).join();
+
+        try {
+            result.put("data", dataFuture.get());
+            result.put("process", processFuture.get());
+            result.put("total", totalFuture.get());
+            result.put("footSum", footSumFuture.get());
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
+        }
+
+        return result;
+    }
+
+    public Map<String, Object> scheduleProductionScheduleSv(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, String processes, ScheduleProductionScheduleDTO scheduleProductionScheduleDTO) {
+        Integer offset = (pageNum - 1) * pageSize;
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.scheduleProductionScheduleMp(offset, pageSize, selectTime1, selectTime2,processes, scheduleProductionScheduleDTO));
+        map.put("total", reportMapper.getScheduleProductionScheduleTotal(offset, pageSize, selectTime1, selectTime2,processes, scheduleProductionScheduleDTO));
+        map.put("process", productionSchedulingMapper.selectProcess());
+        return map;
+    }
+
+    public List exportScheduleReportSv(Map<String, Object> dates) {
+        List<LocalDate> date= (List<LocalDate>) dates.get("date1");
+        String process= (String) dates.get("processes");
+        return reportMapper.exportScheduleReportMp(date,process);
+    }
+
+    public List exportTeamOutputSv(Map<String, Object> dates) {
+        List<LocalDate> date= (List<LocalDate>) dates.get("date");
+        String process= (String) dates.get("processes");
+        if (process.equals("all")){
+            process="";
+        }
+        String laminating = reportMapper.getLaminating(process);
+        List<TeamOutputDTO> list = reportMapper.exportTeamOutputMp(date, process, laminating);
+
+        // 娓呮礂姣忎釜 TeamOutputDTO 瀹炰緥鐨� String 瀛楁锛堝幓闄ゅ墠鍚庣┖鏍硷級
+        for (TeamOutputDTO dto : list) {
+            for (Field field : dto.getClass().getDeclaredFields()) {
+                field.setAccessible(true);
+                try {
+                    Object value = field.get(dto);
+                    if (value instanceof String) {
+                        String trimmed = ((String) value).trim();
+                        field.set(dto, trimmed);
+                    }
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        return list;
+    }
+
+    public Map<String, Object> workInProgressCombinationProcessSv(
+            Integer pageNum, Integer pageSize,
+            String orderId, String inputProject, String selectProcesses,
+            String optionVal, WorkInProgressDTO workInProgressDTO) {
+
+        Integer offset = (pageNum - 1) * pageSize;
+
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
+        if ("null".equals(inputProject)) {
+            inputProject = "";
+        }
+        if ("null".equals(optionVal)) {
+            optionVal = "";
+        }
+        if ("all".equals(selectProcesses)) {
+            selectProcesses = "";
+        }
+
+        String laminating = "";
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Double> totalSumMap = new HashMap<>();
+
+        double totalStockNum = 0;
+        double totalStockArea = 0;
+
+
+
+
+        map.put("process", productionSchedulingMapper.selectProcess());
+
+        return map;
+    }
+
+    public Map<String, Object> workInProgressCombinationSv(
+            Integer pageNum, Integer pageSize,
+            String orderId, String inputProject, String selectProcesses,
+            String optionVal,String terminationVal, WorkInProgressDTO workInProgressDTO) {
+
+        Integer offset = (pageNum - 1) * pageSize;
+
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
+        if ("null".equals(inputProject)) {
+            inputProject = "";
+        }
+        if ("null".equals(optionVal)) {
+            optionVal = "";
+        }
+        if ("null".equals(terminationVal)) {
+            terminationVal = "";
+        }
+        if ("all".equals(selectProcesses)) {
+            selectProcesses = "";
+        }
+
+        String laminating = "";
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Double> totalSumMap = new HashMap<>();
+
+        double totalStockNum = 0;
+        double totalStockArea = 0;
+
+        // 鑾峰彇鎵�鏈夊伐搴�
+        List<String> processList = reportMapper.selectProcess();
+
+        // 鏈�缁堟暟鎹泦鍚�
+        List<Map<String, Object>> resultList = new ArrayList<>();
+        if (!"".equals(selectProcesses)) {
+            laminating = reportingWorkMapper.getProcessLaminating(selectProcesses);
+            List<Map<String, Object>> singleResult =
+                    reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal,terminationVal);
+            if (singleResult != null && !singleResult.isEmpty()) {
+                resultList.addAll(singleResult);
+            }
+
+            Map<String, Object> total =
+                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal,terminationVal);
+            if (total != null) {
+                BigDecimal stockNum = (BigDecimal) total.get("stockNum");
+                BigDecimal stockArea = (BigDecimal) total.get("stockArea");
+
+                if (stockNum != null) {
+                    totalStockNum += stockNum.doubleValue();
+                }
+                if (stockArea != null) {
+                    totalStockArea += stockArea.doubleValue();
+                }
+            }
+
+        } else {
+            for (String process : processList) {
+                laminating = reportingWorkMapper.getProcessLaminating(process);
+
+                List<Map<String, Object>> singleResult =
+                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal,terminationVal);
+
+                if (singleResult != null && !singleResult.isEmpty()) {
+                    resultList.addAll(singleResult);
+                }
+
+                Map<String, Object> total =
+                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal,terminationVal);
+                if (total != null) {
+                    BigDecimal stockNum = (BigDecimal) total.get("stockNum");
+                    BigDecimal stockArea = (BigDecimal) total.get("stockArea");
+
+                    if (stockNum != null) {
+                        totalStockNum += stockNum.doubleValue();
+                    }
+                    if (stockArea != null) {
+                        totalStockArea += stockArea.doubleValue();
+                    }
+                }
+            }
+        }
+
+        totalSumMap.put("stockNum", totalStockNum);
+        totalSumMap.put("stockArea", totalStockArea);
+
+        map.put("data", resultList);
+        map.put("total", totalSumMap);
+        map.put("process", productionSchedulingMapper.selectProcess());
+
+        return map;
+    }
+
+    public List exportWorkInProgressCombinationSv(Map<String, Object> dates) {
+        String process= (String) dates.get("processes");
+        if (process.equals("all")){
+            process="";
+        }
+        String inputVal= (String) dates.get("inputVal");
+        String project= (String) dates.get("project");
+        String terminationVals= dates.get("terminationVals").toString();
+        if (inputVal==null) {
+            inputVal = "";
+        }
+        if (project==null) {
+            project = "";
+        }
+        if (terminationVals==null) {
+            terminationVals = "";
+        }
+
+        String laminating = "";
+
+        // 鑾峰彇鎵�鏈夊伐搴�
+        List<String> processList = reportMapper.selectProcess();
+
+        // 鏈�缁堟暟鎹泦鍚�
+        List<WorkInProgressCombinationDTO> resultList = new ArrayList<>();
+
+        if (!"".equals(process)) {
+            laminating = reportingWorkMapper.getProcessLaminating(process);
+            List<WorkInProgressCombinationDTO> singleResult =
+                    reportMapper.exportWorkInProgressCombination(process, laminating, inputVal,terminationVals);
+            if (singleResult != null && !singleResult.isEmpty()) {
+                resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
+            }
+
+
+        } else {
+            for (String processVal : processList) {
+                laminating = reportingWorkMapper.getProcessLaminating(processVal);
+
+                List<WorkInProgressCombinationDTO> singleResult =
+                        reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal,terminationVals);
+
+                if (singleResult != null && !singleResult.isEmpty()) {
+                    resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
+                }
+            }
+        }
+
+        return resultList;
+    }
+
+    public Object processCardProgressCollectSv(String orderId, List<String> columns) {
+        Map<String, Object> map = new HashMap<>();
+        //鑾峰彇琛ㄦ牸鍐呭鏁版嵁
+        List<Map<String, String>> dataList = reportMapper.processCardProgressCollectMp(orderId);
+        //鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
+        List<Map<String, String>> uniqueList = orderProcessDetailMapper.filterOrderProcess(orderId);
+        map.put("title", uniqueList);
+        Map<String,Map<String,Object>> clos = new HashMap<>();
+        for (int i=0;i<uniqueList.size();i++){
+            //鏍规嵁娴佺▼鏌ヨ鍩虹鏁版嵁
+            BasicData basicData =  basicDataMapper.selectOne(
+                    new QueryWrapper<BasicData>()
+                            .eq("basic_category","process")
+                            .eq("basic_name",uniqueList.get(i).get("process"))
+                            .last("limit 1")
+            );
+            Map<String,Object> getCol = new HashMap<>();
+            //鍒ゆ柇澶硅兌鍜屽す鑳跺悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")
+            if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){
+                getCol.put("col", 11+i);
+                getCol.put("step","stepA");
+                clos.put(uniqueList.get(i).get("process"), getCol);
+            }
+            //鍒ゆ柇涓┖鍜屼腑绌哄悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")
+            if(Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")){
+                columns.add("reportWorkQuantity."+uniqueList.get(i).get("process"));
+                getCol.put("col", 11+i);
+                getCol.put("step","stepB");
+                clos.put(uniqueList.get(i).get("process"), getCol);
+            }
+        }
+        List<Map<String, Object>> getRowCount = orderProcessDetailMapper.getGlassLRow(orderId);
+        HashMap<String,Map<String, Object>> getRowCountMap = new HashMap<>();
+        getRowCount.forEach(col -> {
+            String getRowCountProcessId = String.valueOf(col.get("process_id"));
+            getRowCountMap.put(getRowCountProcessId, col);
+        });
+        HashMap<String,HashMap<String,Map<String, Integer>>> rowCount = new HashMap<String,HashMap<String,Map<String, Integer>>>();
+        //寰幆缁撴灉
+        for (int i=0;i<dataList.size();i++ ) {
+            String processId = String.valueOf(dataList.get(i).get("process_id"));
+            Integer technologyNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")));
+            int finalI1 = i;
+            columns.forEach(col -> {
+                if(rowCount.get(col) == null){
+                    rowCount.put(col, new HashMap<String,Map<String,Integer>>());
+                }
+
+                if(getRowCountMap.get(processId) != null){
+                    Map<String,Object> row = getRowCountMap.get(processId);
+                    Map<String, Integer> getRow = new HashMap<>();
+                    //鍒ゆ柇褰撳墠姝ゆ 鏄惁涓虹涓�琛� 骞朵笖鐩稿悓搴忓彿
+                    if(technologyNumber==1){
+                        getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
+                        getRow.put("colspan", 1);
+                    }else{
+                        getRow.put("rowspan", 0);
+                        getRow.put("colspan", 0);
+                    }
+                    rowCount.get(col).put(finalI1+"_"+col, getRow);
+                }
+
+
+            });
+
+
+            dataList.get(i).put("reportWorkQuantityShow",dataList.get(i).get("reportWorkQuantity"));
+            Map<String, String> data = JSON.parseObject(dataList.get(i).get("reportWorkQuantity"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            Map<String, String> dataShow = JSON.parseObject(dataList.get(i).get("reportWorkQuantityShow"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            //鍒ゆ柇鍚庡伐搴忔娴佺▼鍗″彿鏄惁鏈夋鐮�
+            List<DamageDetails> hasBreak = damageDetailsMapper
+                    .getNotReview(dataList.get(i).get("process_id"),
+                            null,
+                            String.valueOf(dataList.get(i).get("technology_number"))
+                    );
+
+            if(!hasBreak.isEmpty()){
+                int finalI = i;
+                data.forEach((thisProcess, index)->{
+                    String behindProcess = orderProcessDetailMapper.getBehindProcess(
+                            dataList.get(finalI).get("process_id"),
+                            String.valueOf(dataList.get(finalI).get("order_number")),
+                            String.valueOf(dataList.get(finalI).get("technology_number")),
+                            thisProcess,
+                            orderId
+                    );
+
+                    if(behindProcess!=null &&!behindProcess.isEmpty()){
+                        Integer behindDamageSum = damageDetailsMapper.getBehindDamageSum(
+                                dataList.get(finalI).get("process_id"),
+                                String.valueOf(dataList.get(finalI).get("order_number")),
+                                String.valueOf(dataList.get(finalI).get("technology_number")),
+                                behindProcess,
+                                null
+                        );
+                        if(behindDamageSum>0){
+                            data.put(thisProcess, String.valueOf(Integer.parseInt(data.get(thisProcess) )- behindDamageSum));
+                            dataShow.put(thisProcess, String.valueOf(Integer.parseInt(dataShow.get(thisProcess) )- behindDamageSum));
+                        }
+
+                    }
+                });
+
+            }
+
+            if(!clos.isEmpty()){
+                Integer max = orderGlassDetailMapper
+                        .getMaxTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+                Integer min = orderGlassDetailMapper
+                        .getMinTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+
+                for (String key : clos.keySet()) {
+                    if(data.get(key) != null){
+                        //鍒ゆ柇鏄す鑳跺伐搴�
+                        if( clos.get(key).get("step")=="stepA"){
+                            if (rowCount.get("reportWorkQuantity."+key)==null){
+                                rowCount.put("reportWorkQuantity."+key, new HashMap<String,Map<String,Integer>>());
+                            }
+                            Map<String, Integer> getRow = new HashMap<>();
+                            if(min == Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")))  ){
+                                getRow.put("rowspan", max-min+1);
+                                getRow.put("colspan", 1);
+                            }else{
+                                getRow.put("rowspan", 0);
+                                getRow.put("colspan", 0);
+                                data.put(key,"0");
+                            }
+                            rowCount.get("reportWorkQuantity."+key).put(i+"_reportWorkQuantity."+key, getRow);
+                        }else{//涓┖锛屼腑绌哄悗宸ュ簭
+                            //灏忕墖搴忓彿涓嶆槸1 鐨勬椂鍊欒祴鍊�0
+                            if(Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")))  !=1){
+                                data.put(key,"0");
+                            }
+                        }
+
+                    }
+
+                }
+            }
+            dataList.get(i).put("reportWorkQuantity",JSON.toJSONString(data));
+            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
+
+        }
+        Order order = orderMapper.selectOrderId(orderId);
+        map.put("mergeCells", rowCount);
+        map.put("data",dataList);
+        map.put("order",order);
+
+        return  map;
+    }
+
+    public Map<String, Object> processCardProgressReportSv(String orderId, List<String> columns) {
+        Map<String, Object> map = new HashMap<>();
+        //鑾峰彇琛ㄦ牸鍐呭鏁版嵁
+        List<Map<String, String>> dataList = reportMapper.processCardProgressReportMp(orderId);
+
+        //鑾峰彇琛ㄥご宸ュ簭绛涢�夋暟鎹�
+        List<Map<String, String>> uniqueList = orderProcessDetailMapper.filterOrderProcess(orderId);
+
+        map.put("title", uniqueList);
+        Map<String,Integer> clos = new HashMap<>();
+        HashMap<String,HashMap<String,Map<String, Integer>>> rowCount = new HashMap<String,HashMap<String,Map<String, Integer>>>();
+        for (int i=0;i<uniqueList.size();i++){
+            //鏍规嵁娴佺▼鏌ヨ鍩虹鏁版嵁
+            BasicData basicData =  basicDataMapper.selectOne(
+                    new QueryWrapper<BasicData>()
+                            .eq("basic_category","process")
+                            .eq("basic_name",uniqueList.get(i).get("process"))
+                            .last("limit 1")
+            );
+
+            //鍒ゆ柇澶硅兌鍜屽す鑳跺悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")
+            if(Objects.equals(basicData.getNickname(), "stepA") || Objects.equals(basicData.getNickname(), "stepC")){
+                clos.put(uniqueList.get(i).get("process"), 14+i);
+            }
+            //鍒ゆ柇涓┖鍜屼腑绌哄悗宸ュ簭
+            //Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")
+            if(Objects.equals(basicData.getNickname(), "stepB") || Objects.equals(basicData.getNickname(), "stepD")){
+                columns.add("reportWorkQuantity."+uniqueList.get(i).get("process"));
+            }
+        }
+
+
+        List<Map<String, Object>> getRowCount = orderProcessDetailMapper.getGlassLRow(orderId);
+        HashMap<Integer,Map<String, Object>> getRowCountMap = new HashMap<>();
+        getRowCount.forEach(col -> {
+            Integer getRowCountOrderNumber = ((Number) col.get("order_number")).intValue();
+            getRowCountMap.put(getRowCountOrderNumber, col);
+        });
+
+        //寰幆缁撴灉
+        for (int i=0;i<dataList.size();i++ ) {
+            Integer orderNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("order_number")));
+            Integer technologyNumber = Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")));
+            int finalI1 = i;
+            columns.forEach(col -> {
+                if(rowCount.get(col) == null){
+                    rowCount.put(col, new HashMap<String,Map<String,Integer>>());
+                }
+
+                if(getRowCountMap.get(orderNumber) != null){
+                    Map<String,Object> row = getRowCountMap.get(orderNumber);
+                    Map<String, Integer> getRow = new HashMap<>();
+                    //鍒ゆ柇褰撳墠姝ゆ 鏄惁涓虹涓�琛� 骞朵笖鐩稿悓搴忓彿
+                    if(technologyNumber==1){
+                        getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
+                        getRow.put("colspan", 1);
+                    }else{
+                        getRow.put("rowspan", 0);
+                        getRow.put("colspan", 0);
+                    }
+                    rowCount.get(col).put(finalI1+"_"+col, getRow);
+                }
+
+
+            });
+
+
+            Map<String, String> data = JSON.parseObject(dataList.get(i).get("reportWorkQuantity"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            Map<String, String> dataShow = JSON.parseObject(dataList.get(i).get("reportWorkQuantityShow"),
+                    new TypeReference<Map<String, String>>() {
+                    });
+            //鍒ゆ柇鍚庡伐搴忔娴佺▼鍗″彿鏄惁鏈夋鐮�
+            List<DamageDetails> hasBreak = damageDetailsMapper
+                    .getNotReview(dataList.get(i).get("processId"),
+                            String.valueOf(dataList.get(i).get("order_number")),
+                            String.valueOf(dataList.get(i).get("technology_number"))
+                    );
+
+
+
+
+
+            if(!hasBreak.isEmpty()){
+                int finalI = i;
+                data.forEach((thisProcess, index)->{
+                    String behindProcess = orderProcessDetailMapper.getBehindProcess(
+                            dataList.get(finalI).get("processId"),
+                            String.valueOf(dataList.get(finalI).get("order_number")),
+                            String.valueOf(dataList.get(finalI).get("technology_number")),
+                            thisProcess,
+                            orderId
+                    );
+
+                    if(behindProcess!=null &&!behindProcess.isEmpty()){
+                        Integer behindDamageSum = damageDetailsMapper.getBehindDamageSum(
+                                dataList.get(finalI).get("processId"),
+                                String.valueOf(dataList.get(finalI).get("order_number")),
+                                String.valueOf(dataList.get(finalI).get("technology_number")),
+                                behindProcess,1
+                        );
+                        if(behindDamageSum>0){
+                            data.put(thisProcess, String.valueOf(Integer.parseInt(data.get(thisProcess) )- behindDamageSum));
+                            dataShow.put(thisProcess, String.valueOf(Integer.parseInt(dataShow.get(thisProcess) )- behindDamageSum));
+                        }
+
+                    }
+                });
+
+            }
+            //澶硅兌宸ュ簭鍒ゆ柇鍚堝苟琛屾暟
+            if(!clos.isEmpty()){
+
+                Integer max = orderGlassDetailMapper
+                        .getMaxTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+                Integer min = orderGlassDetailMapper
+                        .getMinTechnologyNumberByGroup(dataList.get(i).get("order_id"),
+                                String.valueOf(dataList.get(i).get("order_number")),
+                                String.valueOf(dataList.get(i).get("group"))
+                        );
+
+                for (String key : clos.keySet()) {
+                    if(data.get(key) != null){
+                        if (rowCount.get("reportWorkQuantity."+key)==null){
+                            rowCount.put("reportWorkQuantity."+key, new HashMap<String,Map<String,Integer>>());
+                        }
+                        Map<String, Integer> getRow = new HashMap<>();
+                        if(min == Integer.parseInt(String.valueOf(dataList.get(i).get("technology_number")))  ){
+
+                            // { row: 0, col: 1, rowspan: 3, colspan: 0},
+                            //getRow.put("row", i );
+                            getRow.put("rowspan", max-min+1);
+                            getRow.put("colspan", 1);
+
+                        }else{
+                            getRow.put("rowspan", 0);
+                            getRow.put("colspan", 0);
+                            data.put(key,"0");
+                        }
+                        rowCount.get("reportWorkQuantity."+key).put(i+"_reportWorkQuantity."+key, getRow);
+                    }
+                }
+            }
+            dataList.get(i).put("reportWorkQuantity",JSON.toJSONString(data));
+            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
+
+        }
+
+
+
+
+        map.put("data",dataList );
+        map.put("mergeCells", rowCount);
+
+        return map;
+    }
+
+    public Map<String, Object> yieldProcessSv(String selectTime1, String selectTime2, Report report) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", reportMapper.yieldProcessMp(selectTime1, selectTime2, report));
+        map.put("process", productionSchedulingMapper.selectProcess());
+        return map;
+    }
+
+    public Map<String, Object> selectProcessCompletedSv(Date selectTime1, Date selectTime2, String orderId, String inputProject, String selectProcesses, Report report) {
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
+        if ("null".equals(inputProject)) {
+            inputProject = "";
+        }
+        Map<String, Object> map = new HashMap<>();
+        String laminating = reportMapper.getLaminating(selectProcesses);
+        map.put("data", reportMapper.selectProcessCompletedMp(selectTime1, selectTime2, orderId, inputProject, selectProcesses,laminating, report));
+        map.put("process", productionSchedulingMapper.selectProcess());
+        map.put("footSum" ,reportMapper.processToBeCompletedFootSum(selectTime1, selectTime2, orderId, inputProject, selectProcesses, report));
+
+        return map;
+    }
 }

--
Gitblit v1.8.0