From 384698a3568b3ab723843b4e48fdd188c3640aa0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 08 八月 2024 15:51:01 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
index 072185f..954de19 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
@@ -15,17 +15,30 @@
                         SUM(case task_state when 2 then 1 else 0 end) as real_count
                  from big_storage_cage_feed_task
                  where task_state in (1, 2)
-                   and target_slot is null
+                   and deleted = 0
+                   and (target_slot = 0 or target_slot is null)
                  group by line
              ) t
         where t.total_count = t.real_count
     </select>
     <select id="querySitToUpRemainWidth" resultMap="bigStorageDTO">
-        SELECT cast(5000 - sum(width + 20) as INT) as REMAIN_WIDTH,
-               count(glass_id)                     as GLASS_COUNT
-        FROM big_storage_cage_feed_task
-        WHERE line = #{line}
-          AND task_state in (1, 2)
+        SELECT CAST
+                   (5000 - SUM(MAX_LENGTH + #{glassGap}) AS INT) AS REMAIN_WIDTH,
+               COUNT(GLASS_ID)                                   AS GLASS_COUNT
+        FROM (
+                 SELECT GLASS_ID,
+                        CASE
+
+                            WHEN WIDTH >= HEIGHT THEN
+                                WIDTH
+                            ELSE HEIGHT
+                            END MAX_LENGTH
+                 FROM BIG_STORAGE_CAGE_FEED_TASK
+                 WHERE LINE = #{line}
+                   AND (target_slot = 0 or target_slot is null)
+                   AND TASK_STATE IN (1, 2)
+                   and deleted = 0
+             ) T
     </select>
 
 </mapper>

--
Gitblit v1.8.0