From 09fe50d59e2f1e2261d376eb49ad6c40301f25b4 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期五, 10 五月 2024 16:08:59 +0800
Subject: [PATCH] 修改IP与数据库连接

---
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java |  120 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 64 insertions(+), 56 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 8fa8143..d590b52 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -15,6 +15,7 @@
 import com.example.springboot.entity.Queue;
 import com.example.springboot.entity.StorageCage;
 import com.example.springboot.entity.alarmmg;
+import com.example.springboot.entity.north_frame_buffer1_frames;
 import com.example.springboot.entity.north_glass_buffer1;
 import com.example.springboot.mapper.HomeMapper;
 import com.example.springboot.mapper.SpianMapper;
@@ -40,6 +41,8 @@
     public static Boolean isConfirm = true;
     // 寰呯‘璁ょ殑鍑虹墖闃熷垪
     public static List<north_glass_buffer1> AluminumFrame;
+    // 寰呯‘璁ょ殑閾濇淇℃伅
+    public static north_frame_buffer1_frames AluminumFrameInfo=new north_frame_buffer1_frames();
 
     // private Configuration config;
 
@@ -62,14 +65,7 @@
     // b.put()
     @Override
     public void run() {
-        homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
-                spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
-                spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
-                outSliceServive = WebSocketServer.applicationContext.getBean(OutSliceServive.class);
-                north_Glass_Buffer1Service = WebSocketServer.applicationContext
-                        .getBean(North_Glass_Buffer1Service.class);
-                storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
-                dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
+                
         while (this != null) {
             Short zhi = 0;
             JSONObject jsonObject = new JSONObject();
@@ -78,7 +74,14 @@
             try {
                 Thread.sleep(1000);
                 // 娉ㄥ叆mapper
-                
+                homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
+                spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+                spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+                outSliceServive = WebSocketServer.applicationContext.getBean(OutSliceServive.class);
+                north_Glass_Buffer1Service = WebSocketServer.applicationContext
+                        .getBean(North_Glass_Buffer1Service.class);
+                storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
+                dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
 
                 // boolean dbconnected = false;
                 try {
@@ -173,52 +176,52 @@
                     // E02鐜荤拑id
                     // log.info("frame1"+S7controlLK.getinstance().CheckConnected());
                     String E02id="";
-                    try {
-                        E02id= S7controlLK.getinstance().readStrings("DB17.40");
-                        plc2=true;
-                    } catch (Exception e) {
-                        // TODO: handle exception
-                        plc2=false;
-                        e.printStackTrace();
-                    }
+                    // try {
+                    //     E02id= S7controlLK.getinstance().readStrings("DB17.40");
+                    //     plc2=true;
+                    // } catch (Exception e) {
+                    //     // TODO: handle exception
+                    //     plc2=false;
+                    //     e.printStackTrace();
+                    // }
                     
-                    jsonObject.append("Plc2", plc2);
-                    // log.info("閾濇绾胯鍙�2"+S7controlLK.getinstance().CheckConnected());
+                    // jsonObject.append("Plc2", plc2);
+                    // // log.info("閾濇绾胯鍙�2"+S7controlLK.getinstance().CheckConnected());
                     
-                    // log.info("E02id"+E02id);
-                    outSliceServive.FrameStateUpdate(E02id);
-                    if (CurrentFrame != null) {
-                        S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
-                    }
-                    String J01id = S7controlLK.getinstance().readStrings("DB17.22");
-                    List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
-                    Short framerequest = liststate.get(0);
-                    // log.info("liststate:" + liststate);
-                    if (framerequest == 1) {
-                        // 閾濇id
-                        String position;
-                        try {
-                            position = dbserve.SelectPositionByFrameBarcode(J01id);
-                        } catch (SQLException e) {
-                            // TODO Auto-generated catch block
-                            position = "0";
-                            e.printStackTrace();
-                        }
-                        Short send;
-                        if (position.equals("0")) {
-                            send = 2;
-                        } else {
-                            send = 1;
-                        }
-                        if (J01id != null) {
-                            int barcodeState = spianMapper.SelectOverState(J01id);// 鑾峰彇璇ラ摑妗嗙殑鐘舵��
-                            if (barcodeState == 0) {// 褰撹閾濇鎵�鏈夌殑鐜荤拑閮芥槸瀹屾垚鐘舵�佹椂鍒犻櫎鍦ㄥ嚭鐗囬槦鍒楃殑鏁版嵁
-                                spianMapper.DeleteQueue(J01id);
-                                // log.info("deleteoutslice:" + J01id);
-                            }
-                        }
-                        S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
-                    }
+                    // // log.info("E02id"+E02id);
+                    // outSliceServive.FrameStateUpdate(E02id);
+                    // if (CurrentFrame != null) {
+                    //     S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
+                    // }
+                    // String J01id = S7controlLK.getinstance().readStrings("DB17.22");
+                    // List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
+                    // Short framerequest = liststate.get(0);
+                    // // log.info("liststate:" + liststate);
+                    // if (framerequest == 1) {
+                    //     // 閾濇id
+                    //     String position;
+                    //     try {
+                    //         position = dbserve.SelectPositionByFrameBarcode(J01id);
+                    //     } catch (SQLException e) {
+                    //         // TODO Auto-generated catch block
+                    //         position = "0";
+                    //         e.printStackTrace();
+                    //     }
+                    //     Short send;
+                    //     if (position.equals("1")) {
+                    //         send = 1;
+                    //     } else {
+                    //         send = 2;
+                    //     }
+                    //     if (J01id != null) {
+                    //         int barcodeState = spianMapper.SelectOverState(J01id);// 鑾峰彇璇ラ摑妗嗙殑鐘舵��
+                    //         if (barcodeState == 0) {// 褰撹閾濇鎵�鏈夌殑鐜荤拑閮芥槸瀹屾垚鐘舵�佹椂鍒犻櫎鍦ㄥ嚭鐗囬槦鍒楃殑鏁版嵁
+                    //             spianMapper.DeleteQueue(J01id);
+                    //             // log.info("deleteoutslice:" + J01id);
+                    //         }
+                    //     }
+                    //     S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
+                    // }
 
                     String E01id = S7controlLK.getinstance().readStrings("DB17.0");
                     // log.info("frameno:" + E01id);
@@ -330,15 +333,14 @@
                                 north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                             } else {
                                 Plchome.AluminumFrame = north_glass_buffer1s;
+                                Plchome.AluminumFrameInfo=dbserve.SelectFrameBarcode(Plchome.FrameNo);
                             }
                         } catch (SQLException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                         }
                     }
-                    if (AluminumFrame != null) {
-                        jsonObject.append("AluminumFrame", AluminumFrame);
-                    }
+                    
 
                     // 澶嶄綅鍊掕鏃�
                     // 鍦板潃104.9.6
@@ -391,6 +393,12 @@
                     plc1=false;
                     log.info("Plc1" + S7controlLK.getinstance().CheckConnected());
                 }
+                if (AluminumFrame != null) {
+                    jsonObject.append("AluminumFrame", AluminumFrame);
+                }
+                if (AluminumFrameInfo.getbarcode() != null) {
+                    jsonObject.append("AluminumFrameInfo", AluminumFrameInfo);
+                }
                 jsonObject.append("zhi", zhi);
                 jsonObject.append("Plc1", plc1);
                 // jsonObject.append("params", new short[] { 30, 40, });

--
Gitblit v1.8.0