From 03ddbc02f5f0f35354489af3badacccd993457f0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 21 十二月 2023 11:52:09 +0800
Subject: [PATCH] 修改进出片终止功能

---
 CanadaMes-ui/src/views/home/index.vue                                               |   43 +++++-----
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java        |   19 ++--
 CanadaMes-ui/src/lang/locales/en-US.json                                            |    1 
 springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java      |   11 +-
 springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java   |   43 ++++++++--
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java         |   23 ++---
 springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java         |   12 ++
 springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java |   55 +++++++++----
 CanadaMes-ui/src/lang/locales/zh-CN.json                                            |    3 
 9 files changed, 132 insertions(+), 78 deletions(-)

diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index e30f3fd..34f5b2d 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -335,6 +335,7 @@
   "Approximately resettable time":"Approximately resettable time",
   "EXTERIQR OUT AND BYPASS TO THE LEFT":"EXTERIQR OUT AND BYPASS TO THE LEFT",
   "EXTERIQR OUT AND BYPASS TO THE RIGHT":"EXTERIQR OUT AND BYPASS TO THE RIGHT",
+  "Complete Task":"Complete Task",
     "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 a7b7d97..f199688 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": "192.168.10.113",
   "systemTitle": "鐧诲綍绯荤粺",
   "usernamePlaceholder": "璇疯緭鍏ョ敤鎴峰悕",
   "passwordPlaceholder": "璇疯緭鍏ュ瘑鐮�",
@@ -327,6 +327,7 @@
   "Approximately resettable time":"鍙浣嶅ぇ姒傛椂闂�",
   "EXTERIQR OUT AND BYPASS TO THE LEFT":"EXTERIQR OUT AND BYPASS TO THE LEFT",
   "EXTERIQR OUT AND BYPASS TO THE RIGHT":"EXTERIQR OUT AND BYPASS TO THE RIGHT",
+  "Complete Task":"瀹屾垚浠诲姟",
   "langparameter": {
     "conveyor Velocity(Auto FAST)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄥ揩閫�",
     "conveyor Velocity(Auto SLOW)": "D01-D06 鐨甫杈撻�佽嚜鍔ㄦ參閫�",
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 7763605..d5e6344 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -214,9 +214,11 @@
 .hide {
     display: none;
 }
+
 .el-table .cell {
     display: flex;
 }
+
 /* .el-table td,
 .el-table th {
     padding: 0px 0;
@@ -262,7 +264,9 @@
                             <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                                 @click="endtask(1, scope.row.glassId, scope.row.cell)">{{ $t('Terminate Task')
                                 }}</el-button>
-
+                            <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
+                                @click="endtask(3, scope.row.glassId, scope.row.cell)">{{ $t('Complete Task')
+                                }}</el-button>
                         </template>
                     </el-table-column>
                 </el-table>
@@ -663,10 +667,10 @@
                     </template>
                 </el-table-column>
                 <el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
-                <el-table-column :min-width="90" prop="barcode" :label="$t('Complete')">Complete
+                <el-table-column :min-width="90" prop="barcode" :label="$t('Complete')">
                     <template slot-scope='scope' style="height:100px;height:100px;">
                         <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
-                            :disabled="(!isAllowQueue || scope.row.state != 1)"
+                            :disabled="!(!isAllowQueue && scope.row.state != 2&&scope.row.state != 4)"
                             @click="CompleteQueue(scope.row.id, scope.row.barcode, scope.row.glassId)">{{ $t('Complete')
                             }}</el-button>
                     </template>
@@ -683,13 +687,13 @@
                 </el-table-column>
                 <el-table-column prop="position" :label="$t('Flipped')" :min-width="200">
                     <template slot-scope='scope'>
-                        {{ scope.row.flip == true ? $t('EXTERIQR OUT AND BYPASS TO THE LEFT') : $t('EXTERIQR OUT AND BYPASS
-                                                TO THE RIGHT') }}
+                        {{ scope.row.flip == true ? $t('EXTERIQR OUT AND BYPASS TO THE LEFT')
+                            : $t('EXTERIQR OUT AND BYPASS TO THE RIGHT') }}
                     </template>
                 </el-table-column>
                 <el-table-column prop="barcode" :label="$t('Frame No')"></el-table-column>
 
-                
+
                 <el-table-column :width="280" :label="$t('Operate')">
                     <template slot-scope='scope'>
                         <el-button type="text" size="small" @click="getTopMove(scope.row, scope.$index)"
@@ -900,7 +904,7 @@
                     this.tasklist1 = obj.tasklist1[0];
                     this.tasklist2 = obj.tasklist2[0];
                     this.alarm = obj.alarmmg[0];
-                    if (this.alarm.length > 0) {
+                    if (this.alarm.length > 0&&this.alarm!=obj.alarmmg[0]) {
                         this.dialogFormVisible2 = true;
                     } else {
                         this.dialogFormVisible2 = false;
@@ -911,22 +915,22 @@
                     }
 
                     //澶嶄綅鍊掕鏃�
-                    if(obj.countdown!=null){
+                    if (obj.countdown != null) {
                         if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
-                        this.CountDown();
+                            this.CountDown();
+                        }
                     }
-                    }
-                    
+
                     //澶嶄綅瀹屾垚淇″彿
-                    if( obj.reset!=null){
+                    if (obj.reset != null) {
                         this.reset = obj.reset[0];
                     }
-                    
+
                     //鏄惁鏈夎繘鐗囪姹�
-                    if(obj.D01RequestState!=null){
+                    if (obj.D01RequestState != null) {
                         this.D01RequestState = obj.D01RequestState[0];
                     }
-                    
+
 
                     //鏄惁鍏佽鍑虹墖
                     this.isAllowQueue = obj.isAllowQueue[0];
@@ -1667,10 +1671,9 @@
             // if (columnIndex === 9 && row.flip == 1) {
             //     style = "background-Color:yellow;";
             // }
-            if (columnIndex === 6 && row.state == 3) {
-                style = "background-Color:gray;";
-            }
-            style
+            // if (columnIndex === 6 && row.state == 3) {
+            //     style = "background-Color:gray;";
+            // }
             return style;
         }
         ,
@@ -1688,7 +1691,7 @@
             if (rowIndex != 0) {
                 barcode2 = arrOutSlice[rowIndex - 1].barcode;
             }
-            if (columnIndex === 12 || columnIndex === 9|| columnIndex === 10|| columnIndex === 11) {
+            if (columnIndex === 12 || columnIndex === 9 || columnIndex === 10 || columnIndex === 11) {
                 if (barcode != barcode2) {
                     // this.FrameNoFlag = barcode;
                     for (let i = rowIndex; i < this.OutSlice.length; i++) {
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 f66d279..66b3252 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
@@ -31,7 +31,7 @@
     // 鍑虹墖闃熷垪鏄惁鍏佽鍑虹墖
     public static Boolean isAllowQueue = true;
     // 閾濇id
-    public static String FrameNo;
+    public static String FrameNo="";
     // 鏄惁闇�瑕佹墜鍔ㄧ‘璁ょ幓鐠�
     public static Boolean isConfirm = false;
 
@@ -116,20 +116,19 @@
             //     if (inglassInfo.size() > 0)
             //         jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
             // }
-            
 
             // // 鑾峰彇閾濇idDB106.DBW64
-            // String frameno=spianService.queGlassid("DB103.270",14).toString();
-            // if(frameno!=Plchome.FrameNo&&frameno!=""){
-            // Plchome.FrameNo=frameno;
+            // String frameno = spianService.queGlassid("DB103.270", 14).toString();
+            // // String frameno="X12345611002GV";
+            // if (!frameno.equals(Plchome.FrameNo)) {
+            //     Plchome.FrameNo = frameno;
+            //     try {
+            //         north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
+            //     } catch (SQLException e) {
+            //         // TODO Auto-generated catch block
+            //         e.printStackTrace();
+            //     }
             // }
-            // try {
-            // north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
-            // } catch (SQLException e) {
-            // // TODO Auto-generated catch block
-            // e.printStackTrace();
-            // }
-            
 
             // // 鑾峰彇杩涚墖璇锋眰鐘舵��
             // List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
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 e320119..c832698 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
@@ -30,6 +30,7 @@
 import com.example.springboot.component.S7control;
 import com.example.springboot.entity.CarPosition;
 import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.StorageTask;
 import com.example.springboot.entity.User;
 import com.example.springboot.entity.alarmmg;
 import com.example.springboot.entity.north_glass_buffer1;
@@ -136,27 +137,47 @@
     return Result.success(map);
   }
 
-  // 鎵嬪姩瀹屾垚杩�/鍑虹墖浠诲姟
+  // 鎵嬪姩瀹屾垚杩�/鍑虹墖浠诲姟 缁堟杩涚墖/鍑虹墖浠诲姟
   @GetMapping("/UpdateTask")
   public Result UpdateTask(Integer types, Integer shelfrack, String glassid) {
     Map<String, Object> map = new HashMap<>();
-    homeMapper.UpdateTask(types, glassid);
-    if (types == 0) {
-      // homeMapper.UpdateCageTask1(glassid);
+    if (types == 0) {// 瀹屾垚杩涚墖
       spianService.overtask(glassid);
-    } else if (types == 1) {
-      // homeMapper.DeleteByGlassID(glassid);
+    } else if (types == 1) {// 瀹屾垚鍑虹墖
       spianService.overtask(glassid);
-    } else if (types == 2) {//缁堟杩涚墖浠诲姟
-      spianService.overtask(glassid);
-      StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
-      spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.getCell());
-      homeMapper.DeleteByGlassID(glassid);
+    } else if (types == 2) {// 缁堟杩涚墖浠诲姟
+      outSliceServive.StopTask(glassid, 0);
       // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
-    }else{//缁堟鍑虹墖浠诲姟
-      spianService.overtask(glassid);
-      homeMapper.UpdateOutSliceGlass(glassid);
+    } else {// 缁堟鍑虹墖浠诲姟
+      outSliceServive.StopTask(glassid, 1);
     }
+    map.put("message3", "200");
+    return Result.success(map);
+  }
+
+  //缁堟杩涚墖/鍑虹墖浠诲姟
+  @GetMapping("/EndTask")
+  public Result EndTask(int types) {
+     if (types == 0) {// 缁堟杩涚墖浠诲姟
+      List<StorageTask> cageList = homeMapper.SelectTaskByState(types);
+      for (StorageTask storageTask : cageList) {
+        outSliceServive.StopTask(storageTask.getGlassId(), types);  
+      }
+      // 鍙戦�佺粓姝㈣繘鐗囦换鍔′俊鍙�
+    } else {// 缁堟鍑虹墖浠诲姟
+      List<StorageCage> storageCages =homeMapper.selectinout(types);
+      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);
+          }
+        }
+      }
+    }
+    Map<String, Object> map = new HashMap<>();
     map.put("message3", "200");
     return Result.success(map);
   }
@@ -182,9 +203,7 @@
   // 鎵嬪姩鍒犻櫎鐞嗙墖绗肩幓鐠�
   @GetMapping("/DeleteByGlassID")
   public Result DeleteByGlassID(String glassid) {
-    StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
-    spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.getCell());
-    homeMapper.DeleteByGlassID(glassid);
+    outSliceServive.DeleteByGlassID(glassid);
     Map<String, Object> map = new HashMap<>();
     map.put("message3", "200");
     return Result.success(map);
@@ -349,6 +368,7 @@
   @PostMapping("/DeleteProductionQueueGlass")
   public Result DeleteProductionQueueGlass(String FrameNo) {
     homeMapper.CompleteQueueByFrameNo(FrameNo);
+
     Map<String, Object> map = new HashMap<>();
     map.put("message", "200");
     return Result.success(map);
@@ -390,7 +410,6 @@
   @PostMapping("/CompleteQueue")
   public Result CompleteQueue(String id, String frameid, String glassid) {
     return outSliceServive.CompleteQueue(id, frameid, glassid);
-
   }
 
 }
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 5eb7b2a..4d38b21 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
@@ -4,6 +4,7 @@
 
 import com.example.springboot.entity.CarPosition;
 import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.StorageTask;
 import com.example.springboot.entity.alarmmg;
 import com.example.springboot.entity.north_glass_buffer1;
 import com.example.springboot.entity.Out_slice;
@@ -139,6 +140,10 @@
   @Select("select * from storage_cage where glass_id=#{glassid}")
   StorageCage SelectStorageGlassById(String glassid);
 
+  //鏍规嵁鐜荤拑id鏌ヨ绗煎唴鐜荤拑淇℃伅
+  @Select("select * from storage_cage where glass_id=#{glassid}")
+  List<StorageCage> SelectStoragesGlassById(String glassid);
+
 
   // //鏍规嵁鐜荤拑id鍒犻櫎鍑虹墖闃熷垪鐜荤拑
   // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)")
@@ -172,7 +177,7 @@
   void CompleteQueue(String id);
 
   //鏌ヨ閾濇id瀵瑰簲鐜荤拑瀹屾垚鏁伴噺
-  @Select("select count(*) from out_slice where barcode=#{frameid} and state<2")
+  @Select("select count(*) from out_slice where barcode=#{frameid} and (state=0 or state=1 or state=3)")
   Short SelectCountByFrameNo(String frameid);
 
   //鍒犻櫎宸插畬鎴愮殑浠诲姟
@@ -182,7 +187,10 @@
   @Select("Select width from storage_cage where cage=#{cage} and cell=#{cell} limit 1")
   Double SelectCageWidth(short cage, short cell);
 
-  @Select("update out_slice set state=3 where glassId=#{glassid}")
+  @Select("update out_slice set state=3 where glassId=#{glassid} and state<3")
   void UpdateOutSliceGlass(String glassid);
 
+  @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 f638b6c..8ef5196 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
@@ -42,7 +42,7 @@
     StorageCage selectCage1(int cage1, int cell, double width);
 
     // 鍒ゆ柇绗煎瓙鍐呯幓鐠冩暟
-    @Select("select COUNT(tier)as tier from storage_cage where  cage=#{cage} and cell=#{cell} and state=1;")
+    @Select("select COUNT(tier)as tier from storage_cage where  cage=#{cage} and cell=#{cell} and state!=0 and state!=3;")
     int selectsum(int cage, int cell);
 
     // 瀹屾垚杩涚墖涓殑鐜荤拑鐘舵��
@@ -53,7 +53,7 @@
     void UpdateCageadd(String glassid, int state);
 
     // 鑾峰彇鐜荤拑淇℃伅
-    @Select("select *,ordernumber ,glasslength_mm as glasslengthmm,glassheight_mm as glassheightmm,barcode,listnumber,boxnumber,glasslength,glassheight from north_glass_buffer1 where barcode=#{glassid}")
+    @Select("select *,ordernumber ,glasslength_mm as glasslengthmm,glassheight_mm as glassheightmm,barcode,listnumber,boxnumber,glasslength,glassheight,FrameBarcode from north_glass_buffer1 where barcode=#{glassid}")
     north_glass_buffer1 selectGlass(String glassid);
 
     // 鍑虹墖浠诲姟鏌ヨ
@@ -73,11 +73,11 @@
     int selectGlassState(int cage, int cell);
 
     // 鍒ゆ柇璇ヨ皟鎷ㄧ殑绗煎瓙
-    @Select("select glass_id,cage,cell,max(state)as shu,ROUND(id/2)as prcid,id from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage),cell desc  limit 1;")
-    StorageCage selectGlassCage(int cage, double width, int cage1, int cage2);
+    @Select("select glass_id,cage,cell,max(state)as shu,ROUND(id/2)as prcid,id,abs(#{cell}-cell)as xuhao from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage),xuhao desc  limit 1;")
+    StorageCage selectGlassCage(int cage, double width, int cage1, int cage2,int cell);
 
     // 鍒犻櫎绗煎瓙淇℃伅(鍑虹墖)
-    @Update("update storage_cage as a set state=#{state},glass_id=null,order_id=null,glasswidth=null,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;")
+    @Update("update storage_cage as a set state=#{state},glass_id=null,FrameBarcode=null,order_id=null,glasswidth=null,a.glassheight=null,a.glasswidthmm=null,a.glassheightmm=null,a.listid=null,a.boxid=null where glass_id=#{glassid} and state=3;")
     void UpdataGlassCage(String glassid, int state);
 
     // 鏀瑰彉鐜荤拑鐘舵�佷负鍑虹墖涓�
@@ -88,7 +88,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} 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);
 
@@ -213,7 +213,7 @@
     int SelectOutSliceshu();
 
     // 鏇存柊鍑虹墖闃熷垪鐨勪换鍔$姸鎬�
-    @Update("update out_slice set state=#{state} where glassid=#{glassid}")
+    @Update("update out_slice set state=#{state} where glassid=#{glassid} and state=1")
     void OverOutSlice(String glassid, int state);
 
     // 鑾峰彇鐜荤拑鐨勯摑妗唅d
@@ -221,7 +221,7 @@
     String SelectBarcode(String glassId);
 
     // 鑾峰彇鍑虹墖闃熷垪鐨勯摑妗嗘槸鍚﹀叏閮ㄥ畬鎴�
-    @Select("select MIN(state) from out_slice where barcode=#{barcode};")
+    @Select("select count(*) from out_slice where barcode=#{barcode} and (state=1 or state=0 or state=3);")
     int SelectOverState(String barcode);
 
     // 鍒犻櫎鍑虹墖闃熷垪璇ラ摑妗嗙殑id
@@ -234,4 +234,7 @@
     //鏂板鏃ュ織琛ㄦ牸
     @Insert("INSERT INTO `canadames`.`log`( `text`,time) VALUES (#{logtxt},now());")
     void insertlog(String logtxt);
+    //鑾峰彇璇ュ崐鍖烘槸鍚︽湁鎵ц鐨勪换鍔�
+    @Select(" select count(*) from storage_cage where state=#{state} and cage>#{cage1} and cage<#{cage2}")
+    int SelectCageTask(int state,int cage1,int cage2);
 }
\ No newline at end of file
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 7457865..e041e8d 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 HomeMapper homeMapper;
   @Autowired
   private SpianMapper spianMapper;
+  @Autowired
+  SpianService spianService;
 
   @Autowired
   private JdbcConnections jdbcConnections;
@@ -32,12 +34,13 @@
 
     // 娣诲姞鍒版暟鎹簱
     // for (String[] item : AluminumFrames) {
-    //   if (item[1] == "true") {
-    //     Short state=0;
-    //     String position = jdbcConnections.SelectPositionByFrameBarcode(item[3]);
-    //     homeMapper.AddOutSliceS(item[0], item[2], item[3], item[4], item[5], sequence, position,state );
-    //     sequence += 1;
-    //   }
+    // if (item[1] == "true") {
+    // Short state=0;
+    // String position = jdbcConnections.SelectPositionByFrameBarcode(item[3]);
+    // homeMapper.AddOutSliceS(item[0], item[2], item[3], item[4], item[5],
+    // sequence, position,state );
+    // sequence += 1;
+    // }
     // }
   }
 
@@ -45,12 +48,12 @@
   public List<Out_slice> SelectProductionqueue() {
     List<Out_slice> listoutslice = homeMapper.SelectProductionqueue();
     // for (Out_slice out_slice : listoutslice) {
-    //   out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId()));
+    // out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId()));
     // }
     return listoutslice;
   }
 
-  //瀹屾垚鍑虹墖浠诲姟
+  // 瀹屾垚鍑虹墖浠诲姟
   public Result CompleteQueue(String id, String frameid, String glassid) {
     homeMapper.CompleteQueue(id);
     Short num = homeMapper.SelectCountByFrameNo(frameid);
@@ -58,14 +61,32 @@
       homeMapper.CompleteQueueByFrameNo(frameid);
     }
     StorageCage storageCage = homeMapper.SelectGlassInfo(glassid);
-    if(storageCage!=null){
+    if (storageCage != null&&storageCage.getState().equals("3")) {
       spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
+      homeMapper.DeleteByGlassID(glassid);
     }
-    homeMapper.DeleteByGlassID(glassid);
-    S7control.getinstance().WriteWord("DB105.12", (short) 0);
     Map<String, Object> map = new HashMap<>();
     map.put("message", "200");
     return Result.success(map);
   }
 
+  //缁堟杩涚墖/鍑虹墖
+  public void StopTask(String glassid, int i) {
+    if (i == 0) {// 杩涚墖缁堟
+      spianService.overtask(glassid);
+      DeleteByGlassID(glassid);
+    } else {// 鍑虹墖缁堟
+      spianMapper.UpdatetaskOut(glassid);//瀹屾垚鍑虹墖浠诲姟
+      spianMapper.UpdataGlassCage(glassid, 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
+      spianMapper.UpdateCageOver(glassid, 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
+      homeMapper.UpdateOutSliceGlass(glassid);//淇敼鍑虹墖闃熷垪姝ょ幓鐠冪姸鎬佷负缂哄け
+    }
+  }
+  //鍒犻櫎绗煎唴鐜荤拑杩樺師瀹藉害
+  public void DeleteByGlassID(String glassid) {
+    StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
+    spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.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 e3bb07b..329b5ca 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
@@ -55,7 +55,7 @@
             cage1 = storageCage2.getCage();
             // 鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
             int cages = spianMapper.selectCage(cage1);
-            if(cages==0){
+            if (cages == 0) {
                 return (400);
             }
             StorageCage cages1;
@@ -239,7 +239,7 @@
                     // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 鏂板鍑虹墖浠诲姟
                     spianMapper.UpdateDBCage(ids, cage, cell, 2);// 灏嗗師鏍煎瓙鏁版嵁鏇存柊鍒版柊鏍煎瓙閲�
                     spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 鍑忓皯鏂版牸瀛愬搴�
-                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�        
+                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 澧炲姞鍘熸牸瀛愬搴�
                     // 浼犺緭mes鏁版嵁,鍧愭爣锛屾暟鎹�
                     System.out.println("鍑虹墖浠诲姟|" + datas);
                     S7control.getinstance().WriteWord(adddresslist, datas);// 娲惧彂鍑虹墖杞︿换鍔�
@@ -300,20 +300,19 @@
 
     // 鏍规嵁鐜荤拑id瀹屾垚鍦ㄨ繘琛屼腑鐨勪换鍔�
     public void overtask(String glassid) {
-        
+
         spianMapper.UpdatetaskOut(glassid);// 瀹屾垚涓婁竴娆� 鍑虹墖鎴栬�呰繘鐗囦换鍔�
         spianMapper.OverOutSlice(glassid, 2);// 瀹屾垚鍑虹墖闃熷垪浠诲姟
         spianMapper.UpdataGlassCage(glassid, 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
         spianMapper.UpdateCageOver(glassid, 0);// 鏇存敼绗煎瓙琛ㄥ嚭鐗囩姸鎬�
-        spianMapper.UpdateCageadd(glassid,1);// 鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
+        spianMapper.UpdateCageadd(glassid, 1);// 鏇存敼绗煎瓙琛ㄨ繘鐗囩姸鎬�
         String barcode = spianMapper.SelectBarcode(glassid);// 鑾峰彇璇ョ幓鐠冪殑閾濇id
         spianMapper.UpdateAddQueue(glassid);// 鎶婅繘鐗囩殑鐜荤拑鏇存柊鍒板嚭鐗囬槦鍒椾腑
         if (barcode != null) {
             int barcodeState = spianMapper.SelectOverState(barcode);// 鑾峰彇璇ラ摑妗嗙殑鐘舵��
-            if (barcodeState == 2) {// 褰撹閾濇鎵�鏈夌殑鐜荤拑閮芥槸瀹屾垚鐘舵�佹椂鍒犻櫎鍦ㄥ嚭鐗囬槦鍒楃殑鏁版嵁
+            if (barcodeState == 0) {// 褰撹閾濇鎵�鏈夌殑鐜荤拑閮芥槸瀹屾垚鐘舵�佹椂鍒犻櫎鍦ㄥ嚭鐗囬槦鍒楃殑鏁版嵁
                 spianMapper.DeleteQueue(barcode);
             }
         }
-
     }
 }

--
Gitblit v1.8.0