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/North_Glass_Buffer1Service.java |   66 ++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java b/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
index 0a351d4..fcb0582 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/North_Glass_Buffer1Service.java
@@ -1,13 +1,17 @@
 package com.example.springboot.service;
 
 import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Comparator;
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.example.springboot.entity.StorageCage;
 import com.example.springboot.entity.north_glass_buffer1;
 import com.example.springboot.mapper.HomeMapper;
+import java.util.Collections;
 
 @Service
 public class North_Glass_Buffer1Service {
@@ -17,7 +21,34 @@
     @Autowired
     private JdbcConnections jdbcConnections;
 
-    //鑾峰彇鐜荤拑鏄惁鍦ㄧ瀛愶紝鏄惁鍦ㄥ嚭鐗囬槦鍒�
+    class north_glass_buffer1Comparator implements Comparator<north_glass_buffer1> {
+        @Override
+        public int compare(north_glass_buffer1 n1, north_glass_buffer1 n2) {//瀵规煡璇㈠埌鐨勯摑妗嗗搴旂殑鐜荤拑鏁版嵁杩涜鎺掑簭锛屽皢绂诲嚭鐗囦綅缃繎鐨勶紝闈犺繎绗煎瓙鍑虹墖渚х殑鐜荤拑鎺掑湪鍓嶉潰
+            if (n1.getstorageCage() != null) {
+                if (n2.getstorageCage() != null) {
+                    int cageComparison = n2.getstorageCage().getCage().compareTo(n1.getstorageCage().getCage());//闈犲嚭鐗囧彛杩戠殑绗煎瓙浼樺厛
+                    if (cageComparison != 0) {
+                        return cageComparison;
+                    } else {
+                        int cellComparison = n2.getstorageCage().getCell().compareTo(n1.getstorageCage().getCell());//闈犲嚭鐗囧彛杩戠殑鏍煎瓙浼樺厛
+                        if (cellComparison != 0) {
+                            return cellComparison;
+                        } else {
+                            return n2.getstorageCage().getTier().compareTo(n1.getstorageCage().getTier());//闈犲嚭鐗囧彛杩戠殑鏍煎瓙澶栧眰浼樺厛
+                        }
+                    }
+                } else {
+                    return -1;
+                }
+
+            } else {
+                return 1;
+            }
+
+        }
+    }
+
+    // 鑾峰彇鐜荤拑鏄惁鍦ㄧ瀛愶紝鏄惁鍦ㄥ嚭鐗囬槦鍒�
     public List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException {
         List<north_glass_buffer1> listAluminumFrame = jdbcConnections
                 .SelectGlassByGlassIdOrderIdFrameIdss(FrameBarcode);
@@ -25,27 +56,34 @@
             north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode()));
             north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode()));
         }
+        // 瀵瑰祵濂楃被杩涜鎺掑簭
+        Collections.sort(listAluminumFrame, new north_glass_buffer1Comparator());
         return listAluminumFrame;
     }
 
-    //鏍规嵁閾濇id娣诲姞鐜荤拑鍒板嚭鐗囬槦鍒�
-    public void AddOutSliceS(String FrameBarcode) throws SQLException{
-        List<north_glass_buffer1> north_glass_buffer1s=SelectAluminumFrameInfoById(FrameBarcode);
+    // 鏍规嵁閾濇id娣诲姞鐜荤拑鍒板嚭鐗囬槦鍒�
+    public void AddOutSliceS(String FrameBarcode) throws SQLException {
+        List<north_glass_buffer1> north_glass_buffer1s = SelectAluminumFrameInfoById(FrameBarcode);
         String flip = jdbcConnections.SelectFlipByFrameBarcode(FrameBarcode);
-        String position =jdbcConnections.SelectPositionByFrameBarcode(FrameBarcode);
-        int sequence=homeMapper.SelectMaxSquence();
-
+        String position = jdbcConnections.SelectPositionByFrameBarcode(FrameBarcode);
+        String framelength=jdbcConnections.SelectFrameLengthByFrameBarcode(FrameBarcode);
+        String frameheight=jdbcConnections.SelectFrameHeightByFrameBarcode(FrameBarcode);
+        int sequence = homeMapper.SelectMaxSquence();
         for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
-            Short state=0;
-            if(north_glass_buffer1.getOut_slice()==null){
-                if(north_glass_buffer1.getstorageCage()==null){
-                    state=3;
+            Short state = 0;
+            if (north_glass_buffer1.getOut_slice() == null) {
+                if (north_glass_buffer1.getstorageCage() == null) {
+                    state = 3;
                 }
-                homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode, north_glass_buffer1.getglasslengthmm().toString(), north_glass_buffer1.getglassheightmm().toString(), sequence, position, state);
-                sequence+=1;
+                homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode,
+                        north_glass_buffer1.getglasslengthmm().toString(),
+                        north_glass_buffer1.getglassheightmm().toString(), sequence, position, state,
+                        north_glass_buffer1.getordernumber(), north_glass_buffer1.getlistnumber(),
+                        north_glass_buffer1.getboxnumber(), north_glass_buffer1.getglasslength().toString(),
+                        north_glass_buffer1.getglassheight().toString(),framelength,frameheight);
+                sequence += 1;
             }
         }
     }
 
-    
 }

--
Gitblit v1.8.0