From 5a354d67a0e62c63bef598dfcc96e3d54f50d2b2 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 24 七月 2025 09:05:01 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java |  206 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 177 insertions(+), 29 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 5a98514..0c9ab51 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,7 +5,6 @@
 
 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.entity.sd.BasicData;
 import com.example.erp.entity.sd.OrderDetail;
@@ -14,19 +13,19 @@
 import com.example.erp.mapper.pp.FlowCardMapper;
 import com.example.erp.mapper.pp.ProductionSchedulingMapper;
 import com.example.erp.mapper.pp.ReportMapper;
+import com.example.erp.mapper.pp.ReportingWorkMapper;
 import com.example.erp.mapper.sd.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.math.BigDecimal;
 import java.sql.Date;
 import java.time.LocalDate;
 import java.util.*;
-import java.util.concurrent.Executor;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toDouble;
 
 @Service
 @DS("pp")
@@ -42,6 +41,7 @@
     private final OrderDetailMapper orderDetailMapper;
 
     FlowCardMapper flowCardMapper;
+    private ReportingWorkMapper reportingWorkMapper;
 
 
     //涓婂伐搴忔姤宸ョ彮缁�
@@ -78,7 +78,6 @@
                               .eq("order_number", dto1.getOrderNumber())
                               .eq("technology_number",dto1.getTechnologyNumber())
                       );
-              System.out.println(orderGlassDetailGroup.getGroup());
 
               String glassName = productDetailMapper.getGlassNameByGroup(
                       orderDetail.getProductId(),
@@ -117,7 +116,11 @@
     }
 
 
-    public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper, ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper, ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper) {
+    public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper,
+                         ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper,
+                         OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper,
+                         ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper,
+                         ReportingWorkMapper reportingWorkMapper) {
         this.reportMapper = reportMapper;
         this.orderProcessDetailMapper = orderProcessDetailMapper;
         this.productionSchedulingMapper = productionSchedulingMapper;
@@ -126,6 +129,7 @@
         this.basicDataMapper = basicDataMapper;
         this.productDetailMapper = productDetailMapper;
         this.orderDetailMapper = orderDetailMapper;
+        this.reportingWorkMapper = reportingWorkMapper;
     }
 
     //娴佺▼鍗¤繘搴︽柟娉�
@@ -184,12 +188,7 @@
             getRowCount.forEach(row -> {
                 Map<String, Integer> getRow = new HashMap<>();
                 // { row: 0, col: 1, rowspan: 3, 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("row",  row.get("RowNum"));
                 getRow.put("col", col);
                 getRow.put("rowspan", row.get("rowCount"));
                 getRow.put("colspan", 0);
@@ -242,7 +241,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);
@@ -251,7 +249,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);
@@ -291,7 +288,7 @@
         return map;
     }
 
-    public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, DamageReportDTO damageReportDTO) {
+    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));
@@ -389,13 +386,16 @@
         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>> processFilterList = orderProcessDetailMapper.filterOrderProcessCollect(selectTime1, selectTime2,orderId);
         List<Map<String, String>> processList = processFilterList;
 
         List<String> filterList = new ArrayList<>();
@@ -437,22 +437,24 @@
         }
         map.put("title", uniqueList);
 
-
-        List<Map<String, Integer>> getRowCount = orderProcessDetailMapper.getGlassLRowCollect(selectTime1, selectTime2);
+        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"));
+                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);
 
         return map;
@@ -480,11 +482,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) {
@@ -581,4 +590,143 @@
         String laminating = reportMapper.getLaminating(process);
         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) {
+
+        Integer offset = (pageNum - 1) * pageSize;
+
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
+        if ("null".equals(inputProject)) {
+            inputProject = "";
+        }
+        if ("null".equals(optionVal)) {
+            optionVal = "";
+        }
+        if ("鍏ㄩ儴".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);
+            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);
+
+                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();
+                    }
+                }
+            }
+        }
+
+        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