From 1af2e979880431228c984ee295b93604caa91b4a Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期日, 17 九月 2023 15:08:58 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/home/index.vue                                          |   28 +++++++++----
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java    |   21 +++++-----
 CanadaMes-ui/src/views/Electrical/State.vue                                    |    1 
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java   |    6 +-
 springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java |   38 ++++++++++--------
 springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java    |   10 ++--
 6 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index ffc2d89..bb0a133 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -167,6 +167,7 @@
   margin-bottom: 15px;
 }
 
+
 .el-input {
   border: none;
 
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 91b92dd..b87e524 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -60,6 +60,8 @@
 
 .gezi {
     height: 35px;
+    
+    position: absolute;
     width: 3.07px;
     /* width: 4.22px; */
 }
@@ -75,19 +77,20 @@
 
 
 .blocks {
+
     
-    max-width: 94vw;
     background-image: url('../../img/xmjc.png');
     margin: 0 auto;
     background-repeat: no-repeat;
     background-attachment: local;
     width: 1660px;
     min-height: 55vh;
+    max-width: 94vw;
     background-size: 1200px 510px;
     /* max-width: 100vw;
     background-size: 1660px 560px; */
-    
-    
+
+
 }
 
 .blocks-img {
@@ -239,18 +242,21 @@
             <div class="blocks" style="position: relative;">
                 <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
-                        @click="showcageinfo(item['cage'])"></div>
+                        :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
-                        @click="showcageinfo(item['cage'])"></div>
+                        :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
                 </div>
-                <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:237px;">
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
-                        @click="showcageinfo(item['cage'])"></div>
+                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
+                        @click="showcageinfo(item['cage'])">
+                    </div>
                 </div>
-                <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:640px;">
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
+                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -259,18 +265,22 @@
                 <div class="blocks-img3"></div>
                 <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
+                        :style="{ height: 35 * item['glassWidth'] + 'px' }"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:885px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
+                        :style="{ height: 35 * item['glassWidth'] + 'px' }"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:328px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
+                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:885px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
+                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
@@ -625,7 +635,7 @@
                     OutByGlassID(glassid).then(res => {
                         if (res.data.message3 == 200) {
                             this.$message.success(this.$t('Operation successful'));
-                        } 
+                        }
                         else if (res.data.message2 == 300) {
                             this.$message.success(this.$t('There is no such grid'));
                         }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index 5573950..c410d62 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -45,11 +45,11 @@
       //   // TODO Auto-generated catch block
       //   e.printStackTrace();
       // }
-     
+     spianService.selectAll((short)257);
       //鍒ゆ柇杩涚墖璇锋眰
       List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);
       List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);
-
+   
       
       if (datas1List != null && datas1ListState != null) {
         // 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
@@ -62,7 +62,7 @@
           // 褰撹繘鐗囪溅绌洪棽鏃�
           if (exist1 == true) {
             // 鑾峰彇杩涚墖id
-            List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 13);
+            List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 1);
             if (datas1ListID != null) {
               // 鑾峰彇鐜荤拑id
               for (Short list1 : datas1ListID) {
@@ -76,7 +76,7 @@
           // System.out.println(exist);
         }
       }
-
+      
       //spianService.selectAll((short) 111);
       
       List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
@@ -84,14 +84,15 @@
        if (outlist != null) {
         // 鍒ゆ柇鎸夎鍗曞嚭鐗�
          outstate = outlist.contains((short) 0);
-        }
-      Glass glass=spianMapper.SelectDBOut();//鍒ゆ柇鏄惁鏈夎皟鎷ㄥ悗鐨勫嚭鐗囦换鍔℃湭瀹屾垚
+          Glass glass=spianMapper.SelectDBOut();//鍒ゆ柇鏄惁鏈夎皟鎷ㄥ悗鐨勫嚭鐗囦换鍔℃湭瀹屾垚
 
-     if(outstate== true ){
-       if(glass.getId()==2){
-        spianService.selectout2(glass.getGlassId().toString());
+         if(outstate== true ){
+          if(glass.getId()==2){
+           spianService.selectout2(glass.getGlassId().toString());
+            }
+        }
       }
-     }
+     
       
  
      
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 3e22d2c..8c8b53b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -14,19 +14,19 @@
   List<StorageCage> selectAll();
 
   // 鏌ヨ1-5绗煎唴灞傛牸瀛愮姸鎬�
-  @Select("SELECT cage,state from storage_cage where cage<=5 and tier=1")
+  @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage<=5 and tier=2")
   List<StorageCage> selectRack1();
 
   // 鏌ヨ6-10绗煎唴灞傛牸瀛愮姸鎬�
-  @Select("SELECT cage,state from storage_cage where cage>5 and tier=1")
+  @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage>5 and tier=2")
   List<StorageCage> selectRack2();
 
   // 鏌ヨ1-5绗煎灞傛牸瀛愮姸鎬�
-  @Select("SELECT cage,state from storage_cage where cage<=5 and tier=2")
+  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width  from storage_cage where cage<=5  group by cell")
   List<StorageCage> selectRack3();
 
   // 鏌ヨ6-10绗煎灞傛牸瀛愮姸鎬�
-  @Select("SELECT cage,state from storage_cage where cage>5 and tier=2")
+  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width  from storage_cage where cage>5  group by cell")
   List<StorageCage> selectRack4();
 
   // 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
@@ -66,7 +66,7 @@
   List<alarmmg> SelectAlarmmgInfo();
 
   //鑾峰彇鐞嗙墖绗煎唴鐜荤拑淇℃伅
-  @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where cage=#{cage} ")
+  @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where cage=#{cage} and state!=0 ")
   List<StorageCage> SelectCageInfo(short cage);
 
   @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where glass_id=#{glassid}")
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
index 03a0c76..e86cd52 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -18,12 +18,12 @@
      
      //@Select("(select*from storage_cage as a  where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join  (select cage,if(shu2=1,shu3,shu5) as gezi from ( select  cage, count(case when state1=1 and state2=0 then cell else null end)as shu1,  count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from  (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where  cage%2!=0  GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0)  ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;")
     //鑾峰彇璁㈠崟鍙锋帓搴忕殑绌鸿鍗曠瀛�
-     @Select("select cage,COUNT(if(order_id=#{orderids},order_id,null))as orderid from storage_cage where (order_id=#{orderids} or ''='') GROUP BY cage ORDER BY orderid desc; ")
+     @Select("select cage,COUNT(if(order_id=#{orderids},order_id,null))as orderid,cell,min(state)as state1 from storage_cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY orderid desc; ")
      List<StorageCage> selectAll(Short orderids);
 
      //鍒ゆ柇璇ョ瀛愭槸鍚︽湁鍚堥�傚搴︾┖鏍�
-     @Select("select cage,cell,tier,id,ROUND(id/2)as prcId from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell asc,tier desc LIMIT 1")
-     StorageCage selectCage1(int  cage1,double width);
+     @Select("select cage,cell,tier,id,ROUND(id/2)as prcId,width from storage_cage where cage=#{cage1} and cell=#{cell} and state=0 and width>=#{width} ORDER BY cell asc,tier desc LIMIT 1")
+     StorageCage selectCage1(int  cage1,int cell,double width);
      //鍒ゆ柇绗煎瓙鍐呯幓鐠冩暟
      @Select("select COUNT(tier)as tier from storage_cage where  cage=#{cage} and cell=#{cell} and state=1;")
      int selectsum(int cage,int cell);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
index e6ec84d..70bb729 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -150,7 +150,8 @@
         int prcid;
         int tiers;
         int prctier;
-        
+        double width;
+        double minwidth=0;
         spianMapper.Updatetask(1, 0);//瀹屾垚浠诲姟
             Glass glasslist = spianMapper.selectGlass(glassid);
         if(glasslist==null){
@@ -177,22 +178,24 @@
             cage1 = storageCage2.getCage();
             // 鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
             int cages = spianMapper.selectCage(cage1);
+            StorageCage cages1 ;
+            //鍒ゆ柇鏄惁鏄浜岀墖闇�瑕佸姞闂撮殧鐗�
+            prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 浼犵粰prc鐨勬牸瀛愬唴鐜荤拑鏁�
+                if(prctier>0){
+                   cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths+400);
+                }else{
+                    cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths);
+                }
             // 鍒ゆ柇閫変腑绗煎瓙鏄惁鏈夊悎閫傚搴︾┖鏍�
-            StorageCage cages1 = spianMapper.selectCage1(cage1, widths);
-            if (cages1 != null) {
+             // 鏈夊悎閫傜┖鏍兼椂杩涚墖
+            if (cages1 != null&&cages>=1) {
                 ids = cages1.getId();// 鏁版嵁搴揑D
                 tiers = cages1.getTier();// 鍐呭鐗�
                 cells = cages1.getCell();// 鏍煎瓙鍙�
                 prcid = cages1.getPrcId();// 浼犵粰prc鐨勭洰鏍囧湴id
-                
-                
-               if (glasslist == null) {
-                    return (300);
-                }
-                spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//鏂板浠诲姟
-                prctier = spianMapper.selectsum(cage1, cells);// 浼犵粰prc鐨勬牸瀛愬唴鐜荤拑鏁�
-                // 鏈夊悎閫傜┖鏍兼椂杩涚墖
-                if (cages > 1 && cages1.getTier() != null) {
+                width=cages1.getWidth();//鏍煎瓙鍓╀綑瀹藉害
+                widths=glasslist.getWidth();
+
                     // 鎵ц杩涚墖
                     datas.add((short) 1000);
                     datas.add((short) prcid);
@@ -201,10 +204,10 @@
                     // 鏁版嵁搴撲慨鏀圭瀛愯〃鏂板涓�鏉$幓鐠�
                     spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1);
                     spianMapper.UpdataAddCage1(widths, cage1, cells);//鍑忓皯鏍煎瓙瀹藉害
-                      
+                    spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//鏂板浠诲姟  
                     S7control.getinstance().WriteWord(adddresslist, datas);
-                    return (200);
-                }
+                   return (200);              
+               
             }
 
         }
@@ -242,17 +245,18 @@
         double glasswidth = cageout.getGlassWidth();
         // 鍒ゆ柇鐜荤拑鍐呭鐗�
         if (tier == 2) {
+            int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
             // 鍒ゆ柇鐜荤拑鍙洿鎺ュ嚭鐗囨椂
             // 淇敼鏁版嵁搴撶瀛愯〃(鍑虹墖)
             datas.add((short) prcid);
             datas.add((short) 1000);
-            datas.add((short) 1);
+            datas.add((short) state);
             datas.add((short) 1);
                
             spianMapper.UpdataOutCage1(glasswidth, cage, cell);//澧炲姞鍘熸牸瀛愬搴�
             spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//娓呴櫎鏍煎瓙鐜荤拑淇℃伅
             spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//鏂板浠诲姟
-            int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
+            //int state = spianMapper.selectGlassState(cage, cell);//鑾峰彇鏍煎瓙鏁伴噺
             if(state==2){
                 spianMapper.UpdateDBCage1(cage, cell);// 灏嗗唴鐗囨暟鎹洿鏂板埌澶栫墖閲�
                 spianMapper.UpdateDBCage2(cage, cell);// 娓呴櫎鍐呯墖鏁版嵁

--
Gitblit v1.8.0