From 100f4dcea20a32663a07e91525de111f7515eb79 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期五, 21 十一月 2025 17:25:53 +0800
Subject: [PATCH] 可发布版本202517.25

---
 src/xitongshezhi/kuaisuquka.java |  558 ++++++++++++++++++++-----------------------------------
 1 files changed, 200 insertions(+), 358 deletions(-)

diff --git a/src/xitongshezhi/kuaisuquka.java b/src/xitongshezhi/kuaisuquka.java
index 94f2958..a648035 100644
--- a/src/xitongshezhi/kuaisuquka.java
+++ b/src/xitongshezhi/kuaisuquka.java
@@ -1,5 +1,4 @@
 package xitongshezhi;
-
 import javax.swing.*;
 import javax.swing.border.EmptyBorder;
 import java.awt.*;
@@ -10,30 +9,23 @@
 import java.util.List;
 import java.util.Map;
 
-// 鏂板瀵煎叆
-import publicway.OpenDoor;
 import chuankou.Sendmsg;
 import chushihua.SlotManager;
+import home.Fkj;
 
+@SuppressWarnings("serial")
 public class kuaisuquka extends JDialog {
     // 灞忓箷灏哄甯搁噺 - 閫傞厤7瀵哥珫灞�
     private static final int SCREEN_WIDTH = 600;
     private static final int SCREEN_HEIGHT = 1024;
-    // 鏂板锛氳褰曡繘鍏ュ揩閫熷彇鍗¢〉闈㈠墠鐨勮疆璇㈢姸鎬�
-    private boolean wasPollingRunning = false;
-    private boolean wasPollingPaused = false;
+    
     // 棰滆壊甯搁噺
     private static final Color PRIMARY_COLOR = new Color(52, 152, 219);
     private static final Color PRIMARY_DARK_COLOR = new Color(41, 128, 185);
     private static final Color SECONDARY_COLOR = new Color(46, 204, 113);
-    private static final Color DANGER_COLOR = new Color(231, 76, 60);
-    private static final Color WARNING_COLOR = new Color(243, 156, 18);
     private static final Color DARK_COLOR = new Color(15, 28, 48);
-    private static final Color DARK_LIGHT_COLOR = new Color(26, 43, 68);
     private static final Color TEXT_COLOR = new Color(224, 224, 224);
     private static final Color TEXT_LIGHT_COLOR = new Color(160, 200, 255);
-    private static final Color CARD_BG_COLOR = new Color(30, 60, 114, 178);
-    
     // 浼樺寲鐨勯鑹插父閲�
     private static final Color BRIGHT_GREEN = new Color(46, 204, 113);  // 鏈夊崱 - 缁胯壊
     private static final Color DARK_GRAY = new Color(93, 109, 126);     // 鏃犲崱 - 娣辩伆鑹�
@@ -46,16 +38,10 @@
         HAS_CARD("{鍗″彿}", BRIGHT_GREEN),  // 鍗犱綅绗︼紝瀹為檯鏄剧ず鏃朵細鏇挎崲涓哄叿浣撳崱鍙�
         NO_CARD("鏃犲崱", DARK_GRAY);
         
-        private final String displayName;
         private final Color color;
         
         SlotStatus(String displayName, Color color) {
-            this.displayName = displayName;
             this.color = color;
-        }
-        
-        public String getDisplayName() {
-            return displayName;
         }
         
         public Color getColor() {
@@ -72,34 +58,47 @@
     // 缁熻淇℃伅
     private JLabel cardsCountLabel;
     
-    // 浼樺寲鐨勫璇濇绠$悊
-    private JDialog progressDialog;
-    private JProgressBar progressBar;
-    private JLabel progressLabel;
-    private JDialog resultDialog;
-    
     // 鍏变韩鐨勪簨浠剁洃鍚櫒
     private final SlotButtonListener slotButtonListener;
     
-    private SlotManager slotManager;
     private Timer refreshTimer; // 鏂板锛氬埛鏂板畾鏃跺櫒
 
     public kuaisuquka(JFrame parent) {
         super(parent, "蹇�熷彇鍗�", true);
-        slotManager = new SlotManager();
         slotButtons = new ArrayList<>(60);
         slotStatuses = new ArrayList<>(60);
         slotButtonListener = new SlotButtonListener();
         
-        // 璁板綍杩涘叆蹇�熷彇鍗¢〉闈㈠墠鐨勮疆璇㈢姸鎬�
-        recordPollingStateBeforeEntering();
-        
         initializeUI();
         initializeSlots();
-        startAutoRefresh(); // 鏂板锛氬惎鍔ㄨ嚜鍔ㄥ埛鏂�
+        startAutoRefresh();
         
-        // 杩涘叆蹇�熷彇鍗¢〉闈㈡椂鏆傚仠杞
-        pausePollingWhenEntering();
+        // 璋冭瘯淇℃伅
+        //System.out.println("蹇�熷彇鍗¢〉闈㈠垵濮嬪寲瀹屾垚锛屽紑濮嬫樉绀哄崱妲界姸鎬�");
+        debugSlotStatus();
+    }
+    
+    /**
+     * 璋冭瘯鏂规硶锛氭墦鍗板崱妲界姸鎬佷俊鎭�
+     */
+    private void debugSlotStatus() {
+        Fkj[] slotArray = SlotManager.getSlotArray();
+        if (slotArray == null) {
+            //System.out.println("SlotManager.getSlotArray() 杩斿洖 null");
+            return;
+        }
+        
+        //System.out.println("=== 鍗℃Ы鐘舵�佽皟璇曚俊鎭� ===");
+        for (int i = 0; i < Math.min(slotArray.length, 60); i++) {
+            Fkj slot = slotArray[i];
+            if (slot != null) {
+                System.out.printf("鍗℃Ы %d: hasCard=%s, cardNumber=%s%n", 
+                    i + 1, slot.getHasCard(), slot.getCardNumber());
+            } else {
+                System.out.printf("鍗℃Ы %d: null%n", i + 1);
+            }
+        }
+        //System.out.println("======================");
     }
     
     /**
@@ -116,74 +115,113 @@
     }
     
     /**
-     * 浠嶴lotManager鍒锋柊鍗℃Ы鐘舵��
+     * 浠嶴lotManager鍒锋柊鍗℃Ы鐘舵�� - 褰诲簳閲嶅啓鐗堟湰
      */
     private void refreshSlotStatusFromManager() {
         boolean statusChanged = false;
+        Fkj[] slotArray = SlotManager.getSlotArray();
         
-        for (int i = 0; i < 60; i++) {
-            int slotId = i + 1;
-            String hasCardStatus = SlotManager.getSlotHasCardStatus(slotId);
+        if (slotArray == null) {
+            //System.out.println("鍒锋柊鍗℃Ы鐘舵��: slotArray 涓� null");
+            return;
+        }
+        
+        for (int i = 0; i < 60 && i < slotArray.length; i++) {
+            Fkj slotInfo = slotArray[i];
+            if (slotInfo == null) {
+                // 濡傛灉鍗℃Ы淇℃伅涓簄ull锛岃缃负鏃犲崱鐘舵��
+                if (i < slotStatuses.size() && slotStatuses.get(i) != SlotStatus.NO_CARD) {
+                    slotStatuses.set(i, SlotStatus.NO_CARD);
+                    statusChanged = true;
+                }
+                continue;
+            }
             
-            // 妫�鏌ユ槸鍚︽湁鍗″苟涓旀湁鏈夋晥鐨勫崱鍙�
+            String hasCardStatus = slotInfo.getHasCard();
+            String cardNumber = slotInfo.getCardNumber();
+            
+            // 璋冭瘯鍗曚釜鍗℃Ы
+            if (i < 5) { // 鍙墦鍗板墠5涓崱妲界殑璋冭瘯淇℃伅
+                System.out.printf("鍒锋柊鍗℃Ы %d: hasCard=%s, cardNumber=%s%n", 
+                    i + 1, hasCardStatus, cardNumber);
+            }
+            
+            // 绠�鍖栫殑鍒ゆ柇閫昏緫 - 閲嶇偣璋冭瘯
             boolean reallyHasCard = false;
+            
             if ("1".equals(hasCardStatus)) {
-                Fkj slotInfo = slotManager.getSlotInfo(slotId);
-                String cardNumber = slotInfo != null ? slotInfo.getCardNumber() : "-1";
-                // 鍙湁褰撳崱鍙蜂笉鏄�-1銆乶ull涓斾笉涓虹┖鏃讹紝鎵嶈涓虹湡姝f湁鍗�
-                reallyHasCard = !("-1".equals(cardNumber) && cardNumber != null && !cardNumber.trim().isEmpty());
+                // 濡傛灉hasCard涓�"1"锛岃繘涓�姝ユ鏌ュ崱鍙�
+                if (cardNumber != null && !cardNumber.trim().isEmpty()) {
+                    // 鏀惧鏉′欢锛氬彧瑕佸崱鍙蜂笉涓虹┖涓斾笉鏄�"0000"鍜�"-1"锛屽氨璁や负鏈夊崱
+                    reallyHasCard = !"0000".equals(cardNumber) && !"-1".equals(cardNumber);
+                } else {
+                    // 鍗″彿涓簄ull鎴栫┖锛屼絾鏈夊崱鐘舵�佷负1锛屾樉绀轰负鏈夊崱浣嗗崱鍙锋湭鐭�
+                    reallyHasCard = true;
+                }
             }
             
             SlotStatus newStatus = reallyHasCard ? SlotStatus.HAS_CARD : SlotStatus.NO_CARD;
-            SlotStatus currentStatus = slotStatuses.get(i);
             
-            // 妫�鏌ョ姸鎬佹槸鍚﹀彂鐢熷彉鍖�
-            if (newStatus != currentStatus) {
-                slotStatuses.set(i, newStatus);
+            // 纭繚slotStatuses鏈夎冻澶熺殑鍏冪礌
+            if (i >= slotStatuses.size()) {
+                slotStatuses.add(newStatus);
                 statusChanged = true;
+            } else {
+                SlotStatus currentStatus = slotStatuses.get(i);
+                if (newStatus != currentStatus) {
+                    slotStatuses.set(i, newStatus);
+                    statusChanged = true;
+                    
+                    // 璋冭瘯鐘舵�佸彉鍖�
+                    System.out.printf("鍗℃Ы %d 鐘舵�佸彉鍖�: %s -> %s (hasCard=%s, cardNumber=%s)%n",
+                        i + 1, currentStatus, newStatus, hasCardStatus, cardNumber);
+                }
             }
+            
+            // 鏇存柊鎸夐挳鏄剧ず
+            updateSlotButtonDisplay(i, slotInfo, newStatus);
         }
         
-        // 濡傛灉鐘舵�佸彂鐢熷彉鍖栵紝鏇存柊鏄剧ず
+        // 濡傛灉鐘舵�佸彂鐢熷彉鍖栵紝鏇存柊缁熻淇℃伅
         if (statusChanged) {
-            updateCardSlotsDisplay();
             updateStatistics();
-        } else {
-            // 鍗充娇鐘舵�佹病鍙橈紝涔熻妫�鏌ュ崱鍙锋槸鍚︽洿鏂�
-            updateCardSlotsDisplay();
-        }
-    }
-    /**
-     * 璁板綍杩涘叆蹇�熷彇鍗¢〉闈㈠墠鐨勮疆璇㈢姸鎬�
-     */
-    private void recordPollingStateBeforeEntering() {
-        wasPollingRunning = chushihua.lunxun.isPolling();
-        wasPollingPaused = chushihua.lunxun.isPaused();
-        //System.out.println("杩涘叆蹇�熷彇鍗¢〉闈紝璁板綍杞鐘舵�� - 杩愯: " + wasPollingRunning + ", 鏆傚仠: " + wasPollingPaused);
-    }
-    
-    /**
-     * 杩涘叆蹇�熷彇鍗¢〉闈㈡椂鏆傚仠杞
-     */
-    private void pausePollingWhenEntering() {
-        if (chushihua.lunxun.isPolling() && !chushihua.lunxun.isPaused()) {
-            chushihua.lunxun.pausePolling();
-            //System.out.println("杩涘叆蹇�熷彇鍗¢〉闈紝杞宸叉殏鍋�");
         }
     }
     
-    /**
-     * 閫�鍑哄揩閫熷彇鍗¢〉闈㈡椂鎭㈠杞
-     */
-    private void resumePollingWhenExiting() {
-        // 鍙湁杩涘叆蹇�熷彇鍗¢〉闈㈡椂杞鏄繍琛岀姸鎬佷笖鏈鏆傚仠锛屾墠鎭㈠杞
-        if (wasPollingRunning && !wasPollingPaused) {
-            if (chushihua.lunxun.isPolling() && chushihua.lunxun.isPaused()) {
-                chushihua.lunxun.resumePolling();
-                //System.out.println("閫�鍑哄揩閫熷彇鍗¢〉闈紝杞宸叉仮澶�");
+    private void updateSlotButtonDisplay(int index, Fkj slotInfo, SlotStatus status) {
+        if (index < 0 || index >= slotButtons.size()) {
+            return;
+        }
+        
+        JButton slotButton = slotButtons.get(index);
+        
+        // 鏇存柊鎸夐挳鑳屾櫙棰滆壊
+        slotButton.setBackground(status.getColor());
+        
+        // 鏇存柊鐘舵�佹爣绛�
+        Component[] components = slotButton.getComponents();
+        for (Component comp : components) {
+            if (comp instanceof JLabel) {
+                JLabel label = (JLabel) comp;
+                // 鎵惧埌鐘舵�佹爣绛撅紙杈冨皬鐨勫瓧浣擄級
+                if (label.getFont().getSize() == 11) {
+                    String displayText;
+                    if (status == SlotStatus.HAS_CARD) {
+                        // 鏄剧ず瀹為檯鍗″彿锛屽鏋滃崱鍙锋棤鏁堝垯鏄剧ず"鏈夊崱"
+                        String cardNumber = slotInfo.getCardNumber();
+                        if (cardNumber != null && !cardNumber.trim().isEmpty() && 
+                            !"0000".equals(cardNumber) && !"-1".equals(cardNumber)) {
+                            displayText = cardNumber;
+                        } else {
+                            displayText = "鏈夊崱";
+                        }
+                    } else {
+                        displayText = "鏃犲崱";
+                    }
+                    label.setText(displayText);
+                    break;
+                }
             }
-        } else {
-            //System.out.println("閫�鍑哄揩閫熷彇鍗¢〉闈紝淇濇寔鍘熸湁杞鐘舵�� - 杩愯: " + wasPollingRunning + ", 鏆傚仠: " + wasPollingPaused);
         }
     }
     
@@ -285,7 +323,6 @@
         openAllButton.setForeground(Color.WHITE);
         openAllButton.setFocusPainted(false);
         openAllButton.setBorder(BorderFactory.createEmptyBorder(12, 24, 12, 24));
-        openAllButton.setIcon(getCachedIcon("馃毆", 20));
         openAllButton.addActionListener(e -> openAllSlots());
         
         // 娣诲姞鎮仠鏁堟灉
@@ -347,53 +384,98 @@
     }
     
     private void initializeSlots() {
-        // 浠� SlotManager 鑾峰彇鍗℃Ы鐘舵��
-        for (int i = 0; i < 60; i++) {
-            int slotId = i + 1;
-            String hasCardStatus = SlotManager.getSlotHasCardStatus(slotId);
-            
-            // 妫�鏌ユ槸鍚︽湁鍗″苟涓旀湁鏈夋晥鐨勫崱鍙�
-            boolean reallyHasCard = false;
-            if ("1".equals(hasCardStatus)) {
-                Fkj slotInfo = slotManager.getSlotInfo(slotId);
-                String cardNumber = slotInfo != null ? slotInfo.getCardNumber() : "-1";
-                // 鍙湁褰撳崱鍙蜂笉鏄�-1銆乶ull涓斾笉涓虹┖鏃讹紝鎵嶈涓虹湡姝f湁鍗�
-                reallyHasCard = !("-1".equals(cardNumber) && cardNumber != null && !cardNumber.trim().isEmpty());
+        // 娓呯┖鐜版湁鐘舵��
+        slotStatuses.clear();
+        
+        // 鐩存帴浠� SlotManager 鑾峰彇鏈�鏂版暟鎹�
+        Fkj[] slotArray = SlotManager.getSlotArray();
+        
+        //System.out.println("鍒濆鍖栧崱妲界姸鎬侊紝slotArray: " + (slotArray != null ? "闈炵┖" : "绌�"));
+        
+        if (slotArray != null) {
+            for (int i = 0; i < 60 && i < slotArray.length; i++) {
+                Fkj slotInfo = slotArray[i];
+                SlotStatus status = SlotStatus.NO_CARD;
+                
+                if (slotInfo != null) {
+                    String hasCardStatus = slotInfo.getHasCard();
+                    String cardNumber = slotInfo.getCardNumber();
+                    
+                    // 绠�鍖栫殑鍒ゆ柇閫昏緫
+                    boolean reallyHasCard = false;
+                    
+                    if ("1".equals(hasCardStatus)) {
+                        if (cardNumber != null && !cardNumber.trim().isEmpty()) {
+                            reallyHasCard = !"0000".equals(cardNumber) && !"-1".equals(cardNumber);
+                        } else {
+                            // 鍗″彿涓簄ull鎴栫┖锛屼絾鏈夊崱鐘舵�佷负1锛屾樉绀轰负鏈夊崱
+                            reallyHasCard = true;
+                        }
+                    }
+                    
+                    status = reallyHasCard ? SlotStatus.HAS_CARD : SlotStatus.NO_CARD;
+                    
+                    // 璋冭瘯鍓嶅嚑涓崱妲�
+                    if (i < 5) {
+                        System.out.printf("鍒濆鍖栧崱妲� %d: hasCard=%s, cardNumber=%s, 鍒ゆ柇涓�: %s%n",
+                            i + 1, hasCardStatus, cardNumber, status);
+                    }
+                }
+                
+                slotStatuses.add(status);
             }
-            
-            SlotStatus status = reallyHasCard ? SlotStatus.HAS_CARD : SlotStatus.NO_CARD;
-            slotStatuses.add(status);
+        } else {
+            // 濡傛灉slotArray涓簄ull锛屽叏閮ㄥ垵濮嬪寲涓烘棤鍗�
+            //System.out.println("slotArray涓簄ull锛屽叏閮ㄥ垵濮嬪寲涓烘棤鍗�");
+            for (int i = 0; i < 60; i++) {
+                slotStatuses.add(SlotStatus.NO_CARD);
+            }
         }
         
         createCardSlots();
         updateStatistics();
+        
+        // 绔嬪嵆鍒锋柊涓�娆$姸鎬�
+        refreshSlotStatusFromManager();
     }
     
     private void createCardSlots() {
         cardSlotsPanel.removeAll();
         slotButtons.clear();
         
+        Fkj[] slotArray = SlotManager.getSlotArray();
+        
         for (int i = 0; i < 60; i++) {
             final int slotId = i + 1;
-            SlotStatus status = slotStatuses.get(i);
+            
+            // 鑾峰彇褰撳墠鍗℃Ы鐨勫疄闄呯姸鎬�
+            Fkj slotInfo = null;
+            if (slotArray != null && i < slotArray.length) {
+                slotInfo = slotArray[i];
+            }
+            
+            SlotStatus currentStatus = i < slotStatuses.size() ? slotStatuses.get(i) : SlotStatus.NO_CARD;
+            
+            // 鍒涘缓 final 鍓湰鐢ㄤ簬鍐呴儴绫�
+            final SlotStatus finalStatus = currentStatus;
             
             JButton slotButton = new JButton();
             slotButton.setLayout(new BorderLayout());
-            slotButton.setBackground(status.getColor());
+            slotButton.setBackground(currentStatus.getColor());
             slotButton.setForeground(Color.WHITE);
             slotButton.setFocusPainted(false);
             slotButton.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
             
-            // 娣诲姞榧犳爣鎮仠鏁堟灉
+            // 娣诲姞榧犳爣鎮仠鏁堟灉 - 浣跨敤 finalStatus 鑰屼笉鏄� status
             slotButton.addMouseListener(new java.awt.event.MouseAdapter() {
                 public void mouseEntered(java.awt.event.MouseEvent evt) {
-                    if (status == SlotStatus.HAS_CARD) {
-                        slotButton.setBackground(brighterColor(status.getColor()));
+                    if (finalStatus == SlotStatus.HAS_CARD) {
+                        slotButton.setBackground(brighterColor(finalStatus.getColor()));
                     }
                 }
                 
                 public void mouseExited(java.awt.event.MouseEvent evt) {
-                    slotButton.setBackground(status.getColor());
+                    slotButton.setBackground(finalStatus.getColor());
                 }
             });
             
@@ -402,14 +484,16 @@
             slotIdLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 16));
             slotIdLabel.setForeground(Color.WHITE);
             
-            // 鍗℃Ы鐘舵�� - 淇敼锛氭湁鍗℃椂鏄剧ず鍗″彿锛屾棤鍗℃椂鏄剧ず"鏃犲崱"
+            // 鍗℃Ы鐘舵�� - 鏍规嵁瀹為檯鐘舵�佹樉绀�
             String displayText;
-            if (status == SlotStatus.HAS_CARD) {
-                // 浠嶴lotManager鑾峰彇鍗″彿
-                Fkj slotInfo = slotManager.getSlotInfo(slotId);
-                String cardNumber = slotInfo != null ? slotInfo.getCardNumber() : "-1";
-                // 鏄剧ず瀹為檯鍗″彿
-                displayText = cardNumber;
+            if (currentStatus == SlotStatus.HAS_CARD && slotInfo != null) {
+                String cardNumber = slotInfo.getCardNumber();
+                if (cardNumber != null && !cardNumber.trim().isEmpty() && 
+                    !"0000".equals(cardNumber) && !"-1".equals(cardNumber)) {
+                    displayText = cardNumber;
+                } else {
+                    displayText = "鏈夊崱";
+                }
             } else {
                 displayText = "鏃犲崱";
             }
@@ -447,14 +531,7 @@
                     JLabel label = (JLabel) comp;
                     try {
                         int slotId = Integer.parseInt(label.getText());
-                        SlotStatus status = slotStatuses.get(slotId - 1);
-                        
-                        // 濡傛灉鏄湁鍗$姸鎬侊紝鎵ц鍙栧崱鎿嶄綔
-                        if (status == SlotStatus.HAS_CARD) {
-                            takeCard(slotId);
-                        }
-                        // 鍙戦�佸紑闂ㄦ寚浠わ紙涓嶇鏄惁鏈夊崱锛�
-                        sendOpenDoorCommand(slotId);
+                        Sendmsg.opendoorzhiling(slotId,2);
                         break;
                     } catch (NumberFormatException ex) {
                         // 蹇界暐闈炴暟瀛楁爣绛�
@@ -464,249 +541,23 @@
         }
     }
     
-    // 鏂板鏂规硶锛氬彂閫佸崟涓崱妲藉紑闂ㄦ寚浠�
-    private void sendOpenDoorCommand(int slotId) {
-        try {
-            // 鐢熸垚寮�闂ㄦ寚浠�
-            String command = OpenDoor.openOneDoor(slotId, OpenDoor.TYPE_ADMIN);
-            
-            // 鍙戦�佷覆鍙f寚浠�
-            boolean sent = Sendmsg.sendMessage(command);
-            
-            if (sent) {
-                //System.out.println("鎴愬姛鍙戦�佸紑闂ㄦ寚浠ゅ埌鍗℃Ы " + slotId);
-            } else {
-                System.err.println("鍙戦�佸紑闂ㄦ寚浠ゅ埌鍗℃Ы " + slotId + " 澶辫触");
-            }
-        } catch (Exception e) {
-            System.err.println("鐢熸垚寮�闂ㄦ寚浠ゅけ璐�: " + e.getMessage());
-            e.printStackTrace();
-        }
-    }
-    
-    private void takeCard(int slotId) {
-        int index = slotId - 1;
-        
-        // 鏇存柊鍗℃Ы鐘舵�佷负鏃犲崱
-        slotStatuses.set(index, SlotStatus.NO_CARD);
-        
-        // 璋冪敤 SlotManager 鐨刢hanggehaska鏂规硶鏇存柊鐘舵��
-        SlotManager.changgehaska(slotId, "1"); // "1"琛ㄧず绠$悊鍛樻搷浣�
-        
-        updateCardSlotsDisplay();
-        updateStatistics();
-    }
-    
-    // 浼樺寲鐨勫崱妲芥樉绀烘洿鏂�
- // 淇敼鏇存柊鍗℃Ы鏄剧ず鐨勬柟娉�
-    private void updateCardSlotsDisplay() {
-        for (int i = 0; i < 60; i++) {
-            JButton slotButton = slotButtons.get(i);
-            SlotStatus status = slotStatuses.get(i);
-            
-            // 鍙洿鏂版敼鍙樼殑鐘舵��
-            if (!slotButton.getBackground().equals(status.getColor())) {
-                slotButton.setBackground(status.getColor());
-            }
-            
-            // 鏇存柊鐘舵�佹爣绛� - 淇敼锛氭湁鍗℃椂鏄剧ず鍗″彿锛屾棤鍗℃椂鏄剧ず"鏃犲崱"
-            Component[] components = slotButton.getComponents();
-            for (Component comp : components) {
-                if (comp instanceof JLabel) {
-                    JLabel label = (JLabel) comp;
-                    // 鎵惧埌鐘舵�佹爣绛撅紙杈冨皬鐨勫瓧浣擄級
-                    if (label.getFont().getSize() == 11) {
-                        String displayText;
-                        if (status == SlotStatus.HAS_CARD) {
-                            // 浠嶴lotManager鑾峰彇鍗″彿
-                            Fkj slotInfo = slotManager.getSlotInfo(i + 1);
-                            String cardNumber = slotInfo != null ? slotInfo.getCardNumber() : "-1";
-                            // 鏄剧ず瀹為檯鍗″彿
-                            displayText = cardNumber;
-                        } else {
-                            displayText = "鏃犲崱";
-                        }
-                        label.setText(displayText);
-                        break;
-                    }
-                }
-            }
-        }
-        
-        cardSlotsPanel.revalidate();
-        cardSlotsPanel.repaint();
-    }
-    
-    private void openAllSlots() {
-        int openedCount = 0;
-        
-        // 鏇存柊鎵�鏈夋湁鍗″崱妲戒负鏃犲崱
-        for (int i = 0; i < slotStatuses.size(); i++) {
-            if (slotStatuses.get(i) == SlotStatus.HAS_CARD) {
-                slotStatuses.set(i, SlotStatus.NO_CARD);
-                // 璋冪敤 SlotManager 鐨刢hanggehaska鏂规硶鏇存柊鐘舵��
-                SlotManager.changgehaska(i + 1, "1"); // "1"琛ㄧず绠$悊鍛樻搷浣�
-                openedCount++;
-            }
-        }
-        
-        if (openedCount > 0) {
-            updateCardSlotsDisplay();
-            updateStatistics();
-        }
-        
-        // 淇敼锛氱洿鎺ヨ皟鐢ㄤ覆鍙e彂閫佹柟娉曪紝涓嶆樉绀鸿繘搴﹀璇濇
-        openAllSlotsWithSerialCommands(openedCount);
-    }
-    
-    // 鏂板鏂规硶锛氶�氳繃涓插彛鍙戦�佸紑闂ㄦ寚浠�
-    private void openAllSlotsWithSerialCommands(int openedCount) {
-        // 淇敼锛氱洿鎺ヨ皟鐢∣penDoor鐨勫紓姝ュ紑闂ㄦ柟娉曪紝涓嶆樉绀鸿繘搴﹀璇濇
-        OpenDoor.openAllSlotsAsync(60, 250, OpenDoor.TYPE_ADMIN, new OpenDoor.OpenDoorCallback() {
-            @Override
-            public void onProgress(int currentSlot, int totalSlots, String command) {
-                // 鍙戦�佷覆鍙f寚浠�
-                boolean sent = Sendmsg.sendMessage(command);
-                if (!sent) {
-                    System.err.println("鍙戦�佹寚浠ゅけ璐�: " + command);
-                }
-            }
-            
-            @Override
-            public void onComplete(String[] commands) {
-                SwingUtilities.invokeLater(() -> {
-                    String message;
-                    if (openedCount > 0) {
-                        message = "宸叉垚鍔熸墦寮�鍏ㄩ儴 " + openedCount + " 涓湁鍗″崱妲絓n鍙戦�佷簡 " + commands.length + " 鏉″紑闂ㄦ寚浠�";
-                    } else {
-                        message = "宸插彂閫� " + commands.length + " 鏉″紑闂ㄦ寚浠ゅ埌鎵�鏈夊崱妲�";
-                    }
-                    showResultDialog("success", "鎿嶄綔鎴愬姛", message);
-                });
-            }
-            
-            @Override
-            public void onError(Exception error) {
-                SwingUtilities.invokeLater(() -> {
-                    showResultDialog("error", "鎿嶄綔澶辫触", 
-                        "鍙戦�佸紑闂ㄦ寚浠ゆ椂鍙戠敓閿欒: " + error.getMessage());
-                    error.printStackTrace();
-                });
-            }
-        });
+    private void openAllSlots() {        
+        Sendmsg.openAllSlots(2);       
     }
     
     // 浼樺寲鐨勭粺璁¤绠�
     private void updateStatistics() {
         int hasCardCount = 0;
-        for (SlotStatus status : slotStatuses) {
-            if (status == SlotStatus.HAS_CARD) {
+        for (int i = 0; i < 60 && i < slotStatuses.size(); i++) {
+            if (slotStatuses.get(i) == SlotStatus.HAS_CARD) {
                 hasCardCount++;
             }
         }
         
         cardsCountLabel.setText("鏈夊崱: " + hasCardCount + "/60");
-    }
-    
-    // 浼樺寲鐨勭粨鏋滃璇濇鏄剧ず
-    private void showResultDialog(String type, String title, String message) {
-        if (resultDialog == null) {
-            createResultDialog();
-        }
-        updateResultDialog(type, title, message);
-        resultDialog.setVisible(true);
-    }
-    
-    private void createResultDialog() {
-        resultDialog = new JDialog(this, "", true);
-        resultDialog.setSize(400, 250);
-        resultDialog.setLocationRelativeTo(this);
-        resultDialog.setResizable(false);
-        resultDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
         
-        JPanel contentPanel = new JPanel();
-        contentPanel.setLayout(new BorderLayout());
-        contentPanel.setBorder(new EmptyBorder(25, 25, 25, 25));
-        contentPanel.setBackground(DARK_LIGHT_COLOR);
-        
-        // 鍥炬爣鍜屾爣棰�
-        JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-        headerPanel.setOpaque(false);
-        
-        JLabel iconLabel = new JLabel();
-        iconLabel.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 32));
-        
-        JLabel titleLabel = new JLabel();
-        titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 20));
-        titleLabel.setForeground(TEXT_COLOR);
-        
-        headerPanel.add(iconLabel);
-        headerPanel.add(Box.createRigidArea(new Dimension(10, 0)));
-        headerPanel.add(titleLabel);
-        
-        // 娑堟伅鍐呭
-        JLabel messageLabel = new JLabel();
-        messageLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
-        messageLabel.setForeground(TEXT_LIGHT_COLOR);
-        messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
-        messageLabel.setBorder(new EmptyBorder(15, 0, 25, 0));
-        
-        // 纭畾鎸夐挳
-        JButton confirmButton = new JButton("纭畾");
-        confirmButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
-        confirmButton.setBackground(SECONDARY_COLOR);
-        confirmButton.setForeground(Color.WHITE);
-        confirmButton.setFocusPainted(false);
-        confirmButton.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30));
-        confirmButton.addActionListener(e -> resultDialog.dispose());
-        
-        // 娣诲姞鎮仠鏁堟灉
-        confirmButton.addMouseListener(new java.awt.event.MouseAdapter() {
-            public void mouseEntered(java.awt.event.MouseEvent evt) {
-                confirmButton.setBackground(brighterColor(SECONDARY_COLOR));
-            }
-            
-            public void mouseExited(java.awt.event.MouseEvent evt) {
-                confirmButton.setBackground(SECONDARY_COLOR);
-            }
-        });
-        
-        JPanel buttonPanel = new JPanel();
-        buttonPanel.setOpaque(false);
-        buttonPanel.add(confirmButton);
-        
-        contentPanel.add(headerPanel, BorderLayout.NORTH);
-        contentPanel.add(messageLabel, BorderLayout.CENTER);
-        contentPanel.add(buttonPanel, BorderLayout.SOUTH);
-        
-        resultDialog.add(contentPanel);
-    }
-    
-    private void updateResultDialog(String type, String title, String message) {
-        resultDialog.setTitle(title);
-        
-        Component[] components = ((JPanel)resultDialog.getContentPane().getComponent(0)).getComponents();
-        
-        // 鏇存柊鍥炬爣鍜屾爣棰�
-        JPanel headerPanel = (JPanel) components[0];
-        JLabel iconLabel = (JLabel) headerPanel.getComponent(0);
-        JLabel titleLabel = (JLabel) headerPanel.getComponent(2);
-        
-        if ("success".equals(type)) {
-            iconLabel.setText("鉁�");
-        } else if ("warning".equals(type)) {
-            iconLabel.setText("鈿狅笍");
-        } else if ("error".equals(type)) {
-            iconLabel.setText("鉂�");
-        } else {
-            iconLabel.setText("鈩癸笍");
-        }
-        
-        titleLabel.setText(title);
-        
-        // 鏇存柊娑堟伅
-        JLabel messageLabel = (JLabel) components[1];
-        messageLabel.setText("<html><div style='text-align: center;'>" + message.replace("\n", "<br>") + "</div></html>");
+        // 璋冭瘯缁熻淇℃伅
+        //System.out.println("鏇存柊缁熻淇℃伅: 鏈夊崱 " + hasCardCount + "/60");
     }
     
     private Color brighterColor(Color color) {
@@ -756,19 +607,10 @@
         if (slotStatuses != null) {
             slotStatuses.clear();
         }
-        if (progressDialog != null) {
-            progressDialog.dispose();
-            progressDialog = null;
-        }
-        if (resultDialog != null) {
-            resultDialog.dispose();
-            resultDialog = null;
-        }
-        
-        // 鎭㈠杞鐘舵��
-        resumePollingWhenExiting();
         
         super.dispose();
+        
+        //System.out.println("蹇�熷彇鍗¢〉闈㈠凡鍏抽棴");
     }
     
     // 闈欐�佹柟娉曪細浠庣郴缁熻缃〉闈㈣皟鐢�

--
Gitblit v1.9.3