From fdf2903b8944b80877e7df5d0da38f34b5d84ed9 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期一, 04 十二月 2023 15:02:28 +0800
Subject: [PATCH] Merge branch 'tzskasrs-1' of http://47.97.1.152:5880/r/zy-asrs into tzskasrs-1

---
 src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
index 9c4db97..310b62a 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
@@ -40,7 +40,7 @@
         //鍒濆鍖�1妤肩紦瀛樿揣鏋剁珯鐐� 2鎺�5鍒�3灞�
         this.insertBatch(getCacheBasDevpList(1,2,1,5,1,3,1));
         //鍒濆鍖�3妤肩紦瀛樿揣鏋剁珯鐐� 3鎺�5鍒�3灞�
-        this.insertBatch(getCacheBasDevpList(5,7,1,5,1,3,3));
+        this.insertBatch(getCacheBasDevpList(5,9,1,5,1,3,3));
         //鍒濆鍖�3妤艰緭閫佺嚎宸ヤ綔绔欑偣 4涓珯鐐�
         this.insertBatch(getLineBasDevpList());
 
@@ -100,8 +100,11 @@
                     .eq("station_code", stationCode)
                     .like("dev_no", "0" + i + "@");
 
-            if("CS-305".equals(stationCode) || "CS-306".equals(stationCode) || "CS-307".equals(stationCode)){
-                wrapper.orderBy("dev_no",false);
+            List<String> list = this.selectCacheShelvesStationCodeByFloor(3);
+            if(list.contains(stationCode)){
+                if(Cools.eq(stationCode,"CS-305") || Cools.eq(stationCode,"CS-306") || Cools.eq(stationCode,"CS-307")){
+                    wrapper.orderBy("dev_no",false);
+                }
             }
 
             List<AgvBasDevp> agvBasDevpList = this.selectList(wrapper);
@@ -117,9 +120,20 @@
                     return agvBasDevpDto;
                 }
 
-                AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>()
+                List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
                         .eq("loc_no", agvBasDevpDto.getDevNo())
                         .or().eq("source_loc_no",agvBasDevpDto.getDevNo()));
+
+                AgvWrkMast agvWrkMast = null;
+                for (AgvWrkMast wrkMast : agvWrkMasts){
+                    if(Cools.isEmpty(agvWrkMast)){
+                        agvWrkMast = wrkMast;
+                    }else {
+                        if(agvWrkMast.getWrkSts() < wrkMast.getWrkSts()){
+                            agvWrkMast = wrkMast;
+                        }
+                    }
+                }
 
                 agvBasDevpDto.setAgvWrkMast(agvWrkMast);
 
@@ -194,4 +208,31 @@
         return this.selectOne(new EntityWrapper<AgvBasDevp>().eq("dev_no",devNo));
     }
 
+    @Override
+    public AgvBasDevp selectEmptyDevpByStation(String stationCode) {
+        return this.selectOne(new EntityWrapper<AgvBasDevp>()
+                .eq("station_code", stationCode)
+                .eq("loc_sts", "O"));
+    }
+
+    @Override
+    public List<AgvBasDevp> getBasDevpByNoCacheShelves() {
+        return this.selectList(new EntityWrapper<AgvBasDevp>().eq("cache_shelves","N"));
+    }
+
+    @Override
+    public List<String> selectCacheShelvesStationCodeByFloor(int floor) {
+        //Object o = this.selectList(new EntityWrapper<AgvBasDevp>().setSqlSelect("station_code").eq("floor",floor).eq("cache_shelves","Y").groupBy("station_code"));
+        return this.baseMapper.selectCacheShelvesStationCodeByFloor(floor);
+    }
+
+    public List<Map<String,Object>> selectDevNoAndNumBystationCode(String stationCode){
+        return this.baseMapper.selectDevNoAndNumBystationCode(stationCode);
+    }
+
+    @Override
+    public List<String> selectAllStationCode() {
+        return this.baseMapper.selectAllStationCode();
+    }
+
 }

--
Gitblit v1.9.1