From d7e08c1a87903f9961c31e57ed6f6243f6c43eee Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 12 十二月 2023 13:02:26 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java    |   53 ++++++--------------------
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java   |   13 ++++++
 springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java |   13 ++++++
 3 files changed, 37 insertions(+), 42 deletions(-)

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 799ff79..8916392 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
@@ -1,4 +1,5 @@
 package com.example.springboot.component;
+
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.example.springboot.service.JdbcConnections;
@@ -15,7 +16,7 @@
   private JdbcConnections jdbcConnections;
   private SpianMapper spianMapper;
   private SpianService spianService;
-  
+
   @Override
   public void run() {
     boolean inglassbegin = false;
@@ -28,7 +29,7 @@
         // \\ TODO Auto-generated catch block
         e.printStackTrace();
       }
-       spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+      spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
       spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
       jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
       // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
@@ -37,9 +38,8 @@
       // // System.out.println(glass.getOrderId());
       // } catch (SQLException e) {
       // // TODO Auto-generated catch block
-      // e.printStackTrace(); 
+      // e.printStackTrace();
       // }
-      //spianService.selectAll("X12345610102GV");
       List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
       List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 鑾峰彇杩涚墖杞︾姸鎬�
       List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
@@ -50,27 +50,17 @@
       StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02鐨勭幓鐠僫d
       // 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
       if (B01backs == true) {
-        // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬�  涓�1
-        spianMapper.UpdateCageOver(B01glassid.toString(), 1);// 鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
-        spianMapper.Updatetask(1, 0);// 鏇存敼杩涚墖浠诲姟鐘舵�佷负1
-        spianMapper.UpdatetaskOut(B01glassid.toString()); // 瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰繘鐗囦换鍔�
-        spianMapper.OverOutSlice(B01glassid.toString(), 2);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
-        spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
+        // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
+        spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
         S7control.getinstance().WriteWord("DB106.60", (short) 0);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
         System.out.println("姹囨姤鏃禕01|" + B01glassid);
-
-        // S7control.getinstance().WriteWord("DB105.48", (short) 1);//姹囨姤B01灏忚溅鏀跺埌
       }
 
       // 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
       if (B02backs == true) {
         // 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
-        spianMapper.UpdateCageOver(B02glassid.toString(), 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
-        spianMapper.UpdatetaskOut(B02glassid.toString()); // 瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰繘鐗囦换鍔�
-        spianMapper.OverOutSlice(B02glassid.toString(), 2);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
-        spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
+        spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
         S7control.getinstance().WriteWord("DB106.62", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
-        // S7control.getinstance().WriteWord("DB105.50", (short) 1);//姹囨姤B02灏忚溅鏀跺埌
         System.out.println("姹囨姤鏃禕02|" + B02glassid);
       }
 
@@ -78,8 +68,7 @@
       StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
       // 鑾峰彇DO2鏁版嵁
       StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14);
-//      System.out.println("D01|" + queueid1);
-//      System.out.println("D02|" + queueid2);
+
 
       int questate = spianMapper.Selectquecount(queueid1.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
       // queueid1.toString().isEmpty()
@@ -124,36 +113,18 @@
       boolean outstate = false;// 鍑虹墖杞︾┖闂插垽鏂�
       boolean outstate1 = false;// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
       if (outlist != null && outlist1 != null) {
-        // 鍒ゆ柇鎸夎鍗曞嚭鐗�
+
         outstate = outlist.contains((short) 0);// 鍑虹墖杞︾┖闂插垽鏂� 褰撳嚭鐗囪溅绌洪棽鏃朵负true
         outstate1 = outlist1.contains((short) 1);// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔� 褰撳嚭鐗囪溅浠诲姟鍚姩鏃朵负true
-
-        north_glass_buffer1 glass = spianMapper.SelectDBOut();// 鍒ゆ柇鏄惁鏈夎皟鎷ㄥ悗鐨勫嚭鐗囦换鍔℃湭瀹屾垚
-
-        if (!outglassbegin & !outstate)// 褰撲换鍔¤繕鏈紑濮嬶紝涓斿嚭鐗囪溅涓嶇┖闂叉椂,浠诲姟鐘舵�佹敼涓哄紑濮�
-        {
-          outglassbegin = true;
-        }
-        if (outglassbegin & outstate)// 褰撲换鍔″紑濮嬩笖鍑虹墖杞︾┖闂叉椂
-        {
-          outglassbegin = false;
-        }
-
-        if (outstate == true & glass.getbarcode() != null&&Plchome.isAllowQueue==true) { // 褰撳嚭鐗囪溅绌洪棽涓旀湁鍑虹墖浠诲姟寰呭畬鎴愭椂
-          // 鍒ゆ柇鏈変袱涓嚭鐗囨垨璋冩嫧浠诲姟鏃跺苟涓斿嚭鐗噄d鍜屾湭瀹屾垚鐨勫嚭鐗囦换鍔d涓嶄竴鏍锋椂鎵ц鍑虹墖
-          if (!writedstrIdOut.toString().equals(glass.getbarcode().toString())) {
-            spianService.selectout2(glass.getbarcode().toString());
-            outstate = false;
-          }
-        }
+   
         // 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
         int outnum = spianMapper.SelectOutSliceshu();
         // 褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
-        if (outnum == 0 && outstate == true&&Plchome.isAllowQueue==true) {
+        if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true) {
           // 鍒ゆ柇閾濇鍑虹墖闃熷垪琛ㄦ槸鍚︽湁寰呭嚭鐗囩殑鐜荤拑
           String outglassid = spianMapper.SelectOutSlice();
           if (outglassid != null) {
-            
+
             spianService.selectout2(outglassid);
             outstate = false;
           }
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 404cb87..be079cd 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
@@ -163,6 +163,17 @@
      //鏇存柊鍑虹墖闃熷垪鐨勪换鍔$姸鎬�
      @Update("update out_slice set state=#{state} where glassid=#{glassid}")
      void OverOutSlice(String glassid,int state);
-  
+     //鑾峰彇鐜荤拑鐨勯摑妗唅d
+     @Select("select barcode from out_slice where glassid=#{glassid};")
+     String SelectBarcode(String glassId);    
+     //鑾峰彇鍑虹墖闃熷垪鐨勯摑妗嗘槸鍚﹀叏閮ㄥ畬鎴�
+     @Select("select MIN(state) from out_slice where barcode=#{barcode};")
+     int SelectOverState(String barcode);
+     //鍒犻櫎鍑虹墖闃熷垪璇ラ摑妗嗙殑id
+     @Delete("delete from out_slice where barcode=#{barcode};")
+     void DeleteQueue(String barcode);
+     //鎶婅杩涚墖鐨勭幓鐠冩洿鏂板埌鍑虹墖闃熷垪
+     @Select("update out_slice set state=0 where glassId=#{glassId} and state=3")
+     void UpdateAddQueue(String glassId);
 }   
     
\ No newline at end of file
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 1c6f951..01b9e20 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
@@ -288,4 +288,17 @@
        boolean listbool = list.contains((short) 1);
         return listbool;
     }
+    //鏍规嵁鐜荤拑id瀹屾垚鍦ㄨ繘琛屼腑鐨勪换鍔�
+    public void overtask(String glassid){
+        spianMapper.UpdateCageOver(glassid, 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
+        spianMapper.UpdatetaskOut(glassid); // 瀹屾垚涓婁竴娆″嚭鐗囨垨鑰呰繘鐗囦换鍔�
+        spianMapper.OverOutSlice(glassid, 2);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
+        spianMapper.UpdataGlassCage(glassid,0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
+        String barcode=spianMapper.SelectBarcode(glassid);//鑾峰彇璇ョ幓鐠冪殑閾濇id
+        spianMapper.UpdateAddQueue(glassid);//鎶婅繘鐗囩殑鐜荤拑鏇存柊鍒板嚭鐗囬槦鍒椾腑
+        int barcodeState=spianMapper.SelectOverState(barcode);//鑾峰彇璇ラ摑妗嗙殑鐘舵��
+        if(barcodeState==2){//褰撹閾濇鎵�鏈夌殑鐜荤拑閮芥槸瀹屾垚鐘舵�佹椂鍒犻櫎鍦ㄥ嚭鐗囬槦鍒楃殑鏁版嵁
+            spianMapper.DeleteQueue(barcode);
+        }
+    }
 }

--
Gitblit v1.8.0