From ea46f28356e2acb3bc7cc69b9af3c52fab38c0b0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 18 一月 2024 16:56:47 +0800
Subject: [PATCH] 终止任务功能测试

---
 CanadaMes-ui/src/views/home/index.vue                                                                  |   54 ++--
 springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java                          |  116 +++++++++++
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java                            |    4 
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java                           |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java                           |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java                            |  324 ++++++++++++++++---------------
 springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java                            |    4 
 springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java                    |    6 
 CanadaMes-ui/src/lang/locales/zh-CN.json                                                               |    2 
 springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java                   |   18 +
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java                       |   10 
 CanadaMes-ui/src/api/home.js                                                                           |    4 
 springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java |    8 
 CanadaMes-ui/src/lang/locales/en-US.json                                                               |    3 
 14 files changed, 342 insertions(+), 215 deletions(-)

diff --git a/CanadaMes-ui/src/api/home.js b/CanadaMes-ui/src/api/home.js
index 905bef3..ed2fb1a 100644
--- a/CanadaMes-ui/src/api/home.js
+++ b/CanadaMes-ui/src/api/home.js
@@ -286,9 +286,9 @@
     })
 }
 
-export function SwitchScanMethod(scansmethod) {s
+export function SwitchScanMethod(scansmethod) {
     return request({
-        url: '/home/SwitchScanMethod?Scanmethod='+scanmethod,
+        url: '/home/SwitchScanMethod?scansmethod='+scansmethod,
         method: 'post',
         data:""
     })
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 2a568e0..b100ef2 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -1,6 +1,5 @@
 {
-  
-  "ip": "localhost",
+  "ip":"localhost",
   "systemTitle": "Login System",
   "usernamePlaceholder": "Please enter username",
   "passwordPlaceholder": "Please enter password",
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 5273df5..5bda464 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -1,5 +1,5 @@
 {
-  "ip": "localhost",
+  "ip":"localhost",
   "systemTitle": "鐧诲綍绯荤粺",
   "usernamePlaceholder": "璇疯緭鍏ョ敤鎴峰悕",
   "passwordPlaceholder": "璇疯緭鍏ュ瘑鐮�",
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index b1e9558..cf37f5b 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -252,7 +252,7 @@
             <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
                 <!-- <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid1"
                     :class="ManuallyInfeedGlass == true ? 'hide' : ''"></el-input> -->
-                <el-button type="primary" @click="SelectGlassByGlassIDs(2)" :disabled="ManuallyInfeedGlass"
+                <el-button type="primary" @click="SelectGlassByGlassIDs()" :disabled="ManuallyInfeedGlass"
                     :class="ManuallyInfeedGlass == true ? 'hide' : ''">
                     {{ $t('Manually Infeed Glass') }}</el-button>
                 <el-button type="primary" @click="showform2()" :disabled="OrderInfo"
@@ -389,10 +389,10 @@
                     A01.1:{{ ShowGlassIdList(4) }}</div>
 
                 <div class="glass A01" style="top: 290px;left: 289px;position: absolute;"
-                    @click="ClearGlassId('DB101.10.1,5')">A01.2:{{ ShowGlassIdList(5) }}</div>
+                    @click="ClearGlassId('DB101.10.1,5',5)">A01.2:{{ ShowGlassIdList(5) }}</div>
 
                 <div class="glass A02" style="top: 310px;left: 289px;position: absolute;"
-                    @click="ClearGlassId('DB101.10.2,6')">A02:{{ ShowGlassIdList(6) }}</div>
+                    @click="ClearGlassId('DB101.10.2,6',6)">A02:{{ ShowGlassIdList(6) }}</div>
 
                 <div class="glass D03" style="top: 137px;left: 42px;position: absolute;"
                     @click="ClearGlassId('DB101.9.4', 7)">
@@ -583,14 +583,14 @@
                         }}</el-button>
                     </el-form-item>
                     <el-form-item>
-                        <el-input style="width:70%;" maxlength="14" :placeholder="$t('Enter the glass barcode')"
+                        <el-input style="width:70%;" maxlength="13" :placeholder="$t('Enter the glass barcode')"
                             v-model="glassid1"></el-input>
-                        <el-button type="primary" :disabled="Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
+                        <el-button type="primary" :disabled="!Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
                         }}</el-button>
                     </el-form-item>
                     <el-form-item>
                         {{ $t('Barcode') }}:
-                        <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="glassid1"></el-input>
+                        <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="CurrrentGlassId"></el-input>
                     </el-form-item>
                 </div>
                 <div style="display: flex;justify-content: space-around;">
@@ -701,11 +701,11 @@
                         {{ $t('Confirm') }}</el-button>
                 </div>
             </el-form>
-            <template #footer>
+            <!-- <template #footer>
                 <span class="dialog-footer">
                     <el-button @click="cancel3()">{{ $t('cancel') }}</el-button>
                 </span>
-            </template>
+            </template> -->
         </el-dialog>
 
         <el-dialog :visible.sync="dialogFormVisible6" :title="$t('Outing Queue')" top="5vh">
@@ -980,7 +980,8 @@
             CurrentFrame: [],
             DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
             GlassIdList: [],
-            Scanningmethod: true
+            Scanningmethod: true,
+            CurrrentGlassId:""
         };
     },
     created() {
@@ -1028,14 +1029,15 @@
                     this.alarm = obj.alarmmg[0];
                     //鑾峰彇褰撳墠鎵爜鏂瑰紡
                     if (obj.Scanningmethod != null) {
-                        if (obj.Scanningmethod == 0) {
-                            this.Scanningmethod = true;
-                        }
-                        else {
-                            this.Scanningmethod = false;
-                        }
+                        this.Scanningmethod=obj.Scanningmethod[0];
                     }
 
+                    //鑾峰彇褰撳墠鎵爜鏋幓鐠僫d
+                    if(obj.CurrrentGlassId!=null){
+                        const specialChars = /[^\w\s]/g;
+                        this.CurrrentGlassId=obj.CurrrentGlassId[0].replace(specialChars, "");
+                    }
+                    
                     //鏌ヨ褰撳墠閾濇淇℃伅
                     this.CurrentFrame = obj.CurrentFrame;
                     //鑾峰彇璁惧鐘舵��
@@ -1120,10 +1122,13 @@
                     } else {
                         this.form3 = {};
                     }
+                    
                     if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
                         this.loadglassheight1 = 70;
+                        if(this.form5.glassId!=obj.form3[0].glassId){
+                            this.showform3();
+                        }
                         this.form5 = obj.form3[0];
-                        this.showform3();
                         this.glassid1 = "";
                         if (this.D01RequestState == true) {
                             this.Sizerange(this.form5, 3);
@@ -1328,7 +1333,7 @@
             }
         },
         //鑾峰彇鎵爜浣嶅拰涓婄墖浣嶆暟鎹�
-        SelectGlassByGlassIDs(parameter) {
+        SelectGlassByGlassIDs() {
             this.showform3();
             // if (parameter == 1) {
             //     SelectGlassByGlassID(this.glassid2).then(res => {
@@ -2039,8 +2044,9 @@
         //娓呴櫎鐜荤拑id
         ClearGlassId(position, num) {
             if (this.ClearGlassID == false) {
-                if (this.DeviceList[position] == 0) {
-                    if (this.GlassIdList[num].length == 14) {
+                console.log(this.DeviceList,num);
+                if (this.DeviceList[num] == 0) {
+                    if (this.GlassIdList[num].length < 14) {
                         this.$confirm(this.$t('Are you sure to clear this barcode ?'), this.$t('confirm'), {
                             confirmButtonText: this.$t('Yes'),
                             cancelButtonText: this.$t('No'),
@@ -2099,14 +2105,8 @@
         },
         //鍒囨崲浜岀淮鐮佽幏鍙栨柟寮�
         SwitchScanMethod(){
-            var Scanmethod;
-            if(this.Scanningmethod == true){
-                this.Scanmethod = 1;
-            }else{
-                this.Scanmethod = 0;
-            }
-            SwitchScanMethod(Scanmethod).then(res => {
-                if (res.data.message == 200) {
+            SwitchScanMethod(!this.Scanningmethod).then(res => {
+                if(res.data.message == 200) {
                     this.$message.success(this.$t('Operation successful'));
                 }
             });
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
index b1c3859..31a404a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
@@ -26,10 +26,10 @@
         this.storageCageService = storageCageService;
         this.plcParameterObject = new PlcParameterObject();
         this.plcBitObject = new PlcBitObject();
-        String jsonFilePath = "JsonFile/PlcParameter.json";
-        InitUtil.initword(jsonFilePath); // 鍒濆鍖� PlcParameterObject
-        String jsonFilePath2 = "JsonFile/PlcSign.json";
-        InitUtil.initbit(jsonFilePath2); // 鍒濆鍖� PlcSign
+        // String jsonFilePath = "JsonFile/PlcParameter.json";
+        // InitUtil.initword(jsonFilePath); // 鍒濆鍖� PlcParameterObject
+        // String jsonFilePath2 = "JsonFile/PlcSign.json";
+        // InitUtil.initbit(jsonFilePath2); // 鍒濆鍖� PlcSign
 
 
     }
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 54de033..fda114a 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
@@ -29,7 +29,7 @@
         // \\ TODO Auto-generated catch block
         e.printStackTrace();
       }
-      if (S7control.getinstance().CheckConnected() == false) {
+      // if (S7control.getinstance().CheckConnected() == false) {
         spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
         spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
         jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
@@ -165,7 +165,7 @@
         // 鏌ヨ鏁版嵁搴�
         // 鎺ㄩ�佸埌鍓嶇
 
-      }
+      // }
     }
   }
 
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
new file mode 100644
index 0000000..9e9128f
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
@@ -0,0 +1,116 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.example.springboot.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.example.springboot.entity.Out_slice;
+import com.example.springboot.entity.Queue;
+import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.alarmmg;
+import com.example.springboot.entity.north_glass_buffer1;
+import com.example.springboot.mapper.HomeMapper;
+import com.example.springboot.mapper.SpianMapper;
+
+public class PlcLayout extends Thread {
+
+    @Autowired
+    private HomeMapper homeMapper;
+    @Autowired
+    // 鍑虹墖闃熷垪鏄惁鍏佽鍑虹墖
+    public static Boolean isAllowQueue = true;
+    public static Boolean isAllowReordering = true;
+    // 鍑虹墖闃熷垪璀﹀憡
+    public static Boolean isQueueWarning = false;
+    // 閾濇id
+    public static String FrameNo = "";
+    // 鏄惁闇�瑕佹墜鍔ㄧ‘璁ょ幓鐠�
+    public static Boolean isConfirm = false;
+    // 寰呯‘璁ょ殑鍑虹墖闃熷垪
+    public static List<north_glass_buffer1> AluminumFrame;
+
+    // private Configuration config;
+
+    private StorageCageService storageCageService;
+
+    // public Plchome() throws IOException {
+    // config = new Configuration("config.properties");
+    // }
+
+    // public static Map b=new HashMap<>();
+    // b.put()
+    @Override
+    public void run() {
+        while (this != null) {
+            try {
+                Thread.sleep(1000);
+
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            JSONObject jsonObject = new JSONObject();
+
+            // 娉ㄥ叆mapper
+
+            homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
+
+
+            if (S7control.getinstance().CheckConnected() == true) {
+                
+            
+               
+                // 鏌ヨ鎶ヨ淇℃伅
+            List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
+            jsonObject.append("alarmmg", alarmmg);
+
+                // 澶嶄綅鍊掕鏃�
+                // 鍦板潃104.9.6
+                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
+                for (Boolean countdowns : countdown) {
+                    jsonObject.append("countdown", countdowns);
+                }
+                // jsonObject.append("countdown", true);
+                // 澶嶄綅瀹屾垚淇″彿ss
+                List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
+                for (Boolean reset : resetss) {
+                    jsonObject.append("reset", reset);
+                }
+
+                // 鏄惁鎬ュ仠
+                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
+                for (Boolean emergencystop : emergencystops) {
+                    jsonObject.append("emergencystop", emergencystop);
+                }
+
+            }
+
+            // jsonObject.append("params", new short[] { 30, 40, });
+            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Layout");
+            if (sendwServer != null) {
+                for (WebSocketServer webserver : sendwServer) {
+                    webserver.sendMessage(jsonObject.toString());
+
+                    if (webserver != null) {
+
+                        List<String> messages = webserver.getMessages();
+
+                        if (!messages.isEmpty()) {
+                            // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+                            webserver.clearMessages();
+                        }
+
+                    }
+
+                }
+            }
+        }
+    }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
index 2d0c98d..4de113f 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -28,7 +28,7 @@
     FileInputStream fileInputStream;
     try {
       // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
-      fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
+      fileInputStream = new FileInputStream("D:/code/canadames/Alarm.json");
       // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
       InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
       // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
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 019d969..46a5d6b 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
@@ -121,171 +121,181 @@
 
             // List<Short> listd17 = S7control.getinstance().ReadWord("DB17.0",10);
             // String id=spianService.queGlassid("DB17.10", 14).toString();
-            // 
+            //
             // // 閾濇绾夸氦浜�
             // try {
-            //     if (CurrentFrame != null) {
-            //         spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
-            //     }
-            //     List<Short> framerequests = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
-            //     for (Short framerequest : framerequests) {
-            //         if (framerequest == 1) {
-            //             // 閾濇id
-            //             String franmeno = spianService.queGlassid("DB17.10", 14).toString();
-            //             String position;
-            //             try {
-            //                 position = dbserve.SelectPositionByFrameBarcode(franmeno);
-            //             } catch (SQLException e) {
-            //                 // TODO Auto-generated catch block
-            //                 position = "0";
-            //                 e.printStackTrace();
-            //             }
-            //             Short send;
-            //             if (position == "0") {
-            //                 send = 0;
-            //             } else {
-            //                 send = 1;
-            //             }
-            //             S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short) send);
-            //         }
-            //     }
+            // if (CurrentFrame != null) {
+            // spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
+            // }
+            // List<Short> framerequests = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
+            // for (Short framerequest : framerequests) {
+            // if (framerequest == 1) {
+            // // 閾濇id
+            // String franmeno = spianService.queGlassid("DB17.10", 14).toString();
+            // String position;
+            // try {
+            // position = dbserve.SelectPositionByFrameBarcode(franmeno);
+            // } catch (SQLException e) {
+            // // TODO Auto-generated catch block
+            // position = "0";
+            // e.printStackTrace();
+            // }
+            // Short send;
+            // if (position == "0") {
+            // send = 0;
+            // } else {
+            // send = 1;
+            // }
+            // S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short) send);
+            // }
+            // }
             // } catch (Exception e) {
-            //     // TODO: handle exception
+            // // TODO: handle exception
             // }
 
-            if (S7control.getinstance().CheckConnected() == true) {
-                // 鑾峰彇褰撳墠鎵爜鏂瑰紡
-                List<Short> Scanningmethod = S7control.getinstance().ReadWord("DB103.255", 1);
-                jsonObject.append("Scanningmethod", Scanningmethod);
-                // 鑾峰彇D01-D06,A01,A02,B01,B02鐘舵��
-                List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
-                jsonObject.append("DeviceList", DeviceList);
-                // 鑾峰彇D01-D06,A01,A02,B01,B02鐜荤拑id
-                List<String> GlassIdList = new ArrayList<String>();
-                GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
+            // if (S7control.getinstance().CheckConnected() == true) {
+            // 鑾峰彇褰撳墠鎵爜鏂瑰紡
 
-                GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.212", 14).toString());
-
-                GlassIdList.add(spianService.queGlassid("DB103.128", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.142", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.156", 14).toString());
-
-                GlassIdList.add(spianService.queGlassid("DB103.72", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.86", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.100", 14).toString());
-                GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
-                jsonObject.append("GlassIdList", GlassIdList);
-
-                // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
-                List<String> addressList = new ArrayList<String>();
-                addressList.add("DB106.12");
-                addressList.add("DB106.0");
-                List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
-                if (paramlist != null) {
-                    jsonObject.append("params", paramlist);
+            List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
+            if(Scanningmethods!=null){
+                for (Boolean Scanningmethod : Scanningmethods) {
+                    jsonObject.append("Scanningmethod", Scanningmethod);
                 }
-                // 鑾峰彇杩涚墖杞︾姸鎬�
-                List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
-                        1);// 鑾峰彇杩涚墖杞︾姸鎬�
-                if (datas1ListState != null) {
-                    boolean exist1 = datas1ListState.contains((short) 0);
-                    jsonObject.append("zhuangtai", exist1);
-                }
-
-                // 鑾峰彇杩涚墖鐜荤拑淇℃伅
-                List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
-                if (inglassInfo != null) {
-                    if (inglassInfo.size() > 0) {
-                        jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
-                    }
-
-                }
-                // // 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
-                // String frameno="X21763329601FB";
-                String frameno = spianService.queGlassid("DB103.270", 14).toString();
-                if (!frameno.equals(Plchome.FrameNo)) {
-                    Plchome.FrameNo = frameno;
-                    try {
-                        Short num = 0;
-                        List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service
-                                .SelectAluminumFrameInfoById(Plchome.FrameNo);
-                        for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
-                            if (north_glass_buffer1.getstorageCage() == null) {
-                                break;
-                            }
-                            num++;
-                        }
-                        if (num == north_glass_buffer1s.size()) {
-                            north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
-                        } else {
-                            Plchome.AluminumFrame = north_glass_buffer1s;
-                        }
-                    } catch (SQLException e) {
-                        // TODO Auto-generated catch block
-                        e.printStackTrace();
-                    }
-                }
-                if (AluminumFrame != null) {
-                    jsonObject.append("AluminumFrame", AluminumFrame);
-                }
-
-                // 鑾峰彇杩涚墖璇锋眰鐘舵��
-                List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
-                boolean D01RequestState = D01Request.contains((short) 1);
-                // boolean D01RequestState =true;
-                jsonObject.append("D01RequestState", D01RequestState);
-
-                // 澶嶄綅鍊掕鏃�
-                // 鍦板潃104.9.6
-                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
-                for (Boolean countdowns : countdown) {
-                    jsonObject.append("countdown", countdowns);
-                }
-                // jsonObject.append("countdown", true);
-                // 澶嶄綅瀹屾垚淇″彿ss
-                List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
-                for (Boolean reset : resetss) {
-                    jsonObject.append("reset", reset);
-                }
-
-                // 鏄惁鎬ュ仠
-                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
-                for (Boolean emergencystop : emergencystops) {
-                    jsonObject.append("emergencystop", emergencystop);
-                }
-
-                // // 缁堟缁х画鎸夐挳
-                // List<String> niuanaddressList3 =
-                // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
-                // List<Boolean> anniuread =
-                // S7control.getinstance().readBits(niuanaddressList3);
-                // // Boolean[] value4 = { false, false};
-                // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
-                // Boolean[] value5 = { true };
-                // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
-                // short[] anniuparams = new short[anniuread.size()];
-                // for (int i = 0; i < anniuread.size(); i++) {
-                // boolean value = anniuread.get(i);
-                // anniuparams[i] = value ? (short) 1 : (short) 0;
-                // }
-
-                // short[] resets2 = new short[resets.size()];
-                // for (int i = 0; i < resets.size(); i++) {
-                // boolean value = resets.get(i);
-                // resets2[i] = value ? (short) 1 : (short) 0;
-                // }
-
-                // for (short number : resets2) {
-
-                // if (number == 1) {
-                // jsonObject.append("Abort", anniuparams);
-
-                // }
-
-                // }
             }
+            
+
+            String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
+            jsonObject.append("CurrrentGlassId", CurrrentGlassId);
+
+            // 鑾峰彇D01-D06,A01,A02,B01,B02鐘舵��
+            List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
+            jsonObject.append("DeviceList", DeviceList);
+            // 鑾峰彇D01-D06,A01,A02,B01,B02鐜荤拑id
+            List<String> GlassIdList = new ArrayList<String>();
+            GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
+
+            GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.212", 14).toString());
+
+            GlassIdList.add(spianService.queGlassid("DB103.128", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.142", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.156", 14).toString());
+
+            GlassIdList.add(spianService.queGlassid("DB103.72", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.86", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.100", 14).toString());
+            GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
+            jsonObject.append("GlassIdList", GlassIdList);
+
+            // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
+            List<String> addressList = new ArrayList<String>();
+            addressList.add("DB106.12");
+            addressList.add("DB106.0");
+            List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
+            if (paramlist != null) {
+                jsonObject.append("params", paramlist);
+            }
+            // 鑾峰彇杩涚墖杞︾姸鎬�
+            List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
+                    1);// 鑾峰彇杩涚墖杞︾姸鎬�
+            if (datas1ListState != null) {
+                boolean exist1 = datas1ListState.contains((short) 0);
+                jsonObject.append("zhuangtai", exist1);
+            }
+
+            // 鑾峰彇杩涚墖鐜荤拑淇℃伅
+            List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
+            if (inglassInfo != null) {
+                if (inglassInfo.size() > 0) {
+                    jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
+                }
+
+            }
+            // // 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
+            // String frameno="X21763329601FB";
+            String frameno = spianService.queGlassid("DB103.270", 14).toString();
+            if (!frameno.equals(Plchome.FrameNo)) {
+                Plchome.FrameNo = frameno;
+                try {
+                    Short num = 0;
+                    List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service
+                            .SelectAluminumFrameInfoById(Plchome.FrameNo);
+                    for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
+                        if (north_glass_buffer1.getstorageCage() == null) {
+                            break;
+                        }
+                        num++;
+                    }
+                    if (num == north_glass_buffer1s.size()) {
+                        north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
+                    } else {
+                        Plchome.AluminumFrame = north_glass_buffer1s;
+                    }
+                } catch (SQLException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+            if (AluminumFrame != null) {
+                jsonObject.append("AluminumFrame", AluminumFrame);
+            }
+
+            // 鑾峰彇杩涚墖璇锋眰鐘舵��
+            List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
+            boolean D01RequestState = D01Request.contains((short) 1);
+            // boolean D01RequestState =true;
+            jsonObject.append("D01RequestState", D01RequestState);
+
+            // 澶嶄綅鍊掕鏃�
+            // 鍦板潃104.9.6
+            List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
+            for (Boolean countdowns : countdown) {
+                jsonObject.append("countdown", countdowns);
+            }
+            // jsonObject.append("countdown", true);
+            // 澶嶄綅瀹屾垚淇″彿ss
+            List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
+            for (Boolean reset : resetss) {
+                jsonObject.append("reset", reset);
+            }
+
+            // 鏄惁鎬ュ仠
+            List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
+            for (Boolean emergencystop : emergencystops) {
+                jsonObject.append("emergencystop", emergencystop);
+            }
+
+            // // 缁堟缁х画鎸夐挳
+            // List<String> niuanaddressList3 =
+            // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
+            // List<Boolean> anniuread =
+            // S7control.getinstance().readBits(niuanaddressList3);
+            // // Boolean[] value4 = { false, false};
+            // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
+            // Boolean[] value5 = { true };
+            // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
+            // short[] anniuparams = new short[anniuread.size()];
+            // for (int i = 0; i < anniuread.size(); i++) {
+            // boolean value = anniuread.get(i);
+            // anniuparams[i] = value ? (short) 1 : (short) 0;
+            // }
+
+            // short[] resets2 = new short[resets.size()];
+            // for (int i = 0; i < resets.size(); i++) {
+            // boolean value = resets.get(i);
+            // resets2[i] = value ? (short) 1 : (short) 0;
+            // }
+
+            // for (short number : resets2) {
+
+            // if (number == 1) {
+            // jsonObject.append("Abort", anniuparams);
+
+            // }
+
+            // }
+            // }
 
             storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
             dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index d020781..2ac07c7 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -17,10 +17,10 @@
         //
         System.out.println("鍚姩瀹屾垚");
 
-      //  new PlcHold().start();
+       new PlcHold().start();
 
         new Plchome().start();
-		new PlcLayout().start();
+		    new PlcLayout().start();
         new Plcalarm().start();
 
         new Plcsign().start();
@@ -36,10 +36,10 @@
         new PlcManualonePosition2().start();
         new PlcServoManualone().start();
         new PLCManualJog().start();
-        //new Plclog().start();
+        new Plclog().start();
 
         new PlcInteractionState().start();
-        new PlcParameter1Review().start();
-       // new PLCAutomaticParameterSettingReview().start();
+        // new PlcParameter1Review().start();
+      //  new PLCAutomaticParameterSettingReview().start();
     }
 }
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
index 89bddaa..f2f32ee 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -402,7 +402,7 @@
   @PostMapping("/WriteGlassID")
   public Result WriteGlassID(String glassid) {
     // 鎵爜浣嶅啓鍏ョ幓鐠僫d
-    spianService.outmesid(glassid, "DB103.256");
+    spianService.outmesid(glassid, "DB103.286");
     Map<String, Object> map = new HashMap<>();
     map.put("message", "200");
     return Result.success(map);
@@ -454,8 +454,8 @@
 
   // 鍒囨崲PLC鑾峰彇浜岀淮鐮佹柟寮�
   @PostMapping("/SwitchScanMethod")
-  public Result SwitchScanMethod(Short scansmethod) {
-    S7control.getinstance().WriteWord("DB103.255", scansmethod);
+  public Result SwitchScanMethod(Boolean scansmethod) {
+    S7control.getinstance().WriteBit("DB101.11.4", scansmethod);
     Map<String, Object> map = new HashMap<>();
     map.put("message", "200");
     return Result.success(map);
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 c2f2e29..f5a7bee 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
@@ -58,7 +58,7 @@
   short SelectInTask();
 
   // 鎵嬪姩瀹屾垚浠诲姟
-  @Update("update storage_task set task_state=2 where task_type=#{task_type} and glass_id=#{glassid}")
+  @Update("update storage_task set task_state=1 where task_type=#{task_type} and glass_id=#{glassid}")
   void UpdateTask(@Param("task_type") Integer task_type,String glassid);
 
   // 鎵嬪姩瀹屾垚杩涚墖浠诲姟淇敼绗煎瓙鏁版嵁
@@ -204,7 +204,7 @@
   void UpdateOutSliceGlass(String glassid);
 
   //鏌ヨ鏈畬鎴愮殑浠诲姟
-  @Select("select * from storage_task where task_state!=2 and task_type=#{task_type}")
+  @Select("select * from storage_task where task_state=0 and task_type=#{task_type}")
   List<StorageTask> SelectTaskByState(int task_type);
 
   //淇敼鍑虹墖闃熷垪閾濇鐘舵��
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 58fa75c..612e27a 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
@@ -78,7 +78,7 @@
     @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};")
     void UpdataAddCage(String orderid, String glassid, double width, int cage, int cell, int id, int state);
 
-    @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.FrameBarcode} where id=#{id};")
+    @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.frameBarcode} where id=#{id};")
     void UpdataAddCage2(String orderid, String glassid, north_glass_buffer1 glass, int cage, int cell, int id,int state);
 
     // 淇敼绗煎瓙淇℃伅(澶氱墖杩涚墖)
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
index dc630bf..4ef8022 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -45,39 +45,41 @@
                 } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
                     ClearGlassId("DB101.10.3");
                     outSliceServive.StopTask(storageTask.getGlassId(), types);
-                }\
+                }
             }
             // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
         } else {// 缁堟鍑虹墖浠诲姟
             List<StorageTask> cageLists = homeMapper.SelectTaskByState(types);
             List<StorageTask> cageList2 = homeMapper.SelectTaskByState(2);
-            if (cageList2!=null) {
+            if (cageList2.size()>0) {
                 cageLists.add(cageList2.get(0));
             }
             for (StorageTask cageList : cageLists) {
                 if (cageList.getTaskType().equals("1")) {
-                    if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){
+
+                    System.out.println(DeviceList.get(5));
+                    if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.1");
                     }
-                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
+                    if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.2");
                     }
-                    else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){
+                    if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.3");
                     }
                 }else if (cageList.getTaskType().equals("2")) {
-                    if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){
+                    if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), 2);
                         ClearGlassId("DB101.10.1");
                     }
-                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
+                    if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), 2);
                         ClearGlassId("DB101.10.2");
                     }
-                    else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){
+                    if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){
                         outSliceServive.StopTask(cageList.getGlassId(), 2);
                         ClearGlassId("DB101.10.3");
                     }

--
Gitblit v1.8.0