From ef78717c5b956a26b360de44f774fc2b804296c2 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期四, 20 十一月 2025 20:56:36 +0800
Subject: [PATCH] 修改20251120

---
 src/home/Homein.java |   62 +++++++++++++++---------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/home/Homein.java b/src/home/Homein.java
index 4a9fe73..cecbe3d 100644
--- a/src/home/Homein.java
+++ b/src/home/Homein.java
@@ -7,6 +7,8 @@
 import chushihua.Chushihua;
 import chushihua.SlotManager;
 import chushihua.lunxun;
+import chushihua.lunxunzaixian;
+import jiekou.lunxunkazhuangtai;
 
 public class Homein {
     public static void main(String[] args) {
@@ -47,23 +49,23 @@
      */
     private static boolean initializeSystem() {
         try {
-            System.out.println("寮�濮嬬郴缁熷垵濮嬪寲娴佺▼...");
+            //System.out.println("寮�濮嬬郴缁熷垵濮嬪寲娴佺▼...");
             
             // 1. 杩愯绯荤粺鍒濆鍖栫被 Chushihua
-            System.out.println("姝ラ1: 鍒濆鍖栫郴缁熼厤缃�...");
+            //System.out.println("姝ラ1: 鍒濆鍖栫郴缁熼厤缃�...");
             if (!initializeChushihua()) {
                 System.err.println("绯荤粺閰嶇疆鍒濆鍖栧け璐�");
                 return false;
             }
             
             // 2. 鍒濆鍖� SlotManager 绫�
-            System.out.println("姝ラ2: 鍒濆鍖栧崱妲界鐞嗗櫒...");
+            //System.out.println("姝ラ2: 鍒濆鍖栧崱妲界鐞嗗櫒...");
             if (!initializeSlotManager()) {
                 System.err.println("鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲澶辫触");
                 return false;
             }
             
-            System.out.println("绯荤粺鍒濆鍖栧畬鎴�");
+            //System.out.println("绯荤粺鍒濆鍖栧畬鎴�");
             return true;
             
         } catch (Exception e) {
@@ -82,11 +84,11 @@
             boolean success = configSystem.initialize();
             
             if (success) {
-                System.out.println("鉁� 绯荤粺閰嶇疆鍒濆鍖栨垚鍔�");
-                System.out.println("  璁惧缂栧彿: " + configSystem.getMachineConfig().getMachineId());
-                System.out.println("  鍗℃Ы鎬绘暟: " + configSystem.getMachineConfig().getTotalSlots());
-                System.out.println("  杞闂撮殧: " + configSystem.getMachineConfig().getPollingInterval() + "ms");
-                System.out.println("  娉㈢壒鐜�: " + configSystem.getMachineConfig().getBaudrate());
+                //System.out.println("鉁� 绯荤粺閰嶇疆鍒濆鍖栨垚鍔�");
+                //System.out.println("  璁惧缂栧彿: " + configSystem.getMachineConfig().getMachineId());
+                //System.out.println("  鍗℃Ы鎬绘暟: " + configSystem.getMachineConfig().getTotalSlots());
+                //System.out.println("  杞闂撮殧: " + configSystem.getMachineConfig().getPollingInterval() + "ms");
+                //System.out.println("  娉㈢壒鐜�: " + configSystem.getMachineConfig().getBaudrate());
             } else {
                 System.err.println("鉁� 绯荤粺閰嶇疆鍒濆鍖栧け璐�");
             }
@@ -106,8 +108,8 @@
         try {
             // SlotManager 浼氬湪鏋勯�犲嚱鏁颁腑鑷姩鍒濆鍖栨墍鏈夊崱妲�
             SlotManager slotManager = new SlotManager();
-            System.out.println("鉁� 鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲鎴愬姛");
-            System.out.println("  鎬诲崱妲芥暟: " + slotManager.getTotalSlots());
+            //System.out.println("鉁� 鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲鎴愬姛");
+            //System.out.println("  鎬诲崱妲芥暟: " + slotManager.getTotalSlots());
             
             return true;
             
@@ -121,22 +123,20 @@
      * 鍚姩搴旂敤绋嬪簭涓绘祦绋�
      */
     private static void startApplication() {
-        try {
-            System.out.println("寮�濮嬪簲鐢ㄧ▼搴忎富娴佺▼...");
-            
+        try {                       
             // 3. 杩愯涓插彛杩炴帴瀵硅瘽妗嗭紝绛夊緟涓插彛杩炴帴鎴愬姛
-            System.out.println("姝ラ3: 鍚姩涓插彛杩炴帴...");
             boolean serialConnected = initializeSerialPort();
             
             if (serialConnected) {
                 // 4. 涓插彛杩炴帴鎴愬姛鍚庯紝鍚姩杞
-                System.out.println("姝ラ4: 鍚姩杞鏌ヨ...");
                 boolean pollingStarted = startPollingService();
                 
                 if (pollingStarted) {
-                    // 5. 杩涘叆涓荤晫闈�
-                    System.out.println("姝ラ5: 鍚姩涓荤晫闈�...");
                     showMainInterface();
+                    //鍚姩杞鍗$姸鎬佺粰鏈嶅姟鍣ㄥ彂鏁版嵁
+                    lunxunkazhuangtai.startPolling();
+                    //鍚姩鍦ㄧ嚎鐨勫崱鐘舵�佽疆璇�
+                    lunxunzaixian.startOnlinePolling();
                 } else {
                     System.err.println("杞鏈嶅姟鍚姩澶辫触");
                     JOptionPane.showMessageDialog(null, 
@@ -166,17 +166,17 @@
      */
     private static boolean initializeSerialPort() {
         try {
-            System.out.println("姝e湪鎵撳紑涓插彛杩炴帴瀵硅瘽妗�...");
+            //System.out.println("姝e湪鎵撳紑涓插彛杩炴帴瀵硅瘽妗�...");
             
             // 鏄剧ず涓插彛杩炴帴瀵硅瘽妗嗭紙妯℃�佸璇濇锛屼細闃诲鐩村埌鐢ㄦ埛鎿嶄綔锛�
             // 鐢ㄦ埛蹇呴』鐐瑰嚮"杩炴帴涓插彛"鎸夐挳鎵嶄細瀹為檯杩炴帴
             boolean connected = SerialPortConnectionDialog.showConnectionDialog(null);
             
             if (connected) {
-                System.out.println("鉁� 涓插彛杩炴帴鎴愬姛");
+                //System.out.println("鉁� 涓插彛杩炴帴鎴愬姛");
                 return true;
             } else {
-                System.out.println("鉁� 涓插彛杩炴帴澶辫触鎴栫敤鎴峰彇娑�");
+                //System.out.println("鉁� 涓插彛杩炴帴澶辫触鎴栫敤鎴峰彇娑�");
                 // 娣诲姞璇︾粏閿欒淇℃伅
                 JOptionPane.showMessageDialog(null, 
                     "涓插彛杩炴帴澶辫触锛岃妫�鏌ヤ覆鍙h澶囨槸鍚﹀彲鐢�", 
@@ -211,7 +211,7 @@
             boolean started = lunxun.startPolling();
             
             if (started) {
-                System.out.println("鉁� 杞鏌ヨ鍚姩鎴愬姛");
+                //System.out.println("鉁� 杞鏌ヨ鍚姩鎴愬姛");
                 return true;
             } else {
                 System.err.println("鉁� 杞鏌ヨ鍚姩澶辫触");
@@ -229,11 +229,11 @@
      */
     private static void showMainInterface() {
         try {
-            System.out.println("姝e湪鍒涘缓涓荤晫闈�...");
+            //System.out.println("姝e湪鍒涘缓涓荤晫闈�...");
             
             // 纭繚杞鏈嶅姟宸插惎鍔�
             if (!lunxun.isPolling()) {
-                System.out.println("鍚姩杞鏈嶅姟...");
+                //System.out.println("鍚姩杞鏈嶅姟...");
                 startPollingService();
             }
             
@@ -241,8 +241,8 @@
             CardMachineUI mainUI = new CardMachineUI();
             mainUI.setVisible(true);
             
-            System.out.println("鉁� 涓荤晫闈㈠惎鍔ㄦ垚鍔�");
-            System.out.println("搴旂敤绋嬪簭鍚姩瀹屾垚锛岃繘鍏ユ甯歌繍琛岀姸鎬�");
+            //System.out.println("鉁� 涓荤晫闈㈠惎鍔ㄦ垚鍔�");
+            //System.out.println("搴旂敤绋嬪簭鍚姩瀹屾垚锛岃繘鍏ユ甯歌繍琛岀姸鎬�");
             
             // 娣诲姞鍏抽棴閽╁瓙锛岀‘淇濆簲鐢ㄧ▼搴忛��鍑烘椂姝g‘娓呯悊璧勬簮
             addShutdownHook(mainUI);
@@ -263,26 +263,26 @@
      */
     private static void addShutdownHook(CardMachineUI mainUI) {
         Runtime.getRuntime().addShutdownHook(new Thread(() -> {
-            System.out.println("搴旂敤绋嬪簭姝e湪鍏抽棴锛屾墽琛屾竻鐞嗘搷浣�...");
+            //System.out.println("搴旂敤绋嬪簭姝e湪鍏抽棴锛屾墽琛屾竻鐞嗘搷浣�...");
             
             try {
                 // 鍋滄杞鏌ヨ
                 if (lunxun.isPolling()) {
-                    System.out.println("鍋滄杞鏌ヨ...");
+                    //System.out.println("鍋滄杞鏌ヨ...");
                     lunxun.stopPolling();
                 }
                 
                 // 鍏抽棴绯荤粺閰嶇疆
-                System.out.println("鍏抽棴绯荤粺閰嶇疆...");
+                //System.out.println("鍏抽棴绯荤粺閰嶇疆...");
                 Chushihua.getInstance().shutdown();
                 
                 // 鍏抽棴涓荤晫闈㈣祫婧�
                 if (mainUI != null) {
-                    System.out.println("鍏抽棴涓荤晫闈㈣祫婧�...");
+                    //System.out.println("鍏抽棴涓荤晫闈㈣祫婧�...");
                     mainUI.dispose();
                 }
                 
-                System.out.println("搴旂敤绋嬪簭鍏抽棴瀹屾垚");
+                //System.out.println("搴旂敤绋嬪簭鍏抽棴瀹屾垚");
                 
             } catch (Exception e) {
                 System.err.println("搴旂敤绋嬪簭鍏抽棴杩囩▼涓彂鐢熷紓甯�: " + e.getMessage());

--
Gitblit v1.9.3