From 58d7b0e12ccd92cf3934f6582b51b5fbcecaa39a Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 09 五月 2024 09:42:41 +0800
Subject: [PATCH] 修改注入方式

---
 springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 103 insertions(+), 11 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 ed546f4..359567d 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
@@ -1,35 +1,127 @@
 package com.example.springboot.service;
 
 import java.sql.SQLException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.example.springboot.common.Result;
+import com.example.springboot.entity.Out_slice;
+import com.example.springboot.entity.StorageCage;
 import com.example.springboot.mapper.HomeMapper;
+import com.example.springboot.mapper.SpianMapper;
 
 @Service
 public class OutSliceServive {
 
   @Autowired
   private HomeMapper homeMapper;
-
   @Autowired
-  private JdbcConnections jdbcConnections;
+  private SpianMapper spianMapper;
+  @Autowired
+  SpianService spianService;
+  @Autowired
+  StorageCageService storageCageService;
 
   public void AddOutSliceS(String[][] AluminumFrames) throws SQLException {
-    int sequence = homeMapper.SelectMaxSquence();
-    
+    // int sequence = homeMapper.SelectMaxSquence();
+
     // 娣诲姞鍒版暟鎹簱
-    for (String[] item : AluminumFrames) {
-      if (item[1] == "true") {
-        String position = jdbcConnections.SelectPositionByFrameBarcode(item[3]);
-        homeMapper.AddOutSliceS(item[0], item[2], item[3], item[4], item[5], sequence, position);
-        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()));
+    // }
+    return listoutslice;
+  }
+
+  // 瀹屾垚鍑虹墖浠诲姟
+  public Result CompleteQueue(String id, String frameid, String glassid) {
+    homeMapper.CompleteQueueByGlassId(glassid);
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
+
+  // 纭鍚庡畬鎴愪慨鏀瑰嚭鐗囬槦鍒楃姸鎬�
+  public void CompleteQueueByGlassId(String glassid) {
+    homeMapper.CompleteQueueByGlassId(glassid);
+    Out_slice outslice = homeMapper.SelectQueueByglassid(glassid);
+    Short num = homeMapper.SelectCountByFrameNo(outslice.getBarCode());
+    if (num == 0) {
+      homeMapper.CompleteQueueByFrameNo(outslice.getBarCode());
     }
   }
 
-  
+  // 缁堟杩涚墖/鍑虹墖
+  public void StopTask(String glassid, int i) {
+    if (i == 0) {// 杩涚墖缁堟
+      homeMapper.UpdateTask(0,glassid);// 瀹屾垚杩涚墖浠诲姟
+      DeleteByGlassIDs(glassid);//鍒犻櫎杩涚墖浠诲姟
+      homeMapper.UpdateOutSliceGlass(glassid);
+    } else if(i==1) {// 鍑虹墖缁堟
+      homeMapper.UpdateTask(1,glassid);// 瀹屾垚鍑虹墖浠诲姟
+      spianMapper.UpdataGlassCage(glassid, 0);// 娓呴櫎鍑虹墖鏍煎瓙鐜荤拑淇℃伅
+      homeMapper.UpdateOutSliceGlass(glassid);// 淇敼鍑虹墖闃熷垪姝ょ幓鐠冪姸鎬佷负缂哄け
+    }else{
+      //娓呴櫎杩涚墖
+      homeMapper.UpdateTask(2,glassid);
+      homeMapper.UpdateOutSliceGlass(glassid);
+      //娓呴櫎杩涘嚭鐗囩幓鐠僫d
+      DeleteByGlassIDs(glassid);
+    }
+
+  }
+
+  // 鍒犻櫎绗煎唴鐜荤拑杩樺師瀹藉害
+  public void DeleteByGlassIDs(String glassid) {
+    List<StorageCage> glassinfor = homeMapper.SelectStorageInfoByGlassId(glassid);
+    for (StorageCage storageCage : glassinfor) {
+      if (storageCage.getState().equals("2")||storageCage.getState().equals("1")) {
+        homeMapper.UpdataCageWidth(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
+      }
+    }
+    homeMapper.DeleteByGlassID(glassid);
+    
+  }
+
+  //淇敼閾濇纭鐘舵��
+  public Result FrameStateUpdate(String frameno) {
+    homeMapper.FrameStateUpdate(frameno);
+    Map<String, Object> map = new HashMap<>();
+    map.put("message", "200");
+    return Result.success(map);
+  }
+  //鏌ヨ褰撳墠閾濇
+  public Out_slice SelectCurrentFrame() {
+    return homeMapper.SelectCurrentFrame();
+  }
+
+public Result CompleteQueueByFrameNo(String frameNo) {
+  Map<String, Object> map = new HashMap<>();
+  Short num= homeMapper.SelectOutingQueueCount(frameNo);
+  if(num==0){
+    homeMapper.CompleteQueueByFrameNo(frameNo);
+    map.put("message", "200");
+  }else{
+    map.put("message", "300");
+  }
+  return Result.success(map);
+}
 
 }

--
Gitblit v1.8.0