From 7687eb6cc76ab8ca20b39e7567255939abc4ff66 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 29 四月 2024 09:16:24 +0800
Subject: [PATCH] 修改进片逻辑判断,添加异常捕获

---
 springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java |   75 ++++++++++++++++++++++++++-----------
 1 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
index 1688d29..ff51d9e 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/JdbcConnections.java
@@ -23,17 +23,17 @@
 	private static final String USERNAME = "root";
 	private static final String PASSWORD = "beibo.123/";
 	
-	private static Connection conn = null;
+	private static Connection conns = null;
 	private static PreparedStatement ps = null;
-	private static ResultSet rs = null;
+	private static ResultSet rss = null;
 	
 	public  north_glass_buffer1 selectGlass(int glassid) throws SQLException {
-        conn = getConn();
+        Connection conn = getConn();
         north_glass_buffer1 glass=new north_glass_buffer1();
         String sql = "select ordernumber from north_glass_buffer1 where glassid=?";
          ps = conn.prepareStatement(sql);
          ps.setInt(1, glassid);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			glass.setordernumber(rs.getString("ordernumber"));
          }
@@ -42,14 +42,14 @@
     }
 
 	public  north_glass_buffer1 SelectGlassByGlassIdOrderIdFrameId(String glassid,String orderid,String frameid) throws SQLException {
-        conn = getConn();
+        Connection conn = getConn();
         north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
         String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
          ps = conn.prepareStatement(sql);
          ps.setString(1, glassid);
 		 ps.setString(2, orderid);
 		 ps.setString(3, frameid);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			north_glass_buffer1s.setId(rs.getInt("Id"));
 			north_glass_buffer1s.setordernumber(rs.getString("ordernumber"));
@@ -66,19 +66,49 @@
 			north_glass_buffer1s.setdatecreated(rs.getString("datecreated"));
 			north_glass_buffer1s.setFrameBarcode(rs.getString("FrameBarcode"));
          }
-		//  conn.close();
+		 conn.close();
          return north_glass_buffer1s;
     }
+
+	public  north_glass_buffer1 SelectGlassByGlassIdOrderIdFrameIdplchold(String glassid,String orderid,String frameid) throws SQLException {
+        Connection conn = getConn();
+        north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
+        String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
+         ps = conn.prepareStatement(sql);
+         ps.setString(1, glassid);
+		 ps.setString(2, orderid);
+		 ps.setString(3, frameid);
+         ResultSet rs= ps.executeQuery();
+         while (rs.next()) {
+			north_glass_buffer1s.setId(rs.getInt("Id"));
+			north_glass_buffer1s.setordernumber(rs.getString("ordernumber"));
+			north_glass_buffer1s.setlistnumber(rs.getString("listnumber"));
+			north_glass_buffer1s.setboxnumber(rs.getString("boxnumber"));
+			north_glass_buffer1s.setbarcode(rs.getString("barcode"));
+			north_glass_buffer1s.setglasslength(rs.getDouble("glasslength"));
+			north_glass_buffer1s.setglassheight(rs.getDouble("glassheight"));
+			north_glass_buffer1s.setglasslengthmm(rs.getDouble("glasslength_mm"));
+			north_glass_buffer1s.setglassheightmm(rs.getDouble("glassheight_mm"));
+			north_glass_buffer1s.setitemtype(rs.getString("itemtype"));
+			north_glass_buffer1s.setslotnumber(rs.getString("slotnumber"));
+			north_glass_buffer1s.setdatemodified(rs.getString("datemodified"));
+			north_glass_buffer1s.setdatecreated(rs.getString("datecreated"));
+			north_glass_buffer1s.setFrameBarcode(rs.getString("FrameBarcode"));
+         }
+		 conn.close();
+         return north_glass_buffer1s;
+    }
+
 	//鏍规嵁鐜荤拑id锛岃鍗昳d锛岄摑妗唅d鏌ヨ瀹㈡埛鐜荤拑淇℃伅
 	public  Queue SelectGlassByGlassIdOrderIdFrameIdQueue(String glassid,String orderid,String frameid) throws SQLException {
-        conn = getConn();
+        Connection conn = getConn();
         Queue queue=new Queue();
         String sql = "select * from north_glass_buffer1 where barcode=? or ordernumber=? or FrameBarcode=?";
          ps = conn.prepareStatement(sql);
          ps.setString(1, glassid);
 		 ps.setString(2, orderid);
 		 ps.setString(3, frameid);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			queue.setid(rs.getInt("Id"));
 			queue.setorderId(rs.getString("ordernumber"));
@@ -103,7 +133,7 @@
 
 	//鏍规嵁鐜荤拑id锛岃鍗昳d锛岄摑妗唅d鏌ヨ瀹㈡埛鐜荤拑淇℃伅
 	public  List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIds(String glassid,String orderid,String frameid) throws SQLException {
-        conn = getConn();
+        Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		List<north_glass_buffer1> glass=new ArrayList<north_glass_buffer1>();
         String sql = "select * from north_glass_buffer1 where position(? in barcode) and position(? in ordernumber) and position(? in FrameBarcode)";
@@ -111,7 +141,7 @@
          ps.setString(1, glassid);
 		 ps.setString(2, orderid);
 		 ps.setString(3, frameid);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
 
@@ -140,13 +170,13 @@
 
 	//鏍规嵁閾濇id鏌ヨ瀹㈡埛鐜荤拑淇℃伅
 	public  List<north_glass_buffer1> SelectGlassByGlassIdOrderIdFrameIdss(String frameid) throws SQLException {
-        conn = getConn();
+        Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		List<north_glass_buffer1> glass=new ArrayList<north_glass_buffer1>();
         String sql = "select * from north_glass_buffer1 where FrameBarcode=?";
          ps = conn.prepareStatement(sql);
 		 ps.setString(1, frameid);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			north_glass_buffer1 north_glass_buffer1s=new north_glass_buffer1();
 
@@ -175,13 +205,13 @@
 
 	//鏍规嵁閾濇id鏌ヨl閾濇鏄惁缈昏浆
 	public String SelectFlipByFrameBarcode(String frameBarcode) throws SQLException {
-		conn = getConn();
+		Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		String flip="";
         String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
          ps = conn.prepareStatement(sql1);
 		 ps.setString(1, frameBarcode);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			flip=rs.getString("Flip");
 			
@@ -191,15 +221,15 @@
 	}
 	//鏍规嵁閾濇id鏌ヨ鏄惁閾濇鎽嗘斁
 	public String SelectPositionByFrameBarcode(String frameBarcode) throws SQLException {
-       	conn = getConn();
+		Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		String position="";
         String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
          ps = conn.prepareStatement(sql1);
 		 ps.setString(1, frameBarcode);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
-			position=rs.getString("position");
+			position=rs.getString("flip");
          }
 		 conn.close();
          return position;
@@ -207,13 +237,13 @@
 
 	//鏍规嵁閾濇id鏌ヨ閾濇瀹�
 	public String SelectFrameLengthByFrameBarcode(String frameBarcode) throws SQLException {
-       	conn = getConn();
+		Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		String position="";
         String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
          ps = conn.prepareStatement(sql1);
 		 ps.setString(1, frameBarcode);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			position=rs.getString("framelength");
          }
@@ -223,13 +253,13 @@
 
 	//鏍规嵁閾濇id鏌ヨ閾濇楂�
 	public String SelectFrameHeightByFrameBarcode(String frameBarcode) throws SQLException {
-       	conn = getConn();
+		Connection conn = getConn();
         // north_glass_buffer1 glass=new north_glass_buffer1();
 		String position="";
         String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1";
          ps = conn.prepareStatement(sql1);
 		 ps.setString(1, frameBarcode);
-         rs= ps.executeQuery();
+         ResultSet rs= ps.executeQuery();
          while (rs.next()) {
 			position=rs.getString("frameheight");
          }
@@ -257,6 +287,7 @@
 	public static Connection getConn() throws SQLException {
 		Connection conn = null;
 		conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/canadames?serverTimezone=GMT%2B8&characterEncoding=utf-8", "root", "beibo.123/");
+		// conn = DriverManager.getConnection("jdbc:mysql://192.168.102.9:3306/production?serverTimezone=GMT%2B8&characterEncoding=utf-8", "northglass", "n0rthgla55");
 		return conn;
 	}
 

--
Gitblit v1.8.0