From 65bed7f78be75f0ba279885de647d76bc91d9336 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期五, 19 一月 2024 14:33:13 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/home/index.vue                                                |  106 +++++++--
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java          |    1 
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java         |    4 
 springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java       |   14 
 springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java    |   29 ++
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java          |  164 ++++-----------
 springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java          |   14 +
 CanadaMes-ui/src/layout/index.vue                                                    |    6 
 springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java  |   44 ++-
 CanadaMes-ui/src/lang/locales/zh-CN.json                                             |   13 +
 springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java |  115 +++++++---
 springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java  |    9 
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java     |   30 +-
 CanadaMes-ui/src/api/home.js                                                         |    8 
 CanadaMes-ui/src/lang/locales/en-US.json                                             |   13 +
 15 files changed, 330 insertions(+), 240 deletions(-)

diff --git a/CanadaMes-ui/src/api/home.js b/CanadaMes-ui/src/api/home.js
index 5761c46..905bef3 100644
--- a/CanadaMes-ui/src/api/home.js
+++ b/CanadaMes-ui/src/api/home.js
@@ -285,3 +285,11 @@
         data:""
     })
 }
+
+export function SwitchScanMethod(scansmethod) {s
+    return request({
+        url: '/home/SwitchScanMethod?Scanmethod='+scanmethod,
+        method: 'post',
+        data:""
+    })
+}
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index c19f5e7..2a568e0 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -303,7 +303,7 @@
   "current Information":"current information",
   "Modify Information":"Modify information",
   "Clear Current":"Clear Current",
-  "Confirm Modification":"Confirm modification",
+  "Confirm":"Confirm",
   "The glass ID already exists in the loading queue":"The glass ID already exists in the loading queue",
   "This glass ID already exists in the sorting cage":"This glass ID already exists in the sorting cage",
   "Outing Queue":"Outing Queue",
@@ -349,6 +349,17 @@
   "Outside":"Outside",
   "Inside":"Inside",
   "Cancel":"Cancel",
+  "Are you sure to clear this barcode ?":"Are you sure to clear this barcode ?",
+  "Terminate Feeding":"Terminate Feeding",
+  "Terminate Outing":"Terminate Outing",
+  "SoftEmergencyStop":"SoftEmergencyStop",
+  "Unable to clear glass ID in automatic mode":"Unable to clear glass ID in automatic mode",
+  "Are you sure you want an emergency stop ?":"Are you sure you want an emergency stop ?",
+  "Current State":"Current State",
+  "Automatic":"Automatic",
+  "Hand Movement":"Hand Movement",
+  "Please enter the correct glassID":"Please enter the correct glassID",
+  "Switch":"Switch",
     "ServoManualone": {
       "A01 鎵�鍦ㄦ牸瀛�": "A01 Current Grid",
       "鏁伴噺": "Quantity",
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index b86982f..5273df5 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -290,7 +290,7 @@
   "current Information": "褰撳墠淇℃伅",
   "Modify Information": "淇敼淇℃伅",
   "Clear Current": "娓呴櫎褰撳墠",
-  "Confirm Modification": "纭淇敼",
+  "Confirm": "纭",
   "The glass ID already exists in the loading queue": "涓婄墖闃熷垪宸插瓨鍦ㄦ鐜荤拑id",
   "This glass ID already exists in the sorting cage": "鐞嗙墖绗煎唴宸插瓨鍦ㄦ鐜荤拑id",
   "Outing Queue":"鍑虹墖闃熷垪",
@@ -338,6 +338,17 @@
   "Outside":"澶栦晶",
   "Inside":"鍐呬晶",
   "Cancel":"鍙栨秷",
+  "Are you sure to clear this barcode ?":"纭畾娓呴櫎姝ょ幓鐠僫d鍚� ?",
+  "Terminate Feeding":"缁堟杩涚墖",
+  "Terminate Outing":"缁堟鍑虹墖",
+  "SoftEmergencyStop":"杞�ュ仠",
+  "Unable to clear glass ID in automatic mode":"鏃犳硶鍦ㄨ嚜鍔ㄦā寮忎笅娓呴櫎鐜荤拑ID",
+  "Are you sure you want an emergency stop ?":"纭畾瑕佹�ュ仠鍚�?",
+  "Current State":"褰撳墠鐘舵��",
+  "Automatic":"鑷姩",
+  "Hand Movement":"鎵嬪姩",
+  "Please enter the correct glassID":"璇疯緭鍏ユ纭殑鐜荤拑ID",
+  "Switch":"鍒囨崲",
   "langparameter": {
     "conveyor Velocity(Auto FAST)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄥ揩閫�",
     "conveyor Velocity(Auto SLOW)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄦ參閫�",
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 584fa66..13cc3f5 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -231,7 +231,7 @@
 
     },
     init() {
-      let viewname = "Home";
+      let viewname = "Layout";
       if (typeof (WebSocket) == "undefined") {
         console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
       } else {
@@ -289,8 +289,6 @@
 
 
 
-
-
           if (obj.Abort) {
 
             if (obj.Abort[0].length > 0) {
@@ -340,7 +338,7 @@
         },
         1000
       );
-      if (this.reset == false&&this.EmergencyStop != true) {
+      if (this.reset == false && this.EmergencyStop != true) {
         this.dialogFormCountDown = true;
       }
     },
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index c2e1186..b1e9558 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -263,12 +263,11 @@
                     {{ $t('Outing Queue') }}</el-button>
                 <el-button type="primary" @click="TaskStop(0)" :disabled="OutingQueue"
                     :class="StopTask == true ? 'hide' : ''">
-                    {{ $t('Stop Feeding') }}</el-button>
-                <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask"
-                    :class="StopTask == true ? 'hide' : ''">
-                    {{ $t('Stop Outing') }}</el-button>
-                <el-button type="primary" @click="SoftEmergencyStop()" :disabled="SoftEmergencyStop"
-                    :class="SoftEmergencyStop == true ? 'hide' : ''">
+                    {{ $t('Terminate Feeding') }}</el-button>
+                <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask" :class="StopTask == true ? 'hide' : ''">
+                    {{ $t('Terminate Outing') }}</el-button>
+                <el-button type="primary" @click="SoftEmergencyStop()" :disabled="SoftEmergencyStopState"
+                    :class="SoftEmergencyStopState == true ? 'hide' : ''">
                     {{ $t('SoftEmergencyStop') }}</el-button>
                 <!-- <el-input style="width:15%;" :placeholder="$t('Enter the Order No')" v-model="order"></el-input>
                 <el-button type="warning" @click="showform1();">{{ $t('Exit the glass by order number') }}</el-button> -->
@@ -392,7 +391,7 @@
                 <div class="glass A01" style="top: 290px;left: 289px;position: absolute;"
                     @click="ClearGlassId('DB101.10.1,5')">A01.2:{{ ShowGlassIdList(5) }}</div>
 
-                <div class="glass A02" style="top: 310px;left: 300px;position: absolute;"
+                <div class="glass A02" style="top: 310px;left: 289px;position: absolute;"
                     @click="ClearGlassId('DB101.10.2,6')">A02:{{ ShowGlassIdList(6) }}</div>
 
                 <div class="glass D03" style="top: 137px;left: 42px;position: absolute;"
@@ -574,19 +573,29 @@
                         }}</el-button>
                     </el-form-item> -->
                     <el-form-item>
-                        <el-input style="width:70%;" :placeholder="$t('Enter the glass barcode')"
-                            v-model="glassid1"></el-input>
-                        <el-button type="primary" @click="SelectGlassByGlassIDs(2)">{{ $t('Add')
+                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
+                        <el-button type="primary" @click="isConfirmState()">
+                            {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
+                    </el-form-item>
+                    <el-form-item>
+                        {{ $t('Current State') }}:{{ this.Scanningmethod==true?$t('Automatic'):$t('Hand Movement')}}
+                        <el-button type="primary" @click="SwitchScanMethod()">{{ $t('Switch')
                         }}</el-button>
+                    </el-form-item>
+                    <el-form-item>
+                        <el-input style="width:70%;" maxlength="14" :placeholder="$t('Enter the glass barcode')"
+                            v-model="glassid1"></el-input>
+                        <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-form-item>
                 </div>
                 <div style="display: flex;justify-content: space-around;">
                     <label for="">{{ $t('Upper film position') }}</label>
-                    <div>
-                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
-                        <el-button type="primary" @click="isConfirmState()">
-                            {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
-                    </div>
+                    
                     <label for="">{{ $t('Scan Code Point') }}</label>
                 </div>
                 <div style="display: flex;justify-content: space-around;height: 40px;">
@@ -684,12 +693,12 @@
                     <!-- <el-button @click="DeleteQueueGlasss(2)" type="primary">{{ $t('Clear Current')
                     }}</el-button>
                     <el-button @click="InsertQueueGlass(2)" type="primary" :disabled="disabled">
-                        {{ $t('Confirm Modification') }}</el-button>
+                        {{ $t('Confirm') }}</el-button>
                     <el-button @click="DeleteQueueGlasss(1)" type="primary">{{ $t('Clear Current')
                     }}</el-button> -->
                     <el-button @click="InsertQueueGlass(1)" style="margin-right: 100px;" type="primary"
                         :disabled="disabled1">
-                        {{ $t('Confirm Modification') }}</el-button>
+                        {{ $t('Confirm') }}</el-button>
                 </div>
             </el-form>
             <template #footer>
@@ -873,7 +882,7 @@
     home, home2, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist,
     SelectPassword, SelectGlassByGlassID, Disabled, Inglassid, SelectGlass, InsertQueueGlassId, UpdateQueueState, DeleteQueueGlass, SelectGlassNo,
     SelectAluminumFrameInfoById, DeleteProductionQueueGlass, AddOutSliceS, isAllowQueues, isConfirmStates, SelectPermissionByUserName, currentUsername, CompleteQueue,
-    isAllowReorderings, FrameStateUpdate, WriteGlassID, ClearGlassId, CloseForm7, TaskStop, SoftEmergencyStop
+    isAllowReorderings, FrameStateUpdate, WriteGlassID, ClearGlassId, CloseForm7, TaskStop, SoftEmergencyStop, SwitchScanMethod
 } from "../../api/home";
 
 
@@ -959,9 +968,9 @@
             OutingQueue: true,
             OrderInfo: true,
             CageDetails: true,
-            ClearGlassID:true,
-            StopTask:true,
-            SoftEmergencyStop:true,
+            ClearGlassID: true,
+            StopTask: true,
+            SoftEmergencyStopState: true,
             CountDowns: "0",
             D01RequestState: false,
             EmergencyStop: false,
@@ -970,7 +979,8 @@
             isQueueWarning: false,
             CurrentFrame: [],
             DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
-            GlassIdList: []
+            GlassIdList: [],
+            Scanningmethod: true
         };
     },
     created() {
@@ -1016,6 +1026,16 @@
                     this.tasklist1 = obj.tasklist1[0];
                     this.tasklist2 = obj.tasklist2[0];
                     this.alarm = obj.alarmmg[0];
+                    //鑾峰彇褰撳墠鎵爜鏂瑰紡
+                    if (obj.Scanningmethod != null) {
+                        if (obj.Scanningmethod == 0) {
+                            this.Scanningmethod = true;
+                        }
+                        else {
+                            this.Scanningmethod = false;
+                        }
+                    }
+
                     //鏌ヨ褰撳墠閾濇淇℃伅
                     this.CurrentFrame = obj.CurrentFrame;
                     //鑾峰彇璁惧鐘舵��
@@ -1155,14 +1175,14 @@
                         if (item.permissionId == "35" && item.state == 1) {
                             this.CageDetails = false;
                         }
-                        if (item.permissionId == "36" && item.state == 1) {
+                        if (item.permissionId == "37" && item.state == 1) {
                             this.ClearGlassID = false;
                         }
-                        if (item.permissionId == "37" && item.state == 1) {
+                        if (item.permissionId == "38" && item.state == 1) {
                             this.StopTask = false;
                         }
-                        if (item.permissionId == "38" && item.state == 1) {
-                            this.SoftEmergencyStop = false;
+                        if (item.permissionId == "39" && item.state == 1) {
+                            this.SoftEmergencyStopState = false;
                         }
                     });
                 });
@@ -1298,11 +1318,13 @@
         },
         //鎵嬪姩鍐欏叆plc鎵爜浣嶇幓鐠僫d
         WriteGlassID() {
-            if (this.glassid1 != "") {
+            if (this.glassid1.length ==14) {
                 WriteGlassID(this.glassid1).then(res => {
                     console.log(res.data);
                     this.$message.success(this.$t('Successful operation'));
                 });
+            }else{
+                this.$message.error(this.$t('Please enter the correct glassID'));
             }
         },
         //鑾峰彇鎵爜浣嶅拰涓婄墖浣嶆暟鎹�
@@ -2017,7 +2039,7 @@
         //娓呴櫎鐜荤拑id
         ClearGlassId(position, num) {
             if (this.ClearGlassID == false) {
-                if (this.DeviceList[position] != null) {
+                if (this.DeviceList[position] == 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'),
@@ -2056,8 +2078,34 @@
                 }
             });
         },
+        //杞�ュ仠
         SoftEmergencyStop() {
-            SoftEmergencyStop.then(res => {
+            this.$confirm(this.$t('Are you sure you want an emergency stop ?'), this.$t('confirm'), {
+                confirmButtonText: this.$t('Yes'),
+                cancelButtonText: this.$t('No'),
+                type: 'warning'
+            }).then(() => {
+                SoftEmergencyStop.then(res => {
+                    if (res.data.message == 200) {
+                        this.$message.success(this.$t('Operation successful'));
+                    }
+                });
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: this.$t('Operation canceled')
+                });
+            });
+        },
+        //鍒囨崲浜岀淮鐮佽幏鍙栨柟寮�
+        SwitchScanMethod(){
+            var Scanmethod;
+            if(this.Scanningmethod == true){
+                this.Scanmethod = 1;
+            }else{
+                this.Scanmethod = 0;
+            }
+            SwitchScanMethod(Scanmethod).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/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index 10e33c3..5129112 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
@@ -41,6 +41,7 @@
       // // TODO Auto-generated catch block
       // e.printStackTrace();
       // }
+      
       // 鍑虹墖浠诲姟////////////////////////////////
       List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
       List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
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 147586b..019d969 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
@@ -38,7 +38,7 @@
     public static String FrameNo = "";
     // 鏄惁闇�瑕佹墜鍔ㄧ‘璁ょ幓鐠�
     public static Boolean isConfirm = false;
-    //寰呯‘璁ょ殑鍑虹墖闃熷垪
+    // 寰呯‘璁ょ殑鍑虹墖闃熷垪
     public static List<north_glass_buffer1> AluminumFrame;
 
     // private Configuration config;
@@ -46,7 +46,7 @@
     private StorageCageService storageCageService;
 
     // public Plchome() throws IOException {
-    //     config = new Configuration("config.properties");
+    // config = new Configuration("config.properties");
     // }
 
     // public static Map b=new HashMap<>();
@@ -119,9 +119,44 @@
             Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
             jsonObject.append("CurrentFrame", CurrentFrame);
 
-            
-                
+            // 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);
+            //         }
+            //     }
+            // } catch (Exception e) {
+            //     // 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);
@@ -173,52 +208,28 @@
                 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);
+                        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){
+                            if (north_glass_buffer1.getstorageCage() == null) {
                                 break;
                             }
                             num++;
                         }
-                        if(num==north_glass_buffer1s.size()){
+                        if (num == north_glass_buffer1s.size()) {
                             north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
-                        }else{
-                            Plchome.AluminumFrame=north_glass_buffer1s;
+                        } else {
+                            Plchome.AluminumFrame = north_glass_buffer1s;
                         }
                     } catch (SQLException e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
                     }
                 }
-                if(AluminumFrame!=null){
+                if (AluminumFrame != null) {
                     jsonObject.append("AluminumFrame", AluminumFrame);
                 }
-
-                // // 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
-                // String frameno = spianService.queGlassid("DB103.270", 14).toString();
-                // // String frameno="X12345611002GV";
-                // // frameno="X21763329601FB";
-                // 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){
-                //                 north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
-                //                 break;
-                //             }
-                //             num++;
-                //         }
-                //         if(num==north_glass_buffer1s.size()){
-                //             jsonObject.append("AluminumFrame", north_glass_buffer1s);
-                //         }
-                //     } catch (SQLException e) {
-                //         // TODO Auto-generated catch block
-                //         e.printStackTrace();
-                //     }
-                // }
 
                 // 鑾峰彇杩涚墖璇锋眰鐘舵��
                 List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
@@ -276,29 +287,6 @@
                 // }
             }
 
-            // 閾濇绾夸氦浜�
-
-            // //閾濇id璇锋眰瀛�
-            // List<Short> framerequest = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
-            // if(framerequest!=null){
-            // //閾濇id
-            // String franmeno= spianService.queGlassid("閾濇id鍦板潃", 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);
-            // }
             storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
             dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
             boolean dbconnected = false;
@@ -322,64 +310,6 @@
 
                         if (!messages.isEmpty()) {
                             // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
-                            // String lastMessage = messages.get(messages.size() - 1);
-                            // System.out.println("lastMessage锛�" + lastMessage);
-                            // JSONArray messageArray = new JSONArray(lastMessage);
-
-                            // try {
-                            // // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
-                            // if (messageArray.getJSONArray(0).size() > 0) {
-                            // // 鑾峰彇娑堟伅鏁扮粍
-                            // JSONArray jsonArray = messageArray.getJSONArray(0);
-                            // // 鍒涘缓涓�涓竷灏斿�煎垪琛�
-                            // List<Boolean> sValue = new ArrayList<>();
-                            // // 閬嶅巻娑堟伅鏁扮粍
-                            // for (int i = 0; i < jsonArray.size(); i++) {
-                            // // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
-                            // Object value = jsonArray.get(i);
-                            // // 妫�鏌ュ�兼槸鍚︽湁鏁�
-                            // if (value != null && !value.toString().equals("null")) {
-                            // try {
-                            // // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
-                            // String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
-                            // // 瑙f瀽涓哄竷灏斿��
-                            // boolean val = "1".equals(cleanedValue.trim());
-                            // // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
-                            // sValue.add(val);
-                            // System.out.println(
-                            // "messageValue: " + Arrays.asList(val) + " added to the list");
-
-                            // } catch (NumberFormatException e) {
-                            // // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
-                            // System.err.println("Could not parse value: " + value);
-                            // }
-                            // }
-                            // }
-                            // // 缁堟杩涚墖浠诲姟
-                            // boolean Value1 = sValue.get(0);
-                            // boolean Value2 = sValue.get(1);
-
-                            // if (Value1) {
-                            // storageCageService.EndTask(0);
-
-                            // }
-                            // if (Value2) {
-                            // storageCageService.EndTask(1);
-
-                            // }
-                            // // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
-                            // if (!sValue.isEmpty()) {
-
-                            // // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
-                            // S7control.getinstance().WriteBit(niuanaddressList3, sValue);
-                            // System.out.println(
-                            // "Values " + sValue + " written to PLC at address " + niuanaddressList3);
-                            // }
-                            // }
-                            // } catch (Exception e) {
-                            // System.err.println("An error occurred while writing bit to PLC: " +
-                            // e.getMessage());
-                            // }
                             webserver.clearMessages();
                         }
 
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
index dfea454..8176fbe 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
@@ -65,6 +65,15 @@
             sessionMap.put(username, arrayListwebserver);
         } else {
             webSocketServers.add(this);
+            // Short i=0;
+            // for (WebSocketServer webSocketServer : webSocketServers) {
+            //     if(webSocketServer==this){
+            //         i++;
+            //     }
+            // }
+            // if(i==0){
+            //     webSocketServers.add(this);
+            // }
         }
         
         log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.get(username).size());
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 848a34e..3511209 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
@@ -20,27 +20,27 @@
         new PlcHold().start();
         new Plclog().start();
 
-//         new Plchome().start();
+    //     new Plchome().start();
 
-//         new Plcalarm().start();
+    //     new Plcalarm().start();
 
-//         new Plcsign().start();
+    //     new Plcsign().start();
 
-//         new Plcstate().start();
-//         new PlcPositioning1().start();
+    //     new Plcstate().start();
+    //     new PlcPositioning1().start();
 
-//         new PlcParameter2().start();
+    //     new PlcParameter2().start();
 
-//         new PLCAutomaticParameterSetting().start();
+    //     new PLCAutomaticParameterSetting().start();
 
-//         new PlcManualonePosition().start();
-//         new PlcManualonePosition2().start();
-//         new PlcServoManualone().start();
-//         new PLCManualJog().start();
-//         //new Plclog().start();
+    //     new PlcManualonePosition().start();
+    //     new PlcManualonePosition2().start();
+    //     new PlcServoManualone().start();
+    //     new PLCManualJog().start();
+    //     //new Plclog().start();
 
-//         new PlcInteractionState().start();
-// new PlcParameter1Review().start();
-       // new PLCAutomaticParameterSettingReview().start();
+    //     new PlcInteractionState().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 4a86f46..89bddaa 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
@@ -400,8 +400,12 @@
 
   // 鎵嬪姩鍐欏叆plc鎵爜浣嶇幓鐠僫d
   @PostMapping("/WriteGlassID")
-  public void WriteGlassID(String glassid) {
+  public Result WriteGlassID(String glassid) {
     // 鎵爜浣嶅啓鍏ョ幓鐠僫d
+    spianService.outmesid(glassid, "DB103.256");
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
   }
 
   // 娓呴櫎鎸囧畾浣嶇疆id
@@ -431,20 +435,30 @@
   // 杞�ュ仠
   @PostMapping("/SoftEmergencyStop")
   public Result SoftEmergencyStop(Short num) {
-    String position="DB101.11.3";
+    String position = "DB101.11.3";
     Map<String, Object> map = new HashMap<>();
-        if (S7control.getinstance().CheckConnected() == true) {
-            S7control.getinstance().WriteBit(position, false);
-            try {
-                TimeUnit.MILLISECONDS.sleep(300);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            S7control.getinstance().WriteBit(position, true);
-            map.put("message", "200");
-        } else {
-            map.put("message", "300");
-        }
-        return Result.success(map);
+    if (S7control.getinstance().CheckConnected() == true) {
+      S7control.getinstance().WriteBit(position, false);
+      try {
+        TimeUnit.MILLISECONDS.sleep(300);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+      S7control.getinstance().WriteBit(position, true);
+      map.put("message", "200");
+    } else {
+      map.put("message", "300");
+    }
+    return Result.success(map);
   }
+
+  // 鍒囨崲PLC鑾峰彇浜岀淮鐮佹柟寮�
+  @PostMapping("/SwitchScanMethod")
+  public Result SwitchScanMethod(Short scansmethod) {
+    S7control.getinstance().WriteWord("DB103.255", 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 2743e96..c2f2e29 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=1 where task_type=#{task_type} and task_state=0 and glass_id=#{glassid}")
+  @Update("update storage_task set task_state=2 where task_type=#{task_type} and glass_id=#{glassid}")
   void UpdateTask(@Param("task_type") Integer task_type,String glassid);
 
   // 鎵嬪姩瀹屾垚杩涚墖浠诲姟淇敼绗煎瓙鏁版嵁
@@ -88,6 +88,10 @@
   //鏍规嵁鐜荤拑id鏌ヨ鐞嗙墖绗间俊鎭�
   @Select("select * from storage_cage where glass_id=#{glassid}")
   StorageCage SelectGlassInfo(String glassid);
+
+  //鏍规嵁鐜荤拑id鏌ヨ鐞嗙墖绗间俊鎭�
+  @Select("select * from storage_cage where glass_id=#{glassid}")
+  List<StorageCage> SelectStorageInfoByGlassId(String glassid);
 
   //鏌ヨ鐜荤拑淇℃伅
 //  @Select("select * from glass where glassid=#{glassid}")
@@ -172,7 +176,7 @@
   @Select("select ifnull(max(sequence),0)+1 from out_slice ")
   Short SelectMaxSquence();
   //鏌ヨ鐢ㄦ埛鏉冮檺
-  @Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35 or permission_id=36 or permission_id=37 or permission_id=38)")
+  @Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35 or permission_id=36 or permission_id=37 or permission_id=38 or permission_id=39)")
   List<RolePermission> SelectPermissionByUserName(String username);
 
   //鏍规嵁鐜荤拑瀹屾垚鍑虹墖浠诲姟
@@ -200,7 +204,7 @@
   void UpdateOutSliceGlass(String glassid);
 
   //鏌ヨ鏈畬鎴愮殑浠诲姟
-  @Select("select * from storage_task where task_state=0 and task_type=#{task_type}")
+  @Select("select * from storage_task where task_state!=2 and task_type=#{task_type}")
   List<StorageTask> SelectTaskByState(int task_type);
 
   //淇敼鍑虹墖闃熷垪閾濇鐘舵��
@@ -215,4 +219,8 @@
   @Select("select task_type from storage_task where glass_id=#{glassid} and task_state!=2")
   Short SelectTaskByGlassId(String glassid);
 
+  //淇敼鏍煎瓙瀹藉害
+  @Update("update storage_cage set width=width+#{width} where   cage=#{cage} and cell=#{cell};")
+  void UpdataCageWidth(double width, int cage, int cell);
+
 }
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..609efd5 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,8 +18,8 @@
     @Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage  where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c  on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY (FrameBarcode=#{Fbarcode} or ''='') desc,shu desc,shu2,state2 asc,cage asc;")
     List<StorageCage> selectAll(String orderids,String Fbarcode);
     //浼樺厛鍒ゆ柇涓�娆℃槸鍚︽湁鍚岄摑妗嗙殑绌轰綅
-    @Select("select *,min(state) state1 from storage_cage  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{FrameBarcode} LIMIT 1;")
-    List<StorageCage> selectAllFbarcode(String Fbarcode);
+    @Select("select *,min(state) state1 from storage_cage where width>=(#{width}+#{width2})  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{Fbarcode} ORDER BY width desc LIMIT 1;")
+    List<StorageCage> selectAllFbarcode(String Fbarcode,double width,double width2);
     // 鑾峰彇鍒ゆ柇璇ユ牸瀛愭槸鍚﹂渶瑕佹妸澶栫墖鎺ㄥ叆鍐呯墖浣嶇疆
     @Select("select state from storage_cage where  cage=#{cage} and cell=#{cell} and tier=1;")
     int selectcell(int cage, int cell);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java b/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
index 10f846f..c7a9a27 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
@@ -23,6 +23,8 @@
   private SpianMapper spianMapper;
   @Autowired
   SpianService spianService;
+  @Autowired
+  StorageCageService storageCageService;
 
   public void AddOutSliceS(String[][] AluminumFrames) throws SQLException {
     // int sequence = homeMapper.SelectMaxSquence();
@@ -78,23 +80,34 @@
   // 缁堟杩涚墖/鍑虹墖
   public void StopTask(String glassid, int i) {
     if (i == 0) {// 杩涚墖缁堟
-      spianService.overtask(glassid);
-      DeleteByGlassIDs(glassid);
+      homeMapper.UpdateTask(0,glassid);// 瀹屾垚杩涚墖浠诲姟
+      DeleteByGlassIDs(glassid);//鍒犻櫎杩涚墖浠诲姟
       homeMapper.UpdateOutSliceGlass(glassid);
-    } else {// 鍑虹墖缁堟
-      spianMapper.UpdatetaskOut(glassid);// 瀹屾垚鍑虹墖浠诲姟
+    } else if(i==1) {// 鍑虹墖缁堟
+      homeMapper.UpdateTask(1,glassid);// 瀹屾垚鍑虹墖浠诲姟
       spianMapper.UpdataGlassCage(glassid, 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
-      spianMapper.UpdateCageOver(glassid, 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
       homeMapper.UpdateOutSliceGlass(glassid);// 淇敼鍑虹墖闃熷垪姝ょ幓鐠冪姸鎬佷负缂哄け
-
+    }else{
+      //娓呴櫎杩涚墖
+      homeMapper.UpdateTask(2,glassid);
+      homeMapper.UpdateOutSliceGlass(glassid);
+      //娓呴櫎杩涘嚭鐗囩幓鐠僫d
+      DeleteByGlassIDs(glassid);
     }
+
   }
 
   // 鍒犻櫎绗煎唴鐜荤拑杩樺師瀹藉害
   public void DeleteByGlassIDs(String glassid) {
-    StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
-    spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.getCell());
+    List<StorageCage> glassinfor = homeMapper.SelectStorageInfoByGlassId(glassid);
+    for (StorageCage storageCage : glassinfor) {
+      if (storageCage.getState().equals("2")) {
+        homeMapper.UpdataCageWidth(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
+      }
+    }
     homeMapper.DeleteByGlassID(glassid);
+
+    
   }
 
   //淇敼閾濇纭鐘舵��
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 7d4844b..085f3ab 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
@@ -19,7 +19,7 @@
     // @GetMapping("/all")
     public Short selectAll(String glassid) {
 
-        int cage1;
+        int cage1=0;
         int cells;
         int ids;
         int prcid;
@@ -33,12 +33,7 @@
         if (glasslist == null) {
             return (300);
         }
-        //鍒ゆ柇鏄惁杩樻湁杩涚墖浠诲姟鏈畬鎴愮殑
-        int cagestate=spianMapper.SelectCageState(2);
-        //鏈夎繘鐗囦换鍔℃湭瀹屾垚鏃惰繑鍥炰笉杩涚墖
-        if(cagestate>0){
-            return (300);
-        }
+       
         double widths = glasslist.getglasslengthmm();
         String orderids = glasslist.getordernumber();
         String FrameBarcode = glasslist.getFrameBarcode();
@@ -54,7 +49,10 @@
 
         // String orderid="A001";
         // 鑾峰彇璁㈠崟鐩稿叧搴︽渶楂樼殑绗煎瓙鎺掑簭
-        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode);
+        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode,widths,400);
+        //鍒ゆ柇閾濇鎸囧畾绌烘牸鏄惁闇�瑕侀棿闅旂┖闂�
+        
+        
         if (storageCage.size() == 0) {
             storageCage = spianMapper.selectAll(orderids, FrameBarcode);
         }
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 c296ec6..dc630bf 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
@@ -31,79 +31,120 @@
         String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString();
         String B01glassid = spianService.queGlassid("DB103.184", 14).toString();
         String B02glassid = spianService.queGlassid("DB103.198", 14).toString();
+        List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
         if (types == 0) {// 缁堟杩涚墖浠诲姟
             List<StorageTask> cageList = homeMapper.SelectTaskByState(types);
             for (StorageTask storageTask : cageList) {
                 // 鍒ゆ柇鍑虹墖浠诲姟浣嶇疆骞舵竻闄ゅ搴旂幓鐠僫d
-                if (storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2) {
+                if ((storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2)&&DeviceList.get(4)==0) {
                     outSliceServive.StopTask(storageTask.getGlassId(), types);
                     ClearGlassId("DB101.10.0");
-                } else if (storageTask.getGlassId() == B01glassid) {
+                } else if (storageTask.getGlassId() == B01glassid&&DeviceList.get(2)==0) {
                     outSliceServive.StopTask(storageTask.getGlassId(), types);
                     ClearGlassId("DB101.10.2");
-                } else if (storageTask.getGlassId() == B02glassid) {
+                } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
                     ClearGlassId("DB101.10.3");
                     outSliceServive.StopTask(storageTask.getGlassId(), types);
-                }
+                }\
             }
             // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
         } else {// 缁堟鍑虹墖浠诲姟
-            List<StorageCage> storageCages = homeMapper.selectinout(3);
-            for (StorageCage storageCage : storageCages) {
-                List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId());
-                for (StorageCage storageCagez : storageCagess) {
-                    if (storageCagez.getState().equals("2")) {// 璋冩嫧杩涚墖
-                        outSliceServive.StopTask(storageCagez.getGlassId(), 0);
-                    } else {// 鍑虹墖
-                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
-                    }
-                    // 鍒ゆ柇鍑虹墖浠诲姟浣嶇疆骞舵竻闄ゅ搴旂幓鐠僫d
-                    if (storageCagez.getGlassId() == A02glassid1) {
-                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
+            List<StorageTask> cageLists = homeMapper.SelectTaskByState(types);
+            List<StorageTask> cageList2 = homeMapper.SelectTaskByState(2);
+            if (cageList2!=null) {
+                cageLists.add(cageList2.get(0));
+            }
+            for (StorageTask cageList : cageLists) {
+                if (cageList.getTaskType().equals("1")) {
+                    if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.1");
-                    } else if (storageCagez.getGlassId() == B01glassid) {
-                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
+                    }
+                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.2");
-                    } else if (storageCagez.getGlassId() == B02glassid) {
+                    }
+                    else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), types);
                         ClearGlassId("DB101.10.3");
-                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
+                    }
+                }else if (cageList.getTaskType().equals("2")) {
+                    if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), 2);
+                        ClearGlassId("DB101.10.1");
+                    }
+                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), 2);
+                        ClearGlassId("DB101.10.2");
+                    }
+                    else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){
+                        outSliceServive.StopTask(cageList.getGlassId(), 2);
+                        ClearGlassId("DB101.10.3");
                     }
                 }
             }
+
+            // List<StorageCage> storageCages = homeMapper.selectinout(3);
+            // for (StorageCage storageCage : storageCages) {
+            //     List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId());
+
+            //     for (StorageCage storageCagez : storageCagess) {
+
+            //         if (storageCagez.getState().equals("2")) {// 璋冩嫧杩涚墖
+            //             outSliceServive.StopTask(storageCagez.getGlassId(), 0);
+            //         } else {// 鍑虹墖
+            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
+            //         }
+
+            //         // 鍒ゆ柇鍑虹墖浠诲姟浣嶇疆骞舵竻闄ゅ搴旂幓鐠僫d
+            //         if (storageCagez.getGlassId() == A02glassid1&&DeviceList.get(5)==0) {
+            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
+            //             ClearGlassId("DB101.10.1");
+            //         } else if (storageCagez.getGlassId() == B01glassid&&DeviceList.get(2)==0) {
+            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
+            //             ClearGlassId("DB101.10.2");
+            //         } else if (storageCagez.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
+            //             ClearGlassId("DB101.10.3");
+            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
+            //         }
+            //     }
+            // }
         }
     }
 
-    //鎵嬪姩瀹屾垚浠诲姟
+    // 鎵嬪姩瀹屾垚浠诲姟
     public void UpdateTask(Integer types, Integer shelfrack, String glassid) {
         if (types == 0) {// 瀹屾垚杩涚墖
             spianService.overtask(glassid);
         } else if (types == 1) {// 瀹屾垚鍑虹墖
             spianService.overtask(glassid);
-        } 
+        }
         // else if (types == 2) {// 缁堟杩涚墖浠诲姟
-        //     outSliceServive.StopTask(glassid, 0);
-        //     // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
+        // outSliceServive.StopTask(glassid, 0);
+        // // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
         // } else {// 缁堟鍑虹墖浠诲姟
-        //     outSliceServive.StopTask(glassid, 1);
+        // outSliceServive.StopTask(glassid, 1);
         // }
     }
 
-    //鍒ゆ柇浠诲姟绫诲瀷鍚庢竻闄ゅ搴旂幓鐠僫d
+    // 鍒ゆ柇浠诲姟绫诲瀷鍚庢竻闄ゅ搴旂幓鐠僫d
     public Result ClearGlassId(String position, String glassid) {
         Map<String, Object> map = new HashMap<>();
         if (S7control.getinstance().CheckConnected() == true) {
             // 鍒ゆ柇杩涘嚭杩樻槸鍑虹墖浠诲姟
             Short type = homeMapper.SelectTaskByGlassId(glassid);
-            if (type == 0) {
-                // 杩涚墖
-                outSliceServive.StopTask(glassid, 0);
-            } else if (type == 1) {
-                // 鍑虹墖
-                outSliceServive.StopTask(glassid, 1);
-            } else {
-                // 璋冩嫧
-                outSliceServive.StopTask(glassid, 0);
-                outSliceServive.StopTask(glassid, 1);
+            if (type != null) {
+                if (type == 0) {
+                    // 杩涚墖
+                    outSliceServive.StopTask(glassid, 0);
+                } else if (type == 1) {
+                    // 鍑虹墖
+                    outSliceServive.StopTask(glassid, 1);
+                } else {
+                    // 璋冩嫧
+                    outSliceServive.StopTask(glassid, 0);
+                    outSliceServive.StopTask(glassid, 1);
+                }
             }
             ClearGlassId(position);
             map.put("message", "200");
@@ -113,7 +154,7 @@
         return Result.success(map);
     }
 
-    //娓呴櫎鐜荤拑id
+    // 娓呴櫎鐜荤拑id
     public Result ClearGlassId(String position) {
         Map<String, Object> map = new HashMap<>();
         if (S7control.getinstance().CheckConnected() == true) {

--
Gitblit v1.8.0