From d613f1080234e13d12f2bad22650733b4477aa84 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 09 十二月 2025 16:52:40 +0800
Subject: [PATCH] 在制品报表添加厚度和相关功能

---
 north-glass-erp/src/main/java/com/example/erp/dto/pp/CrossProcessBreakingDTO.java |   13 +++---
 north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductDetailMapper.java  |    2 +
 north-glass-erp/northglass-erp/src/views/pp/report/ProcessToBeCompleted.vue       |    1 
 north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue             |   20 +++++----
 north-glass-erp/src/main/java/com/example/erp/dto/pp/WorkInProgressDTO.java       |    7 +++
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java       |   43 +++++++++++++++++++--
 north-glass-erp/src/main/java/com/example/erp/dto/pp/DamageReportDTO.java         |    5 +-
 north-glass-erp/src/main/resources/mapper/sd/ProductDetailMapper.xml              |    6 +++
 8 files changed, 75 insertions(+), 22 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/ProcessToBeCompleted.vue b/north-glass-erp/northglass-erp/src/views/pp/report/ProcessToBeCompleted.vue
index 4a134e7..8202ab4 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/ProcessToBeCompleted.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/ProcessToBeCompleted.vue
@@ -290,6 +290,7 @@
       filterMethod: filterChanged},
     {field: 'thickness',filters: [{data: ''}],
       slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged,
       width: 90, title: t('order.totalThickness')},
 
     {field: 'quantity', width: 120, title: t('order.quantity'),filters: [{data: ''}],
diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue b/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
index ec19396..5e01eef 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/WorkInProgress.vue
@@ -143,6 +143,7 @@
   }
   request.post(`/report/workInProgress/${pageNum.value}/${total.pageSize}/${inputVal}/${inputProject}/${selectProcesses}/${optionVal}/${terminationVals}`, filterData.value).then((res) => {
     if (res.code == 200) {
+
       total.value = res.data.total
       produceList = deepClone(res.data.data)
       produceList.forEach(item => {
@@ -180,10 +181,10 @@
   request.post(`/report/workInProgress/${pageNum.value}/${total.pageSize}/${inputVal}/${inputProject}/${selectProcesses}/${optionVal}/${terminationVals}`, filterData.value).then((res) => {
 
     if (res.code == 200) {
-      total.dataTotal = res.data.total.total * 1
-      total.pageTotal = res.data.total.pageTotal
-      pageTotal.value = res.data.total
-      total.value = res.data.total
+      total.value = res.data.total;
+      total.dataTotal = res.data.total.total * 1;
+      total.pageTotal = res.data.total.pageTotal;
+      pageTotal.value = res.data.total;
       res.data.data.forEach(item => {
         // 濡傛灉 shape 鍙兘鏄瓧绗︿覆灏辩敤 ==锛屽鏋滀竴瀹氭槸鏁板瓧灏辩敤 ===
         item.shape = (item.shape == 2) ? t('order.alien') : t('order.universalShape');
@@ -246,10 +247,10 @@
   request.post(`/report/workInProgress/${pageNum.value}/${total.pageSize}/${inputVal}/${inputProject}/${selectProcesses}/${optionVal}/${terminationVals}`, filterData.value).then((res) => {
 
     if (res.code == 200) {
-      total.dataTotal = res.data.total.total * 1
-      total.pageTotal = res.data.total.pageTotal
-      pageTotal.value = res.data.total
-      total.value = res.data.total
+      total.value = res.data.total;
+      total.dataTotal = res.data.total.total * 1;
+      total.pageTotal = res.data.total.pageTotal;
+      pageTotal.value = res.data.total;
       produceList = deepClone(res.data.data)
       produceList.forEach(item => {
         // 濡傛灉 shape 鍙兘鏄瓧绗︿覆灏辩敤 ==锛屽鏋滀竴瀹氭槸鏁板瓧灏辩敤 ===
@@ -359,6 +360,7 @@
       slots: {filter: 'num1_filter'},},
     {field: 'childHeight', width: 120, title: t('order.height'),visible: true,filters: [{data: ''}],
       slots: {filter: 'num1_filter'},},
+    {field: 'thickness',width: 90, title: t('order.totalThickness'),visible: true},
     {field: 'stockNum', width: 120, title: t('productStock.inventoryQuantity'),visible: true,filters: [{data: ''}],
       slots: {filter: 'num1_filter'},},
     {field: 'stockArea', width: 120, title: t('report.inventoryArea'),visible: true,filters: [{data: ''}],
@@ -394,7 +396,7 @@
         const List = ["quantity",'stockNum','stockArea',]
         if (List.includes(column.field)) {
           //return footSum(data, column.field)
-          return footSum(data, column.field)
+          return total.value?.[column.field] ?? 0
         }
         return ''
       })
diff --git a/north-glass-erp/src/main/java/com/example/erp/dto/pp/CrossProcessBreakingDTO.java b/north-glass-erp/src/main/java/com/example/erp/dto/pp/CrossProcessBreakingDTO.java
index 604dd86..08d2b45 100644
--- a/north-glass-erp/src/main/java/com/example/erp/dto/pp/CrossProcessBreakingDTO.java
+++ b/north-glass-erp/src/main/java/com/example/erp/dto/pp/CrossProcessBreakingDTO.java
@@ -27,6 +27,12 @@
     private String breakageType;
     @ExcelProperty("娆$牬鍘熷洜")
     private String breakageReason;
+    @ExcelProperty("瀹�")
+    private Double childWidth;
+    @ExcelProperty("楂�")
+    private Double childHeight;
+    @ExcelProperty("鍘氬害")
+    private String thickness;
     @ExcelProperty("娆$牬鏁伴噺")
     private Integer breakageQuantity;
     @ExcelProperty("娆$牬闈㈢Н")
@@ -45,10 +51,5 @@
     private String creator;
     @ExcelProperty("鎶ュ伐缂栧彿")
     private String reportingWorkId;
-    @ExcelProperty("鍘氬害")
-    private String thickness;
-    @ExcelProperty("瀹�")
-    private Double childWidth;
-    @ExcelProperty("楂�")
-    private Double childHeight;
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/dto/pp/DamageReportDTO.java b/north-glass-erp/src/main/java/com/example/erp/dto/pp/DamageReportDTO.java
index 4074604..56d3cee 100644
--- a/north-glass-erp/src/main/java/com/example/erp/dto/pp/DamageReportDTO.java
+++ b/north-glass-erp/src/main/java/com/example/erp/dto/pp/DamageReportDTO.java
@@ -48,12 +48,13 @@
     private Double childWidth;
     @ExcelProperty("楂�")
     private Double childHeight;
+    @ExcelProperty("鍘氬害")
+    private String thickness;
     @ExcelProperty("鎶ュ伐宸ュ簭")
     private String thisProcess;
     @ExcelProperty("鍒涘缓浜�")
     private String creator;
     @ExcelProperty("鎶ュ伐缂栧彿")
     private String reportingWorkId;
-    @ExcelProperty("鍘氬害")
-    private String thickness;
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/dto/pp/WorkInProgressDTO.java b/north-glass-erp/src/main/java/com/example/erp/dto/pp/WorkInProgressDTO.java
index 1e3b104..cfc468d 100644
--- a/north-glass-erp/src/main/java/com/example/erp/dto/pp/WorkInProgressDTO.java
+++ b/north-glass-erp/src/main/java/com/example/erp/dto/pp/WorkInProgressDTO.java
@@ -3,6 +3,8 @@
 import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Data
 public class WorkInProgressDTO {
     @ExcelProperty("宸ュ簭")
@@ -31,10 +33,12 @@
     private Double childWidth;
     @ExcelProperty("楂�")
     private Double childHeight;
+    @ExcelProperty("鍘氬害")
+    private BigDecimal thickness;
     @ExcelProperty("搴撳瓨鏁�")
     private Integer stockNum;
     @ExcelProperty("搴撳瓨闈㈢Н")
-    private Double stockArea;
+    private BigDecimal stockArea;
     @ExcelProperty("鎴愬搧鍚嶇О")
     private String productName;
     @ExcelProperty("鍦ㄥ埗鍝佸悕绉�")
@@ -45,4 +49,5 @@
     private String glassNumber;
     @ExcelProperty("涓婂伐搴忔姤宸ョ彮缁�")
     private String teamsGroupsName;
+
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductDetailMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductDetailMapper.java
index c0b78e1..49a6db3 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductDetailMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductDetailMapper.java
@@ -13,4 +13,6 @@
     boolean insertList(List<ProductDetail> getProductDetails);
 
     String getGlassNameByGroup(Integer productId, Integer minTechnologyNumberByGroup, Integer maxTechnologyNumberByGroup);
+
+    String getGlassName(Integer productId);
 }
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 e3b2045..b68291d 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
@@ -34,6 +34,8 @@
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.function.Function;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 import static cn.hutool.core.convert.Convert.toDouble;
@@ -60,6 +62,33 @@
     @Resource
     private AsyncQueryExecutor asyncExecutor;
 
+
+    //鏍规嵁鍦ㄥ埗鍝佸悕绉拌幏鍙栧帤搴�
+    private List<BigDecimal> parseGlassThicknessList(String glassName) {
+        List<BigDecimal> list = new ArrayList<>();
+        if (glassName == null || glassName.isEmpty()) {
+            return list;
+        }
+
+        // 鍖归厤鎵�鏈� "鏁板瓧 + mm"锛屾敮鎸佸皬鏁帮紝渚嬪 3.2mm銆�5mm銆�8mm
+        Pattern pattern = Pattern.compile("(\\d+(?:\\.\\d+)?)mm");
+        Matcher matcher = pattern.matcher(glassName);
+
+        while (matcher.find()) {
+            String numStr = matcher.group(1); // 鎹曡幏 5銆�8銆�3.2
+            try {
+                list.add(new BigDecimal(numStr));
+            } catch (Exception ignore) {
+            }
+        }
+        return list;
+    }
+
+    //鐜荤拑鍘氬害姹傚拰
+    private BigDecimal calcGlassThicknessSum(String glassName) {
+        return parseGlassThicknessList(glassName).stream()
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+    }
 
     //涓婂伐搴忔姤宸ョ彮缁�
     private void mergeTeamsGroupsName( List<WorkInProgressDTO> dataList1,List<WorkInProgressDTO> dataList2) {
@@ -88,9 +117,11 @@
               if(productDetail!=null){
                   dto1.setGlassName(productDetail.getDetail());
               }
+              BigDecimal thicknessSum = calcGlassThicknessSum(productDetail.getDetail());
+              dto1.setThickness(thicknessSum);
 
             //basicData.getNickname().equals("stepC")
-          }else if(basicData.getNickname().equals("stepC")){
+          }else if(basicData.getNickname().equals("stepC")){//澶瑰眰
               OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
                       .selectOne(new QueryWrapper<OrderGlassDetail>()
                               .eq("order_id", dto1.getOrderId())
@@ -104,9 +135,13 @@
                       orderGlassDetailMapper.getMaxTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup()))
               );
               dto1.setGlassName(glassName);
-
-          }else{
-              dto1.setGlassName(dto1.getProductName());
+              BigDecimal thicknessSum = calcGlassThicknessSum(glassName);
+              dto1.setThickness(thicknessSum);
+          }else{//涓┖
+              String glassName = productDetailMapper.getGlassName(orderDetail.getProductId());
+              dto1.setGlassName(glassName);
+              BigDecimal thicknessSum = calcGlassThicknessSum(glassName);
+              dto1.setThickness(thicknessSum);
           }
 
         }
diff --git a/north-glass-erp/src/main/resources/mapper/sd/ProductDetailMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/ProductDetailMapper.xml
index c141a7f..055ac8e 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/ProductDetailMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/ProductDetailMapper.xml
@@ -33,4 +33,10 @@
       and glass_sort >= #{minTechnologyNumberByGroup}
       and glass_sort &gt;= #{minTechnologyNumberByGroup}
     </select>
+
+    <select id="getGlassName">
+        SELECT GROUP_CONCAT(detail SEPARATOR '+')
+        from sd.product_detail
+        where prod_id = #{productId} and detail_type='glass'
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0