From ad71edbf0f9d2cf2bc46cd2ba1e0239f80949e68 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期四, 21 十二月 2023 15:12:56 +0800
Subject: [PATCH] 增加清除id调用终止出片任务

---
 springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java |   52 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 15 deletions(-)

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 aeba11e..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,33 +23,37 @@
   private HomeMapper homeMapper;
   @Autowired
   private SpianMapper spianMapper;
+  @Autowired
+  SpianService spianService;
 
   @Autowired
   private JdbcConnections jdbcConnections;
 
   public void AddOutSliceS(String[][] AluminumFrames) throws SQLException {
-    int sequence = homeMapper.SelectMaxSquence();
+    // int sequence = homeMapper.SelectMaxSquence();
 
     // 娣诲姞鍒版暟鎹簱
-    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;
-      }
-    }
+    // 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;
+    // }
+    // }
   }
 
   // 鏌ヨ鍑虹墖闃熷垪
   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()));
-    }
+    // for (Out_slice out_slice : listoutslice) {
+    // 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);
@@ -57,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);
+  }
+
 }

--
Gitblit v1.8.0