From 25ae4025978ef7498db9790b237fa5a26698b1ec Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 23 七月 2025 09:32:13 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java |  152 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 129 insertions(+), 23 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 4f9901c..cedd67e 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
@@ -18,11 +18,15 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.math.BigDecimal;
 import java.sql.Date;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toDouble;
 
 @Service
 @DS("pp")
@@ -243,7 +247,6 @@
         Map<String, Object> map = new HashMap<>();
         List<WorkInProgressDTO> dataList2  =reportMapper.workInProgressMpdataList2(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
         if (optionVal.equals("1")){
-            System.out.println(1);
             /* 鏍规嵁閿�鍞崟鍙锋眹鎬�*/
             //map.put("data", reportMapper.workInProgressOrderMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO));
             List<WorkInProgressDTO> dataList1  =reportMapper.workInProgressOrderMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
@@ -252,7 +255,6 @@
             // map.put("total", reportMapper.workInProgressOrderTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO));
             map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO));
         }else if(optionVal.equals("2")){
-            System.out.println(2);
             /* 鏍规嵁娴佺▼鍗″彿姹囨��*/
             //map.put("data", reportMapper.workInProgressProcessMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO));
             List<WorkInProgressDTO> dataList1  =reportMapper.workInProgressProcessMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
@@ -481,11 +483,18 @@
         return reportMapper.exportCrossProcessBreakingMp(dates);
     }
 
-    public List exportDamageReportSv(List<LocalDate> dates) {
-        if (dates != null && dates.size() > 1) {
-            dates.set(1, dates.get(1).plusDays(1)); // 灏嗙浜屼釜鏃ユ湡鍔犱竴澶�
-        }
-        return reportMapper.exportDamageReportMp(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) {
@@ -583,8 +592,13 @@
         return reportMapper.exportTeamOutputMp(date,process,laminating);
     }
 
-    public Map<String, Object> workInProgressCombinationSv(Integer pageNum, Integer pageSize,String orderId, String inputProject, String selectProcesses, String optionVal, WorkInProgressDTO workInProgressDTO) {
+    public Map<String, Object> workInProgressCombinationSv(
+            Integer pageNum, Integer pageSize,
+            String orderId, String inputProject, String selectProcesses,
+            String optionVal, WorkInProgressDTO workInProgressDTO) {
+
         Integer offset = (pageNum - 1) * pageSize;
+
         if ("null".equals(orderId)) {
             orderId = "";
         }
@@ -592,36 +606,128 @@
             inputProject = "";
         }
         if ("null".equals(optionVal)) {
-            optionVal = ("");
+            optionVal = "";
         }
-        if (selectProcesses.equals("鍏ㄩ儴")){
-            selectProcesses="";
+        if ("鍏ㄩ儴".equals(selectProcesses)) {
+            selectProcesses = "";
         }
+
         String laminating = "";
         Map<String, Object> map = new HashMap<>();
-        // 鑾峰彇鎵�鏈夊伐搴�
-        List<String> processList  = reportMapper.selectProcess();
-        // 閬嶅巻姣忎釜宸ュ簭骞惰皟鐢ㄦ柊鏂规硶
-        List<Map<String, Object>> resultList = new ArrayList<>();
-        if (selectProcesses!=""){
-            laminating = reportingWorkMapper.getProcessLaminating(selectProcesses);
-            List<Map<String, Object>> singleResult = reportMapper.getWorkInProgressCombination(selectProcesses,laminating,optionVal);
+        Map<String, Double> totalSumMap = new HashMap<>();
 
-            resultList.addAll(singleResult);
-        }else {
+        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);
+            if (singleResult != null && !singleResult.isEmpty()) {
+                resultList.addAll(singleResult);
+            }
+
+            Map<String, Object> total =
+                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal);
+            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);
+
+                List<Map<String, Object>> singleResult =
+                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal);
 
                 if (singleResult != null && !singleResult.isEmpty()) {
                     resultList.addAll(singleResult);
                 }
+
+                Map<String, Object> total =
+                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal);
+                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();
+                    }
+                }
             }
         }
 
-        map.put("data",resultList);
+        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("鍏ㄩ儴")){
+            process="";
+        }
+        String inputVal= (String) dates.get("inputVal");
+        String project= (String) dates.get("project");
+        if ("null".equals(inputVal)) {
+            inputVal = "";
+        }
+        if ("null".equals(project)) {
+            project = "";
+        }
+
+        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);
+            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);
+
+                if (singleResult != null && !singleResult.isEmpty()) {
+                    resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
+                }
+            }
+        }
+
+        return resultList;
+    }
 }

--
Gitblit v1.8.0