From 184e9d1d4ce1c33a47e5cc66478b10539a2cc4e7 Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期二, 20 五月 2025 15:32:08 +0800
Subject: [PATCH] 完善钣金计划大表

---
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java                     |    7 +
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateProcessShopPlanStat.java              |  145 +++++++++++++++++++----------------
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateProcessShopStatServiceImpl.java |   21 ++---
 aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessShopStatMapper.xml                |   38 +++++++++
 4 files changed, 132 insertions(+), 79 deletions(-)

diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateProcessShopPlanStat.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateProcessShopPlanStat.java
index eb5d194..552aee3 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateProcessShopPlanStat.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateProcessShopPlanStat.java
@@ -29,44 +29,24 @@
     private String mainPartNumber;
 
     /** 涓讳欢瀹㈡埛 */
-    @Schema(description = "涓讳欢瀹㈡埛锛屾潵鑷狤RP", type = "String")
+    @Schema(description = "涓讳欢瀹㈡埛", type = "String")
     @Excel(name = "涓讳欢瀹㈡埛")
     private String customer;
 
-    /** 涓讳欢璁㈠崟浜ゆ湡 */
-    @Schema(description = "涓讳欢璁㈠崟浜ゆ湡锛屾潵鑷狤RP", type = "String")
-    @Excel(name = "涓讳欢璁㈠崟浜ゆ湡")
-    private BigInteger mainOrderDelivery;
+    @Schema(description = "寤烘爲琛�", type = "String")
+    @Excel(name = "寤烘爲琛�")
+    private String requireTrackId;;
 
     /** 涓氬姟绫诲瀷 */
     @Schema(description = "涓氬姟绫诲瀷", type = "String")
     @Excel(name = "涓氬姟绫诲瀷")
     private String businessType;
 
-    /** 鐣彿 */
-    @Schema(description = "闇�姹傝拷婧彿锛岀敱APS浜х敓", type = "String")
-    @Excel(name = "鐣彿")
-    private String designation;
 
     /** 鍗曟嵁鍙� */
     @Schema(description = "鍗曟嵁鍙�", type = "String")
     @Excel(name = "鍗曟嵁鍙�")
     private String documentNumber;
-
-    /** 闇�姹傚垎绫� */
-    @Schema(description = "闇�姹傚垎绫�", type = "String")
-    @Excel(name = "闇�姹傚垎绫�")
-    private String requirementType;
-
-    /** 鍗曟嵁鐘舵�� */
-    @Schema(description = "鍗曟嵁鐘舵��", type = "String")
-    @Excel(name = "鍗曟嵁鐘舵��")
-    private String documentStatus;
-
-    /** 褰撳墠宸ュ簭 */
-    @Schema(description = "褰撳墠宸ュ簭", type = "String")
-    @Excel(name = "褰撳墠宸ュ簭")
-    private String workCenter;
 
 
     /** 鏂欏彿 */
@@ -84,34 +64,99 @@
     @Excel(name = "鐗堟湰鍙�")
     private String versionNumber;
 
+    /** 浣庨樁鐮�*/
+    @Excel(name = "浣庨樁鐮�")
+    private String lowOrderCode;
+
     /** 鐢熶骇鏁伴噺 */
     @Schema(description = "鐢熶骇鏁伴噺", type = "String")
     @Excel(name = "鐢熶骇鏁伴噺")
     private BigDecimal productionQuantity;
 
-    /** 宸ュ崟鍒涘缓鏃堕棿 */
-    @Schema(description = "宸ュ崟鍒涘缓鏃堕棿锛屾潵鑷狤RP", type = "String")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "宸ュ崟鍒涘缓鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private Date orderCreateTime;
+    /** 闇�姹傚垎绫� */
+    @Schema(description = "闇�姹傚垎绫�", type = "String")
+    @Excel(name = "闇�姹傚垎绫�")
+    private String requirementType;
+
+    /** 鍗曟嵁鐘舵�� */
+    @Schema(description = "鍗曟嵁鐘舵��", type = "String")
+    @Excel(name = "鍗曟嵁鐘舵��")
+    private String documentStatus;
 
     /** 宸ュ崟瀹℃牳鏃堕棿 */
-    @Schema(description = "宸ュ崟瀹℃牳鏃堕棿锛屾潵鑷狤RP", type = "String")
+    @Schema(description = "宸ュ崟瀹℃牳鏃堕棿", type = "String")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "宸ュ崟瀹℃牳鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date approveOn;
 
+    /** 宸ュ簭鍙� */
+    @Excel(name = "宸ュ簭鍙�")
+    private String processNumber;
+
+    /** 褰撳墠宸ュ簭 */
+    @Schema(description = "褰撳墠宸ュ簭", type = "String")
+    @Excel(name = "褰撳墠宸ュ簭")
+    private String workCenter;
+
+    /** 褰撳墠宸ュ簭璐d换浜� */
+    @Excel(name = "褰撳墠宸ュ簭璐d换浜�")
+    private String department;
+
+    /** 褰撳墠宸ュ簭鐘舵�� */
+    @Excel(name = "鐘舵��")
+    private String opStatus;
+
+    /** 涓嬩竴閬撳伐搴� */
+    @Excel(name = "涓嬩竴閬撳伐搴�")
+    private String nextOpName;
+
+    /** 宸ュ崟鍒涘缓鏃堕棿 */
+    @Schema(description = "宸ュ崟鍒涘缓鏃堕棿", type = "String")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "宸ュ崟鍒涘缓鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date orderCreateTime;
+
+
     /** 宸ュ崟寮�宸ユ椂闂� */
-    @Schema(description = "宸ュ崟寮�宸ユ椂闂达紝鏉ヨ嚜ERP", type = "String")
+    @Schema(description = "宸ュ崟寮�宸ユ椂闂�", type = "String")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "宸ュ崟寮�宸ユ椂闂�", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date startWorkDate;
 
+    @Schema(description = "鍓╀綑宸ュ簭", type = "String")
+    private String remainedProcess;
+
+    /*--------*/
+
     /** 鍐嶆纭瀹屽伐鏃堕棿 */
-    @Schema(description = "鍐嶆纭瀹屽伐鏃堕棿锛屾潵鑷狝PS", type = "String")
+    @Schema(description = "鍐嶆纭瀹屽伐鏃堕棿", type = "String")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "鍐嶆纭瀹屽伐鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date workOrderConfirmTime;
+
+    /** 鐢熶骇宸ュ巶 */
+    @Schema(description = "鐢熶骇宸ュ巶", type = "String")
+    @Excel(name = "鐢熶骇宸ュ巶")
+    private String productionBase;
+
+    /** 榻愬鐘跺喌 */
+    @Schema(description = "榻愬鐘跺喌", type = "String")
+    @Excel(name = "榻愬鐘跺喌")
+    private String kittingCondition;
+
+
+    /** 璁″垝榻愬鏃堕棿 */
+    @Schema(description = "璁″垝榻愬鏃堕棿", type = "String")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "璁″垝榻愬鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date planKittingTime;
+
+
+    /** 涓讳欢璁㈠崟浜ゆ湡 */
+    @Schema(description = "涓讳欢璁㈠崟浜ゆ湡", type = "String")
+    @Excel(name = "涓讳欢璁㈠崟浜ゆ湡")
+    private BigInteger mainOrderDelivery;
+
 
     /** 璁″垝瀹屽伐鏃� */
     @Schema(description = "璁″垝瀹屽伐鏃�", type = "String")
@@ -119,44 +164,12 @@
     @Excel(name = "璁″垝瀹屽伐鏃�", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date planEndDay;
 
-    /** 鐗堟湰鍙� */
-    @Schema(description = "鐢熶骇宸ュ巶锛屾潵鑷狤RP", type = "String")
-    @Excel(name = "鐢熶骇宸ュ巶")
-    private String productionBase;
 
-    /** 鐗堟湰鍙� */
-    @Schema(description = "榻愬鐘跺喌锛屾潵鑷狤RP", type = "String")
-    @Excel(name = "榻愬鐘跺喌")
-    private String kittingCondition;
-
-    /** 璁″垝榻愬鏃堕棿 */
-    @Schema(description = "璁″垝榻愬鏃堕棿锛屾潵鑷狤RP", type = "String")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "璁″垝榻愬鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private Date planKittingTime;
-
-    /** 宸ュ簭鍙� */
-    @Excel(name = "宸ュ簭鍙�")
-    private String processNumber;
-
-    /** 鎵�灞為儴闂� */
-    @Excel(name = "鎵�灞為儴闂�")
-    private String department;
     /** 涓嬮亾宸ュ簭鎵�灞為儴闂� */
     @Excel(name = "涓嬮亾宸ュ簭鎵�灞為儴闂�")
     private String nextProcessDeparment;
 
-    /** 褰撳墠宸ュ簭鐘舵�� */
-    @Excel(name = "褰撳墠宸ュ簭鐘舵��")
-    private String opStatus;
-
-    /** 涓嬩竴宸ュ簭鍚嶇О */
-    @Excel(name = "涓嬩竴宸ュ簭鍚嶇О")
-    private String nextOpName;
-
-    /** 浣庨樁鐮�*/
-    @Excel(name = "浣庨樁鐮�")
-    private String lowOrderCode;
-
+    /** 杞﹂棿宸ュ簭淇℃伅 */
     private List<ApsPlateProcessShopStat> deptPlans=new ArrayList<>();
+
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
index ca20fc5..6e285d0 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
@@ -1,6 +1,8 @@
 package com.aps.core.mapper;
 
 import java.util.List;
+
+import com.aps.core.domain.ApsPlate.ApsPlateProcessShopPlanStat;
 import com.aps.core.domain.ApsPlate.ApsPlateProcessShopStat;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -64,4 +66,9 @@
     int deleteAll();
 
     void batchInsert(List<ApsPlateProcessShopStat> stats);
+
+    /**
+     * 閽i噾璁″垝澶ц〃 鍩虹淇℃伅鏌ヨ
+     * */
+    List<ApsPlateProcessShopPlanStat> selectPlatePlanBaseTable();
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateProcessShopStatServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateProcessShopStatServiceImpl.java
index 6da9ad7..5bb509d 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateProcessShopStatServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateProcessShopStatServiceImpl.java
@@ -266,8 +266,7 @@
                 .toList();
 
         // 鑾峰彇璁″垝鍒楄〃鍜岀姸鎬佸垪琛�
-        List<ApsPlatePlan> planList = Optional.ofNullable(apsPlatePlanMapper.selectApsPlatePlanList(platePlan))
-                .orElse(Collections.emptyList());
+        List<ApsPlateProcessShopPlanStat> planList = apsPlateProcessShopStatMapper.selectPlatePlanBaseTable();
 
         List<ApsPlateProcessShopStat> shopStates = Optional.ofNullable(apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(new ApsPlateProcessShopStat()))
                 .orElse(Collections.emptyList());
@@ -281,26 +280,22 @@
         List<SysDictData> documentStatusDic = DictUtils.getDictCache("aps_document_status");
 
         // 鏋勫缓缁撴灉鍒楄〃
-        List<ApsPlateProcessShopPlanStat> shopPlanStats = planList.stream()
-                .map(plan -> {
-                    ApsPlateProcessShopPlanStat shopPlanStat = new ApsPlateProcessShopPlanStat();
-                    BeanUtils.copyProperties(plan, shopPlanStat); // 纭繚鐩爣瀵硅薄鏄悎娉曠殑鍗曚釜瀵硅薄瀹炰緥
-
+        planList.forEach(
+                 plan -> {
                     // 鏍规嵁 docNo 鑾峰彇瀵瑰簲鐨� shopStatList
                     List<ApsPlateProcessShopStat> shopStatList = shopStatesByDocNo.getOrDefault(plan.getDocumentNumber(), Collections.emptyList());
-                    shopPlanStat.setDeptPlans(shopStatList);
+                    plan.setDeptPlans(shopStatList);
                     if (businessTypeDic != null) {
                         businessTypeDic.stream().filter(x -> x.getDictValue().equals(plan.getBusinessType())).findFirst()
-                                .ifPresent(sysDictData -> shopPlanStat.setBusinessType(sysDictData.getDictLabel()));
+                                .ifPresent(sysDictData -> plan.setBusinessType(sysDictData.getDictLabel()));
                     }
                     if (documentStatusDic != null) {
                         documentStatusDic.stream().filter(x->x.getDictValue().equals(plan.getDocumentStatus()))
-                                .findFirst().ifPresent(sysDictData -> shopPlanStat.setDocumentStatus(sysDictData.getDictLabel()));
+                                .findFirst().ifPresent(sysDictData -> plan.setDocumentStatus(sysDictData.getDictLabel()));
                     }
-                    return shopPlanStat;
-                }).toList();
+        });
         // 鏋勫缓杩斿洖缁撴灉
-        AjaxResult success = AjaxResult.success(shopPlanStats);
+        AjaxResult success = AjaxResult.success(planList);
         success.put("shopNames", shopList);
         return success;
     }
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessShopStatMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessShopStatMapper.xml
index 149a884..fe180ee 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessShopStatMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateProcessShopStatMapper.xml
@@ -131,4 +131,42 @@
         )
         </foreach>
     </insert>
+
+
+    <!--閽i噾璁″垝澶ц〃 宸ュ崟鍩虹淇℃伅鏌ヨ-->
+    <select id="selectPlatePlanBaseTable" resultType="com.aps.core.domain.ApsPlate.ApsPlateProcessShopPlanStat">
+        with a as(
+            select ap.document_number, string_agg(pr.process_name,',') as remained_process
+            from aps_plate_plan as ap
+                     left join aps_process_route as pr on ap.document_number=pr.work_order_no
+            where cast(pr.process_number as numeric) > cast(ap.process_number as numeric)
+            group by ap.document_number
+        )
+        select
+            app.id,
+            app.main_part_number,
+            app.customer,
+            app.business_type,
+            app.document_number,
+            app.item_number,
+            app.drawing_no,
+            app.version_number,
+            app.low_order_code,
+            app.production_quantity,
+            app.requirement_type,
+            app.document_status,
+            app.approve_on,
+            app.process_number,
+            app.work_center,
+            app.department,
+            app.op_status,
+            app.next_op_name,
+            app.order_create_time,
+            app.start_work_date,
+            app.production_base,
+            a.remained_process
+        from aps_plate_plan as app
+                 left join a on app.document_number=a.document_number
+        where app.del_flag='0';
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3