From 03b0fb0ba2de86bcfff277778826547c0e37a93f Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期四, 20 十一月 2025 23:52:51 +0800
Subject: [PATCH] 优化修改

---
 src/home/CardMachineUI.java |   55 +++++++++++--------------------------------------------
 1 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/src/home/CardMachineUI.java b/src/home/CardMachineUI.java
index 12e7f49..63c01cd 100644
--- a/src/home/CardMachineUI.java
+++ b/src/home/CardMachineUI.java
@@ -87,7 +87,7 @@
 	        startUIUpdates(); // UI鍒锋柊瀹氭椂鍣�
 	        startSerialStatusMonitoring(); // 涓插彛鐘舵�佺洃鎺�        
 	        
-	        System.out.println("涓荤晫闈㈠垵濮嬪寲瀹屾垚");
+	        //System.out.println("涓荤晫闈㈠垵濮嬪寲瀹屾垚");
 	    } catch (Exception e) {
 	        e.printStackTrace();
 	        JOptionPane.showMessageDialog(null, 
@@ -133,7 +133,7 @@
         try {
             // 鍒濆鍖栧崱妲界鐞嗗櫒 - 蹇呴』棣栧厛鎵ц
             slotManager = new SlotManager();
-            System.out.println("鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲瀹屾垚");
+            //System.out.println("鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲瀹屾垚");
 
             // 鐩存帴浣跨敤宸茬粡鍒濆鍖栫殑閰嶇疆绯荤粺
             Chushihua configSystem = Chushihua.getInstance();
@@ -156,9 +156,9 @@
                 PICKUP_PASSWORD = configSystem.getMachineConfig().getFetchCardPassword();
             }
 
-            System.out.println("绯荤粺閰嶇疆鍒濆鍖栧畬鎴�");
-            System.out.println("绠$悊鍛樺瘑鐮侀暱搴�: " + (ADMIN_PASSWORD != null ? ADMIN_PASSWORD.length() : "null"));
-            System.out.println("鍙栧崱瀵嗙爜闀垮害: " + (PICKUP_PASSWORD != null ? PICKUP_PASSWORD.length() : "null"));
+            //System.out.println("绯荤粺閰嶇疆鍒濆鍖栧畬鎴�");
+            //System.out.println("绠$悊鍛樺瘑鐮侀暱搴�: " + (ADMIN_PASSWORD != null ? ADMIN_PASSWORD.length() : "null"));
+            //System.out.println("鍙栧崱瀵嗙爜闀垮害: " + (PICKUP_PASSWORD != null ? PICKUP_PASSWORD.length() : "null"));
 
         } catch (Exception e) {
             System.err.println("绯荤粺鍒濆鍖栧紓甯�: " + e.getMessage());
@@ -466,9 +466,6 @@
 	    cardSlotsPanel.removeAll();
 	    slotButtons.clear();
 
-	    int updatedSlots = 0;
-	    int errorSlots = 0;
-
 	    for (int i = 1; i <= TOTAL_SLOTS; i++) {
 	        final int slotId = i;
 	        SlotStatus status = getSlotStatusFromManager(slotId);
@@ -476,10 +473,8 @@
 	        // 娣诲姞璋冭瘯淇℃伅
 	        Fkj slotInfo = slotManager.getSlotInfo(slotId);
 	        if (slotInfo != null) {
-	            updatedSlots++;
 	        } else {
 	            System.err.println("鍗℃Ы " + slotId + " - 鑾峰彇淇℃伅澶辫触");
-	            errorSlots++;
 	        }
 
 	        JButton slotButton = new JButton(String.valueOf(slotId));
@@ -509,7 +504,7 @@
 	    cardSlotsPanel.revalidate();
 	    cardSlotsPanel.repaint();
 	    
-	    System.out.println("鍗℃Ы鏄剧ず鏇存柊瀹屾垚: " + updatedSlots + " 涓垚鍔�, " + errorSlots + " 涓け璐�");
+//	    //System.out.println("鍗℃Ы鏄剧ず鏇存柊瀹屾垚: " + updatedSlots + " 涓垚鍔�, " + errorSlots + " 涓け璐�");
 	}
 
 	private Color brighterColor(Color color) {
@@ -572,7 +567,6 @@
 	            if (panel.getComponentCount() >= 2) {
 	                JLabel textLabel = (JLabel) panel.getComponent(1);
 	                if (textLabel.getText().startsWith("涓插彛:")) {
-	                    String statusText = lunxun.isSerialConnected() ? "姝e父" : "鏂紑";
 	                    Color statusColor = lunxun.isSerialConnected() ? 
 	                        new Color(52, 152, 219) : new Color(231, 76, 60);
 	                    
@@ -591,8 +585,9 @@
 	    boolean pickupSuccess = CardPickupDialog.showCardPickup(this, slotId, status);
 	    
 	    if (pickupSuccess) {
-	        // 鍙栧崱鎴愬姛锛岀晫闈㈠凡缁忓湪瀵硅瘽妗嗕腑鏇存柊锛岃繖閲屼笉闇�瑕侀澶栨搷浣�
-	        System.out.println("鍗℃Ы " + slotId + " 鍙栧崱鎴愬姛");
+	        // 鍙栧崱鎴愬姛锛岃皟鐢╟hanggehaska鏂规硶鏀瑰彉鍗℃Ы灞炴��
+	        SlotManager.changgehaska(slotId, "1"); // "1"琛ㄧず绠$悊鍛樻搷浣�
+	        //System.out.println("鍗℃Ы " + slotId + " 鍙栧崱鎴愬姛锛屽凡鏇存柊鍗℃Ы鐘舵��");
 	    }
 	}
 	
@@ -610,7 +605,7 @@
 		// 鍋滄杞鏌ヨ
 		if (lunxun.isPolling()) {
 			lunxun.stopPolling();
-			System.out.println("搴旂敤绋嬪簭鍏抽棴锛岃疆璇㈡煡璇㈠凡鍋滄");
+			//System.out.println("搴旂敤绋嬪簭鍏抽棴锛岃疆璇㈡煡璇㈠凡鍋滄");
 		}
 		
 		// 鍋滄涓插彛鍗忚瑙f瀽鍣紙鏂板锛�
@@ -637,34 +632,6 @@
 	    return "涓插彛瑙f瀽鍣ㄦ湭鍒濆鍖�";
 	}
 	
-	/**
-	 * 鍒涘缓缇庡寲鎸夐挳
-	 */
-	private JButton createStyledButton(String text, Color color) {
-		JButton button = new JButton(text);
-		button.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
-		button.setBackground(color);
-		button.setForeground(Color.WHITE);
-		button.setFocusPainted(false);
-		button.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
-		button.setCursor(new Cursor(Cursor.HAND_CURSOR));
-
-		// 榧犳爣鎮仠鏁堟灉
-		button.addMouseListener(new java.awt.event.MouseAdapter() {
-			public void mouseEntered(java.awt.event.MouseEvent evt) {
-				button.setBackground(brighterColor(color));
-			}
-
-			public void mouseExited(java.awt.event.MouseEvent evt) {
-				button.setBackground(color);
-			}
-		});
-
-		return button;
-	}
-
-	
-
 	/**
 	 * 楠岃瘉鍙栧崱瀵嗙爜
 	 */
@@ -818,7 +785,7 @@
 	        if (lunxun.checkSerialConnection()) {
 	            boolean resumed = lunxun.setPollingPaused(false);
 	            if (resumed) {
-	                System.out.println("鍒囨崲鍒颁富椤甸潰锛岃疆璇㈡煡璇㈠凡鎭㈠");
+	                //System.out.println("鍒囨崲鍒颁富椤甸潰锛岃疆璇㈡煡璇㈠凡鎭㈠");
 	            }
 	        } else {
 	            System.err.println("鍒囨崲鍒颁富椤甸潰锛屼覆鍙f湭杩炴帴锛屼繚鎸佽疆璇㈡殏鍋�");

--
Gitblit v1.9.3