From 16a3dbbf28606a90dd6dadeffe843f53f72d3955 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期五, 29 三月 2024 16:28:57 +0800
Subject: [PATCH] 初始化库位和站点

---
 src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java |   89 ++++++++++++++++++++++++++++++++------------
 1 files changed, 65 insertions(+), 24 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 28ed908..7adeaaa 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
@@ -37,38 +37,58 @@
 
     public void initBasDevp(){
 
-        //鍒濆鍖�1妤肩紦瀛樿揣鏋剁珯鐐� 2鎺�5鍒�3灞�
-        this.insertBatch(getCacheBasDevpList(1,2,1,5,1,3,1));
-        //鍒濆鍖�3妤肩紦瀛樿揣鏋剁珯鐐� 3鎺�5鍒�3灞�
-        this.insertBatch(getCacheBasDevpList(5,9,1,5,1,3,3));
-        //鍒濆鍖�3妤艰緭閫佺嚎宸ヤ綔绔欑偣 4涓珯鐐�
-        this.insertBatch(getLineBasDevpList());
+//        //鍒濆鍖�1妤肩紦瀛樿揣鏋剁珯鐐� 2鎺�5鍒�3灞�
+//        this.insertBatch(getCacheBasDevpList(1,2,1,5,1,3,1));
+//        //鍒濆鍖�3妤肩紦瀛樿揣鏋剁珯鐐� 3鎺�5鍒�3灞�
+//        this.insertBatch(getCacheBasDevpList(5,9,1,5,1,3,3));
+//        //鍒濆鍖�3妤艰緭閫佺嚎宸ヤ綔绔欑偣 4涓珯鐐�
+//        this.insertBatch(getLineBasDevpList());
 
+        //寰呭寘瑁呮垚鍝佸瓨鍌ㄥ尯鍏ュ簱鎺ラ┏浣�
+        this.insertBatch(getConnectionBasDevpList("DI",12,2,true,(short)1));
+        //寰呭寘瑁呮垚鍝佸瓨鍌ㄥ尯鍑哄簱鎺ラ┏浣�
+        this.insertBatch(getConnectionBasDevpList("DO",8,2,false,(short)1));
+        //鍘熸潗鏂欏叆搴撴帴椹充綅
+        this.insertBatch(getConnectionBasDevpList("YI",14,2,true,(short)2));
+        //鍘熸潗鏂欏嚭搴撴帴椹充綅
+        this.insertBatch(getConnectionBasDevpList("YO",18,2,false,(short)2));
+        //绠卞3鍏ュ簱鎺ラ┏浣�
+        this.insertBatch(getConnectionBasDevpList("XI",5,2,true,(short)3));
+        //绠卞3鍑哄簱鎺ラ┏浣�
+        this.insertBatch(getConnectionBasDevpList("XO",12,2,false,(short)3));
     }
 
-    private List<AgvBasDevp> getLineBasDevpList(){
+//    private List<AgvBasDevp> getLineBasDevpList(){
+//        List<AgvBasDevp> agvBasDevpList = new ArrayList<>();
+//        Date now = new Date();
+//        for(int row=1; row<=4; row++){
+//            agvBasDevpList.add(getAgvBasDevp(row,1,1,3,"N",now));
+//        }
+//        return agvBasDevpList;
+//    }
+
+    private List<AgvBasDevp> getConnectionBasDevpList(String type, int num, int floor, boolean inEnable, Short locType){
         List<AgvBasDevp> agvBasDevpList = new ArrayList<>();
         Date now = new Date();
-        for(int row=1; row<=4; row++){
-            agvBasDevpList.add(getAgvBasDevp(row,1,1,3,"N",now));
+        for(int index=1; index<=num; index++){
+            agvBasDevpList.add(getAgvBasDevp(type,index,floor,inEnable,locType,now));
         }
         return agvBasDevpList;
     }
 
-    //鏍规嵁鎺掑垪灞傝幏鍙朅GV缂撳瓨璐ф灦绔欑偣鍒楄〃
-    private List<AgvBasDevp> getCacheBasDevpList(int rowIndex, int rowMax, int bayIndex, int bayMax, int levIndex, int levMax, int floor){
-        List<AgvBasDevp> agvBasDevpList = new ArrayList<>();
-        Date now = new Date();
-        for(int row=rowIndex; row<=rowMax; row++){
-            for(int bay=bayIndex; bay<=bayMax; bay++){
-                for(int lev=levIndex; lev<=levMax; lev++){
-                    agvBasDevpList.add(getAgvBasDevp(row,bay,lev,floor,"Y",now));
-                }
-            }
-        }
-
-        return agvBasDevpList;
-    }
+//    //鏍规嵁鎺掑垪灞傝幏鍙朅GV缂撳瓨璐ф灦绔欑偣鍒楄〃
+//    private List<AgvBasDevp> getCacheBasDevpList(int rowIndex, int rowMax, int bayIndex, int bayMax, int levIndex, int levMax, int floor){
+//        List<AgvBasDevp> agvBasDevpList = new ArrayList<>();
+//        Date now = new Date();
+//        for(int row=rowIndex; row<=rowMax; row++){
+//            for(int bay=bayIndex; bay<=bayMax; bay++){
+//                for(int lev=levIndex; lev<=levMax; lev++){
+//                    agvBasDevpList.add(getAgvBasDevp(row,bay,lev,floor,"Y",now));
+//                }
+//            }
+//        }
+//        return agvBasDevpList;
+//    }
 
     private AgvBasDevp getAgvBasDevp(int row, int bay, int lev, int floor, String cacheShelves, Date now){
         AgvBasDevp agvBasDevp = new AgvBasDevp();
@@ -84,11 +104,27 @@
         return agvBasDevp;
     }
 
-    public void updateLocStsAndBarcodeByDevNo(String devNo, String locSts, String barcode){
+    private AgvBasDevp getAgvBasDevp(String type, int index, int floor, boolean inEnable, Short locType, Date now){
+        AgvBasDevp agvBasDevp = new AgvBasDevp();
+        String no = index >= 10 ? index + "" : "0" + index;
+        String devNo = type + "_" + no + "F" + floor;
+        agvBasDevp.setDevNo(devNo);
+        agvBasDevp.setLocSts("O");
+        agvBasDevp.setInEnable(inEnable ? "Y" : "N");
+        agvBasDevp.setOutEnable(inEnable ? "N" : "Y");
+        agvBasDevp.setFloor(floor);
+        agvBasDevp.setLocType1(locType);
+        agvBasDevp.setModiTime(now);
+        agvBasDevp.setAppeTime(now);
+        return agvBasDevp;
+    }
+
+    public void updateLocStsAndBarcodeByDevNo(String devNo, String locSts, String barcode, Short containerType){
 
         AgvBasDevp agvBasDevp = this.selectById(devNo);
         agvBasDevp.setLocSts(locSts);
         agvBasDevp.setBarcode(barcode);
+        agvBasDevp.setLocType2(containerType);
         this.updateById(agvBasDevp);
     }
 
@@ -263,6 +299,11 @@
         return this.baseMapper.selectCacheShelvesStationCodeByFloor(floor);
     }
 
+    @Override
+    public List<String> selectCacheShelvesStationCodeByLocType(short locType) {
+        return this.baseMapper.selectCacheShelvesStationCodeByLocType(locType);
+    }
+
     public List<Map<String,Object>> selectDevNoAndNumBystationCode(String stationCode){
         return this.baseMapper.selectDevNoAndNumBystationCode(stationCode);
     }

--
Gitblit v1.9.1