From 27550ee46778905ab194844ab5247b116f70659e Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期四, 23 十月 2025 17:42:16 +0800
Subject: [PATCH] 切割排产重写,增加详情查询接口,增加查询类,部分中文翻译

---
 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml |   58 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml
index 02adb4e..4515458 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml
@@ -36,33 +36,47 @@
         </if>
     </select>
     <select id="queryRunTimes" resultType="com.mes.largenscreen.entity.RunTime">
-        with edg_storage_cage_history_task_temp as (
-            select distinct create_time from edg_storage_device_task_history  where task_type in (1,3) and
-                create_time  BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 DAY)
-        )
+        WITH edg_storage_cage_history_task_temp AS
+                 (SELECT DISTINCT create_time
+                  FROM edg_storage_device_task_history
+                  WHERE task_type IN (1, 3) AND DATE ( create_time ) = '${days}' ),
+            time_temp AS (
         SELECT
+            date (create_time) AS day_time,
+            MIN(create_time) AS start_timestamp,
+            MAX(create_time) AS end_timestamp
+        FROM
+            edg_storage_device_task_history
+        WHERE
+            Date ( create_time ) = '${days}'
+        GROUP BY
+            date ( create_time )
+            ),
+            result_temp AS (
+        SELECT
+            date ( t1.create_time ) AS day_time,
             t1.create_time AS first_timestamp,
             t2.create_time AS second_timestamp,
-            TIMESTAMPDIFF(MINUTE, t1.create_time, t2.create_time) as diff_minutes
-                ,(select min(create_time) from edg_storage_cage_history_task_temp) as start_timestamp
-                ,(select max(create_time) from edg_storage_cage_history_task_temp) as end_timestamp
+            TIMESTAMPDIFF( MINUTE, t1.create_time, t2.create_time ) AS diff_minutes
         FROM
-            (SELECT
-                 create_time,
-                 LEAD(create_time) OVER (ORDER BY create_time) AS next_timestamp
-             FROM
-                 edg_storage_cage_history_task_temp ) t1
-                JOIN
-            (SELECT
-                 create_time,
-                 LEAD(create_time) OVER (ORDER BY create_time) AS next_timestamp
-             FROM
-                 edg_storage_cage_history_task_temp ) t2 ON t1.next_timestamp = t2.create_time
-
+            ( SELECT create_time, LEAD( create_time ) OVER ( ORDER BY create_time ) AS next_timestamp FROM edg_storage_cage_history_task_temp ) t1
+            JOIN ( SELECT create_time, LEAD( create_time ) OVER ( ORDER BY create_time ) AS next_timestamp FROM edg_storage_cage_history_task_temp ) t2
+        ON t1.next_timestamp = t2.create_time
         WHERE
-            TIMESTAMPDIFF(MINUTE, t1.create_time, t2.create_time) between 6 and 500
-        GROUP BY t1.create_time,t2.create_time
-        ;
+            TIMESTAMPDIFF( MINUTE
+            , t1.create_time
+            , t2.create_time ) BETWEEN 6
+          AND 500
+        GROUP BY
+            t1.create_time,
+            t2.create_time
+            ),
+            result AS (
+        SELECT first_timestamp, second_timestamp, diff_minutes, start_timestamp, end_timestamp
+        FROM time_temp t1 LEFT JOIN result_temp t2
+        ON t1.day_time = t2.day_time )
+        SELECT *
+        FROM result
     </select>
     <select id="queryEdgDailyProduction" resultMap="baseMap">
         SELECT

--
Gitblit v1.8.0