From 947622a11997e34a92b5b74bc5982aba21562240 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 09 十二月 2025 12:29:09 +0800
Subject: [PATCH] 次破报表添加厚度以及相关功能

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java |  443 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 329 insertions(+), 114 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 60f47e5..e3b2045 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
@@ -5,6 +5,7 @@
 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;
@@ -12,15 +13,13 @@
 import com.example.erp.dto.pp.*;
 import com.example.erp.entity.pp.DamageDetails;
 import com.example.erp.entity.pp.Report;
-import com.example.erp.entity.sd.BasicData;
-import com.example.erp.entity.sd.OrderDetail;
-import com.example.erp.entity.sd.OrderGlassDetail;
-import com.example.erp.entity.sd.ProductDetail;
 import com.example.erp.mapper.pp.*;
 import com.example.erp.mapper.sd.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
@@ -29,6 +28,9 @@
 import java.sql.Date;
 import java.sql.SQLOutput;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.function.Function;
@@ -53,6 +55,7 @@
 
     FlowCardMapper flowCardMapper;
     private ReportingWorkMapper reportingWorkMapper;
+    private final OrderMapper orderMapper;
 
     @Resource
     private AsyncQueryExecutor asyncExecutor;
@@ -82,7 +85,10 @@
                               .eq("prod_id", orderDetail.getProductId())
                               .eq("glass_sort",dto1.getTechnologyNumber())
                       );
-              dto1.setGlassName(productDetail.getDetail());
+              if(productDetail!=null){
+                  dto1.setGlassName(productDetail.getDetail());
+              }
+
             //basicData.getNickname().equals("stepC")
           }else if(basicData.getNickname().equals("stepC")){
               OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
@@ -133,7 +139,7 @@
                          ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper,
                          OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper,
                          ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper,
-                         ReportingWorkMapper reportingWorkMapper, DamageDetailsMapper damageDetailsMapper) {
+                         ReportingWorkMapper reportingWorkMapper, DamageDetailsMapper damageDetailsMapper, OrderMapper orderMapper) {
         this.reportMapper = reportMapper;
         this.orderProcessDetailMapper = orderProcessDetailMapper;
         this.productionSchedulingMapper = productionSchedulingMapper;
@@ -144,6 +150,7 @@
         this.orderDetailMapper = orderDetailMapper;
         this.reportingWorkMapper = reportingWorkMapper;
         this.damageDetailsMapper = damageDetailsMapper;
+        this.orderMapper = orderMapper;
     }
 
     //娴佺▼鍗¤繘搴︽柟娉�
@@ -302,8 +309,6 @@
         }
 
 
-
-
         map.put("data",dataList );
         map.put("mergeCells", rowCount);
 
@@ -332,22 +337,47 @@
 //        return map;
 //    }
 
+
+    private static final DateTimeFormatter DATE_TIME_FMT =
+            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+    private String toReportTime(String dateStr, String reportTime) {
+        if (dateStr == null || dateStr.isEmpty()) {
+            return null;
+        }
+
+        // 鍙繚鐣� yyyy-MM-dd锛岄槻姝㈠墠绔紶瀹屾暣鏃堕棿瀵艰嚧 parse 寮傚父
+        String onlyDate = dateStr.length() > 10 ? dateStr.substring(0, 10) : dateStr;
+
+
+        String[] parts = reportTime.split(":");
+        int hour   = Integer.parseInt(parts[0]);
+        int minute = parts.length > 1 ? Integer.parseInt(parts[1]) : 0;
+        int second = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
+
+        LocalDate date = LocalDate.parse(onlyDate);
+        LocalTime time = LocalTime.of(hour, minute, second);
+
+        return LocalDateTime.of(date, time).format(DATE_TIME_FMT);
+    }
     //璺ㄥ伐搴忔鐮�
     public Map<String, Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize,
                                                       List<String> selectDate,
+                                                      String reportTime,
                                                       CrossProcessBreakingDTO crossProcessBreakingDTO) {
         Integer offset = (pageNum - 1) * pageSize;
 
-        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
-        String endDate = LocalDate.now().toString();
-        String startDate = LocalDate.now().minusDays(15).toString();
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
 
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
         if (selectDate != null && selectDate.size() == 2) {
-            if (!selectDate.get(0).isEmpty()) {
-                startDate = selectDate.get(0);
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = toReportTime(selectDate.get(0), reportTime);
             }
-            if (!selectDate.get(1).isEmpty()) {
-                endDate = selectDate.get(1);
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = toReportTime(selectDate.get(1), reportTime);
             }
         }
 
@@ -384,19 +414,21 @@
     //闈炶法宸ュ簭娆$牬
     public Map<String, Object> notCrossProcessBreakingSv(Integer pageNum, Integer pageSize,
                                                       List<String> selectDate,
+                                                      String reportTime,
                                                       CrossProcessBreakingDTO crossProcessBreakingDTO) {
         Integer offset = (pageNum - 1) * pageSize;
 
-        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
-        String endDate = LocalDate.now().toString();
-        String startDate = LocalDate.now().minusDays(15).toString();
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
 
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
         if (selectDate != null && selectDate.size() == 2) {
-            if (!selectDate.get(0).isEmpty()) {
-                startDate = selectDate.get(0);
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = toReportTime(selectDate.get(0), reportTime);
             }
-            if (!selectDate.get(1).isEmpty()) {
-                endDate = selectDate.get(1);
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = toReportTime(selectDate.get(1), reportTime);
             }
         }
 
@@ -477,13 +509,14 @@
     public Map<String, Object> workInProgressSv(
             Integer pageNum, Integer pageSize,
             String orderId, String inputProject, String selectProcesses,
-            String optionVal, WorkInProgressDTO workInProgressDTO) {
+            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);
@@ -494,6 +527,7 @@
             String finalOrderId = orderId;
             String finalInputProject = inputProject;
             String finalSelectProcesses = selectProcesses;
+            String finalTerminationVals = terminationVals;
             CompletableFuture<List<WorkInProgressDTO>> dataList2Future =
                     asyncExecutor.runAsync(() ->
                             reportMapper.workInProgressMpdataList2(
@@ -511,7 +545,7 @@
 
                 totalFuture = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressOrderFootSum(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
 
             } else if ("2".equals(optionVal)) {
                 // 娴佺▼鍗″彿姹囨��
@@ -521,25 +555,25 @@
 
                 totalFuture = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressOrderFootSum(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
 
             } else if ("3".equals(optionVal)) {
                 dataList1Future = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressMpdataList1(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
                 totalFuture = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressOrderFootSum(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
 
             } else {
                 // 涓嶅垎缁�
                 dataList1Future = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressMpdataList1(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
 
                 totalFuture = asyncExecutor.runAsync(() ->
                         reportMapper.workInProgressOrderFootSum(
-                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
+                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
             }
 
             // 绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
@@ -590,23 +624,42 @@
 //    }
 
     public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize,
-                                                    String selectTime1, String selectTime2,
+                                                    List<String> selectDate,
+                                                    String reportTime,
                                                     DamageReportDTO damageReportDTO) {
+
         Integer offset = (pageNum - 1) * pageSize;
+
+
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
+
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = toReportTime(selectDate.get(0), reportTime);
+            }
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = toReportTime(selectDate.get(1), reportTime);
+            }
+        }
+
         Map<String, Object> result = new HashMap<>();
+        String finalStartDate = startDate;
+        String finalEndDate = endDate;
 
         // 寮傛浠诲姟瀹氫箟
-
         CompletableFuture<List<DamageReportDTO>> dataFuture = asyncExecutor.runAsync(() ->
-                reportMapper.selectDamageReportMp(offset, pageSize, selectTime1, selectTime2, damageReportDTO));
+                reportMapper.selectDamageReportMp(offset, pageSize, finalStartDate, finalEndDate, damageReportDTO));
 
         CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() ->
-                reportMapper.getDamageReportPageTotal(offset, pageSize, selectTime1, selectTime2, damageReportDTO));
+                reportMapper.getDamageReportPageTotal(offset, pageSize, finalStartDate, finalEndDate, damageReportDTO));
 
         CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() ->
-                reportMapper.damageReportFootSum(selectTime1, selectTime2, damageReportDTO));
+                reportMapper.damageReportFootSum(finalStartDate, finalEndDate, damageReportDTO));
 
-        //绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
+        // 绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
         CompletableFuture.allOf(dataFuture, totalFuture, footSumFuture).join();
 
         try {
@@ -615,11 +668,18 @@
             result.put("footSum", footSumFuture.get());
         } catch (Exception e) {
             e.printStackTrace();
-            throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
+            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> splittingDetailsOutsideSv(String orderId, Report report) {
         Map<String, Object> map = new HashMap<>();
@@ -634,77 +694,190 @@
         return map;
     }
 
-    public Map<String, Object> yieldSv(String selectTime1, String selectTime2, String selectProcesses, Report report) {
+    public Map<String, Object> yieldSv(List<String> selectDate, String selectProcesses,String reportTime, Report report) {
         Map<String, Object> map = new HashMap<>();
-        map.put("data", reportMapper.yieldMp(selectTime1, selectTime2, selectProcesses, report));
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 7 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(7).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
+
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = toReportTime(selectDate.get(0), reportTime);
+            }
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = toReportTime(selectDate.get(1), reportTime);
+            }
+        }
+        map.put("data", reportMapper.yieldMp(startDate, endDate, selectProcesses, report));
         map.put("process", productionSchedulingMapper.selectProcess());
+        List<String> list = new ArrayList<>();
+        list.add(startDate);
+        list.add(endDate);
+        map.put("selectDate",list);
         return map;
     }
 
-    public Map<String, Object> productionScheduleSv(String orderId, List<Integer> columns) {
+    public Map<String, Object> productionScheduleSv(String orderId, List<String> 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);
-                    }
-                });
-            }
-
-        }
-        // 浣跨敤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);
-            }
-        }
         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);
-        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", ((Number) row.get("RowNum")).intValue());
-                getRow.put("col", col);
-                getRow.put("rowspan", ((Number) row.get("rowCount")).intValue());
-                getRow.put("colspan", 0);
-                rowCount.add(getRow);
-            });
+        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;
@@ -802,12 +975,22 @@
         return map;
     }
 
-    public List exportCrossProcessBreakingSv(List<LocalDate> dates) {
+    public List exportCrossProcessBreakingSv(List<String> dates) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        List<LocalDateTime> dateTimeList = dates.stream()
+                .map(s -> LocalDateTime.parse(s, formatter))
+                .collect(Collectors.toList());
         return reportMapper.exportCrossProcessBreakingMp(dates);
     }
 
-    public List exportNotCrossProcessBreakingSv(List<LocalDate> dates) {
-        return reportMapper.exportNotCrossProcessBreakingMp(dates);
+    public List exportNotCrossProcessBreakingSv(List<String> dates) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        List<LocalDateTime> dateTimeList = dates.stream()
+                .map(s -> LocalDateTime.parse(s, formatter))
+                .collect(Collectors.toList());
+        return reportMapper.exportNotCrossProcessBreakingMp(dateTimeList);
     }
 
     //    public List exportTeamOutputSv(Map<String, Object> dates) {
@@ -819,9 +1002,15 @@
 //        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 exportDamageReportSv(List<String> dates) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        List<LocalDateTime> dateTimeList = dates.stream()
+                .map(s -> LocalDateTime.parse(s, formatter))
+                .collect(Collectors.toList());
+
+        // 杩欓噷鐢� LocalDateTime 鍘昏皟鐢� mapper
+        return reportMapper.exportDamageReportMp(dateTimeList);
     }
 
     public List exportOrderPlanDecompositionSv(List<LocalDate> dates) {
@@ -849,13 +1038,17 @@
         }
         String inputVal= (String) dates.get("inputVal");
         String project= (String) dates.get("project");
-        if ("null".equals(inputVal)) {
+        String terminationVals= dates.get("terminationVals").toString();;
+        if (inputVal==null) {
             inputVal = "";
         }
-        if ("null".equals(project)) {
+        if (project==null) {
             project = "";
         }
-        List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project);
+        if (terminationVals==null) {
+            terminationVals = "";
+        }
+        List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project,terminationVals);
         List<WorkInProgressDTO> dataList2  =reportMapper.exportWorkInProgressMpdataList2(process);
 
         mergeTeamsGroupsName(dataList1, dataList2);
@@ -1018,7 +1211,7 @@
     public Map<String, Object> workInProgressCombinationSv(
             Integer pageNum, Integer pageSize,
             String orderId, String inputProject, String selectProcesses,
-            String optionVal, WorkInProgressDTO workInProgressDTO) {
+            String optionVal,String terminationVal, WorkInProgressDTO workInProgressDTO) {
 
         Integer offset = (pageNum - 1) * pageSize;
 
@@ -1030,6 +1223,9 @@
         }
         if ("null".equals(optionVal)) {
             optionVal = "";
+        }
+        if ("null".equals(terminationVal)) {
+            terminationVal = "";
         }
         if ("all".equals(selectProcesses)) {
             selectProcesses = "";
@@ -1047,17 +1243,16 @@
 
         // 鏈�缁堟暟鎹泦鍚�
         List<Map<String, Object>> resultList = new ArrayList<>();
-
         if (!"".equals(selectProcesses)) {
             laminating = reportingWorkMapper.getProcessLaminating(selectProcesses);
             List<Map<String, Object>> singleResult =
-                    reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal);
+                    reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal,terminationVal);
             if (singleResult != null && !singleResult.isEmpty()) {
                 resultList.addAll(singleResult);
             }
 
             Map<String, Object> total =
-                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal);
+                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal,terminationVal);
             if (total != null) {
                 BigDecimal stockNum = (BigDecimal) total.get("stockNum");
                 BigDecimal stockArea = (BigDecimal) total.get("stockArea");
@@ -1075,14 +1270,14 @@
                 laminating = reportingWorkMapper.getProcessLaminating(process);
 
                 List<Map<String, Object>> singleResult =
-                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal);
+                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal,terminationVal);
 
                 if (singleResult != null && !singleResult.isEmpty()) {
                     resultList.addAll(singleResult);
                 }
 
                 Map<String, Object> total =
-                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal);
+                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal,terminationVal);
                 if (total != null) {
                     BigDecimal stockNum = (BigDecimal) total.get("stockNum");
                     BigDecimal stockArea = (BigDecimal) total.get("stockArea");
@@ -1114,11 +1309,15 @@
         }
         String inputVal= (String) dates.get("inputVal");
         String project= (String) dates.get("project");
-        if ("null".equals(inputVal)) {
+        String terminationVals= dates.get("terminationVals").toString();;
+        if (inputVal==null) {
             inputVal = "";
         }
-        if ("null".equals(project)) {
+        if (project==null) {
             project = "";
+        }
+        if (terminationVals==null) {
+            terminationVals = "";
         }
 
         String laminating = "";
@@ -1132,7 +1331,7 @@
         if (!"".equals(process)) {
             laminating = reportingWorkMapper.getProcessLaminating(process);
             List<WorkInProgressCombinationDTO> singleResult =
-                    reportMapper.exportWorkInProgressCombination(process, laminating, inputVal);
+                    reportMapper.exportWorkInProgressCombination(process, laminating, inputVal,terminationVals);
             if (singleResult != null && !singleResult.isEmpty()) {
                 resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
             }
@@ -1143,7 +1342,7 @@
                 laminating = reportingWorkMapper.getProcessLaminating(processVal);
 
                 List<WorkInProgressCombinationDTO> singleResult =
-                        reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal);
+                        reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal,terminationVals);
 
                 if (singleResult != null && !singleResult.isEmpty()) {
                     resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
@@ -1309,11 +1508,10 @@
             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;
     }
@@ -1480,10 +1678,27 @@
         return map;
     }
 
-    public Map<String, Object> yieldProcessSv(String selectTime1, String selectTime2, Report report) {
+    public Map<String, Object> yieldProcessSv(List<String> selectDate,String reportTime, Report report) {
         Map<String, Object> map = new HashMap<>();
-        map.put("data", reportMapper.yieldProcessMp(selectTime1, selectTime2, report));
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 7 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(7).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
+
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
+        if (selectDate != null && selectDate.size() == 2) {
+            if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
+                startDate = toReportTime(selectDate.get(0), reportTime);
+            }
+            if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
+                endDate = toReportTime(selectDate.get(1), reportTime);
+            }
+        }
+        map.put("data", reportMapper.yieldProcessMp(startDate, endDate, report));
         map.put("process", productionSchedulingMapper.selectProcess());
+        List<String> list = new ArrayList<>();
+        list.add(startDate);
+        list.add(endDate);
+        map.put("selectDate",list);
         return map;
     }
 

--
Gitblit v1.8.0