From a6077217e25f5804027194a5c2848e773eda1abd Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期五, 21 十一月 2025 15:47:17 +0800
Subject: [PATCH] 修改
---
bin/xitongshezhi/ConfigSet.class | 0
bin/publicway/ProtocolParser01$FaultType.class | 0
bin/home/CardMachineUI.class | 0
bin/xitongshezhi/ConfigSet$2.class | 0
err.properties | 4
bin/publicway/SerialProtocolParser.class | 0
bin/chushihua/SlotManager.class | 0
.settings/org.eclipse.core.resources.prefs | 3
bin/xitongshezhi/kuaisuquka$3.class | 0
bin/xitongshezhi/lishijilu.class | 0
src/chushihua/SlotManager.java | 15
src/xitongshezhi/SystemDebugDialog.java | 82
bin/xitongshezhi/kacaoguanli$3.class | 0
src/publicway/OpenDoor.java | 4
src/publicway/ProtocolParser01.java | 37
bin/publicway/ProtocolParser01$CardStatus.class | 0
bin/xitongshezhi/kacaoguanli$4.class | 0
bin/publicway/ProtocolParser01$WorkStatus.class | 0
bin/publicway/ProtocolParser01$ParseResultPool.class | 0
bin/publicway/ProtocolParser01$ParseResult.class | 0
bin/publicway/ProtocolParser01.class | 0
bin/xitongshezhi/kuaisuquka$SlotButtonListener.class | 0
src/dialog/Errlog.java | 17
bin/chushihua/lunxun$PollingTask.class | 0
bin/chuankou/SerialPortService.class | 0
src/home/CardMachineUI.java | 66 +
bin/xitongshezhi/kuaisuquka$2.class | 0
src/dialog/Charulog.java | 13
src/jiekou/lunxunkazhuangtai.java | 3
bin/home/CardMachineUI$1.class | 0
bin/xitongshezhi/kacaoguanli$CustomTableCellRenderer.class | 0
bin/xitongshezhi/ConfigSet$MenuItemListener.class | 0
bin/xitongshezhi/kacaoguanli$5.class | 0
src/xitongshezhi/kuaisuquka.java | 223 ---
bin/chushihua/Chushihua.class | 0
bin/xitongshezhi/lishijilu$1.class | 0
bin/xitongshezhi/kacaoguanli$1.class | 0
src/chuankou/Sendmsg.java | 99 +
bin/xitongshezhi/kuaisuquka.class | 0
src/xitongshezhi/lishijilu.java | 306 ++++
bin/.gitignore | 1
src/home/Homein.java | 11
bin/xitongshezhi/kuaisuquka$SlotStatus.class | 0
src/chuankou/SerialPortService.java | 118 +
src/dialog/Dingshidialog.java | 45
bin/chuankou/Sendmsg.class | 0
log.properties | 204 +++
src/xitongshezhi/ConfigSet.java | 77 +
bin/xitongshezhi/ConfigSet$1.class | 0
bin/home/CardMachineUI$SlotStatus.class | 0
bin/xitongshezhi/kuaisuquka$1.class | 0
bin/xitongshezhi/ConfigSet$3.class | 0
bin/home/Homein.class | 0
src/chushihua/Chushihua.java | 17
bin/publicway/ProtocolParser01$DoorStatus.class | 0
config.properties | 3
/dev/null | 506 ---------
bin/xitongshezhi/kuaisuquka$4.class | 0
src/chushihua/lunxun.java | 1386 +++++++++++++-----------
bin/xitongshezhi/kacaoguanli.class | 0
src/publicway/SerialProtocolParser.java | 35
bin/chushihua/lunxun.class | 0
bin/xitongshezhi/kacaoguanli$StatusInfo.class | 0
src/home/Fkj.java | 2
bin/xitongshezhi/kacaoguanli$2.class | 0
src/xitongshezhi/kacaoguanli.java | 1
66 files changed, 1,675 insertions(+), 1,603 deletions(-)
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
index 2a67676..e6f20c7 100644
--- a/.settings/org.eclipse.core.resources.prefs
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -3,4 +3,5 @@
encoding//src/publicway/ProtocolParser01.java=GBK
encoding//src/publicway/ProtocolParser51.java=GBK
encoding//src/publicway/SerialProtocolParser.java=UTF-8
-encoding/log.properties=GBK
+encoding/err.properties=utf8
+encoding/log.properties=UTF8
diff --git a/bin/.gitignore b/bin/.gitignore
index 419602a..191f907 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -4,3 +4,4 @@
/xitongshezhi/
/chuankou/
/publicway/
+/dialog/
diff --git a/bin/chuankou/Sendmsg.class b/bin/chuankou/Sendmsg.class
index 9ae930b..8841258 100644
--- a/bin/chuankou/Sendmsg.class
+++ b/bin/chuankou/Sendmsg.class
Binary files differ
diff --git a/bin/chuankou/SerialPortService.class b/bin/chuankou/SerialPortService.class
index 0f128ec..2f2422e 100644
--- a/bin/chuankou/SerialPortService.class
+++ b/bin/chuankou/SerialPortService.class
Binary files differ
diff --git a/bin/chushihua/Chushihua.class b/bin/chushihua/Chushihua.class
index 7d327f2..fb221bd 100644
--- a/bin/chushihua/Chushihua.class
+++ b/bin/chushihua/Chushihua.class
Binary files differ
diff --git a/bin/chushihua/SlotManager.class b/bin/chushihua/SlotManager.class
index c660f1b..e8e3056 100644
--- a/bin/chushihua/SlotManager.class
+++ b/bin/chushihua/SlotManager.class
Binary files differ
diff --git a/bin/chushihua/lunxun$PollingTask.class b/bin/chushihua/lunxun$PollingTask.class
index f685c69..25a471d 100644
--- a/bin/chushihua/lunxun$PollingTask.class
+++ b/bin/chushihua/lunxun$PollingTask.class
Binary files differ
diff --git a/bin/chushihua/lunxun.class b/bin/chushihua/lunxun.class
index 2f8cacf..4886da2 100644
--- a/bin/chushihua/lunxun.class
+++ b/bin/chushihua/lunxun.class
Binary files differ
diff --git a/bin/home/CardMachineUI$1.class b/bin/home/CardMachineUI$1.class
index b974ee2..3663706 100644
--- a/bin/home/CardMachineUI$1.class
+++ b/bin/home/CardMachineUI$1.class
Binary files differ
diff --git a/bin/home/CardMachineUI$SlotStatus.class b/bin/home/CardMachineUI$SlotStatus.class
index ad60bf5..69e2e99 100644
--- a/bin/home/CardMachineUI$SlotStatus.class
+++ b/bin/home/CardMachineUI$SlotStatus.class
Binary files differ
diff --git a/bin/home/CardMachineUI.class b/bin/home/CardMachineUI.class
index a818ec0..3340287 100644
--- a/bin/home/CardMachineUI.class
+++ b/bin/home/CardMachineUI.class
Binary files differ
diff --git a/bin/home/Homein.class b/bin/home/Homein.class
index e2e5dc8..871b789 100644
--- a/bin/home/Homein.class
+++ b/bin/home/Homein.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$CardStatus.class b/bin/publicway/ProtocolParser01$CardStatus.class
index 3e78a0b..70ece56 100644
--- a/bin/publicway/ProtocolParser01$CardStatus.class
+++ b/bin/publicway/ProtocolParser01$CardStatus.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$DoorStatus.class b/bin/publicway/ProtocolParser01$DoorStatus.class
index 8dddec2..4e51f5a 100644
--- a/bin/publicway/ProtocolParser01$DoorStatus.class
+++ b/bin/publicway/ProtocolParser01$DoorStatus.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$FaultType.class b/bin/publicway/ProtocolParser01$FaultType.class
index ea11a28..1e2f890 100644
--- a/bin/publicway/ProtocolParser01$FaultType.class
+++ b/bin/publicway/ProtocolParser01$FaultType.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$ParseResult.class b/bin/publicway/ProtocolParser01$ParseResult.class
index 4f78fd2..be6e6af 100644
--- a/bin/publicway/ProtocolParser01$ParseResult.class
+++ b/bin/publicway/ProtocolParser01$ParseResult.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$ParseResultPool.class b/bin/publicway/ProtocolParser01$ParseResultPool.class
index 5ab9cd1..cc4dacc 100644
--- a/bin/publicway/ProtocolParser01$ParseResultPool.class
+++ b/bin/publicway/ProtocolParser01$ParseResultPool.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01$WorkStatus.class b/bin/publicway/ProtocolParser01$WorkStatus.class
index 66c075e..7a1e9fa 100644
--- a/bin/publicway/ProtocolParser01$WorkStatus.class
+++ b/bin/publicway/ProtocolParser01$WorkStatus.class
Binary files differ
diff --git a/bin/publicway/ProtocolParser01.class b/bin/publicway/ProtocolParser01.class
index ce3015e..1163f05 100644
--- a/bin/publicway/ProtocolParser01.class
+++ b/bin/publicway/ProtocolParser01.class
Binary files differ
diff --git a/bin/publicway/SerialProtocolParser.class b/bin/publicway/SerialProtocolParser.class
index 1992833..79d819d 100644
--- a/bin/publicway/SerialProtocolParser.class
+++ b/bin/publicway/SerialProtocolParser.class
Binary files differ
diff --git a/bin/xitongshezhi/ConfigSet$1.class b/bin/xitongshezhi/ConfigSet$1.class
index 8abaab9..eeaa6aa 100644
--- a/bin/xitongshezhi/ConfigSet$1.class
+++ b/bin/xitongshezhi/ConfigSet$1.class
Binary files differ
diff --git a/bin/xitongshezhi/ConfigSet$2.class b/bin/xitongshezhi/ConfigSet$2.class
index 418e4b0..916db2f 100644
--- a/bin/xitongshezhi/ConfigSet$2.class
+++ b/bin/xitongshezhi/ConfigSet$2.class
Binary files differ
diff --git a/bin/xitongshezhi/ConfigSet$3.class b/bin/xitongshezhi/ConfigSet$3.class
index 4b554ed..834423e 100644
--- a/bin/xitongshezhi/ConfigSet$3.class
+++ b/bin/xitongshezhi/ConfigSet$3.class
Binary files differ
diff --git a/bin/xitongshezhi/ConfigSet$MenuItemListener.class b/bin/xitongshezhi/ConfigSet$MenuItemListener.class
index 9334df6..d65bd1d 100644
--- a/bin/xitongshezhi/ConfigSet$MenuItemListener.class
+++ b/bin/xitongshezhi/ConfigSet$MenuItemListener.class
Binary files differ
diff --git a/bin/xitongshezhi/ConfigSet.class b/bin/xitongshezhi/ConfigSet.class
index 70b313f..4f462fb 100644
--- a/bin/xitongshezhi/ConfigSet.class
+++ b/bin/xitongshezhi/ConfigSet.class
Binary files differ
diff --git a/bin/xitongshezhi/Fkj.class b/bin/xitongshezhi/Fkj.class
deleted file mode 100644
index 425ee99..0000000
--- a/bin/xitongshezhi/Fkj.class
+++ /dev/null
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$1.class b/bin/xitongshezhi/kacaoguanli$1.class
index 12b4614..b0a7ec3 100644
--- a/bin/xitongshezhi/kacaoguanli$1.class
+++ b/bin/xitongshezhi/kacaoguanli$1.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$2.class b/bin/xitongshezhi/kacaoguanli$2.class
index c445a1a..a1fe49e 100644
--- a/bin/xitongshezhi/kacaoguanli$2.class
+++ b/bin/xitongshezhi/kacaoguanli$2.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$3.class b/bin/xitongshezhi/kacaoguanli$3.class
index 6045c94..9367838 100644
--- a/bin/xitongshezhi/kacaoguanli$3.class
+++ b/bin/xitongshezhi/kacaoguanli$3.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$4.class b/bin/xitongshezhi/kacaoguanli$4.class
index 327db6c..d3d9d1c 100644
--- a/bin/xitongshezhi/kacaoguanli$4.class
+++ b/bin/xitongshezhi/kacaoguanli$4.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$5.class b/bin/xitongshezhi/kacaoguanli$5.class
index 8bf53c7..ba1bd13 100644
--- a/bin/xitongshezhi/kacaoguanli$5.class
+++ b/bin/xitongshezhi/kacaoguanli$5.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$CustomTableCellRenderer.class b/bin/xitongshezhi/kacaoguanli$CustomTableCellRenderer.class
index fa646f8..5790bc8 100644
--- a/bin/xitongshezhi/kacaoguanli$CustomTableCellRenderer.class
+++ b/bin/xitongshezhi/kacaoguanli$CustomTableCellRenderer.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli$StatusInfo.class b/bin/xitongshezhi/kacaoguanli$StatusInfo.class
index 52b2ad6..fee6799 100644
--- a/bin/xitongshezhi/kacaoguanli$StatusInfo.class
+++ b/bin/xitongshezhi/kacaoguanli$StatusInfo.class
Binary files differ
diff --git a/bin/xitongshezhi/kacaoguanli.class b/bin/xitongshezhi/kacaoguanli.class
index 414fc58..973a3b4 100644
--- a/bin/xitongshezhi/kacaoguanli.class
+++ b/bin/xitongshezhi/kacaoguanli.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$1.class b/bin/xitongshezhi/kuaisuquka$1.class
index a73b52f..bf6d2ad 100644
--- a/bin/xitongshezhi/kuaisuquka$1.class
+++ b/bin/xitongshezhi/kuaisuquka$1.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$2.class b/bin/xitongshezhi/kuaisuquka$2.class
index 3e84452..736e0f0 100644
--- a/bin/xitongshezhi/kuaisuquka$2.class
+++ b/bin/xitongshezhi/kuaisuquka$2.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$3.class b/bin/xitongshezhi/kuaisuquka$3.class
index 0c90308..b39084d 100644
--- a/bin/xitongshezhi/kuaisuquka$3.class
+++ b/bin/xitongshezhi/kuaisuquka$3.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$4.class b/bin/xitongshezhi/kuaisuquka$4.class
index 8bf3192..e229e71 100644
--- a/bin/xitongshezhi/kuaisuquka$4.class
+++ b/bin/xitongshezhi/kuaisuquka$4.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$5.class b/bin/xitongshezhi/kuaisuquka$5.class
deleted file mode 100644
index 8fa362d..0000000
--- a/bin/xitongshezhi/kuaisuquka$5.class
+++ /dev/null
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$6.class b/bin/xitongshezhi/kuaisuquka$6.class
deleted file mode 100644
index f630746..0000000
--- a/bin/xitongshezhi/kuaisuquka$6.class
+++ /dev/null
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$SlotButtonListener.class b/bin/xitongshezhi/kuaisuquka$SlotButtonListener.class
index 2014449..6edd74e 100644
--- a/bin/xitongshezhi/kuaisuquka$SlotButtonListener.class
+++ b/bin/xitongshezhi/kuaisuquka$SlotButtonListener.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka$SlotStatus.class b/bin/xitongshezhi/kuaisuquka$SlotStatus.class
index e23b511..8a57d99 100644
--- a/bin/xitongshezhi/kuaisuquka$SlotStatus.class
+++ b/bin/xitongshezhi/kuaisuquka$SlotStatus.class
Binary files differ
diff --git a/bin/xitongshezhi/kuaisuquka.class b/bin/xitongshezhi/kuaisuquka.class
index 4de679f..d2d9748 100644
--- a/bin/xitongshezhi/kuaisuquka.class
+++ b/bin/xitongshezhi/kuaisuquka.class
Binary files differ
diff --git a/bin/xitongshezhi/lishijilu$1.class b/bin/xitongshezhi/lishijilu$1.class
index ff88e6d..2258c9c 100644
--- a/bin/xitongshezhi/lishijilu$1.class
+++ b/bin/xitongshezhi/lishijilu$1.class
Binary files differ
diff --git a/bin/xitongshezhi/lishijilu.class b/bin/xitongshezhi/lishijilu.class
index 5775070..df111b3 100644
--- a/bin/xitongshezhi/lishijilu.class
+++ b/bin/xitongshezhi/lishijilu.class
Binary files differ
diff --git a/config.properties b/config.properties
index 6facd85..661b572 100644
--- a/config.properties
+++ b/config.properties
@@ -10,3 +10,6 @@
server.port=8081
system.language=zh-CN
total.slots=60
+popup.display.time=5
+error.log.server.address=39.106.210.13
+error.log.server.port=8082
diff --git a/err.properties b/err.properties
new file mode 100644
index 0000000..1e47fe7
--- /dev/null
+++ b/err.properties
@@ -0,0 +1,4 @@
+#\u64CD\u4F5C\u65E5\u5FD7\u8BB0\u5F55 - \u6700\u540E\u66F4\u65B0: Fri Nov 21 15:10:10 CST 2025
+#Fri Nov 21 15:10:10 CST 2025
+log_1763709005376_be67189d=[2025-11-21 15\:10\:05] 鍙栧崱鎿嶄綔锛�12132232
+log_1763709010792_533f9544=[2025-11-21 15\:10\:10] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
diff --git a/log.properties b/log.properties
index 14d68b6..cf35b17 100644
--- a/log.properties
+++ b/log.properties
@@ -1,5 +1,199 @@
-#\u64CD\u4F5C\u65E5\u5FD7\u8BB0\u5F55 - \u6700\u540E\u66F4\u65B0: Thu Nov 20 20:49:18 CST 2025
-#Thu Nov 20 20:49:18 CST 2025
-log_1763642944396_d82061c8=[2025-11-20 20\:49\:04] \u53D6\u5361\u64CD\u4F5C\uFF1A\u5361\u69FD14\u88AB\u7BA1\u7406\u5458\u53D6\u5361
-log_1763642958908_d200dc13=[2025-11-20 20\:49\:18] \u53D6\u5361\u64CD\u4F5C\uFF1A\u5361\u69FD25\u88AB\u7BA1\u7406\u5458\u53D6\u5361
-\u00B2\u00E2\u00CA\u00D4=
+#\u64CD\u4F5C\u65E5\u5FD7\u8BB0\u5F55 - \u6700\u540E\u66F4\u65B0: Fri Nov 21 15:46:19 CST 2025
+#Fri Nov 21 15:46:19 CST 2025
+log_1763709005376_be67189d=[2025-11-21 15\:10\:05] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
+log_1763709010792_533f9544=[2025-11-21 15\:10\:10] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
+log_1763710366394_3e2ee73b=[2025-11-21 15\:32\:46] 鍙栧崱鎿嶄綔锛氬崱妲�1琚鐞嗗憳鍙栧崱
+log_1763710369073_b9adfbaf=[2025-11-21 15\:32\:49] 绠$悊鍛樺凡灏嗗叏閮ㄥ崱妲藉凡缁忔墦寮�璇峰彇鍗�
+log_1763710369761_bb324453=[2025-11-21 15\:32\:49] 鍙栧崱鎿嶄綔锛氬崱妲�2琚鐞嗗憳鍙栧崱
+log_1763710374805_729bf4a3=[2025-11-21 15\:32\:54] 鍙栧崱鎿嶄綔锛氬崱妲�3琚鐞嗗憳鍙栧崱
+log_1763710376872_53e825d5=[2025-11-21 15\:32\:56] 鍙栧崱鎿嶄綔锛氬崱妲�4琚鐞嗗憳鍙栧崱
+log_1763710377434_30d03572=[2025-11-21 15\:32\:57] 鍙栧崱鎿嶄綔锛氬崱妲�5琚鐞嗗憳鍙栧崱
+log_1763710377702_d982793b=[2025-11-21 15\:32\:57] 鍙栧崱鎿嶄綔锛氬崱妲�6琚鐞嗗憳鍙栧崱
+log_1763710378251_dcba47b6=[2025-11-21 15\:32\:58] 鍙栧崱鎿嶄綔锛氬崱妲�7琚鐞嗗憳鍙栧崱
+log_1763710378740_621c7d16=[2025-11-21 15\:32\:58] 鍙栧崱鎿嶄綔锛氬崱妲�8琚鐞嗗憳鍙栧崱
+log_1763710378945_1f90633a=[2025-11-21 15\:32\:58] 鍙栧崱鎿嶄綔锛氬崱妲�9琚鐞嗗憳鍙栧崱
+log_1763710379551_0d57ca92=[2025-11-21 15\:32\:59] 鍙栧崱鎿嶄綔锛氬崱妲�10琚鐞嗗憳鍙栧崱
+log_1763710379765_c62a1f70=[2025-11-21 15\:32\:59] 鍙栧崱鎿嶄綔锛氬崱妲�11琚鐞嗗憳鍙栧崱
+log_1763710380759_1a3f3a2d=[2025-11-21 15\:33\:00] 鍙栧崱鎿嶄綔锛氬崱妲�12琚鐞嗗憳鍙栧崱
+log_1763710381303_43876449=[2025-11-21 15\:33\:01] 鍙栧崱鎿嶄綔锛氬崱妲�13琚鐞嗗憳鍙栧崱
+log_1763710381490_e2f23d01=[2025-11-21 15\:33\:01] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
+log_1763710381832_64ae1479=[2025-11-21 15\:33\:01] 鍙栧崱鎿嶄綔锛氬崱妲�15琚鐞嗗憳鍙栧崱
+log_1763710382171_5447584c=[2025-11-21 15\:33\:02] 鍙栧崱鎿嶄綔锛氬崱妲�16琚鐞嗗憳鍙栧崱
+log_1763710382679_028e4b55=[2025-11-21 15\:33\:02] 鍙栧崱鎿嶄綔锛氬崱妲�17琚鐞嗗憳鍙栧崱
+log_1763710383184_87fbec0b=[2025-11-21 15\:33\:03] 鍙栧崱鎿嶄綔锛氬崱妲�18琚鐞嗗憳鍙栧崱
+log_1763710383706_a4cf4dc7=[2025-11-21 15\:33\:03] 鍙栧崱鎿嶄綔锛氬崱妲�19琚鐞嗗憳鍙栧崱
+log_1763710383969_ee1134f4=[2025-11-21 15\:33\:03] 鍙栧崱鎿嶄綔锛氬崱妲�20琚鐞嗗憳鍙栧崱
+log_1763710384261_24848bed=[2025-11-21 15\:33\:04] 鍙栧崱鎿嶄綔锛氬崱妲�21琚鐞嗗憳鍙栧崱
+log_1763710384754_dd683aa4=[2025-11-21 15\:33\:04] 鍙栧崱鎿嶄綔锛氬崱妲�22琚鐞嗗憳鍙栧崱
+log_1763710385236_cb72df23=[2025-11-21 15\:33\:05] 鍙栧崱鎿嶄綔锛氬崱妲�23琚鐞嗗憳鍙栧崱
+log_1763710385688_59448adc=[2025-11-21 15\:33\:05] 鍙栧崱鎿嶄綔锛氬崱妲�24琚鐞嗗憳鍙栧崱
+log_1763710385869_5cd15f66=[2025-11-21 15\:33\:05] 鍙栧崱鎿嶄綔锛氬崱妲�25琚鐞嗗憳鍙栧崱
+log_1763710386114_b27f7cdb=[2025-11-21 15\:33\:06] 鍙栧崱鎿嶄綔锛氬崱妲�26琚鐞嗗憳鍙栧崱
+log_1763710386353_207e922a=[2025-11-21 15\:33\:06] 鍙栧崱鎿嶄綔锛氬崱妲�27琚鐞嗗憳鍙栧崱
+log_1763710386567_dedb947b=[2025-11-21 15\:33\:06] 鍙栧崱鎿嶄綔锛氬崱妲�28琚鐞嗗憳鍙栧崱
+log_1763710386774_fdb60ca6=[2025-11-21 15\:33\:06] 鍙栧崱鎿嶄綔锛氬崱妲�29琚鐞嗗憳鍙栧崱
+log_1763710387277_ec9fe131=[2025-11-21 15\:33\:07] 鍙栧崱鎿嶄綔锛氬崱妲�30琚鐞嗗憳鍙栧崱
+log_1763710392318_2b9de060=[2025-11-21 15\:33\:12] 鍙栧崱鎿嶄綔锛氬崱妲�31琚鐞嗗憳鍙栧崱
+log_1763710394899_2c102a5d=[2025-11-21 15\:33\:14] 鍙栧崱鎿嶄綔锛氬崱妲�32琚鐞嗗憳鍙栧崱
+log_1763710395618_9580d0cf=[2025-11-21 15\:33\:15] 鍙栧崱鎿嶄綔锛氬崱妲�33琚鐞嗗憳鍙栧崱
+log_1763710395824_c45c4bb7=[2025-11-21 15\:33\:15] 鍙栧崱鎿嶄綔锛氬崱妲�34琚鐞嗗憳鍙栧崱
+log_1763710396024_19f89ff8=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�35琚鐞嗗憳鍙栧崱
+log_1763710396205_1e9f3544=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�36琚鐞嗗憳鍙栧崱
+log_1763710396395_09793aa0=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�37琚鐞嗗憳鍙栧崱
+log_1763710396586_6da2a2be=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�38琚鐞嗗憳鍙栧崱
+log_1763710396751_27627af1=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�39琚鐞嗗憳鍙栧崱
+log_1763710396925_048a1d33=[2025-11-21 15\:33\:16] 鍙栧崱鎿嶄綔锛氬崱妲�40琚鐞嗗憳鍙栧崱
+log_1763710397700_9009fb44=[2025-11-21 15\:33\:17] 鍙栧崱鎿嶄綔锛氬崱妲�41琚鐞嗗憳鍙栧崱
+log_1763710398160_e8f79aa9=[2025-11-21 15\:33\:18] 鍙栧崱鎿嶄綔锛氬崱妲�42琚鐞嗗憳鍙栧崱
+log_1763710398344_dba27f5c=[2025-11-21 15\:33\:18] 鍙栧崱鎿嶄綔锛氬崱妲�43琚鐞嗗憳鍙栧崱
+log_1763710398527_84a6586d=[2025-11-21 15\:33\:18] 鍙栧崱鎿嶄綔锛氬崱妲�44琚鐞嗗憳鍙栧崱
+log_1763710398709_ca4898fa=[2025-11-21 15\:33\:18] 鍙栧崱鎿嶄綔锛氬崱妲�45琚鐞嗗憳鍙栧崱
+log_1763710398891_21c16b85=[2025-11-21 15\:33\:18] 鍙栧崱鎿嶄綔锛氬崱妲�46琚鐞嗗憳鍙栧崱
+log_1763710399064_7a60cb4f=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�47琚鐞嗗憳鍙栧崱
+log_1763710399256_d1754fdf=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�48琚鐞嗗憳鍙栧崱
+log_1763710399440_adfb38c2=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�49琚鐞嗗憳鍙栧崱
+log_1763710399628_25b129e2=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�50琚鐞嗗憳鍙栧崱
+log_1763710399804_bfdf1f49=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�51琚鐞嗗憳鍙栧崱
+log_1763710399981_9a6fae3a=[2025-11-21 15\:33\:19] 鍙栧崱鎿嶄綔锛氬崱妲�52琚鐞嗗憳鍙栧崱
+log_1763710400191_f4c40a9a=[2025-11-21 15\:33\:20] 鍙栧崱鎿嶄綔锛氬崱妲�53琚鐞嗗憳鍙栧崱
+log_1763710400361_300e2593=[2025-11-21 15\:33\:20] 鍙栧崱鎿嶄綔锛氬崱妲�54琚鐞嗗憳鍙栧崱
+log_1763710400545_ae5dd8e4=[2025-11-21 15\:33\:20] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763710400735_0041b12f=[2025-11-21 15\:33\:20] 鍙栧崱鎿嶄綔锛氬崱妲�56琚鐞嗗憳鍙栧崱
+log_1763710401100_1951843e=[2025-11-21 15\:33\:21] 鍙栧崱鎿嶄綔锛氬崱妲�57琚鐞嗗憳鍙栧崱
+log_1763710401283_580b32ee=[2025-11-21 15\:33\:21] 鍙栧崱鎿嶄綔锛氬崱妲�58琚鐞嗗憳鍙栧崱
+log_1763710401476_d0cee988=[2025-11-21 15\:33\:21] 鍙栧崱鎿嶄綔锛氬崱妲�59琚鐞嗗憳鍙栧崱
+log_1763710401684_bfb7a541=[2025-11-21 15\:33\:21] 鍙栧崱鎿嶄綔锛氬崱妲�60琚鐞嗗憳鍙栧崱
+log_1763710738513_bc5737ed=[2025-11-21 15\:38\:58] 鍙栧崱鎿嶄綔锛氬崱妲�1琚鐞嗗憳鍙栧崱
+log_1763710739297_f16f6cbf=[2025-11-21 15\:38\:59] 绠$悊鍛樺凡灏嗗叏閮ㄥ崱妲藉凡缁忔墦寮�璇峰彇鍗�
+log_1763710743588_a44dd2b1=[2025-11-21 15\:39\:03] 鍙栧崱鎿嶄綔锛氬崱妲�2琚鐞嗗憳鍙栧崱
+log_1763710745191_e7cd7335=[2025-11-21 15\:39\:05] 鍙栧崱鎿嶄綔锛氬崱妲�3琚鐞嗗憳鍙栧崱
+log_1763710745941_38917a60=[2025-11-21 15\:39\:05] 鍙栧崱鎿嶄綔锛氬崱妲�4琚鐞嗗憳鍙栧崱
+log_1763710746428_1be0c2ec=[2025-11-21 15\:39\:06] 鍙栧崱鎿嶄綔锛氬崱妲�5琚鐞嗗憳鍙栧崱
+log_1763710746617_a7f4572b=[2025-11-21 15\:39\:06] 鍙栧崱鎿嶄綔锛氬崱妲�6琚鐞嗗憳鍙栧崱
+log_1763710746844_6dccbbfa=[2025-11-21 15\:39\:06] 鍙栧崱鎿嶄綔锛氬崱妲�7琚鐞嗗憳鍙栧崱
+log_1763710747030_7f129941=[2025-11-21 15\:39\:07] 鍙栧崱鎿嶄綔锛氬崱妲�8琚鐞嗗憳鍙栧崱
+log_1763710747475_7008b86e=[2025-11-21 15\:39\:07] 鍙栧崱鎿嶄綔锛氬崱妲�9琚鐞嗗憳鍙栧崱
+log_1763710747663_5bcece5b=[2025-11-21 15\:39\:07] 鍙栧崱鎿嶄綔锛氬崱妲�10琚鐞嗗憳鍙栧崱
+log_1763710747839_836fdc15=[2025-11-21 15\:39\:07] 鍙栧崱鎿嶄綔锛氬崱妲�11琚鐞嗗憳鍙栧崱
+log_1763710748297_819cb00d=[2025-11-21 15\:39\:08] 鍙栧崱鎿嶄綔锛氬崱妲�12琚鐞嗗憳鍙栧崱
+log_1763710748481_d62eee38=[2025-11-21 15\:39\:08] 鍙栧崱鎿嶄綔锛氬崱妲�13琚鐞嗗憳鍙栧崱
+log_1763710748713_7e8e1b78=[2025-11-21 15\:39\:08] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
+log_1763710748924_6eb58529=[2025-11-21 15\:39\:08] 鍙栧崱鎿嶄綔锛氬崱妲�15琚鐞嗗憳鍙栧崱
+log_1763710749180_b4f93c07=[2025-11-21 15\:39\:09] 鍙栧崱鎿嶄綔锛氬崱妲�16琚鐞嗗憳鍙栧崱
+log_1763710749430_d4374f53=[2025-11-21 15\:39\:09] 鍙栧崱鎿嶄綔锛氬崱妲�17琚鐞嗗憳鍙栧崱
+log_1763710749722_871e5938=[2025-11-21 15\:39\:09] 鍙栧崱鎿嶄綔锛氬崱妲�18琚鐞嗗憳鍙栧崱
+log_1763710749929_a7b4b17c=[2025-11-21 15\:39\:09] 鍙栧崱鎿嶄綔锛氬崱妲�19琚鐞嗗憳鍙栧崱
+log_1763710750112_41fe9c56=[2025-11-21 15\:39\:10] 鍙栧崱鎿嶄綔锛氬崱妲�20琚鐞嗗憳鍙栧崱
+log_1763710750309_c9445b6a=[2025-11-21 15\:39\:10] 鍙栧崱鎿嶄綔锛氬崱妲�21琚鐞嗗憳鍙栧崱
+log_1763710750497_dbfb3b50=[2025-11-21 15\:39\:10] 鍙栧崱鎿嶄綔锛氬崱妲�22琚鐞嗗憳鍙栧崱
+log_1763710750865_8b47fb9d=[2025-11-21 15\:39\:10] 鍙栧崱鎿嶄綔锛氬崱妲�23琚鐞嗗憳鍙栧崱
+log_1763710751038_58cc3a3b=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�24琚鐞嗗憳鍙栧崱
+log_1763710751222_50d2ca7f=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�25琚鐞嗗憳鍙栧崱
+log_1763710751396_e0d7e4d4=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�26琚鐞嗗憳鍙栧崱
+log_1763710751576_c31a2bb8=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�27琚鐞嗗憳鍙栧崱
+log_1763710751759_3257dff6=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�28琚鐞嗗憳鍙栧崱
+log_1763710751933_5b98b5b1=[2025-11-21 15\:39\:11] 鍙栧崱鎿嶄綔锛氬崱妲�29琚鐞嗗憳鍙栧崱
+log_1763710752106_c249e495=[2025-11-21 15\:39\:12] 鍙栧崱鎿嶄綔锛氬崱妲�30琚鐞嗗憳鍙栧崱
+log_1763710752288_3473b11e=[2025-11-21 15\:39\:12] 鍙栧崱鎿嶄綔锛氬崱妲�31琚鐞嗗憳鍙栧崱
+log_1763710752478_bddf4a0f=[2025-11-21 15\:39\:12] 鍙栧崱鎿嶄綔锛氬崱妲�32琚鐞嗗憳鍙栧崱
+log_1763710752678_03b7b598=[2025-11-21 15\:39\:12] 鍙栧崱鎿嶄綔锛氬崱妲�33琚鐞嗗憳鍙栧崱
+log_1763710752882_cead4734=[2025-11-21 15\:39\:12] 鍙栧崱鎿嶄綔锛氬崱妲�34琚鐞嗗憳鍙栧崱
+log_1763710753096_3e58465d=[2025-11-21 15\:39\:13] 鍙栧崱鎿嶄綔锛氬崱妲�35琚鐞嗗憳鍙栧崱
+log_1763710753294_c8a39f42=[2025-11-21 15\:39\:13] 鍙栧崱鎿嶄綔锛氬崱妲�36琚鐞嗗憳鍙栧崱
+log_1763710753795_011f5c48=[2025-11-21 15\:39\:13] 鍙栧崱鎿嶄綔锛氬崱妲�37琚鐞嗗憳鍙栧崱
+log_1763710753999_a6bdf722=[2025-11-21 15\:39\:13] 鍙栧崱鎿嶄綔锛氬崱妲�38琚鐞嗗憳鍙栧崱
+log_1763710754230_c6b37d6c=[2025-11-21 15\:39\:14] 鍙栧崱鎿嶄綔锛氬崱妲�39琚鐞嗗憳鍙栧崱
+log_1763710754429_5a2cf0e3=[2025-11-21 15\:39\:14] 鍙栧崱鎿嶄綔锛氬崱妲�40琚鐞嗗憳鍙栧崱
+log_1763710754634_524e289c=[2025-11-21 15\:39\:14] 鍙栧崱鎿嶄綔锛氬崱妲�41琚鐞嗗憳鍙栧崱
+log_1763710754833_e252c751=[2025-11-21 15\:39\:14] 鍙栧崱鎿嶄綔锛氬崱妲�42琚鐞嗗憳鍙栧崱
+log_1763710755046_ca4fdaed=[2025-11-21 15\:39\:15] 鍙栧崱鎿嶄綔锛氬崱妲�43琚鐞嗗憳鍙栧崱
+log_1763710755245_f0a4c432=[2025-11-21 15\:39\:15] 鍙栧崱鎿嶄綔锛氬崱妲�44琚鐞嗗憳鍙栧崱
+log_1763710755433_66d05da5=[2025-11-21 15\:39\:15] 鍙栧崱鎿嶄綔锛氬崱妲�45琚鐞嗗憳鍙栧崱
+log_1763710755608_b2636ea5=[2025-11-21 15\:39\:15] 鍙栧崱鎿嶄綔锛氬崱妲�46琚鐞嗗憳鍙栧崱
+log_1763710760647_d7b2c8f0=[2025-11-21 15\:39\:20] 鍙栧崱鎿嶄綔锛氬崱妲�47琚鐞嗗憳鍙栧崱
+log_1763710765684_8d3d2ecb=[2025-11-21 15\:39\:25] 鍙栧崱鎿嶄綔锛氬崱妲�48琚鐞嗗憳鍙栧崱
+log_1763710770722_8f84c7e9=[2025-11-21 15\:39\:30] 鍙栧崱鎿嶄綔锛氬崱妲�49琚鐞嗗憳鍙栧崱
+log_1763710775759_33513110=[2025-11-21 15\:39\:35] 鍙栧崱鎿嶄綔锛氬崱妲�50琚鐞嗗憳鍙栧崱
+log_1763710780797_bca992a2=[2025-11-21 15\:39\:40] 鍙栧崱鎿嶄綔锛氬崱妲�51琚鐞嗗憳鍙栧崱
+log_1763710785835_7036b416=[2025-11-21 15\:39\:45] 鍙栧崱鎿嶄綔锛氬崱妲�52琚鐞嗗憳鍙栧崱
+log_1763710790878_14c5f190=[2025-11-21 15\:39\:50] 鍙栧崱鎿嶄綔锛氬崱妲�53琚鐞嗗憳鍙栧崱
+log_1763710795914_e6bed17f=[2025-11-21 15\:39\:55] 鍙栧崱鎿嶄綔锛氬崱妲�54琚鐞嗗憳鍙栧崱
+log_1763710800956_8dce7236=[2025-11-21 15\:40\:00] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763710805994_a2db9e8c=[2025-11-21 15\:40\:05] 鍙栧崱鎿嶄綔锛氬崱妲�56琚鐞嗗憳鍙栧崱
+log_1763710811028_a8d51351=[2025-11-21 15\:40\:11] 鍙栧崱鎿嶄綔锛氬崱妲�57琚鐞嗗憳鍙栧崱
+log_1763710816051_8e739946=[2025-11-21 15\:40\:16] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763710821079_97f443a0=[2025-11-21 15\:40\:21] 鍙栧崱鎿嶄綔锛氬崱妲�58琚鐞嗗憳鍙栧崱
+log_1763710826129_6b6a9bef=[2025-11-21 15\:40\:26] 鍙栧崱鎿嶄綔锛氬崱妲�59琚鐞嗗憳鍙栧崱
+log_1763710831168_7aa2fec2=[2025-11-21 15\:40\:31] 鍙栧崱鎿嶄綔锛氬崱妲�60琚鐞嗗憳鍙栧崱
+log_1763710836208_cbc1493c=[2025-11-21 15\:40\:36] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711168072_7a637b83=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�1琚鐞嗗憳鍙栧崱
+log_1763711168170_6eb3dca2=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�2琚鐞嗗憳鍙栧崱
+log_1763711168270_9dfe9ac0=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�3琚鐞嗗憳鍙栧崱
+log_1763711168370_0e757e2d=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�4琚鐞嗗憳鍙栧崱
+log_1763711168470_bb1dfc2f=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�5琚鐞嗗憳鍙栧崱
+log_1763711168570_6d6b4073=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�6琚鐞嗗憳鍙栧崱
+log_1763711168669_3cfb4ace=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�7琚鐞嗗憳鍙栧崱
+log_1763711168769_ba4e8f33=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�8琚鐞嗗憳鍙栧崱
+log_1763711168870_1c83d283=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�9琚鐞嗗憳鍙栧崱
+log_1763711168968_16b096e0=[2025-11-21 15\:46\:08] 鍙栧崱鎿嶄綔锛氬崱妲�10琚鐞嗗憳鍙栧崱
+log_1763711169070_d8dd15fb=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�11琚鐞嗗憳鍙栧崱
+log_1763711169169_5918a8ad=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�12琚鐞嗗憳鍙栧崱
+log_1763711169269_6149934f=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�13琚鐞嗗憳鍙栧崱
+log_1763711169369_d661fd92=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�14琚鐞嗗憳鍙栧崱
+log_1763711169470_4f7a20e7=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�15琚鐞嗗憳鍙栧崱
+log_1763711169569_be376f54=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�16琚鐞嗗憳鍙栧崱
+log_1763711169721_f89247f7=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�17琚鐞嗗憳鍙栧崱
+log_1763711169820_361b5763=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�18琚鐞嗗憳鍙栧崱
+log_1763711169918_58ac9aff=[2025-11-21 15\:46\:09] 鍙栧崱鎿嶄綔锛氬崱妲�19琚鐞嗗憳鍙栧崱
+log_1763711170019_05f162db=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�20琚鐞嗗憳鍙栧崱
+log_1763711170120_400f321f=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�21琚鐞嗗憳鍙栧崱
+log_1763711170220_f28795df=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�22琚鐞嗗憳鍙栧崱
+log_1763711170320_6c1ec7b4=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�23琚鐞嗗憳鍙栧崱
+log_1763711170420_123cd886=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�24琚鐞嗗憳鍙栧崱
+log_1763711170518_e12bca59=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�25琚鐞嗗憳鍙栧崱
+log_1763711170619_734131eb=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�26琚鐞嗗憳鍙栧崱
+log_1763711170720_993b63cb=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�27琚鐞嗗憳鍙栧崱
+log_1763711170820_d7232328=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�28琚鐞嗗憳鍙栧崱
+log_1763711170920_c6a6fbf9=[2025-11-21 15\:46\:10] 鍙栧崱鎿嶄綔锛氬崱妲�29琚鐞嗗憳鍙栧崱
+log_1763711171020_410bcebc=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�30琚鐞嗗憳鍙栧崱
+log_1763711171170_e6790075=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�31琚鐞嗗憳鍙栧崱
+log_1763711171269_84e5843c=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�32琚鐞嗗憳鍙栧崱
+log_1763711171369_c3e6d9e3=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�33琚鐞嗗憳鍙栧崱
+log_1763711171469_2111fab1=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�34琚鐞嗗憳鍙栧崱
+log_1763711171569_fdb37f62=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�35琚鐞嗗憳鍙栧崱
+log_1763711171669_a00d8931=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�36琚鐞嗗憳鍙栧崱
+log_1763711171768_993fe6d8=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�37琚鐞嗗憳鍙栧崱
+log_1763711171869_aa296e9d=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�38琚鐞嗗憳鍙栧崱
+log_1763711171969_198e8166=[2025-11-21 15\:46\:11] 鍙栧崱鎿嶄綔锛氬崱妲�39琚鐞嗗憳鍙栧崱
+log_1763711172069_47f47189=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�40琚鐞嗗憳鍙栧崱
+log_1763711172169_a0fe6996=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�41琚鐞嗗憳鍙栧崱
+log_1763711172270_f829f19c=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�42琚鐞嗗憳鍙栧崱
+log_1763711172368_544e99ef=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�43琚鐞嗗憳鍙栧崱
+log_1763711172469_35271c30=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�44琚鐞嗗憳鍙栧崱
+log_1763711172569_007a7812=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�45琚鐞嗗憳鍙栧崱
+log_1763711172669_a9d07106=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�46琚鐞嗗憳鍙栧崱
+log_1763711172819_70bacc6a=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�47琚鐞嗗憳鍙栧崱
+log_1763711172919_b0739863=[2025-11-21 15\:46\:12] 鍙栧崱鎿嶄綔锛氬崱妲�48琚鐞嗗憳鍙栧崱
+log_1763711173020_443f36ed=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�49琚鐞嗗憳鍙栧崱
+log_1763711173120_ad2656d1=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�50琚鐞嗗憳鍙栧崱
+log_1763711173220_cb6c90a2=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�51琚鐞嗗憳鍙栧崱
+log_1763711173318_5b3b3197=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�52琚鐞嗗憳鍙栧崱
+log_1763711173419_cb609033=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�53琚鐞嗗憳鍙栧崱
+log_1763711173520_f3fbfaa3=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�54琚鐞嗗憳鍙栧崱
+log_1763711173620_a6626517=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711173720_119445bc=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�56琚鐞嗗憳鍙栧崱
+log_1763711173820_34259d08=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�57琚鐞嗗憳鍙栧崱
+log_1763711173918_9b8dd187=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711173919_78e51f34=[2025-11-21 15\:46\:13] 鍙栧崱鎿嶄綔锛氬崱妲�58琚鐞嗗憳鍙栧崱
+log_1763711174020_de1b1d16=[2025-11-21 15\:46\:14] 鍙栧崱鎿嶄綔锛氬崱妲�59琚鐞嗗憳鍙栧崱
+log_1763711174120_269ca2e6=[2025-11-21 15\:46\:14] 鍙栧崱鎿嶄綔锛氬崱妲�60琚鐞嗗憳鍙栧崱
+log_1763711174220_660bae5f=[2025-11-21 15\:46\:14] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711174519_b989bf73=[2025-11-21 15\:46\:14] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711174820_64ba2235=[2025-11-21 15\:46\:14] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711175119_4d03fcbf=[2025-11-21 15\:46\:15] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711175420_d68f2c75=[2025-11-21 15\:46\:15] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711175719_e0fd7858=[2025-11-21 15\:46\:15] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711176020_c70ee0f2=[2025-11-21 15\:46\:16] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711176319_38854f73=[2025-11-21 15\:46\:16] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711176620_41d8db8a=[2025-11-21 15\:46\:16] 鍙栧崱鎿嶄綔锛氬崱妲�55琚鐞嗗憳鍙栧崱
+log_1763711179015_2952f952=[2025-11-21 15\:46\:19] 绠$悊鍛樺凡灏嗗叏閮ㄥ崱妲藉凡缁忔墦寮�璇峰彇鍗�
diff --git a/src/chuankou/Sendmsg.java b/src/chuankou/Sendmsg.java
index 6479155..0b51605 100644
--- a/src/chuankou/Sendmsg.java
+++ b/src/chuankou/Sendmsg.java
@@ -2,6 +2,15 @@
import java.text.SimpleDateFormat;
import java.util.Date;
+import javax.swing.SwingWorker;
+
+import chushihua.lunxun;
+import dialog.Charulog;
+import dialog.Dingshidialog;
+import dialog.Errlog;
+import publicway.OpenDoor;
+import xitongshezhi.SystemDebugDialog;
+
/**
* 涓插彛娑堟伅鍙戦�佸伐鍏风被
* 鎻愪緵楂樻�ц兘鐨勪覆鍙f秷鎭彂閫佸姛鑳斤紝閫傚悎楂橀璋冪敤
@@ -16,6 +25,78 @@
// 鏃ユ湡鏍煎紡鍖�
private static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss.SSS");
+
+
+ /**鍙戝崱鏈嶅姟鍣ㄦ帶鍒舵墦寮�鏌愪釜鏌滈棬璋冪敤鎸囦护
+ * @param int slotId鏌滈棬缂栧彿1-60
+ * @param int type 1鏄湇鍔″櫒鍙戝崱锛�2鏄鐞嗗憳鍙戝崱*/
+ public static boolean opendoorzhiling(int slotId,int type) {
+ lunxun.setSendChaxunzhiling(false);//鏆傚仠鏌ヨ鎸囦护
+ // 璋冪敤OpenDoor鐢熸垚寮�闂ㄦ寚浠�
+ String command = OpenDoor.openOneDoor(slotId, type);
+ boolean sendResult = Sendmsg.sendMessage(command);
+ String mes=command+";type"+type+"鎺у埗鎵撳紑"+slotId+"鏌滈棬";
+ Charulog.logOperation(mes);
+ if (lunxun.DEBUG_ENABLED) {
+ SystemDebugDialog.appendAsciiData(mes);
+ }
+
+ lunxun.setSendChaxunzhiling(true);//寮�濮嬫煡璇㈡寚浠�
+ return sendResult;
+ }
+
+ /**
+ * 鎵撳紑鍏ㄩ儴鍗℃Ы鐨勫叕鐢ㄩ潤鎬佹柟娉�
+ * @param type 鎿嶄綔绫诲瀷锛�1-鏈嶅姟鍣ㄥ彂鍗★紝2-绠$悊鍛樺彂鍗�
+ */
+ public static void openAllSlots(int type) {
+ lunxun.setSendChaxunzhiling(false);//鏆傚仠鏌ヨ鎸囦护
+ // 浣跨敤SwingWorker鍦ㄥ悗鍙版墽琛岋紝閬垮厤闃诲UI
+ SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
+ @Override
+ protected Void doInBackground() throws Exception {
+ // 閬嶅巻鎵�鏈夊崱妲斤紙1-60锛�
+ for (int slotId = 1; slotId <= 60; slotId++) {
+ try {
+ // 鐢熸垚寮�闂ㄦ寚浠�
+ String command = OpenDoor.openOneDoor(slotId, type);
+
+ // 鍙戦�佷覆鍙f寚浠�
+ boolean sent = Sendmsg.sendMessage(command);
+
+ if (!sent) {
+ Errlog.logOperation("鍙戦�佹寚浠ゅ埌鍗℃Ы " + slotId + " 澶辫触");
+ }
+
+ // 闂撮殧100ms
+ Thread.sleep(100);
+
+ } catch (Exception e) {
+ Errlog.logOperation("澶勭悊鍗℃Ы " + slotId + " 鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ // 鍙�夛細瀹屾垚鍚庡彲浠ユ坊鍔犲洖璋冨鐞�
+ System.out.println("鍏ㄩ儴鍗℃Ы寮�闂ㄦ寚浠ゅ彂閫佸畬鎴�");
+ String types="绠$悊鍛�";
+ if(type==1) {
+ types="鏈嶅姟鍣ㄦ寚浠�";
+ }
+ String message=types+"宸插皢鍏ㄩ儴鍗℃Ы宸茬粡鎵撳紑璇峰彇鍗�";
+ Dingshidialog.showTimedDialog(null,5,message);
+ Charulog.logOperation(message);
+ }
+ };
+
+ worker.execute();
+ lunxun.setSendChaxunzhiling(true);//寮�濮嬫煡璇㈡寚浠�
+ }
+
/**
* 璁剧疆涓插彛鏈嶅姟瀹炰緥
@@ -39,12 +120,12 @@
*/
public static boolean sendMessage(String message) {
if (!isPortOpen || serialService == null) {
- System.err.println("[" + getCurrentTime() + "] 涓插彛鏈墦寮�锛屾棤娉曞彂閫佹暟鎹�");
+ Errlog.logOperation("[" + getCurrentTime() + "] 涓插彛鏈墦寮�锛屾棤娉曞彂閫佹暟鎹�");
return false;
}
if (message == null || message.trim().isEmpty()) {
- System.err.println("[" + getCurrentTime() + "] 鍙戦�佹暟鎹负绌�");
+ Errlog.logOperation("[" + getCurrentTime() + "] 鍙戦�佹暟鎹负绌�");
return false;
}
@@ -56,7 +137,7 @@
try {
byte[] data = hexStringToByteArray(text);
if (data == null) {
- System.err.println("[" + getCurrentTime() + "] HEX杞崲澶辫触锛屾暟鎹�: " + text);
+ Errlog.logOperation("[" + getCurrentTime() + "] HEX杞崲澶辫触锛屾暟鎹�: " + text);
return false;
}
@@ -70,7 +151,7 @@
} else {
retryCount++;
if (retryCount <= MAX_RETRY) {
- System.err.println("[" + getCurrentTime() + "] 鍙戦�佸け璐ワ紝姝e湪閲嶈瘯 (" + retryCount + "/" + MAX_RETRY + ")");
+ Errlog.logOperation("[" + getCurrentTime() + "] 鍙戦�佸け璐ワ紝姝e湪閲嶈瘯 (" + retryCount + "/" + MAX_RETRY + ")");
try {
Thread.sleep(50); // 閲嶈瘯鍓嶇瓑寰�
} catch (InterruptedException e) {
@@ -78,16 +159,16 @@
break;
}
} else {
- System.err.println("[" + getCurrentTime() + "] 涓插彛鍙戦�佸け璐ワ紝鎸囦护: " + text.toUpperCase());
- System.err.println("[" + getCurrentTime() + "] 涓插彛鐘舵�� - 鎵撳紑: " + isPortOpen + ", 鏈嶅姟: " + (serialService != null));
+ Errlog.logOperation("[" + getCurrentTime() + "] 涓插彛鍙戦�佸け璐ワ紝鎸囦护: " + text.toUpperCase());
+ Errlog.logOperation("[" + getCurrentTime() + "] 涓插彛鐘舵�� - 鎵撳紑: " + isPortOpen + ", 鏈嶅姟: " + (serialService != null));
if (serialService != null) {
- System.err.println("[" + getCurrentTime() + "] 涓插彛鏈嶅姟鐘舵�� - 鏄惁鎵撳紑: " + serialService.isOpen());
+ Errlog.logOperation("[" + getCurrentTime() + "] 涓插彛鏈嶅姟鐘舵�� - 鏄惁鎵撳紑: " + serialService.isOpen());
}
return false;
}
}
} catch (Exception e) {
- System.err.println("[" + getCurrentTime() + "] 鍙戦�佸紓甯革紝鎸囦护: " + text.toUpperCase());
+ Errlog.logOperation("[" + getCurrentTime() + "] 鍙戦�佸紓甯革紝鎸囦护: " + text.toUpperCase());
e.printStackTrace();
return false;
}
@@ -103,7 +184,7 @@
public static boolean isPortOpen() {
boolean open = isPortOpen && serialService != null;
if (!open && DEBUG_MODE) {
- System.err.println("[" + getCurrentTime() + "] 涓插彛鐘舵�佹鏌�: 鏈墦寮�");
+ Errlog.logOperation("[" + getCurrentTime() + "] 涓插彛鐘舵�佹鏌�: 鏈墦寮�");
}
return open;
}
diff --git a/src/chuankou/SerialPortService.java b/src/chuankou/SerialPortService.java
index 7efeb68..e2e835b 100644
--- a/src/chuankou/SerialPortService.java
+++ b/src/chuankou/SerialPortService.java
@@ -144,70 +144,83 @@
* 鍚姩鏁版嵁鎺ユ敹绾跨▼
*/
public void startCapture(Consumer<byte[]> onReceived) {
- this.dataReceivedCallback = onReceived;
- if (capturing || port == null || !port.isOpen()) return;
- capturing = true;
- paused = false;
+ this.dataReceivedCallback = onReceived;
+ if (capturing || port == null || !port.isOpen()) return;
+ capturing = true;
+ paused = false;
- readerThread = new Thread(() -> {
- buffer.reset();
- long lastReceivedTime = 0;
+ readerThread = new Thread(() -> {
+ buffer.reset();
+ long lastReceivedTime = 0;
- while (capturing && port.isOpen()) {
- long currentTime = System.currentTimeMillis();
+ while (capturing && port.isOpen()) {
+ long currentTime = System.currentTimeMillis();
- if (buffer.size() > 0 && (currentTime - lastReceivedTime) >= 20) {
- byte[] data = buffer.toByteArray();
- SystemDebugDialog.appendHexData(data);
+ if (buffer.size() > 0 && (currentTime - lastReceivedTime) >= 20) {
+ byte[] data = buffer.toByteArray();
+ SystemDebugDialog.appendHexData(data);
- // 鏂板锛氬皢鏁版嵁浼犻�掔粰鍗忚瑙f瀽鍣�
- if (protocolParser != null) {
- protocolParser.receiveData(data);
- }
+ // 鏂板锛氬皢鏁版嵁浼犻�掔粰鍗忚瑙f瀽鍣� - 纭繚濮嬬粓鎵ц
+ if (protocolParser != null) {
+ protocolParser.receiveData(data);
+ }
- if (!paused) {
- onReceived.accept(data);
- if (responseConsumer != null) {
- responseConsumer.accept(data);
- }
- }
- buffer.reset();
- }
+ // 纭繚鏁版嵁鍥炶皟濮嬬粓鎵ц锛屼笉鍙楁殏鍋滅姸鎬佸奖鍝�
+ if (dataReceivedCallback != null && !paused) {
+ dataReceivedCallback.accept(data);
+ }
+ if (responseConsumer != null && !paused) {
+ responseConsumer.accept(data);
+ }
+ buffer.reset();
+ }
- int len = port.readBytes(readBuffer, readBuffer.length);
- currentTime = System.currentTimeMillis();
+ int len = port.readBytes(readBuffer, readBuffer.length);
+ currentTime = System.currentTimeMillis();
- if (len > 0) {
- buffer.write(readBuffer, 0, len);
- lastReceivedTime = currentTime;
- }
+ if (len > 0) {
+ buffer.write(readBuffer, 0, len);
+ lastReceivedTime = currentTime;
+ }
- if (len <= 0 && buffer.size() == 0) {
- try { Thread.sleep(1); } catch (InterruptedException ignore) {}
- }
- }
+ if (len <= 0 && buffer.size() == 0) {
+ try { Thread.sleep(1); } catch (InterruptedException ignore) {}
+ }
+ }
- if (buffer.size() > 0) {
- byte[] data = buffer.toByteArray();
- SystemDebugDialog.appendHexData(data);
+ if (buffer.size() > 0) {
+ byte[] data = buffer.toByteArray();
+ SystemDebugDialog.appendHexData(data);
- // 鏂板锛氬皢鏁版嵁浼犻�掔粰鍗忚瑙f瀽鍣�
- if (protocolParser != null) {
- protocolParser.receiveData(data);
- }
+ // 鏂板锛氬皢鏁版嵁浼犻�掔粰鍗忚瑙f瀽鍣� - 纭繚濮嬬粓鎵ц
+ if (protocolParser != null) {
+ protocolParser.receiveData(data);
+ }
- if (!paused) {
- onReceived.accept(data);
- if (responseConsumer != null) {
- responseConsumer.accept(data);
- }
- }
- }
- });
- readerThread.setDaemon(true);
- readerThread.start();
+ // 纭繚鏁版嵁鍥炶皟濮嬬粓鎵ц锛屼笉鍙楁殏鍋滅姸鎬佸奖鍝�
+ if (dataReceivedCallback != null && !paused) {
+ dataReceivedCallback.accept(data);
+ }
+ if (responseConsumer != null && !paused) {
+ responseConsumer.accept(data);
+ }
+ }
+ });
+ readerThread.setDaemon(true);
+ readerThread.start();
+ }
+ // 鏂板锛氳缃殏鍋滅姸鎬佷絾涓嶅奖鍝嶅崗璁В鏋愬櫒
+ public void setPaused(boolean paused) {
+ this.paused = paused;
+ // 娉ㄦ剰锛氫笉鍋滄鍗忚瑙f瀽鍣紝鍙殏鍋淯I鍥炶皟
}
+ // 鏂板锛氬崟鐙仠姝㈡暟鎹崟鑾疯�屼笉褰卞搷鍗忚瑙f瀽鍣�
+ public void stopDataCaptureOnly() {
+ // 鍙仠姝㈡暟鎹洖璋冿紝涓嶅奖鍝嶅崗璁В鏋愬櫒
+ this.dataReceivedCallback = null;
+ this.responseConsumer = null;
+ }
/**
* 鍋滄鏁版嵁鎺ユ敹绾跨▼
*/
@@ -219,9 +232,6 @@
}
}
- public void setPaused(boolean paused) {
- this.paused = paused;
- }
public boolean isPaused() {
return paused;
diff --git a/src/chushihua/Chushihua.java b/src/chushihua/Chushihua.java
index 561c68f..4773b12 100644
--- a/src/chushihua/Chushihua.java
+++ b/src/chushihua/Chushihua.java
@@ -2,6 +2,9 @@
import java.io.File;
import java.util.List;
+
+import dialog.Dingshidialog;
+import dialog.Errlog;
import home.MachineConfig;
/**
@@ -66,7 +69,7 @@
return true;
} catch (Exception e) {
- System.err.println("绯荤粺鍒濆鍖栧紓甯�: " + e.getMessage());
+ Errlog.logOperation("绯荤粺鍒濆鍖栧紓甯�: " + e.getMessage());
e.printStackTrace();
return false;
}
@@ -83,7 +86,7 @@
////System.out.println("绯荤粺鍏抽棴锛氳疆璇㈡煡璇㈠凡鍋滄");
}
} catch (Exception e) {
- System.err.println("绯荤粺鍏抽棴寮傚父: " + e.getMessage());
+ Errlog.logOperation("绯荤粺鍏抽棴寮傚父: " + e.getMessage());
}
}
@@ -96,7 +99,7 @@
// 妫�鏌ラ厤缃枃浠舵槸鍚﹀瓨鍦�
File configFile = new File(configFilePath);
if (!configFile.exists()) {
- System.err.println("閰嶇疆鏂囦欢涓嶅瓨鍦�: " + configFilePath);
+ Errlog.logOperation("閰嶇疆鏂囦欢涓嶅瓨鍦�: " + configFilePath);
return false;
}
@@ -119,7 +122,7 @@
return true;
} catch (Exception e) {
- System.err.println("绯荤粺鍒濆鍖栧け璐�: " + e.getMessage());
+ Errlog.logOperation("绯荤粺鍒濆鍖栧け璐�: " + e.getMessage());
e.printStackTrace();
return false;
}
@@ -176,7 +179,7 @@
*/
public boolean saveConfig(String configFilePath) {
if (machineConfig == null) {
- System.err.println("閰嶇疆鏈姞杞斤紝鏃犳硶淇濆瓨");
+ Errlog.logOperation("閰嶇疆鏈姞杞斤紝鏃犳硶淇濆瓨");
return false;
}
@@ -185,7 +188,7 @@
////System.out.println("閰嶇疆宸蹭繚瀛樺埌: " + configFilePath);
return true;
} catch (Exception e) {
- System.err.println("淇濆瓨閰嶇疆澶辫触: " + e.getMessage());
+ Errlog.logOperation("淇濆瓨閰嶇疆澶辫触: " + e.getMessage());
return false;
}
}
@@ -195,7 +198,7 @@
*/
public MachineConfig getMachineConfig() {
if (!initialized) {
- throw new IllegalStateException("绯荤粺鏈垵濮嬪寲锛岃鍏堣皟鐢╥nitialize()鏂规硶");
+ Dingshidialog.showTimedDialog(null,10,"绯荤粺鏈垵濮嬪寲鎴愬姛");
}
return machineConfig;
}
diff --git a/src/chushihua/SlotManager.java b/src/chushihua/SlotManager.java
index 2ff8c95..b85cb60 100644
--- a/src/chushihua/SlotManager.java
+++ b/src/chushihua/SlotManager.java
@@ -5,7 +5,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import xitongshezhi.Fkj;
+import dialog.Dingshidialog;
+import home.Fkj;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -318,6 +319,7 @@
/**
* 鏍规嵁鐘舵�佺爜鍜屾晠闅滅爜鍒ゆ柇鏄惁鏈夊崱 - 浼樺寲鐗堟湰
*/
+ @SuppressWarnings("unused")
private String determineHasCardFromStatus(int status, int fault) {
// 浼樺寲锛氫娇鐢ㄦ暟鍊兼瘮杈冩浛浠e瓧绗︿覆鎿嶄綔
if (fault != 0) {
@@ -521,11 +523,10 @@
if ("0000".equals(oldCardNumber) && !"0000".equals(newCardNumber)) {
// 鍦ㄤ簨浠跺垎鍙戠嚎绋嬩腑鏄剧ず瀵硅瘽妗�
javax.swing.SwingUtilities.invokeLater(() -> {
- xitongshezhi.Dingshidialog.showTimedDialog(
+ Dingshidialog.showTimedDialog(
null, // 鐖剁獥鍙o紝鍙互涓簄ull
5, // 鏄剧ず3绉�
- "杩樺崱鎴愬姛锛屾劅璋㈡偍鐨勪娇鐢�",
- "" // 闊抽鏂囦欢锛屽彲浠ヤ负绌�
+ slotNumber+"鍙峰崱妲借繕鍗℃垚鍔熸劅璋㈡偍鐨勪娇鐢�"
);
});
//System.out.println("鍗℃Ы " + slotNumber + " 杩樺崱鎴愬姛锛屽崱鍙蜂粠 " + oldCardNumber + " 鍙樹负 " + newCardNumber);
@@ -538,7 +539,7 @@
* @param caozuo 鎿嶄綔绫诲瀷锛�1琛ㄧず绠$悊鍛橈紝0琛ㄧず绯荤粺
* @return 淇敼鎴愬姛杩斿洖true锛屽惁鍒欒繑鍥瀎alse
*/
- public static boolean changgehaska(int slotNumber, String caozuo) {
+ public static boolean changgehaska(int slotNumber, int caozuo) {
if (!isValidSlotNumber(slotNumber)) {
return false;
}
@@ -548,9 +549,9 @@
slot.setUpdateTime(getCurrentTime());
// 璁板綍鍙栧崱鏃ュ織
- String operator = "1".equals(caozuo) ? "绠$悊鍛�" : "绯荤粺";
+ String operator =caozuo==1? "绠$悊鍛�" : "绯荤粺";
String logMessage = String.format("鍙栧崱鎿嶄綔锛氬崱妲�%d琚�%s鍙栧崱", slotNumber, operator);
- xitongshezhi.Charulog.logOperation(logMessage);
+ dialog.Charulog.logOperation(logMessage);
return true;
}
diff --git a/src/chushihua/lunxun.java b/src/chushihua/lunxun.java
index 8d08dff..217dab3 100644
--- a/src/chushihua/lunxun.java
+++ b/src/chushihua/lunxun.java
@@ -1,9 +1,10 @@
package chushihua;
import chuankou.Sendmsg;
+import dialog.Errlog;
+import home.Fkj;
import home.MachineConfig;
import publicway.QueryData;
-import xitongshezhi.Fkj;
import xitongshezhi.SystemDebugDialog;
import java.util.Map;
@@ -14,637 +15,762 @@
* 杞鏌ヨ绫� - 浼樺寲鐗堟湰
* 鐢ㄤ簬瀹氭椂鍚戞墍鏈夊崱妲藉彂閫佹煡璇㈡寚浠�
* 鏀寔鏆傚仠鍜屾仮澶嶅姛鑳斤紝妫�鏌ヤ覆鍙h繛鎺ョ姸鎬�
+ * 鏂板锛氫笉鍚屽崱妲界姸鎬佷娇鐢ㄤ笉鍚屾煡璇㈤鐜�
*/
public class lunxun {
- private static volatile boolean isRunning = false;
- private static volatile boolean isPaused = false;
- private static final AtomicBoolean shouldStop = new AtomicBoolean(false);
- private static Thread pollingThread;
- private static int pollingInterval = 100; // 榛樿杞闂撮殧
-
- // 鍗℃Ы鐩稿叧甯搁噺
- private static final int MIN_SLOT = 1;
- private static final int MAX_SLOT = 60;
-
- // 涓插彛杩炴帴妫�鏌ョ浉鍏�
- private static final int SERIAL_CHECK_INTERVAL = 5000; // 5绉掓鏌ヤ竴娆′覆鍙h繛鎺�
- private static long lastSerialCheckTime = 0;
- private static boolean serialConnected = false;
-
- // 鎬ц兘浼樺寲锛氭煡璇㈡寚浠ょ紦瀛�
- private static final Map<Integer, String> queryCommandCache = new ConcurrentHashMap<>();
-
- // 璋冭瘯妯″紡鎺у埗
- public static boolean DEBUG_ENABLED = false;
-
- /**
- * 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬� - 浼樺寲鐗堟湰锛屾坊鍔犻噸璇曟満鍒�
- * @return true-涓插彛宸茶繛鎺�, false-涓插彛鏈繛鎺�
- */
- public static boolean checkSerialConnection() {
- // 閬垮厤棰戠箒妫�鏌ワ紝姣�5绉掓鏌ヤ竴娆�
- long currentTime = System.currentTimeMillis();
- if (currentTime - lastSerialCheckTime < SERIAL_CHECK_INTERVAL) {
- return serialConnected;
- }
-
- lastSerialCheckTime = currentTime;
-
- try {
- // 绠�鍖栨鏌ワ細鐩存帴妫�鏌endmsg鐨勪覆鍙g姸鎬侊紝鑰屼笉鏄彂閫佹祴璇曟寚浠�
- boolean result = Sendmsg.isPortOpen();
-
- if (result) {
- if (DEBUG_ENABLED) {
- //System.out.println("涓插彛杩炴帴姝e父");
- }
- serialConnected = true;
- } else {
- System.err.println("涓插彛杩炴帴澶辫触 - 涓插彛鏈墦寮�");
- serialConnected = false;
- }
- } catch (Exception e) {
- System.err.println("涓插彛杩炴帴妫�鏌ュ紓甯�: " + e.getMessage());
- serialConnected = false;
- }
-
- return serialConnected;
- }
-
- /**
- * 甯﹂噸璇曠殑涓插彛杩炴帴妫�鏌�
- */
- private static boolean checkSerialConnectionWithRetry() {
- for (int i = 0; i < 3; i++) {
- if (checkSerialConnection()) {
- return true;
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return false;
- }
- }
- return false;
- }
-
- /**
- * 鍚姩杞鏌ヨ - 浼樺寲鐗堟湰
- * @return true-鍚姩鎴愬姛, false-鍚姩澶辫触
- */
- public static boolean startPolling() {
- if (isRunning) {
- //System.out.println("杞鏌ヨ宸茬粡鍦ㄨ繍琛屼腑");
- return true;
- }
-
- // 鍚姩鍓嶄弗鏍兼鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鍚姩杞鏌ヨ");
- return false;
- }
-
- // 浠庨厤缃腑鑾峰彇杞闂撮殧
- loadPollingIntervalFromConfig();
-
- isRunning = true;
- isPaused = false;
- shouldStop.set(false);
-
- try {
- pollingThread = new Thread(new PollingTask(), "CardSlot-Polling-Thread");
- pollingThread.setDaemon(true);
- pollingThread.start();
- return true;
- } catch (Exception e) {
- System.err.println("鍚姩杞鏌ヨ绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
- isRunning = false;
- shouldStop.set(true);
- return false;
- }
- }
-
- /**
- * 鍋滄杞鏌ヨ - 淇鐗堟湰
- * @return true-鍋滄鎴愬姛, false-鍋滄澶辫触
- */
- public static boolean stopPolling() {
- if (!isRunning) {
- //System.out.println("杞鏌ヨ鏈湪杩愯");
- return false;
- }
-
- shouldStop.set(true);
- isRunning = false;
- isPaused = false;
-
- if (pollingThread != null) {
- pollingThread.interrupt();
- try {
- pollingThread.join(3000); // 绛夊緟3绉�
- // 妫�鏌ョ嚎绋嬫槸鍚﹁繕鍦ㄨ繍琛�
- if (pollingThread.isAlive()) {
- System.err.println("杞绾跨▼鏈湪3绉掑唴鍋滄锛屾爣璁颁负瀹堟姢绾跨▼骞跺拷鐣�");
- // 涓嶅己鍒跺仠姝紝鑰屾槸纭繚瀹冩槸瀹堟姢绾跨▼
- pollingThread.setDaemon(true);
- }
- } catch (InterruptedException e) {
- System.err.println("鍋滄杞鏌ヨ鏃惰涓柇: " + e.getMessage());
- Thread.currentThread().interrupt();
- } catch (Exception e) {
- System.err.println("鍋滄杞绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
- } finally {
- pollingThread = null;
- }
- }
-
- shouldStop.set(false);
- //System.out.println("杞鏌ヨ宸插仠姝�");
- return true;
- }
-
- /**
- * 鏆傚仠杞鏌ヨ
- * @return true-鏆傚仠鎴愬姛, false-鏆傚仠澶辫触
- */
- public static boolean pausePolling() {
- if (!isRunning) {
- if (DEBUG_ENABLED) {
- //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曟殏鍋�");
- }
- return false;
- }
-
- if (isPaused) {
- if (DEBUG_ENABLED) {
- //System.out.println("杞鏌ヨ宸茬粡澶勪簬鏆傚仠鐘舵��");
- }
- return false;
- }
-
- isPaused = true;
- //System.out.println("杞鏌ヨ宸叉殏鍋�");
- return true;
- }
-
- /**
- * 鎭㈠杞鏌ヨ
- * @return true-鎭㈠鎴愬姛, false-鎭㈠澶辫触
- */
- public static boolean resumePolling() {
- if (!isRunning) {
- //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曟仮澶�");
- return false;
- }
-
- if (!isPaused) {
- //System.out.println("杞鏌ヨ鏈浜庢殏鍋滅姸鎬�");
- return false;
- }
-
- // 鎭㈠鍓嶆鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鎭㈠杞鏌ヨ");
- return false;
- }
-
- isPaused = false;
- synchronized (lunxun.class) {
- lunxun.class.notifyAll(); // 鍞ら啋绛夊緟鐨勭嚎绋�
- }
- //System.out.println("杞鏌ヨ宸叉仮澶�");
- return true;
- }
-
- /**
- * 妫�鏌ヨ疆璇㈢姸鎬�
- * @return true-姝e湪杩愯, false-宸插仠姝�
- */
- public static boolean isPolling() {
- return isRunning;
- }
-
- /**
- * 妫�鏌ユ槸鍚︽殏鍋�
- * @return true-宸叉殏鍋�, false-鏈殏鍋�
- */
- public static boolean isPaused() {
- return isPaused;
- }
-
- /**
- * 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬�
- * @return true-涓插彛宸茶繛鎺�, false-涓插彛鏈繛鎺�
- */
- public static boolean isSerialConnected() {
- return serialConnected;
- }
-
- /**
- * 璁剧疆杞闂撮殧
- * @param interval 杞闂撮殧锛堟绉掞級
- */
- public static void setPollingInterval(int interval) {
- if (interval < 10) {
- System.err.println("杞闂撮殧涓嶈兘灏忎簬10ms");
- return;
- }
-
- pollingInterval = interval;
- //System.out.println("杞闂撮殧宸茶缃负: " + interval + "ms");
-
- // 濡傛灉姝e湪杩愯锛岄噸鏂板惎鍔ㄤ互搴旂敤鏂扮殑闂撮殧
- if (isRunning) {
- restartPolling();
- }
- }
-
- /**
- * 鑾峰彇褰撳墠杞闂撮殧
- * @return 杞闂撮殧锛堟绉掞級
- */
- public static int getPollingInterval() {
- return pollingInterval;
- }
-
- /**
- * 閲嶆柊鍚姩杞鏌ヨ
- * @return true-閲嶅惎鎴愬姛, false-閲嶅惎澶辫触
- */
- public static boolean restartPolling() {
- stopPolling();
-
- // 绛夊緟涓�灏忔鏃堕棿纭繚绾跨▼瀹屽叏鍋滄
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
-
- return startPolling();
- }
-
- /**
- * 浠庨厤缃腑鍔犺浇杞闂撮殧
- */
- private static void loadPollingIntervalFromConfig() {
- try {
- Chushihua configSystem = Chushihua.getInstance();
- if (configSystem.isInitialized()) {
- MachineConfig machineConfig = configSystem.getMachineConfig();
- pollingInterval = machineConfig.getPollingInterval();
- //System.out.println("浠庨厤缃姞杞借疆璇㈤棿闅�: " + pollingInterval + "ms");
- } else {
- //System.out.println("閰嶇疆绯荤粺鏈垵濮嬪寲锛屼娇鐢ㄩ粯璁よ疆璇㈤棿闅�: " + pollingInterval + "ms");
- }
- } catch (Exception e) {
- System.err.println("鍔犺浇杞闂撮殧閰嶇疆澶辫触: " + e.getMessage());
- //System.out.println("浣跨敤榛樿杞闂撮殧: " + pollingInterval + "ms");
- }
- }
-
- /**
- * 鑾峰彇缂撳瓨鐨勬煡璇㈡寚浠�
- */
- private static String getCachedQueryCommand(int slotNumber) {
- return queryCommandCache.computeIfAbsent(slotNumber, QueryData::queryData);
- }
-
- /**
- * 娓呯┖鏌ヨ鎸囦护缂撳瓨锛堝綋鏌ヨ閫昏緫鍙樺寲鏃惰皟鐢級
- */
- public static void clearQueryCache() {
- queryCommandCache.clear();
- //System.out.println("鏌ヨ鎸囦护缂撳瓨宸叉竻绌�");
- }
-
- /**
- * 杞浠诲姟鍐呴儴绫� - 浼樺寲鐗堟湰
- * 浼樺寲鍐呭瓨浣跨敤锛氶伩鍏嶅湪寰幆涓垱寤烘柊瀵硅薄
- * 娣诲姞鎵归噺澶勭悊鍜屾�ц兘鐩戞帶
- */
- private static class PollingTask implements Runnable {
- private int currentIndex = 0; // 褰撳墠绱㈠紩锛岀敤浜庨亶鍘唖lotArray
- private int consecutiveFailures = 0; // 杩炵画澶辫触娆℃暟
- private static final int MAX_CONSECUTIVE_FAILURES = 5; // 鏈�澶ц繛缁け璐ユ鏁�
-
- @Override
- public void run() {
- //System.out.println("杞鏌ヨ绾跨▼寮�濮嬭繍琛�");
-
- while (isRunning && !Thread.currentThread().isInterrupted() && !shouldStop.get()) {
- try {
- // 妫�鏌ユ槸鍚︽殏鍋�
- if (isPaused) {
- synchronized (lunxun.class) {
- while (isPaused && isRunning && !shouldStop.get()) {
- lunxun.class.wait(1000); // 绛夊緟1绉掓垨鐩村埌琚敜閱�
- }
- }
- continue;
- }
-
- // 瀹氭湡妫�鏌ヤ覆鍙h繛鎺ョ姸鎬侊紙姣�10娆″惊鐜鏌ヤ竴娆★級
- if (currentIndex % 10 == 0 && !checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛杩炴帴鏂紑锛屾殏鍋滆疆璇�");
- pausePolling();
- continue;
- }
-
- // 鑾峰彇鍗℃Ы鏁扮粍
- Fkj[] slotArray = SlotManager.getSlotArray();
- if (slotArray == null || slotArray.length == 0) {
- System.err.println("鍗℃Ы鏁扮粍鏈垵濮嬪寲");
- Thread.sleep(pollingInterval);
- continue;
- }
-
- // 閬嶅巻鎵�鏈夊崱妲斤紝鍙粰 hasCard != 1 鐨勫崱妲藉彂閫佹煡璇㈡寚浠�
- boolean sentQuery = false;
- int checkedSlots = 0;
- int maxSlotsPerCycle = Math.min(10, slotArray.length); // 姣忓懆鏈熸渶澶氭鏌�10涓崱妲�
-
- for (int i = 0; i < maxSlotsPerCycle && checkedSlots < slotArray.length; i++) {
- Fkj slot = slotArray[currentIndex];
- if (slot != null) {
- String hasCard = slot.getHasCard();
- if (!"1".equals(hasCard)) {
- int slotNumber = currentIndex + 1;
- if (sendQueryToSlot(slotNumber)) {
- sentQuery = true;
- consecutiveFailures = 0;
-
- // 鍏抽敭淇锛氬湪break鍓嶅厛鏇存柊绱㈠紩
- currentIndex = (currentIndex + 1) % slotArray.length;
- checkedSlots++;
-
- Thread.sleep(pollingInterval);
- break;
- } else {
- consecutiveFailures++;
- if (consecutiveFailures >= MAX_CONSECUTIVE_FAILURES) {
- System.err.println("lunxun杩炵画澶辫触娆℃暟杩囧锛屾殏鍋滆疆璇�");
- pausePolling();
- break;
- }
- }
- }
- }
-
- // 瀵逛簬涓嶉渶瑕佸彂閫佹煡璇㈢殑鍗℃Ы锛屾甯告洿鏂扮储寮�
- currentIndex = (currentIndex + 1) % slotArray.length;
- checkedSlots++;
- }
-
- // 濡傛灉娌℃湁鎵惧埌闇�瑕佹煡璇㈢殑鍗℃Ы锛岀瓑寰呬竴娈垫椂闂村啀缁х画
- if (!sentQuery) {
- Thread.sleep(pollingInterval * 2); // 娌℃湁鏌ヨ鏃剁瓑寰呮椂闂村姞鍊�
- }
-
- } catch (InterruptedException e) {
- //System.out.println("杞鏌ヨ绾跨▼琚腑鏂�");
- Thread.currentThread().interrupt();
- break;
- } catch (Exception e) {
- System.err.println("杞鏌ヨ杩囩▼涓彂鐢熷紓甯�: " + e.getMessage());
- consecutiveFailures++;
-
- // 鍙戠敓寮傚父鏃剁瓑寰呬竴娈垫椂闂村啀缁х画
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
-
- //System.out.println("杞鏌ヨ绾跨▼缁撴潫杩愯");
- }
-
- /**
- * 鍚戞寚瀹氬崱妲藉彂閫佹煡璇㈡寚浠� - 浼樺寲鐗堟湰
- * 浣跨敤缂撳瓨鎸囦护锛屼紭鍖栬皟璇曡緭鍑�
- */
- private boolean sendQueryToSlot(int slotNumber) {
- try {
- // 浣跨敤缂撳瓨鐨勬煡璇㈡寚浠�
- String queryCommand = getCachedQueryCommand(slotNumber);
-
- if (queryCommand != null && !queryCommand.trim().isEmpty()) {
- // 鍙戦�佸埌涓插彛
- boolean sendResult = Sendmsg.sendMessage(queryCommand);
-
- if (sendResult) {
- // 鍙湪璋冭瘯鏃惰緭鍑猴紝閬垮厤棰戠箒鎵撳嵃
- if (DEBUG_ENABLED) {
- SystemDebugDialog.appendAsciiData(String.format("Slot %d Send query (hasCard !=1)\n", slotNumber));
- }
- return true;
- } else {
- if (DEBUG_ENABLED) {
- SystemDebugDialog.appendAsciiData("Send query command to card slot err");
- }
- // 鍙戦�佸け璐ュ彲鑳芥槸涓插彛鏂紑锛屾洿鏂拌繛鎺ョ姸鎬�
- serialConnected = false;
- return false;
- }
- } else {
- System.err.println("鐢熸垚鐨勬煡璇㈡寚浠や负绌猴紝鍗℃Ы: " + slotNumber);
- return false;
- }
-
- } catch (Exception e) {
- System.err.println("鍙戦�佹煡璇㈡寚浠ゅ埌鍗℃Ы " + slotNumber + " 鏃跺彂鐢熷紓甯�: " + e.getMessage());
- // 鍙戠敓寮傚父鏃舵洿鏂颁覆鍙h繛鎺ョ姸鎬�
- serialConnected = false;
- return false;
- }
- }
- }
-
- /**
- * 绔嬪嵆鍚戞寚瀹氬崱妲藉彂閫佹煡璇㈡寚浠わ紙涓嶇瓑寰呰疆璇級
- * @param slotNumber 鍗℃Ы缂栧彿 (1-60)
- * @return true-鍙戦�佹垚鍔�, false-鍙戦�佸け璐�
- */
- public static boolean sendImmediateQuery(int slotNumber) {
- if (slotNumber < MIN_SLOT || slotNumber > MAX_SLOT) {
- System.err.println("鍗℃Ы缂栧彿蹇呴』鍦�" + MIN_SLOT + "-" + MAX_SLOT + "涔嬮棿");
- return false;
- }
-
- // 妫�鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鍙戦�佹煡璇㈡寚浠�");
- return false;
- }
-
- try {
- // 浣跨敤缂撳瓨鐨勬煡璇㈡寚浠�
- String queryCommand = getCachedQueryCommand(slotNumber);
-
- if (queryCommand != null && !queryCommand.trim().isEmpty()) {
- // 鍙戦�佸埌涓插彛
- boolean sendResult = Sendmsg.sendMessage(queryCommand);
-
- if (sendResult) {
- if (DEBUG_ENABLED) {
- //System.out.println("绔嬪嵆鏌ヨ鎴愬姛 - 鍗℃Ы " + slotNumber);
- }
- return true;
- } else {
- System.err.println("绔嬪嵆鏌ヨ澶辫触 - 鍙戦�佹寚浠ゅ埌鍗℃Ы " + slotNumber + " 澶辫触");
- return false;
- }
- } else {
- System.err.println("绔嬪嵆鏌ヨ澶辫触 - 鐢熸垚鐨勬煡璇㈡寚浠や负绌猴紝鍗℃Ы: " + slotNumber);
- return false;
- }
-
- } catch (Exception e) {
- System.err.println("绔嬪嵆鏌ヨ鍗℃Ы " + slotNumber + " 鏃跺彂鐢熷紓甯�: " + e.getMessage());
- return false;
- }
- }
-
- /**
- * 绔嬪嵆鍚戞墍鏈夊崱妲藉彂閫佹煡璇㈡寚浠わ紙鎵归噺锛�- 浼樺寲鐗堟湰
- * @return 鎴愬姛鍙戦�佺殑鎸囦护鏁伴噺
- */
- public static int sendImmediateQueryToAll() {
- // 妫�鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鍙戦�佹壒閲忔煡璇㈡寚浠�");
- return 0;
- }
-
- int successCount = 0;
- int batchSize = 5; // 姣忔壒娆″彂閫�5涓煡璇�
- int totalSlots = MAX_SLOT - MIN_SLOT + 1;
-
- //System.out.println("寮�濮嬫壒閲忔煡璇㈡墍鏈夊崱妲�...");
-
- for (int batchStart = MIN_SLOT; batchStart <= MAX_SLOT; batchStart += batchSize) {
- if (shouldStop.get()) {
- break;
- }
-
- int batchEnd = Math.min(batchStart + batchSize - 1, MAX_SLOT);
-
- // 鎵规鍐呮煡璇�
- for (int slot = batchStart; slot <= batchEnd; slot++) {
- if (sendImmediateQuery(slot)) {
- successCount++;
- }
- }
-
- // 鎵规闂撮棿闅旓紝閬垮厤涓插彛鎷ュ牭
- if (batchEnd < MAX_SLOT) {
- try {
- Thread.sleep(50);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
-
- //System.out.println("鎵归噺鏌ヨ瀹屾垚锛屾垚鍔熷彂閫�: " + successCount + "/" + totalSlots);
- return successCount;
- }
-
- /**
- * 鎵嬪姩璁剧疆涓插彛杩炴帴鐘舵�侊紙鐢ㄤ簬澶栭儴妫�娴嬪埌涓插彛鐘舵�佸彉鍖栨椂璋冪敤锛�
- * @param connected 涓插彛杩炴帴鐘舵��
- */
- public static void setSerialConnected(boolean connected) {
- serialConnected = connected;
- lastSerialCheckTime = System.currentTimeMillis();
-
- if (connected) {
-// //System.out.println("涓插彛杩炴帴鐘舵�佸凡璁剧疆涓�: 宸茶繛鎺�");
- } else {
- System.err.println("涓插彛杩炴帴鐘舵�佸凡璁剧疆涓�: 鏈繛鎺�");
- // 濡傛灉涓插彛鏂紑涓旇疆璇㈡鍦ㄨ繍琛岋紝鑷姩鏆傚仠杞
- if (isRunning && !isPaused) {
- pausePolling();
- }
- }
- }
-
- /**
- * 鑾峰彇杞鐘舵�佷俊鎭�
- * @return 鐘舵�佷俊鎭瓧绗︿覆
- */
- public static String getPollingStatus() {
- String status;
- if (!isRunning) {
- status = "宸插仠姝�";
- } else if (isPaused) {
- status = "宸叉殏鍋�";
- } else {
- status = "杩愯涓�";
- }
-
- String serialStatus = serialConnected ? "宸茶繛鎺�" : "鏈繛鎺�";
- int cacheSize = queryCommandCache.size();
-
- return String.format("杞鐘舵��: %s, 涓插彛: %s, 闂撮殧: %dms, 鎸囦护缂撳瓨: %d, 鍗℃Ы鑼冨洿: %d-%d",
- status, serialStatus, pollingInterval, cacheSize, MIN_SLOT, MAX_SLOT);
- }
-
- /**
- * 鐩存帴璁剧疆杞鏆傚仠鐘舵�侊紙渚涘叾浠栫被璋冪敤锛�
- * @param paused true-鏆傚仠杞, false-鎭㈠杞
- * @return true-璁剧疆鎴愬姛, false-璁剧疆澶辫触锛堝杞鏈繍琛岋級
- */
- public static boolean setPollingPaused(boolean paused) {
- if (!isRunning) {
- //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曡缃殏鍋滅姸鎬�");
- return false;
- }
-
- if (paused) {
- // 璇锋眰鏆傚仠
- if (!isPaused) {
- isPaused = true;
- //System.out.println("杞鏌ヨ宸查�氳繃澶栭儴璋冪敤鏆傚仠");
- return true;
- } else {
- //System.out.println("杞鏌ヨ宸茬粡澶勪簬鏆傚仠鐘舵��");
- return false;
- }
- } else {
- // 璇锋眰鎭㈠
- if (isPaused) {
- // 鎭㈠鍓嶆鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鎭㈠杞鏌ヨ");
- return false;
- }
-
- isPaused = false;
- synchronized (lunxun.class) {
- lunxun.class.notifyAll(); // 鍞ら啋绛夊緟鐨勭嚎绋�
- }
- //System.out.println("杞鏌ヨ宸查�氳繃澶栭儴璋冪敤鎭㈠");
- return true;
- } else {
- //System.out.println("杞鏌ヨ鏈浜庢殏鍋滅姸鎬�");
- return false;
- }
- }
- }
-
- /**
- * 鑾峰彇鎬ц兘缁熻淇℃伅
- */
- public static String getPerformanceStats() {
- return String.format("鏌ヨ鎸囦护缂撳瓨澶у皬: %d, 杞闂撮殧: %dms",
- queryCommandCache.size(), pollingInterval);
- }
+ private static volatile boolean isRunning = false;
+ private static volatile boolean isPaused = false;
+ private static final AtomicBoolean shouldStop = new AtomicBoolean(false);
+ private static Thread pollingThread;
+ private static int pollingInterval = 100; // 榛樿杞闂撮殧
+ public static boolean sendChaxunzhiling=true;//鏄惁鍚戜覆鍙e彂閫佹煡璇㈡寚浠�
+
+ public static boolean isSendChaxunzhiling() {
+ return sendChaxunzhiling;
+ }
+
+ public static void setSendChaxunzhiling(boolean sendChaxunzhiling) {
+ lunxun.sendChaxunzhiling = sendChaxunzhiling;
+ }
+
+ // 鍗℃Ы鐩稿叧甯搁噺
+ private static final int MIN_SLOT = 1;
+ private static final int MAX_SLOT = 60;
+
+ // 涓插彛杩炴帴妫�鏌ョ浉鍏�
+ private static final int SERIAL_CHECK_INTERVAL = 5000; // 5绉掓鏌ヤ竴娆′覆鍙h繛鎺�
+ private static long lastSerialCheckTime = 0;
+ private static boolean serialConnected = false;
+
+ // 鎬ц兘浼樺寲锛氭煡璇㈡寚浠ょ紦瀛�
+ private static final Map<Integer, String> queryCommandCache = new ConcurrentHashMap<>();
+
+ // 璋冭瘯妯″紡鎺у埗
+ public static boolean DEBUG_ENABLED = false;
+
+ // 鏂板锛氫笉鍚岀姸鎬佸崱妲界殑鏌ヨ棰戠巼鎺у埗
+ private static final int NO_CARD_QUERY_INTERVAL = 100; // 鏃犲崱鍗℃Ы鏌ヨ闂撮殧锛�100ms
+ private static final int HAS_CARD_QUERY_INTERVAL = 10000; // 鏈夊崱鍗℃Ы鏌ヨ闂撮殧锛�10绉�
+ private static final Map<Integer, Long> lastQueryTimeMap = new ConcurrentHashMap<>(); // 璁板綍姣忎釜鍗℃Ы鐨勬渶鍚庢煡璇㈡椂闂�
+
+ /**
+ * 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬� - 浼樺寲鐗堟湰锛屾坊鍔犻噸璇曟満鍒�
+ * @return true-涓插彛宸茶繛鎺�, false-涓插彛鏈繛鎺�
+ */
+ public static boolean checkSerialConnection() {
+ // 閬垮厤棰戠箒妫�鏌ワ紝姣�5绉掓鏌ヤ竴娆�
+ long currentTime = System.currentTimeMillis();
+ if (currentTime - lastSerialCheckTime < SERIAL_CHECK_INTERVAL) {
+ return serialConnected;
+ }
+
+ lastSerialCheckTime = currentTime;
+
+ try {
+ // 绠�鍖栨鏌ワ細鐩存帴妫�鏌endmsg鐨勪覆鍙g姸鎬侊紝鑰屼笉鏄彂閫佹祴璇曟寚浠�
+ boolean result = Sendmsg.isPortOpen();
+
+ if (result) {
+ if (DEBUG_ENABLED) {
+ //System.out.println("涓插彛杩炴帴姝e父");
+ }
+ serialConnected = true;
+ } else {
+ Errlog.logOperation("涓插彛杩炴帴澶辫触 - 涓插彛鏈墦寮�");
+ serialConnected = false;
+ }
+ } catch (Exception e) {
+ Errlog.logOperation("涓插彛杩炴帴妫�鏌ュ紓甯�: " + e.getMessage());
+ serialConnected = false;
+ }
+
+ return serialConnected;
+ }
+
+ /**
+ * 甯﹂噸璇曠殑涓插彛杩炴帴妫�鏌�
+ */
+ private static boolean checkSerialConnectionWithRetry() {
+ for (int i = 0; i < 3; i++) {
+ if (checkSerialConnection()) {
+ return true;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 鍚姩杞鏌ヨ - 浼樺寲鐗堟湰
+ * @return true-鍚姩鎴愬姛, false-鍚姩澶辫触
+ */
+ public static boolean startPolling() {
+ if (isRunning) {
+ //System.out.println("杞鏌ヨ宸茬粡鍦ㄨ繍琛屼腑");
+ return true;
+ }
+
+ // 鍚姩鍓嶄弗鏍兼鏌ヤ覆鍙h繛鎺�
+ if (!checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛鏈繛鎺ワ紝鏃犳硶鍚姩杞鏌ヨ");
+ return false;
+ }
+
+ // 浠庨厤缃腑鑾峰彇杞闂撮殧
+ loadPollingIntervalFromConfig();
+
+ // 鍒濆鍖栨渶鍚庢煡璇㈡椂闂磋褰�
+ initializeLastQueryTimes();
+
+ isRunning = true;
+ isPaused = false;
+ shouldStop.set(false);
+
+ try {
+ pollingThread = new Thread(new PollingTask(), "CardSlot-Polling-Thread");
+ pollingThread.setDaemon(true);
+ pollingThread.start();
+ return true;
+ } catch (Exception e) {
+ Errlog.logOperation("鍚姩杞鏌ヨ绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
+ isRunning = false;
+ shouldStop.set(true);
+ return false;
+ }
+ }
+
+ /**
+ * 鍒濆鍖栨渶鍚庢煡璇㈡椂闂磋褰�
+ */
+ private static void initializeLastQueryTimes() {
+ lastQueryTimeMap.clear();
+ for (int i = MIN_SLOT; i <= MAX_SLOT; i++) {
+ lastQueryTimeMap.put(i, 0L); // 鍒濆鍖栦负0锛岃〃绀轰粠鏈煡璇㈣繃
+ }
+ }
+
+ /**
+ * 鍋滄杞鏌ヨ - 淇鐗堟湰
+ * @return true-鍋滄鎴愬姛, false-鍋滄澶辫触
+ */
+ public static boolean stopPolling() {
+ if (!isRunning) {
+ //System.out.println("杞鏌ヨ鏈湪杩愯");
+ return false;
+ }
+
+ shouldStop.set(true);
+ isRunning = false;
+ isPaused = false;
+
+ if (pollingThread != null) {
+ pollingThread.interrupt();
+ try {
+ pollingThread.join(3000); // 绛夊緟3绉�
+ // 妫�鏌ョ嚎绋嬫槸鍚﹁繕鍦ㄨ繍琛�
+ if (pollingThread.isAlive()) {
+ Errlog.logOperation("杞绾跨▼鏈湪3绉掑唴鍋滄锛屾爣璁颁负瀹堟姢绾跨▼骞跺拷鐣�");
+ // 涓嶅己鍒跺仠姝紝鑰屾槸纭繚瀹冩槸瀹堟姢绾跨▼
+ pollingThread.setDaemon(true);
+ }
+ } catch (InterruptedException e) {
+ Errlog.logOperation("鍋滄杞鏌ヨ鏃惰涓柇: " + e.getMessage());
+ Thread.currentThread().interrupt();
+ } catch (Exception e) {
+ Errlog.logOperation("鍋滄杞绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
+ } finally {
+ pollingThread = null;
+ }
+ }
+
+ shouldStop.set(false);
+ //System.out.println("杞鏌ヨ宸插仠姝� - 涓插彛鏁版嵁鎺ユ敹涓嶅彈褰卞搷");
+ return true;
+ }
+
+ /**
+ * 鏆傚仠杞鏌ヨ
+ * @return true-鏆傚仠鎴愬姛, false-鏆傚仠澶辫触
+ */
+ public static boolean pausePolling() {
+ if (!isRunning) {
+ if (DEBUG_ENABLED) {
+ //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曟殏鍋�");
+ }
+ return false;
+ }
+
+ if (isPaused) {
+ if (DEBUG_ENABLED) {
+ //System.out.println("杞鏌ヨ宸茬粡澶勪簬鏆傚仠鐘舵��");
+ }
+ return false;
+ }
+
+ isPaused = true;
+ //System.out.println("杞鏌ヨ宸叉殏鍋� - 浠呭仠姝㈠彂閫佹煡璇㈡寚浠�");
+ return true;
+ }
+
+ /**
+ * 鎭㈠杞鏌ヨ
+ * @return true-鎭㈠鎴愬姛, false-鎭㈠澶辫触
+ */
+ public static boolean resumePolling() {
+ if (!isRunning) {
+ //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曟仮澶�");
+ return false;
+ }
+
+ if (!isPaused) {
+ //System.out.println("杞鏌ヨ鏈浜庢殏鍋滅姸鎬�");
+ return false;
+ }
+
+ // 鎭㈠鍓嶆鏌ヤ覆鍙h繛鎺�
+ if (!checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛鏈繛鎺ワ紝鏃犳硶鎭㈠杞鏌ヨ");
+ return false;
+ }
+
+ isPaused = false;
+ synchronized (lunxun.class) {
+ lunxun.class.notifyAll(); // 鍞ら啋绛夊緟鐨勭嚎绋�
+ }
+ //System.out.println("杞鏌ヨ宸叉仮澶�");
+ return true;
+ }
+
+ /**
+ * 妫�鏌ヨ疆璇㈢姸鎬�
+ * @return true-姝e湪杩愯, false-宸插仠姝�
+ */
+ public static boolean isPolling() {
+ return isRunning;
+ }
+
+ /**
+ * 妫�鏌ユ槸鍚︽殏鍋�
+ * @return true-宸叉殏鍋�, false-鏈殏鍋�
+ */
+ public static boolean isPaused() {
+ return isPaused;
+ }
+
+ /**
+ * 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬�
+ * @return true-涓插彛宸茶繛鎺�, false-涓插彛鏈繛鎺�
+ */
+ public static boolean isSerialConnected() {
+ return serialConnected;
+ }
+
+ /**
+ * 璁剧疆杞闂撮殧
+ * @param interval 杞闂撮殧锛堟绉掞級
+ */
+ public static void setPollingInterval(int interval) {
+ if (interval < 10) {
+ Errlog.logOperation("杞闂撮殧涓嶈兘灏忎簬10ms");
+ return;
+ }
+
+ pollingInterval = interval;
+ //System.out.println("杞闂撮殧宸茶缃负: " + interval + "ms");
+
+ // 濡傛灉姝e湪杩愯锛岄噸鏂板惎鍔ㄤ互搴旂敤鏂扮殑闂撮殧
+ if (isRunning) {
+ restartPolling();
+ }
+ }
+
+ /**
+ * 鑾峰彇褰撳墠杞闂撮殧
+ * @return 杞闂撮殧锛堟绉掞級
+ */
+ public static int getPollingInterval() {
+ return pollingInterval;
+ }
+
+ /**
+ * 閲嶆柊鍚姩杞鏌ヨ
+ * @return true-閲嶅惎鎴愬姛, false-閲嶅惎澶辫触
+ */
+ public static boolean restartPolling() {
+ stopPolling();
+
+ // 绛夊緟涓�灏忔鏃堕棿纭繚绾跨▼瀹屽叏鍋滄
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ return startPolling();
+ }
+
+ /**
+ * 浠庨厤缃腑鍔犺浇杞闂撮殧
+ */
+ private static void loadPollingIntervalFromConfig() {
+ try {
+ Chushihua configSystem = Chushihua.getInstance();
+ if (configSystem.isInitialized()) {
+ MachineConfig machineConfig = configSystem.getMachineConfig();
+ pollingInterval = machineConfig.getPollingInterval();
+ //System.out.println("浠庨厤缃姞杞借疆璇㈤棿闅�: " + pollingInterval + "ms");
+ } else {
+ //System.out.println("閰嶇疆绯荤粺鏈垵濮嬪寲锛屼娇鐢ㄩ粯璁よ疆璇㈤棿闅�: " + pollingInterval + "ms");
+ }
+ } catch (Exception e) {
+ Errlog.logOperation("鍔犺浇杞闂撮殧閰嶇疆澶辫触: " + e.getMessage());
+ //System.out.println("浣跨敤榛樿杞闂撮殧: " + pollingInterval + "ms");
+ }
+ }
+
+ /**
+ * 鑾峰彇缂撳瓨鐨勬煡璇㈡寚浠�
+ */
+ private static String getCachedQueryCommand(int slotNumber) {
+ return queryCommandCache.computeIfAbsent(slotNumber, QueryData::queryData);
+ }
+
+ /**
+ * 娓呯┖鏌ヨ鎸囦护缂撳瓨锛堝綋鏌ヨ閫昏緫鍙樺寲鏃惰皟鐢級
+ */
+ public static void clearQueryCache() {
+ queryCommandCache.clear();
+ //System.out.println("鏌ヨ鎸囦护缂撳瓨宸叉竻绌�");
+ }
+
+ /**
+ * 杞浠诲姟鍐呴儴绫� - 浼樺寲鐗堟湰
+ * 鏀寔涓嶅悓鐘舵�佸崱妲界殑涓嶅悓鏌ヨ棰戠巼
+ */
+
+ private static class PollingTask implements Runnable {
+ private int currentIndex = 0; // 褰撳墠绱㈠紩锛岀敤浜庨亶鍘唖lotArray
+ private int consecutiveFailures = 0; // 杩炵画澶辫触娆℃暟
+ private static final int MAX_CONSECUTIVE_FAILURES = 5; // 鏈�澶ц繛缁け璐ユ鏁�
+
+ @Override
+ public void run() {
+ //System.out.println("杞鏌ヨ绾跨▼寮�濮嬭繍琛�");
+
+ while (isRunning && !Thread.currentThread().isInterrupted() && !shouldStop.get()) {
+ try {
+
+ // System.out.println("鏌ヨ涓�.....绾跨▼");
+ // 妫�鏌ユ槸鍚︽殏鍋�
+ if (isPaused) {
+ synchronized (lunxun.class) {
+ while (isPaused && isRunning && !shouldStop.get()) {
+ lunxun.class.wait(1000); // 绛夊緟1绉掓垨鐩村埌琚敜閱�
+ }
+ }
+ continue;
+ }
+
+ // 瀹氭湡妫�鏌ヤ覆鍙h繛鎺ョ姸鎬侊紙姣�10娆″惊鐜鏌ヤ竴娆★級
+ if (currentIndex % 10 == 0 && !checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛杩炴帴鏂紑锛屾殏鍋滆疆璇�");
+ pausePolling();
+ continue;
+ }
+
+ // 鑾峰彇鍗℃Ы鏁扮粍
+ Fkj[] slotArray = SlotManager.getSlotArray();
+ if (slotArray == null || slotArray.length == 0) {
+ Errlog.logOperation("鍗℃Ы鏁扮粍鏈垵濮嬪寲");
+ Thread.sleep(pollingInterval);
+ continue;
+ }
+
+ // 鏂板锛氭牴鎹崱妲界姸鎬佸拰鏌ヨ棰戠巼鍐冲畾鏄惁鍙戦�佹煡璇�
+ boolean sentQuery = false;
+ long currentTime = System.currentTimeMillis();
+
+ // 閬嶅巻鍗℃Ы锛屽鎵鹃渶瑕佹煡璇㈢殑鍗℃Ы
+ for (int i = 0; i < slotArray.length && !sentQuery; i++) {
+ int slotIndex = (currentIndex + i) % slotArray.length;
+ Fkj slot = slotArray[slotIndex];
+ if (slot != null) {
+ String hasCard = slot.getHasCard();
+ int slotNumber = slotIndex + 1;
+ Long lastQueryTime = lastQueryTimeMap.get(slotNumber);
+
+ // 纭畾鏌ヨ闂撮殧锛氬彧鏈塰asCard="1"鐨勫崱妲戒娇鐢�10绉掗棿闅旓紝鍏朵粬鎯呭喌锛堝寘鎷�"-1"锛夐兘浣跨敤100ms闂撮殧
+ int queryInterval = "1".equals(hasCard) ? HAS_CARD_QUERY_INTERVAL : NO_CARD_QUERY_INTERVAL;
+
+ // 妫�鏌ユ槸鍚﹁揪鍒版煡璇㈡椂闂�
+ if (lastQueryTime == null || currentTime - lastQueryTime >= queryInterval) {
+ if (sendQueryToSlot(slotNumber)) {
+ // 鏇存柊鏈�鍚庢煡璇㈡椂闂�
+ lastQueryTimeMap.put(slotNumber, currentTime);
+ sentQuery = true;
+ consecutiveFailures = 0;
+
+ // 鎴愬姛鍙戦�佹煡璇㈠悗锛岀瓑寰�100ms鍐嶇户缁笅涓�涓煡璇�
+ Thread.sleep(100);
+
+ if (DEBUG_ENABLED) {
+ String status;
+ if ("1".equals(hasCard)) {
+ status = "鏈夊崱";
+ } else if ("-1".equals(hasCard)) {
+ status = "鏈煡";
+ } else {
+ status = "鏃犲崱";
+ }
+ SystemDebugDialog.appendAsciiData(
+ String.format("Slot %d (%s) 鏌ヨ鎴愬姛锛岄棿闅�: %dms\n",
+ slotNumber, status, queryInterval));
+ }
+ } else {
+ consecutiveFailures++;
+ if (consecutiveFailures >= MAX_CONSECUTIVE_FAILURES) {
+ Errlog.logOperation("lunxun杩炵画澶辫触娆℃暟杩囧锛屾殏鍋滆疆璇�");
+ pausePolling();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // 鏇存柊褰撳墠绱㈠紩
+ currentIndex = (currentIndex + 1) % slotArray.length;
+
+ // 濡傛灉娌℃湁鍙戦�佹煡璇紝绛夊緟涓�娈垫椂闂村啀缁х画
+ if (!sentQuery) {
+ Thread.sleep(pollingInterval);
+ }
+
+ } catch (InterruptedException e) {
+ //System.out.println("杞鏌ヨ绾跨▼琚腑鏂�");
+ Thread.currentThread().interrupt();
+ break;
+ } catch (Exception e) {
+ Errlog.logOperation("杞鏌ヨ杩囩▼涓彂鐢熷紓甯�: " + e.getMessage());
+ consecutiveFailures++;
+
+ // 鍙戠敓寮傚父鏃剁瓑寰呬竴娈垫椂闂村啀缁х画
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+ }
+ }
+
+ //System.out.println("杞鏌ヨ绾跨▼缁撴潫杩愯");
+ }
+
+ /**
+ * 鍚戞寚瀹氬崱妲藉彂閫佹煡璇㈡寚浠� - 浼樺寲鐗堟湰
+ * 浣跨敤缂撳瓨鎸囦护锛屼紭鍖栬皟璇曡緭鍑�
+ */
+ private boolean sendQueryToSlot(int slotNumber) {
+ try {
+ // 浣跨敤缂撳瓨鐨勬煡璇㈡寚浠�
+ String queryCommand = getCachedQueryCommand(slotNumber);
+ // System.out.println("鎸囦护鏄細"+queryCommand);
+ if (DEBUG_ENABLED) {
+ SystemDebugDialog.appendAsciiData("send to "+slotNumber+" queryCommand");
+ }
+
+ if (queryCommand != null && !queryCommand.trim().isEmpty()) {
+ // 鍙戦�佸埌涓插彛
+
+ if(sendChaxunzhiling) {
+ boolean sendResult = Sendmsg.sendMessage(queryCommand);
+ if (sendResult) {
+ return true;
+ } else {
+ if (DEBUG_ENABLED) {
+ SystemDebugDialog.appendAsciiData(slotNumber+" Send query command to card slot err");
+ }
+ // 鍙戦�佸け璐ュ彲鑳芥槸涓插彛鏂紑锛屾洿鏂拌繛鎺ョ姸鎬�
+ serialConnected = false;
+ return false;
+ }
+ }else {
+ return false;
+ }
+ } else {
+ Errlog.logOperation("鐢熸垚鐨勬煡璇㈡寚浠や负绌猴紝鍗℃Ы: " + slotNumber);
+ return false;
+ }
+
+ } catch (Exception e) {
+ Errlog.logOperation("鍙戦�佹煡璇㈡寚浠ゅ埌鍗℃Ы " + slotNumber + " 鏃跺彂鐢熷紓甯�: " + e.getMessage());
+ // 鍙戠敓寮傚父鏃舵洿鏂颁覆鍙h繛鎺ョ姸鎬�
+ serialConnected = false;
+ return false;
+ }
+ }
+ }
+
+ /**
+ * 绔嬪嵆鍚戞寚瀹氬崱妲藉彂閫佹煡璇㈡寚浠わ紙涓嶇瓑寰呰疆璇級
+ * @param slotNumber 鍗℃Ы缂栧彿 (1-60)
+ * @return true-鍙戦�佹垚鍔�, false-鍙戦�佸け璐�
+ */
+ public static boolean sendImmediateQuery(int slotNumber) {
+ if (slotNumber < MIN_SLOT || slotNumber > MAX_SLOT) {
+ Errlog.logOperation("鍗℃Ы缂栧彿蹇呴』鍦�" + MIN_SLOT + "-" + MAX_SLOT + "涔嬮棿");
+ return false;
+ }
+
+ // 妫�鏌ヤ覆鍙h繛鎺�
+ if (!checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛鏈繛鎺ワ紝鏃犳硶鍙戦�佹煡璇㈡寚浠�");
+ return false;
+ }
+
+ try {
+ // 浣跨敤缂撳瓨鐨勬煡璇㈡寚浠�
+ String queryCommand = getCachedQueryCommand(slotNumber);
+
+ if (queryCommand != null && !queryCommand.trim().isEmpty()) {
+ // 鍙戦�佸埌涓插彛
+ boolean sendResult = Sendmsg.sendMessage(queryCommand);
+
+ if (sendResult) {
+ // 鏇存柊鏈�鍚庢煡璇㈡椂闂�
+ lastQueryTimeMap.put(slotNumber, System.currentTimeMillis());
+
+ if (DEBUG_ENABLED) {
+ //System.out.println("绔嬪嵆鏌ヨ鎴愬姛 - 鍗℃Ы " + slotNumber);
+ }
+ return true;
+ } else {
+ Errlog.logOperation("绔嬪嵆鏌ヨ澶辫触 - 鍙戦�佹寚浠ゅ埌鍗℃Ы " + slotNumber + " 澶辫触");
+ return false;
+ }
+ } else {
+ Errlog.logOperation("绔嬪嵆鏌ヨ澶辫触 - 鐢熸垚鐨勬煡璇㈡寚浠や负绌猴紝鍗℃Ы: " + slotNumber);
+ return false;
+ }
+
+ } catch (Exception e) {
+ Errlog.logOperation("绔嬪嵆鏌ヨ鍗℃Ы " + slotNumber + " 鏃跺彂鐢熷紓甯�: " + e.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * 绔嬪嵆鍚戞墍鏈夊崱妲藉彂閫佹煡璇㈡寚浠わ紙鎵归噺锛�- 浼樺寲鐗堟湰
+ * @return 鎴愬姛鍙戦�佺殑鎸囦护鏁伴噺
+ */
+ public static int sendImmediateQueryToAll() {
+ // 妫�鏌ヤ覆鍙h繛鎺�
+ if (!checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛鏈繛鎺ワ紝鏃犳硶鍙戦�佹壒閲忔煡璇㈡寚浠�");
+ return 0;
+ }
+
+ int successCount = 0;
+ int batchSize = 5; // 姣忔壒娆″彂閫�5涓煡璇�
+ int totalSlots = MAX_SLOT - MIN_SLOT + 1;
+ long currentTime = System.currentTimeMillis();
+
+ //System.out.println("寮�濮嬫壒閲忔煡璇㈡墍鏈夊崱妲�...");
+
+ for (int batchStart = MIN_SLOT; batchStart <= MAX_SLOT; batchStart += batchSize) {
+ if (shouldStop.get()) {
+ break;
+ }
+
+ int batchEnd = Math.min(batchStart + batchSize - 1, MAX_SLOT);
+
+ // 鎵规鍐呮煡璇�
+ for (int slot = batchStart; slot <= batchEnd; slot++) {
+ if (sendImmediateQuery(slot)) {
+ successCount++;
+ // 鏇存柊鏈�鍚庢煡璇㈡椂闂�
+ lastQueryTimeMap.put(slot, currentTime);
+ }
+ }
+
+ // 鎵规闂撮棿闅旓紝閬垮厤涓插彛鎷ュ牭
+ if (batchEnd < MAX_SLOT) {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+ }
+ }
+
+ //System.out.println("鎵归噺鏌ヨ瀹屾垚锛屾垚鍔熷彂閫�: " + successCount + "/" + totalSlots);
+ return successCount;
+ }
+
+ /**
+ * 鎵嬪姩璁剧疆涓插彛杩炴帴鐘舵�侊紙鐢ㄤ簬澶栭儴妫�娴嬪埌涓插彛鐘舵�佸彉鍖栨椂璋冪敤锛�
+ * @param connected 涓插彛杩炴帴鐘舵��
+ */
+ public static void setSerialConnected(boolean connected) {
+ serialConnected = connected;
+ lastSerialCheckTime = System.currentTimeMillis();
+
+ if (connected) {
+ // //System.out.println("涓插彛杩炴帴鐘舵�佸凡璁剧疆涓�: 宸茶繛鎺�");
+ } else {
+ Errlog.logOperation("涓插彛杩炴帴鐘舵�佸凡璁剧疆涓�: 鏈繛鎺�");
+ // 濡傛灉涓插彛鏂紑涓旇疆璇㈡鍦ㄨ繍琛岋紝鑷姩鏆傚仠杞
+ if (isRunning && !isPaused) {
+ pausePolling();
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇杞鐘舵�佷俊鎭�
+ * @return 鐘舵�佷俊鎭瓧绗︿覆
+ */
+ public static String getPollingStatus() {
+ String status;
+ if (!isRunning) {
+ status = "宸插仠姝�";
+ } else if (isPaused) {
+ status = "宸叉殏鍋�";
+ } else {
+ status = "杩愯涓�";
+ }
+
+ String serialStatus = serialConnected ? "宸茶繛鎺�" : "鏈繛鎺�";
+ int cacheSize = queryCommandCache.size();
+
+ // 缁熻涓嶅悓鐘舵�佺殑鍗℃Ы鏁伴噺
+ int noCardCount = 0;
+ int hasCardCount = 0;
+ Fkj[] slotArray = SlotManager.getSlotArray();
+ if (slotArray != null) {
+ for (Fkj slot : slotArray) {
+ if (slot != null && "1".equals(slot.getHasCard())) {
+ hasCardCount++;
+ } else {
+ noCardCount++;
+ }
+ }
+ }
+
+ return String.format("杞鐘舵��: %s, 涓插彛: %s, 闂撮殧: %dms, 鎸囦护缂撳瓨: %d, 鍗℃Ы鑼冨洿: %d-%d, 鏃犲崱: %d(100ms), 鏈夊崱: %d(10s)",
+ status, serialStatus, pollingInterval, cacheSize, MIN_SLOT, MAX_SLOT,
+ noCardCount, hasCardCount);
+ }
+
+ /**
+ * 鐩存帴璁剧疆杞鏆傚仠鐘舵�侊紙渚涘叾浠栫被璋冪敤锛�
+ * @param paused true-鏆傚仠杞, false-鎭㈠杞
+ * @return true-璁剧疆鎴愬姛, false-璁剧疆澶辫触锛堝杞鏈繍琛岋級
+ */
+ public static boolean setPollingPaused(boolean paused) {
+ if (!isRunning) {
+ //System.out.println("杞鏌ヨ鏈湪杩愯锛屾棤娉曡缃殏鍋滅姸鎬�");
+ return false;
+ }
+
+ if (paused) {
+ // 璇锋眰鏆傚仠
+ if (!isPaused) {
+ isPaused = true;
+ //System.out.println("杞鏌ヨ宸查�氳繃澶栭儴璋冪敤鏆傚仠");
+ return true;
+ } else {
+ //System.out.println("杞鏌ヨ宸茬粡澶勪簬鏆傚仠鐘舵��");
+ return false;
+ }
+ } else {
+ // 璇锋眰鎭㈠
+ if (isPaused) {
+ // 鎭㈠鍓嶆鏌ヤ覆鍙h繛鎺�
+ if (!checkSerialConnectionWithRetry()) {
+ Errlog.logOperation("涓插彛鏈繛鎺ワ紝鏃犳硶鎭㈠杞鏌ヨ");
+ return false;
+ }
+
+ isPaused = false;
+ synchronized (lunxun.class) {
+ lunxun.class.notifyAll(); // 鍞ら啋绛夊緟鐨勭嚎绋�
+ }
+ //System.out.println("杞鏌ヨ宸查�氳繃澶栭儴璋冪敤鎭㈠");
+ return true;
+ } else {
+ //System.out.println("杞鏌ヨ鏈浜庢殏鍋滅姸鎬�");
+ return false;
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇鎬ц兘缁熻淇℃伅
+ */
+ public static String getPerformanceStats() {
+ long currentTime = System.currentTimeMillis();
+ int overdueNoCard = 0;
+ int overdueHasCard = 0;
+
+ Fkj[] slotArray = SlotManager.getSlotArray();
+ if (slotArray != null) {
+ for (int i = 0; i < slotArray.length; i++) {
+ Fkj slot = slotArray[i];
+ if (slot != null) {
+ int slotNumber = i + 1;
+ Long lastQueryTime = lastQueryTimeMap.get(slotNumber);
+ if (lastQueryTime != null) {
+ String hasCard = slot.getHasCard();
+ int queryInterval = "1".equals(hasCard) ? HAS_CARD_QUERY_INTERVAL : NO_CARD_QUERY_INTERVAL;
+ if (currentTime - lastQueryTime > queryInterval) {
+ if ("1".equals(hasCard)) {
+ overdueHasCard++;
+ } else {
+ overdueNoCard++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return String.format("鏌ヨ鎸囦护缂撳瓨澶у皬: %d, 杞闂撮殧: %dms, 瓒呮椂鏃犲崱: %d, 瓒呮椂鏈夊崱: %d",
+ queryCommandCache.size(), pollingInterval, overdueNoCard, overdueHasCard);
+ }
+
+ /**
+ * 璁剧疆鏃犲崱鍗℃Ы鏌ヨ闂撮殧
+ * @param interval 鏌ヨ闂撮殧锛堟绉掞級
+ */
+ public static void setNoCardQueryInterval(int interval) {
+ if (interval < 10) {
+ Errlog.logOperation("鏃犲崱鍗℃Ы鏌ヨ闂撮殧涓嶈兘灏忎簬10ms");
+ return;
+ }
+ // 娉ㄦ剰锛氳繖閲屽彧鏄缃父閲忥紝瀹為檯杩愯鏃堕渶瑕侀噸鏂板惎鍔ㄨ疆璇㈡墠鑳界敓鏁�
+ //System.out.println("鏃犲崱鍗℃Ы鏌ヨ闂撮殧宸茶缃负: " + interval + "ms");
+ }
+
+ /**
+ * 璁剧疆鏈夊崱鍗℃Ы鏌ヨ闂撮殧
+ * @param interval 鏌ヨ闂撮殧锛堟绉掞級
+ */
+ public static void setHasCardQueryInterval(int interval) {
+ if (interval < 1000) {
+ Errlog.logOperation("鏈夊崱鍗℃Ы鏌ヨ闂撮殧涓嶈兘灏忎簬1000ms");
+ return;
+ }
+ // 娉ㄦ剰锛氳繖閲屽彧鏄缃父閲忥紝瀹為檯杩愯鏃堕渶瑕侀噸鏂板惎鍔ㄨ疆璇㈡墠鑳界敓鏁�
+ //System.out.println("鏈夊崱鍗℃Ы鏌ヨ闂撮殧宸茶缃负: " + interval + "ms");
+ }
public static boolean isDEBUG_ENABLED() {
return DEBUG_ENABLED;
diff --git a/src/chushihua/lunxunzaixian.java b/src/chushihua/lunxunzaixian.java
deleted file mode 100644
index 2edfc76..0000000
--- a/src/chushihua/lunxunzaixian.java
+++ /dev/null
@@ -1,506 +0,0 @@
-package chushihua;
-
-import xitongshezhi.Fkj;
-import xitongshezhi.SystemDebugDialog;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * 鍦ㄧ嚎杞绫� - 浼樺寲鐗堟湰
- * 涓撻棬鐢ㄤ簬瀹氭椂杞鏈夊崱鐨勫崱妲藉苟鍙戦�佹煡璇㈡寚浠�
- * 涓庡師鏈夌殑杞鏌ヨ绫讳簰琛ワ紝涓撴敞浜庡湪绾胯澶囩殑鎸佺画鐩戞帶
- */
-public class lunxunzaixian {
- private static final AtomicBoolean isRunning = new AtomicBoolean(false);
- private static final AtomicBoolean isPaused = new AtomicBoolean(false);
- private static final AtomicBoolean shouldStop = new AtomicBoolean(false);
- private static Thread onlinePollingThread;
-
- // 鍙厤缃殑杞鍙傛暟锛堜笉鍐嶆槸final锛�
- private static int cycleInterval = 120000; // 瀹屾暣杞鍛ㄦ湡闂撮殧锛�60绉�
- private static int slotInterval = 200; // 鍗℃Ы闂存煡璇㈤棿闅旓細500姣
-
- // 鍗℃Ы鐩稿叧甯搁噺
- private static final int MIN_SLOT = 1;
- private static final int MAX_SLOT = 60;
-
- // 鎬ц兘浼樺寲閰嶇疆
- private static final int BATCH_SIZE = 5; // 鎵归噺鏌ヨ澶у皬
- private static int consecutiveFailures = 0;
- private static final int MAX_CONSECUTIVE_FAILURES = 3;
-
- /**
- * 鍚姩鍦ㄧ嚎杞 - 浼樺寲鐗堟湰
- * @return true-鍚姩鎴愬姛, false-鍚姩澶辫触
- */
- public static boolean startOnlinePolling() {
- if (isRunning.get()) {
- SystemDebugDialog.appendAsciiData("Online polling is already in progress");
- return true;
- }
-
- // 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鍚姩鍦ㄧ嚎杞");
- return false;
- }
-
- isRunning.set(true);
- isPaused.set(false);
- shouldStop.set(false);
- consecutiveFailures = 0;
-
- try {
- onlinePollingThread = new Thread(new OnlinePollingTask(), "Online-Polling-Thread");
- onlinePollingThread.setDaemon(true);
- onlinePollingThread.start();
- //System.out.println("鍦ㄧ嚎杞宸插惎鍔紝鍛ㄦ湡闂撮殧: " + cycleInterval + "ms, 鍗℃Ы闂撮殧: " + slotInterval + "ms");
- return true;
- } catch (Exception e) {
- System.err.println("鍚姩鍦ㄧ嚎杞绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
- isRunning.set(false);
- shouldStop.set(true);
- return false;
- }
- }
-
- /**
- * 鍋滄鍦ㄧ嚎杞 - 淇鐗堟湰
- * @return true-鍋滄鎴愬姛, false-鍋滄澶辫触
- */
- public static boolean stopOnlinePolling() {
- if (!isRunning.get()) {
- //System.out.println("鍦ㄧ嚎杞鏈湪杩愯");
- return false;
- }
-
- shouldStop.set(true);
- isRunning.set(false);
- isPaused.set(false);
-
- if (onlinePollingThread != null) {
- onlinePollingThread.interrupt();
- try {
- onlinePollingThread.join(3000); // 绛夊緟3绉�
- // 妫�鏌ョ嚎绋嬫槸鍚﹁繕鍦ㄨ繍琛�
- if (onlinePollingThread.isAlive()) {
- System.err.println("鍦ㄧ嚎杞绾跨▼鏈湪3绉掑唴鍋滄锛屾爣璁颁负瀹堟姢绾跨▼骞跺拷鐣�");
- // 涓嶅己鍒跺仠姝紝鑰屾槸纭繚瀹冩槸瀹堟姢绾跨▼
- onlinePollingThread.setDaemon(true);
- }
- } catch (InterruptedException e) {
- System.err.println("鍋滄鍦ㄧ嚎杞鏃惰涓柇: " + e.getMessage());
- Thread.currentThread().interrupt();
- } catch (Exception e) {
- System.err.println("鍋滄鍦ㄧ嚎杞绾跨▼鏃跺彂鐢熷紓甯�: " + e.getMessage());
- } finally {
- onlinePollingThread = null;
- }
- }
-
- shouldStop.set(false);
- //System.out.println("鍦ㄧ嚎杞宸插仠姝�");
- return true;
- }
-
- /**
- * 鏆傚仠鍦ㄧ嚎杞
- * @return true-鏆傚仠鎴愬姛, false-鏆傚仠澶辫触
- */
- public static boolean pauseOnlinePolling() {
- if (!isRunning.get()) {
- //System.out.println("鍦ㄧ嚎杞鏈湪杩愯锛屾棤娉曟殏鍋�");
- return false;
- }
-
- if (isPaused.get()) {
- //System.out.println("鍦ㄧ嚎杞宸茬粡澶勪簬鏆傚仠鐘舵��");
- return false;
- }
-
- isPaused.set(true);
- //System.out.println("鍦ㄧ嚎杞宸叉殏鍋�");
- return true;
- }
-
- /**
- * 鎭㈠鍦ㄧ嚎杞
- * @return true-鎭㈠鎴愬姛, false-鎭㈠澶辫触
- */
- public static boolean resumeOnlinePolling() {
- if (!isRunning.get()) {
- //System.out.println("鍦ㄧ嚎杞鏈湪杩愯锛屾棤娉曟仮澶�");
- return false;
- }
-
- if (!isPaused.get()) {
- //System.out.println("鍦ㄧ嚎杞鏈浜庢殏鍋滅姸鎬�");
- return false;
- }
-
- // 鎭㈠鍓嶆鏌ヤ覆鍙h繛鎺�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鎭㈠鍦ㄧ嚎杞");
- return false;
- }
-
- isPaused.set(false);
- synchronized (lunxunzaixian.class) {
- lunxunzaixian.class.notifyAll(); // 鍞ら啋绛夊緟鐨勭嚎绋�
- }
- //System.out.println("鍦ㄧ嚎杞宸叉仮澶�");
- return true;
- }
-
- /**
- * 妫�鏌ュ湪绾胯疆璇㈢姸鎬�
- * @return true-姝e湪杩愯, false-宸插仠姝�
- */
- public static boolean isOnlinePolling() {
- return isRunning.get();
- }
-
- /**
- * 妫�鏌ユ槸鍚︽殏鍋�
- * @return true-宸叉殏鍋�, false-鏈殏鍋�
- */
- public static boolean isOnlinePaused() {
- return isPaused.get();
- }
-
- /**
- * 閲嶆柊鍚姩鍦ㄧ嚎杞
- * @return true-閲嶅惎鎴愬姛, false-閲嶅惎澶辫触
- */
- public static boolean restartOnlinePolling() {
- stopOnlinePolling();
-
- // 绛夊緟涓�灏忔鏃堕棿纭繚绾跨▼瀹屽叏鍋滄
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
-
- return startOnlinePolling();
- }
-
- /**
- * 璁剧疆杞闂撮殧鍙傛暟
- * @param cycleMs 瀹屾暣杞鍛ㄦ湡闂撮殧锛堟绉掞級
- * @param slotMs 鍗℃Ы闂存煡璇㈤棿闅旓紙姣锛�
- */
- public static void setPollingIntervals(int cycleMs, int slotMs) {
- cycleInterval = Math.max(cycleMs, 1000); // 鏈�灏�1绉�
- slotInterval = Math.max(slotMs, 50); // 鏈�灏�50姣
- //System.out.println("鍦ㄧ嚎杞闂撮殧宸茶缃� - 鍛ㄦ湡闂撮殧: " + cycleInterval + "ms, 鍗℃Ы闂撮殧: " + slotInterval + "ms");
-
- // 濡傛灉姝e湪杩愯锛岄噸鏂板惎鍔ㄤ互搴旂敤鏂扮殑闂撮殧
- if (isRunning.get()) {
- restartOnlinePolling();
- }
- }
-
- /**
- * 鑾峰彇褰撳墠杞闂撮殧閰嶇疆
- * @return 闂撮殧閰嶇疆瀛楃涓�
- */
- public static String getPollingIntervals() {
- return String.format("鍛ㄦ湡闂撮殧: %dms, 鍗℃Ы闂撮殧: %dms", cycleInterval, slotInterval);
- }
-
- /**
- * 鑾峰彇鍦ㄧ嚎杞缁熻淇℃伅
- * @return 缁熻淇℃伅瀛楃涓�
- */
- public static String getOnlinePollingStats() {
- int totalSlots = MAX_SLOT - MIN_SLOT + 1;
- int cardSlots = countCardSlots();
-
- String status;
- if (!isRunning.get()) {
- status = "宸插仠姝�";
- } else if (isPaused.get()) {
- status = "宸叉殏鍋�";
- } else {
- status = "杩愯涓�";
- }
-
- return String.format("鍦ㄧ嚎杞鐘舵��: %s, 鏈夊崱鍗℃Ы: %d/%d, 鍛ㄦ湡闂撮殧: %ds, 鍗℃Ы闂撮殧: %dms",
- status, cardSlots, totalSlots, cycleInterval/1000, slotInterval);
- }
-
- /**
- * 缁熻鏈夊崱鐨勫崱妲芥暟閲�
- * @return 鏈夊崱鐨勫崱妲芥暟閲�
- */
- private static int countCardSlots() {
- if (SlotManager.slotArray == null) {
- return 0;
- }
-
- int count = 0;
- for (Fkj slot : SlotManager.slotArray) {
- if (slot != null && "1".equals(slot.getHasCard())) {
- count++;
- }
- }
- return count;
- }
-
- /**
- * 甯﹂噸璇曠殑涓插彛杩炴帴妫�鏌�
- */
- private static boolean checkSerialConnectionWithRetry() {
- for (int i = 0; i < 3; i++) {
- if (lunxun.checkSerialConnection()) {
- return true;
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return false;
- }
- }
- return false;
- }
-
- /**
- * 鍦ㄧ嚎杞浠诲姟鍐呴儴绫� - 浼樺寲鐗堟湰
- * 涓撻棬杞鏈夊崱鐨勫崱妲斤紝浼樺寲璧勬簮浣跨敤
- */
- private static class OnlinePollingTask implements Runnable {
- @Override
- public void run() {
- //System.out.println("鍦ㄧ嚎杞绾跨▼寮�濮嬭繍琛�");
-
- while (isRunning.get() && !Thread.currentThread().isInterrupted() && !shouldStop.get()) {
- try {
- // 妫�鏌ユ槸鍚︽殏鍋�
- if (isPaused.get()) {
- synchronized (lunxunzaixian.class) {
- while (isPaused.get() && isRunning.get() && !shouldStop.get()) {
- lunxunzaixian.class.wait(1000); // 绛夊緟1绉掓垨鐩村埌琚敜閱�
- }
- }
- continue;
- }
-
- // 妫�鏌ヤ覆鍙h繛鎺ョ姸鎬�
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛杩炴帴鏂紑锛屾殏鍋滃湪绾胯疆璇�");
- pauseOnlinePolling();
- continue;
- }
-
- // 鎵ц涓�杞湁鍗″崱妲界殑杞
- if (pollCardSlotsOptimized()) {
- consecutiveFailures = 0; // 閲嶇疆杩炵画澶辫触璁℃暟
- } else {
- consecutiveFailures++;
- if (consecutiveFailures >= MAX_CONSECUTIVE_FAILURES) {
- System.err.println("lunxunzaixian杩炵画澶辫触娆℃暟杩囧锛屾殏鍋滃湪绾胯疆璇�");
- pauseOnlinePolling();
- }
- }
-
- // 绛夊緟瀹屾暣鍛ㄦ湡闂撮殧
- Thread.sleep(cycleInterval);
-
- } catch (InterruptedException e) {
- //System.out.println("鍦ㄧ嚎杞绾跨▼琚腑鏂�");
- Thread.currentThread().interrupt();
- break;
- } catch (Exception e) {
- System.err.println("鍦ㄧ嚎杞杩囩▼涓彂鐢熷紓甯�: " + e.getMessage());
- consecutiveFailures++;
-
- // 鍙戠敓寮傚父鏃剁瓑寰呬竴娈垫椂闂村啀缁х画
- try {
- Thread.sleep(5000);
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
-
- //System.out.println("鍦ㄧ嚎杞绾跨▼缁撴潫杩愯");
- }
-
- /**
- * 浼樺寲鐗堟湰锛氭壒閲忚疆璇㈡湁鍗″崱妲�
- * @return true-杞鎴愬姛, false-杞澶辫触
- */
- private boolean pollCardSlotsOptimized() {
- if (SlotManager.slotArray == null) {
- System.err.println("鍗℃Ы鏁扮粍鏈垵濮嬪寲");
- return false;
- }
-
- List<Integer> cardSlots = new ArrayList<>();
-
- // 绗竴闃舵锛氭敹闆嗘墍鏈夋湁鍗″崱妲�
- for (int i = 0; i < SlotManager.slotArray.length; i++) {
- if (!isRunning.get() || Thread.currentThread().isInterrupted() || shouldStop.get()) {
- break;
- }
-
- Fkj slot = SlotManager.slotArray[i];
- if (slot != null && "1".equals(slot.getHasCard())) {
- cardSlots.add(i + 1);
- }
- }
-
- if (cardSlots.isEmpty()) {
- if (lunxun.DEBUG_ENABLED) {
- //System.out.println("娌℃湁鎵惧埌鏈夊崱鐨勫崱妲�");
- }
- return true;
- }
-
- int polledCount = 0;
- int totalCardSlots = cardSlots.size();
-
- // 绗簩闃舵锛氭壒閲忔煡璇㈡湁鍗″崱妲� - 淇锛氭瘡涓崱妲介棿閮芥湁闂撮殧
- for (int i = 0; i < cardSlots.size(); i += BATCH_SIZE) {
- if (!isRunning.get() || Thread.currentThread().isInterrupted() || shouldStop.get()) {
- break;
- }
-
- int end = Math.min(i + BATCH_SIZE, cardSlots.size());
- List<Integer> batch = cardSlots.subList(i, end);
-
- // 鎵规鍐呮煡璇� - 淇锛氭瘡涓崱妲介棿娣诲姞闂撮殧
- for (int j = 0; j < batch.size(); j++) {
- int slotNumber = batch.get(j);
-
- if (sendQueryToCardSlot(slotNumber)) {
- polledCount++;
- }
-
- // 閲嶈淇锛氭瘡涓崱妲芥煡璇㈠悗绛夊緟鎸囧畾闂撮殧锛堟渶鍚庝竴涓崱妲介櫎澶栵級
- if (j < batch.size() - 1) {
- try {
- Thread.sleep(slotInterval); // 鍗℃Ы闂撮棿闅�
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
-
- // 鎵规闂撮棿闅旓紙淇濇寔鍘熸湁閫昏緫锛�
- if (end < cardSlots.size()) {
- try {
- Thread.sleep(slotInterval * BATCH_SIZE);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- break;
- }
- }
- }
-
- if (polledCount > 0 && lunxun.DEBUG_ENABLED) {
- System.out.println("鍦ㄧ嚎杞瀹屾垚锛屾垚鍔熸煡璇� " + polledCount + "/" + totalCardSlots + " 涓湁鍗″崱妲�");
- }
-
- return polledCount > 0;
- }
-
-
-
- /**
- * 鍚戞寚瀹氭湁鍗″崱妲藉彂閫佹煡璇㈡寚浠�
- * @param slotNumber 鍗℃Ы缂栧彿
- * @return true-鍙戦�佹垚鍔�, false-鍙戦�佸け璐�
- */
- private boolean sendQueryToCardSlot(int slotNumber) {
- try {
- // 浣跨敤鍘熸湁鐨勭珛鍗虫煡璇㈠姛鑳�
- boolean result = lunxun.sendImmediateQuery(slotNumber);
-
- if (result) {
- // 璁板綍璋冭瘯淇℃伅锛堝噺灏戣緭鍑洪鐜囷級
- if (lunxun.DEBUG_ENABLED && (slotNumber == 1 || slotNumber % 10 == 0)) {
- //System.out.println("鍦ㄧ嚎杞 - 鏌ヨ鏈夊崱鍗℃Ы " + slotNumber);
- }
- return true;
- } else {
- System.err.println("鍦ㄧ嚎杞 - 鏌ヨ鏈夊崱鍗℃Ы " + slotNumber + " 澶辫触");
- return false;
- }
-
- } catch (Exception e) {
- System.err.println("鍦ㄧ嚎杞 - 鏌ヨ鏈夊崱鍗℃Ы " + slotNumber + " 鏃跺彂鐢熷紓甯�: " + e.getMessage());
- return false;
- }
- }
- }
-
- /**
- * 鎵嬪姩瑙﹀彂绔嬪嵆杞锛堜笉绛夊緟鍛ㄦ湡锛�- 浼樺寲鐗堟湰
- * @return 鎴愬姛鏌ヨ鐨勫崱妲芥暟閲�
- */
- public static int triggerImmediatePolling() {
- if (!isRunning.get() || isPaused.get()) {
- System.err.println("鍦ㄧ嚎杞鏈繍琛屾垨宸叉殏鍋滐紝鏃犳硶绔嬪嵆杞");
- return 0;
- }
-
- if (!checkSerialConnectionWithRetry()) {
- System.err.println("涓插彛鏈繛鎺ワ紝鏃犳硶鎵ц绔嬪嵆杞");
- return 0;
- }
-
- //System.out.println("寮�濮嬬珛鍗宠疆璇㈡湁鍗″崱妲�...");
-
- OnlinePollingTask task = new OnlinePollingTask();
-
- // 浣跨敤鏂扮殑鎵归噺杞鏂规硶
- int cardSlotCount = countCardSlots();
-
- // 鍦ㄦ柊绾跨▼涓墽琛岀珛鍗宠疆璇紝閬垮厤闃诲褰撳墠绾跨▼
- Thread immediateThread = new Thread(() -> {
- try {
- task.pollCardSlotsOptimized();
- } catch (Exception e) {
- System.err.println("绔嬪嵆杞杩囩▼涓彂鐢熷紓甯�: " + e.getMessage());
- }
- }, "Immediate-Online-Polling");
-
- immediateThread.setDaemon(true);
- immediateThread.start();
-
- return cardSlotCount;
- }
-
- /**
- * 璁剧疆鍦ㄧ嚎杞鏆傚仠鐘舵�侊紙渚涘叾浠栫被璋冪敤锛�
- * @param paused true-鏆傚仠杞, false-鎭㈠杞
- * @return true-璁剧疆鎴愬姛, false-璁剧疆澶辫触
- */
- public static boolean setOnlinePollingPaused(boolean paused) {
- if (!isRunning.get()) {
- //System.out.println("鍦ㄧ嚎杞鏈湪杩愯锛屾棤娉曡缃殏鍋滅姸鎬�");
- return false;
- }
-
- if (paused) {
- return pauseOnlinePolling();
- } else {
- return resumeOnlinePolling();
- }
- }
-
- /**
- * 鑾峰彇鎬ц兘缁熻淇℃伅
- */
- public static String getPerformanceStats() {
- return String.format("鎵归噺澶у皬: %d, 鍛ㄦ湡闂撮殧: %dms, 鍗℃Ы闂撮殧: %dms",
- BATCH_SIZE, cycleInterval, slotInterval);
- }
-}
\ No newline at end of file
diff --git a/src/xitongshezhi/Charulog.java b/src/dialog/Charulog.java
similarity index 93%
rename from src/xitongshezhi/Charulog.java
rename to src/dialog/Charulog.java
index 9015ef5..5342212 100644
--- a/src/xitongshezhi/Charulog.java
+++ b/src/dialog/Charulog.java
@@ -1,4 +1,4 @@
-package xitongshezhi;
+package dialog;
import java.io.*;
import java.text.SimpleDateFormat;
@@ -51,8 +51,9 @@
File file = new File(LOG_FILE);
if (file.exists()) {
- try (FileInputStream fis = new FileInputStream(file)) {
- props.load(fis);
+ try (FileInputStream fis = new FileInputStream(file);
+ InputStreamReader isr = new InputStreamReader(fis, "UTF-8")) {
+ props.load(isr);
} catch (IOException e) {
System.err.println("璇诲彇鏃ュ織鏂囦欢澶辫触: " + e.getMessage());
}
@@ -95,14 +96,14 @@
* 鍐欏叆鏃ュ織鏂囦欢
*/
private static void writeLogFile(Properties props) {
- try (FileOutputStream fos = new FileOutputStream(LOG_FILE)) {
+ try (FileOutputStream fos = new FileOutputStream(LOG_FILE);
+ OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8")) {
// 娣诲姞鏂囦欢澶存敞閲�
- props.store(fos, "鎿嶄綔鏃ュ織璁板綍 - 鏈�鍚庢洿鏂�: " + new Date());
+ props.store(osw, "鎿嶄綔鏃ュ織璁板綍 - 鏈�鍚庢洿鏂�: " + new Date());
} catch (IOException e) {
System.err.println("鍐欏叆鏃ュ織鏂囦欢澶辫触: " + e.getMessage());
}
}
-
/**
* 鑾峰彇褰撳墠鏃ュ織璁板綍鏁伴噺锛堢敤浜庢祴璇曪級
*/
diff --git a/src/xitongshezhi/Dingshidialog.java b/src/dialog/Dingshidialog.java
similarity index 86%
rename from src/xitongshezhi/Dingshidialog.java
rename to src/dialog/Dingshidialog.java
index 6a564c2..f821c1d 100644
--- a/src/xitongshezhi/Dingshidialog.java
+++ b/src/dialog/Dingshidialog.java
@@ -1,4 +1,4 @@
-package xitongshezhi;
+package dialog;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -26,6 +26,9 @@
*/
public class Dingshidialog {
+ // 娣诲姞闈欐�佹爣蹇楁潵璺熻釜寮圭獥鏄剧ず鐘舵��
+ private static volatile boolean isDialogShowing = false;
+
/**
* 鏄剧ず瀹氭椂鍏抽棴瀵硅瘽妗�
* @param parent 鐖剁獥鍙�
@@ -34,8 +37,14 @@
* @param audioFile MP3鏂囦欢鍚嶏紙鏍圭洰褰曚笅锛屾棤闇�鎵╁睍鍚嶏級
* @return 1-鎴愬姛 0-澶辫触
*/
- public static int showTimedDialog(Frame parent, int countdownTime, String message, String audioFile) {
- TimedDialog dialog = new TimedDialog(parent, countdownTime, message, audioFile);
+ public static int showTimedDialog(Frame parent, int countdownTime, String message) {
+ // 妫�鏌ユ槸鍚﹀凡鏈夊脊绐楀湪鏄剧ず
+ if (isDialogShowing) {
+ System.out.println("宸叉湁寮圭獥鍦ㄦ樉绀猴紝蹇界暐鏂拌姹�");
+ return 0; // 杩斿洖澶辫触
+ }
+
+ TimedDialog dialog = new TimedDialog(parent, countdownTime, message);
return dialog.showDialog();
}
@@ -43,19 +52,18 @@
* 鍐呴儴瀵硅瘽妗嗙被锛岀‘淇濅娇鐢ㄥ悗鑳借鍨冨溇鍥炴敹
*/
@SuppressWarnings("serial")
- private static class TimedDialog extends JDialog {
+ private static class TimedDialog extends JDialog {
private JLabel countdownLabel;
private int remainingTime;
private int result = 0;
private Clip audioClip;
private volatile boolean running = true;
- public TimedDialog(Frame parent, int countdownTime, String message, String audioFile) {
+ public TimedDialog(Frame parent, int countdownTime, String message) {
super(parent, "", true);
this.remainingTime = countdownTime;
initializeUI(message);
startCountdown();
- playAudio(audioFile);
}
private void initializeUI(String message) {
@@ -89,7 +97,7 @@
messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
// 鍒涘缓鍊掕鏃舵爣绛�
- countdownLabel = new JLabel("鍓╀綑鏃堕棿: " + remainingTime + "绉�");
+ countdownLabel = new JLabel(remainingTime + "绉掑悗鑷姩鍏抽棴");
countdownLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 16));
countdownLabel.setForeground(new Color(231, 76, 60));
countdownLabel.setHorizontalAlignment(SwingConstants.CENTER);
@@ -132,6 +140,18 @@
public void windowClosing(java.awt.event.WindowEvent e) {
disposeDialog();
}
+
+ @Override
+ public void windowOpened(java.awt.event.WindowEvent e) {
+ // 璁剧疆寮圭獥鏄剧ず鏍囧織
+ isDialogShowing = true;
+ }
+
+ @Override
+ public void windowClosed(java.awt.event.WindowEvent e) {
+ // 纭繚寮圭獥鍏抽棴鏃堕噸缃爣蹇�
+ isDialogShowing = false;
+ }
});
}
@@ -147,7 +167,7 @@
SwingUtilities.invokeLater(() -> {
if (countdownLabel != null) {
- countdownLabel.setText("鍓╀綑鏃堕棿: " + remainingTime + "绉�");
+ countdownLabel.setText( remainingTime + "绉掑悗鑷姩鍏抽棴");
}
});
@@ -245,6 +265,9 @@
// 娓呯悊UI寮曠敤
countdownLabel = null;
+ // 閲嶇疆寮圭獥鏄剧ず鏍囧織
+ isDialogShowing = false;
+
dispose();
}
@@ -252,6 +275,12 @@
* 鏄剧ず瀵硅瘽妗�
*/
public int showDialog() {
+ // 鍐嶆妫�鏌ユ爣蹇楋紝闃叉绔炴�佹潯浠�
+ if (isDialogShowing) {
+ System.out.println("宸叉湁寮圭獥鍦ㄦ樉绀猴紝鍙栨秷鏄剧ず");
+ return 0;
+ }
+
setVisible(true);
return result;
}
diff --git a/src/xitongshezhi/Charulog.java b/src/dialog/Errlog.java
similarity index 91%
copy from src/xitongshezhi/Charulog.java
copy to src/dialog/Errlog.java
index 9015ef5..da59a46 100644
--- a/src/xitongshezhi/Charulog.java
+++ b/src/dialog/Errlog.java
@@ -1,12 +1,12 @@
-package xitongshezhi;
+package dialog;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
-public class Charulog {
- private static final String LOG_FILE = "log.properties";
+public class Errlog {
+ private static final String LOG_FILE = "err.properties";
private static final int MAX_RECORDS = 500;
private static final ReentrantLock lock = new ReentrantLock();
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -51,8 +51,9 @@
File file = new File(LOG_FILE);
if (file.exists()) {
- try (FileInputStream fis = new FileInputStream(file)) {
- props.load(fis);
+ try (FileInputStream fis = new FileInputStream(file);
+ InputStreamReader isr = new InputStreamReader(fis, "UTF-8")) {
+ props.load(isr);
} catch (IOException e) {
System.err.println("璇诲彇鏃ュ織鏂囦欢澶辫触: " + e.getMessage());
}
@@ -95,14 +96,14 @@
* 鍐欏叆鏃ュ織鏂囦欢
*/
private static void writeLogFile(Properties props) {
- try (FileOutputStream fos = new FileOutputStream(LOG_FILE)) {
+ try (FileOutputStream fos = new FileOutputStream(LOG_FILE);
+ OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8")) {
// 娣诲姞鏂囦欢澶存敞閲�
- props.store(fos, "鎿嶄綔鏃ュ織璁板綍 - 鏈�鍚庢洿鏂�: " + new Date());
+ props.store(osw, "鎿嶄綔鏃ュ織璁板綍 - 鏈�鍚庢洿鏂�: " + new Date());
} catch (IOException e) {
System.err.println("鍐欏叆鏃ュ織鏂囦欢澶辫触: " + e.getMessage());
}
}
-
/**
* 鑾峰彇褰撳墠鏃ュ織璁板綍鏁伴噺锛堢敤浜庢祴璇曪級
*/
diff --git a/src/home/CardMachineUI.java b/src/home/CardMachineUI.java
index 63c01cd..caa3f4a 100644
--- a/src/home/CardMachineUI.java
+++ b/src/home/CardMachineUI.java
@@ -13,7 +13,6 @@
import xitongshezhi.AdminLoginDialog;
import xitongshezhi.CardPickupDialog;
import xitongshezhi.ConfigSet;
-import xitongshezhi.Fkj;
import chuankou.SerialPortService;
import chuankou.Sendmsg;
@@ -77,9 +76,12 @@
private JPanel commFaultPanel;
public CardMachineUI() {
- try {
+ try {
// 鍏堝垵濮嬪寲绯荤粺閰嶇疆鍜岀粍浠�
initializeSystem();
+
+ // 鍒濆鍖栦覆鍙hВ鏋愬櫒
+ initializeSerialParser();
// 鐒跺悗鍒濆鍖朥I
initializeUI();
@@ -110,7 +112,8 @@
if (serialConnected && lunxun.isPolling() && lunxun.isPaused()) {
// 鍙湁鍦ㄤ笉鍦ㄨ缃〉闈㈡椂鎵嶈嚜鍔ㄦ仮澶�
if (!isInConfigPage()) {
- lunxun.resumePolling();
+// lunxun.resumePolling();
+// System.out.println("灏濊瘯鑷姩鍚姩杞鍔熻兘");
}
}
});
@@ -171,7 +174,7 @@
}
private void initializeUI() {
- setTitle("UWB浜哄憳瀹氫綅鍗″彂鍗℃満绠$悊绯荤粺");
+ setTitle("鏅鸿兘浜鸿劯鍙戝崱鏈虹鐞嗙郴缁�");
setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
@@ -288,8 +291,9 @@
refreshBtn.addActionListener(e -> {
updateCardSlotsDisplay();
updateStatistics();
+ lunxun.resumePolling();
JOptionPane.showMessageDialog(CardMachineUI.this,
- "鎵嬪姩鍒锋柊瀹屾垚锛屽叡鍒锋柊 " + TOTAL_SLOTS + " 涓崱妲�",
+ "鎵嬪姩鍒锋柊瀹屾垚锛屽惎鍔ㄨ疆璇紝鍏卞埛鏂� " + TOTAL_SLOTS + " 涓崱妲�",
"鍒锋柊瀹屾垚", JOptionPane.INFORMATION_MESSAGE);
});
@@ -586,7 +590,7 @@
if (pickupSuccess) {
// 鍙栧崱鎴愬姛锛岃皟鐢╟hanggehaska鏂规硶鏀瑰彉鍗℃Ы灞炴��
- SlotManager.changgehaska(slotId, "1"); // "1"琛ㄧず绠$悊鍛樻搷浣�
+ SlotManager.changgehaska(slotId,1); // "1"琛ㄧず绠$悊鍛樻搷浣�
//System.out.println("鍗℃Ы " + slotId + " 鍙栧崱鎴愬姛锛屽凡鏇存柊鍗℃Ы鐘舵��");
}
}
@@ -796,12 +800,15 @@
/**
* 鍚姩UI鍒锋柊瀹氭椂鍣� - 姣�3绉掑埛鏂颁竴娆�
*/
+ // 鍦╯tartUIUpdates()鏂规硶涓皟鐢�
private void startUIUpdates() {
- uiUpdateTimer = new Timer(3000, e -> {
- updateCardSlotsDisplay();
- updateStatistics();
- });
- uiUpdateTimer.start();
+ uiUpdateTimer = new Timer(3000, e -> {
+ ensurePollingRunning(); // 纭繚杞杩愯
+ ensureSerialParserRunning(); // 纭繚涓插彛瑙f瀽鍣ㄨ繍琛�
+ updateCardSlotsDisplay();
+ updateStatistics();
+ });
+ uiUpdateTimer.start();
}
/**
@@ -829,5 +836,42 @@
public SlotManager getSlotManager() {
return slotManager;
}
+
+ /**
+ * 妫�鏌ュ苟纭繚杞鏌ヨ姝e父杩愯
+ */
+ private void ensurePollingRunning() {
+ if (!lunxun.isPolling() && lunxun.checkSerialConnection()) {
+ // 濡傛灉杞鏈繍琛屼絾涓插彛宸茶繛鎺ワ紝鑷姩鍚姩杞
+ boolean started = lunxun.startPolling();
+ if (started) {
+ System.out.println("妫�娴嬪埌杞鏈繍琛岋紝宸茶嚜鍔ㄥ惎鍔�");
+ }
+ }
+ }
+
+ /**
+ * 纭繚涓插彛瑙f瀽鍣ㄦ甯歌繍琛�
+ */
+ private void ensureSerialParserRunning() {
+ // 濡傛灉涓插彛瑙f瀽鍣ㄦ湭杩愯浣嗕覆鍙e凡杩炴帴锛岃嚜鍔ㄥ惎鍔�
+ if (serialProtocolParser != null && !serialProtocolParser.isRunning() && lunxun.checkSerialConnection()) {
+ serialProtocolParser.start();
+ //System.out.println("妫�娴嬪埌涓插彛瑙f瀽鍣ㄦ湭杩愯锛屽凡鑷姩鍚姩");
+ }
+ }
+
+ /**
+ * 鍒濆鍖栦覆鍙hВ鏋愬櫒
+ */
+ private void initializeSerialParser() {
+ try {
+ serialProtocolParser = new SerialProtocolParser();
+ serialProtocolParser.start();
+ //System.out.println("涓插彛鍗忚瑙f瀽鍣ㄥ凡鍚姩");
+ } catch (Exception e) {
+ System.err.println("鍒濆鍖栦覆鍙hВ鏋愬櫒澶辫触: " + e.getMessage());
+ }
+ }
}
\ No newline at end of file
diff --git a/src/xitongshezhi/Fkj.java b/src/home/Fkj.java
similarity index 98%
rename from src/xitongshezhi/Fkj.java
rename to src/home/Fkj.java
index 72af3b7..351fc28 100644
--- a/src/xitongshezhi/Fkj.java
+++ b/src/home/Fkj.java
@@ -1,4 +1,4 @@
-package xitongshezhi;
+package home;
public class Fkj {
// 瀹氫箟鎵�鏈夊睘鎬э紝鍧囦负String绫诲瀷
private String slotNumber; // 鍗℃Ы缂栧彿
diff --git a/src/home/Homein.java b/src/home/Homein.java
index 447b82e..d0de3f1 100644
--- a/src/home/Homein.java
+++ b/src/home/Homein.java
@@ -1,5 +1,4 @@
package home;
-
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@@ -7,8 +6,6 @@
import chushihua.Chushihua;
import chushihua.SlotManager;
import chushihua.lunxun;
-import chushihua.lunxunzaixian;
-import jiekou.lunxunkazhuangtai;
public class Homein {
public static void main(String[] args) {
@@ -107,7 +104,7 @@
private static boolean initializeSlotManager() {
try {
// SlotManager 浼氬湪鏋勯�犲嚱鏁颁腑鑷姩鍒濆鍖栨墍鏈夊崱妲�
- SlotManager slotManager = new SlotManager();
+ new SlotManager();
//System.out.println("鉁� 鍗℃Ы绠$悊鍣ㄥ垵濮嬪寲鎴愬姛");
//System.out.println(" 鎬诲崱妲芥暟: " + slotManager.getTotalSlots());
@@ -130,11 +127,7 @@
if (serialConnected) {
// 4. 涓插彛杩炴帴鎴愬姛鍚庯紝鍚姩杞
startPollingService();
- showMainInterface();
- //鍚姩杞鍗$姸鎬佺粰鏈嶅姟鍣ㄥ彂鏁版嵁
- lunxunkazhuangtai.startPolling();
- //鍚姩鍦ㄧ嚎鐨勫崱鐘舵�佽疆璇�
- lunxunzaixian.startOnlinePolling();
+ showMainInterface();
} else {
System.err.println("涓插彛杩炴帴澶辫触");
diff --git a/src/jiekou/lunxunkazhuangtai.java b/src/jiekou/lunxunkazhuangtai.java
index 49c8774..5ebd582 100644
--- a/src/jiekou/lunxunkazhuangtai.java
+++ b/src/jiekou/lunxunkazhuangtai.java
@@ -1,6 +1,7 @@
package jiekou;
import chushihua.SlotManager;
-import xitongshezhi.Fkj;
+import home.Fkj;
+
/**
* 杞鍗℃Ы鐘舵�佺被
diff --git a/src/publicway/OpenDoor.java b/src/publicway/OpenDoor.java
index 860c080..0bf481b 100644
--- a/src/publicway/OpenDoor.java
+++ b/src/publicway/OpenDoor.java
@@ -6,8 +6,8 @@
private static final String FUNCTION_CODE_PREFIX = "515AA55AA5";
// 寮�闂ㄧ被鍨嬪父閲�
- public static final int TYPE_ISSUE_CARD = 1;
- public static final int TYPE_ADMIN = 2;
+ public static final int TYPE_ISSUE_CARD = 1;//1鍙戝崱寮�闂�
+ public static final int TYPE_ADMIN = 2;//2绠$悊鍛樺紑闂�
// 鍙傛暟鑼冨洿甯搁噺
private static final int MIN_SLOT_NUMBER = 0;
diff --git a/src/publicway/ProtocolParser01.java b/src/publicway/ProtocolParser01.java
index 3b402aa..3c5effb 100644
--- a/src/publicway/ProtocolParser01.java
+++ b/src/publicway/ProtocolParser01.java
@@ -4,6 +4,7 @@
import chuankou.SerialPortService;
import chushihua.SlotManager;
+import dialog.Errlog;
public class ProtocolParser01 {
/**
@@ -110,7 +111,8 @@
* CRC校验
* 根据协议:CRC16校验从功能码之后一直到CRC16之前的数据
*/
- private static boolean validateCRC(String hexData) {
+ @SuppressWarnings("unused")
+ private static boolean validateCRC(String hexData) {
try {
// CRC在最后4个字符
String receivedCRC = hexData.substring(hexData.length() - 6);
@@ -121,7 +123,7 @@
//System.out.println("校验码是:"+crc);
return receivedCRC.equalsIgnoreCase(crc);
} catch (Exception e) {
- System.err.println("CRC校验异常: " + e.getMessage());
+ Errlog.logOperation("CRC校验异常: " + e.getMessage());
return false;
}
}
@@ -500,22 +502,21 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("=== DDCC协议数据解析结果 ===\n");
- sb.append("1. 主机地址: ").append(String.format("%02X", hostAddress));
- sb.append("2. 卡槽编号: ").append(slotNumber);
- sb.append("3. 工作状态: ").append(workStatus.getDescription())
- .append(" (").append(workStatus.getValue());
- sb.append("4. 门状态: ").append(doorStatus.getDescription())
- .append(" (").append(doorStatus.getValue());
- sb.append("5. 卡状态: ").append(cardStatus.getDescription())
- .append(" (").append(cardStatus.getValue());
- sb.append("6. 卡状态变更: ").append(cardStatusChange);
- sb.append("7. 卡号: ").append(cardNumber);
- sb.append("8. 故障: ").append(getFaultsString());
- sb.append("9. 电压: ").append(String.format("%.2f", voltage));
- sb.append("10. 电流: ").append(String.format("%.2f", current));
- sb.append("数据长度: ").append(dataLength).append(" 字节");
-// //System.out.println(sb.toString());
+ sb.append("1.主机地址:").append(String.format("%02X", hostAddress));
+ sb.append("2.卡槽编号:").append(slotNumber);
+ sb.append("3.工作状态:").append(workStatus.getDescription())
+ .append("(").append(workStatus.getValue()).append(")");
+ sb.append("4. 门状态:").append(doorStatus.getDescription())
+ .append("(").append(doorStatus.getValue()).append(")");
+ sb.append("5.卡状态:").append(cardStatus.getDescription())
+ .append("(").append(cardStatus.getValue()).append(")");
+ sb.append("6.卡状态变更:").append(cardStatusChange);
+ sb.append("7.卡号:").append(cardNumber);
+ sb.append("8.故障:").append(getFaultsString());
+ sb.append("9.电压:").append(String.format("%.2f", voltage));
+ sb.append("10.电流:").append(String.format("%.2f", current));
+ sb.append("数据长度:").append(dataLength).append(" 字节");
+// System.out.println(sb.toString());
return sb.toString();
}
diff --git a/src/publicway/SerialProtocolParser.java b/src/publicway/SerialProtocolParser.java
index f342178..e68a786 100644
--- a/src/publicway/SerialProtocolParser.java
+++ b/src/publicway/SerialProtocolParser.java
@@ -6,7 +6,12 @@
import java.util.concurrent.TimeUnit;
import chuankou.SerialPortService;
+import chushihua.SlotManager;
+import chushihua.lunxun;
+import dialog.Charulog;
+import dialog.Dingshidialog;
import publicway.ProtocolParser01.ParseResult;
+import xitongshezhi.SystemDebugDialog;
public class SerialProtocolParser {
@@ -59,7 +64,7 @@
processorThread.setDaemon(true);
processorThread.start();
- //System.out.println("涓插彛鍗忚瑙f瀽鍣ㄥ凡鍚姩");
+ //System.out.println("涓插彛鍗忚瑙f瀽鍣ㄥ凡鍚姩 - 鐙珛浜庤疆璇㈢姸鎬佽繍琛�");
}
/**
@@ -113,15 +118,15 @@
*/
public void receiveData(byte[] rawData) {
if (!isRunning) {
- //System.out.println("璀﹀憡: 涓插彛鍗忚瑙f瀽鍣ㄦ湭鍚姩锛屽拷鐣ユ帴鏀剁殑鏁版嵁");
- return;
+ // 濡傛灉瑙f瀽鍣ㄦ湭杩愯锛岃嚜鍔ㄥ惎鍔�
+ start();
}
if (rawData == null || rawData.length == 0) {
return;
}
- // 灏嗘暟鎹坊鍔犲埌鎵归噺闃熷垪
+ // 灏嗘暟鎹坊鍔犲埌鎵归噺闃熷垪 - 纭繚濮嬬粓鎵ц
if (!batchQueue.offer(rawData)) {
System.err.println("鎵归噺闃熷垪宸叉弧锛屼涪寮冩暟鎹�");
}
@@ -250,14 +255,14 @@
* 澶勭悊鏁版嵁鍖呯殑涓绘柟娉�
*/
private void processPackets() {
- //System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬪紑濮嬭繍琛�");
+ System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬪紑濮嬭繍琛�");
while (isRunning && !Thread.currentThread().isInterrupted()) {
try {
byte[] packet = dataQueue.take(); // 闃诲鐩村埌鏈夋暟鎹�
parsePacket(packet);
} catch (InterruptedException e) {
- //System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬭涓柇");
+ System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬭涓柇");
Thread.currentThread().interrupt();
break;
} catch (Exception e) {
@@ -266,7 +271,7 @@
}
}
- //System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬬粨鏉熻繍琛�");
+ System.out.println("涓插彛鏁版嵁鍖呭鐞嗙嚎绋嬬粨鏉熻繍琛�");
}
/**
@@ -278,8 +283,7 @@
// 瑙f瀽鍩烘湰瀛楁
byte hostAddress = packet[4]; // 涓绘満鍦板潃
byte slotAddress = packet[5]; // 鍗℃Ы鍦板潃
- byte functionCode = packet[6]; // 鍔熻兘鐮�
-
+ byte functionCode = packet[6]; // 鍔熻兘鐮�
// 鏁版嵁闀垮害 (浠庡崗璁腑璇诲彇)
int dataLength = ((packet[2] & 0xFF) << 8) | (packet[3] & 0xFF);
@@ -298,17 +302,24 @@
// 浣跨敤浼樺寲鐨勫瓧鑺傛暟缁勮В鏋愭柟娉曪紝閬垮厤瀛楃涓茶浆鎹�
ParseResult rst = ProtocolParser01.parseDDCC01Data(packet);
rst.fuzhi();
-// rst.toString();
+// System.out.println(rst.toString());
+ if (lunxun.DEBUG_ENABLED) {
+ SystemDebugDialog.appendAsciiData(rst.toString());
+ }
+
}
break;
case FUNCTION_51:
// 璋冪敤 ProtocolParser51 澶勭悊鏁版嵁
String hexPacket = bytesToHex(packet);
int result = ProtocolParser51.parse(hexPacket);
+ int slot = slotAddress;
if (result == 1) {
- //System.out.println("鍔熻兘鐮� 0x51 - 寮�闂ㄦ帶鍒舵垚鍔�");
+// Dingshidialog.showTimedDialog(null, 5,slot+"鍙峰崱妲藉嚭鍗℃垚鍔熻鍙栬蛋鍗�...");
+ SlotManager.changgehaska(slot, result);
} else {
- //System.out.println("鍔熻兘鐮� 0x51 - 寮�闂ㄦ帶鍒跺け璐ユ垨鎶ユ枃涓嶅悎娉�");
+ String message=slot+"鍙峰崱妲藉彇鍗″け璐�";
+ Charulog.logOperation(message);
}
break;
case FUNCTION_52:
diff --git a/src/xitongshezhi/ConfigSet.java b/src/xitongshezhi/ConfigSet.java
index b31f830..77c1313 100644
--- a/src/xitongshezhi/ConfigSet.java
+++ b/src/xitongshezhi/ConfigSet.java
@@ -54,13 +54,13 @@
private final MenuItemListener menuItemListener;
public ConfigSet(JFrame parent) {
- super(parent, "璁剧疆", true);
+ super(parent, "", true);
configManager = Chushihua.getInstance();
menuItemListener = new MenuItemListener();
- // 璁板綍杩涘叆璁剧疆椤甸潰鍓嶇殑杞鐘舵��
+ // 璁板綍杩涘叆璁剧疆椤甸潰鍓嶇殑杞鐘舵��
recordPollingStateBeforeEntering();
initializeUI();
- // 杩涘叆璁剧疆椤甸潰鏃舵殏鍋滆疆璇�
+ // 杩涘叆璁剧疆椤甸潰鏃舵殏鍋滆疆璇�
pausePollingWhenEntering();
}
@@ -135,7 +135,26 @@
mainPanel.add(createHeaderPanel(), BorderLayout.NORTH);
mainPanel.add(createMenuGridPanel(), BorderLayout.CENTER);
+ // 娣诲姞鐗堟潈淇℃伅鍦ㄥ簳閮�
+ mainPanel.add(createCopyrightPanel(), BorderLayout.SOUTH);
+
getContentPane().add(mainPanel);
+ }
+
+ // 鍒涘缓鐗堟潈淇℃伅闈㈡澘
+ private JPanel createCopyrightPanel() {
+ JPanel copyrightPanel = new JPanel();
+ copyrightPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
+ copyrightPanel.setOpaque(true);
+ copyrightPanel.setBackground(DARK_COLOR);
+ copyrightPanel.setBorder(new EmptyBorder(10, 0, 5, 0));
+
+ JLabel copyrightLabel = new JLabel("鍖椾含鍗庢槦鍖楁枟鏅烘帶鎶�鏈湁闄愬叕鍙� 鐗堟潈鎵�鏈� 2025");
+ copyrightLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
+ copyrightLabel.setForeground(new Color(160, 160, 160));
+
+ copyrightPanel.add(copyrightLabel);
+ return copyrightPanel;
}
private JPanel createHeaderPanel() {
@@ -158,8 +177,11 @@
closeButton.setOpaque(true); // 纭繚涓嶉�忔槑
closeButton.setFocusPainted(false);
closeButton.setBorder(BorderFactory.createEmptyBorder(10, 18, 10, 18));
- closeButton.setIcon(getCachedIcon("鉁�", 16));
- closeButton.addActionListener(e -> dispose());
+ closeButton.addActionListener(e -> {
+ // 寮哄埗寮�鍚疆璇㈡煡璇㈠姛鑳�
+ forceStartPolling();
+ dispose();
+ });
// 娣诲姞鎮仠鏁堟灉
closeButton.addMouseListener(new java.awt.event.MouseAdapter() {
@@ -588,12 +610,13 @@
return icon;
}
- private void showSystemDebugDialog() {
- SystemDebugDialog.showSystemDebugDialog((JFrame) getParent());
- }
+
@Override
public void dispose() {
+ // 閫�鍑鸿缃〉闈㈡椂鎭㈠杞鎺у埗
+ SystemDebugDialog.setPollingControlEnabled(true);
+
// 閫�鍑鸿缃〉闈㈡椂鎭㈠杞
resumePollingWhenExiting();
@@ -673,5 +696,43 @@
configDialog.setVisible(true);
});
}
+ /**
+ * 寮哄埗寮�鍚疆璇㈡煡璇㈠姛鑳斤紙鏃犺褰撳墠鐘舵�佸浣曪級
+ */
+ private void forceStartPolling() {
+ try {
+ // 濡傛灉杞鏈繍琛岋紝鍒欏惎鍔ㄨ疆璇�
+ if (!lunxun.isPolling()) {
+ boolean started = lunxun.startPolling();
+ if (started) {
+ //System.out.println("寮哄埗寮�鍚細杞鏌ヨ宸插惎鍔�");
+ } else {
+ System.err.println("寮哄埗寮�鍚細鍚姩杞鏌ヨ澶辫触");
+ }
+ }
+ // 濡傛灉杞宸茶繍琛屼絾澶勪簬鏆傚仠鐘舵�侊紝鍒欐仮澶嶈疆璇�
+ else if (lunxun.isPaused()) {
+ boolean resumed = lunxun.resumePolling();
+ if (resumed) {
+ //System.out.println("寮哄埗寮�鍚細杞鏌ヨ宸叉仮澶�");
+ } else {
+ System.err.println("寮哄埗寮�鍚細鎭㈠杞鏌ヨ澶辫触");
+ }
+ }
+ // 濡傛灉杞宸茶繍琛屼笖鏈殏鍋滐紝鍒欐棤闇�鎿嶄綔
+ else {
+ //System.out.println("寮哄埗寮�鍚細杞鏌ヨ宸插湪杩愯涓�");
+ }
+
+ } catch (Exception e) {
+ System.err.println("寮哄埗寮�鍚疆璇㈡煡璇㈡椂鍙戠敓寮傚父: " + e.getMessage());
+ }
+ }
+ // 鍦� showSystemDebugDialog 鏂规硶涓坊鍔�
+ private void showSystemDebugDialog() {
+ // 鍦ㄦ墦寮�璋冭瘯瀵硅瘽妗嗘椂绂佺敤杞鎺у埗
+ SystemDebugDialog.setPollingControlEnabled(false);
+ SystemDebugDialog.showSystemDebugDialog((JFrame) getParent());
+ }
}
\ No newline at end of file
diff --git a/src/xitongshezhi/SystemDebugDialog.java b/src/xitongshezhi/SystemDebugDialog.java
index 08ca52c..9b19556 100644
--- a/src/xitongshezhi/SystemDebugDialog.java
+++ b/src/xitongshezhi/SystemDebugDialog.java
@@ -10,6 +10,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import chushihua.lunxun;
+import dialog.Errlog;
public class SystemDebugDialog extends JDialog {
private static final long serialVersionUID = -9131186661220052051L;
@@ -25,11 +26,9 @@
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 TEXT_COLOR = new Color(224, 224, 224);
-
- // UI缁勪欢
+ // UI缁勪欢
private JTextArea dataTextArea;
private JButton clearButton;
- private JButton pollingButton;
private JButton scrollButton;
private JTextField sendTextField;
private JButton sendButton;
@@ -43,7 +42,7 @@
private SerialPortService serialService;
// 鎺у埗鍙橀噺
- private boolean autoScroll = true; // 榛樿鑷姩婊氬姩
+ private boolean autoScroll =false; // 榛樿鑷姩婊氬姩
private static boolean dataUpdateEnabled = true; // 鎺у埗鏁版嵁鏇存柊
// 鏃ユ湡鏍煎紡鍖�
@@ -214,14 +213,6 @@
scrollButton.setBorder(BorderFactory.createEmptyBorder(8, 20, 8, 20));
scrollButton.addActionListener(e -> toggleAutoScroll());
- // 鍚姩/鍏抽棴鏌ヨ鎸夐挳
- pollingButton = new JButton("鍚姩鏌ヨ");
- pollingButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
- pollingButton.setBackground(SECONDARY_COLOR);
- pollingButton.setForeground(Color.WHITE);
- pollingButton.setFocusPainted(false);
- pollingButton.setBorder(BorderFactory.createEmptyBorder(8, 20, 8, 20));
- pollingButton.addActionListener(e -> togglePolling());
// 娓呯┖鎸夐挳
clearButton = new JButton("娓呯┖鏁版嵁");
@@ -233,7 +224,6 @@
clearButton.addActionListener(e -> clearData());
buttonPanel.add(scrollButton);
- buttonPanel.add(pollingButton);
buttonPanel.add(clearButton);
return buttonPanel;
@@ -331,40 +321,22 @@
staticDataUpdateEnabled = dataUpdateEnabled; // 鍚屾闈欐�佸彉閲�
if (autoScroll) {
- scrollButton.setText("鏆傚仠");
+ scrollButton.setText("寮�濮�");
scrollButton.setBackground(PRIMARY_COLOR);
if (staticDataTextArea != null) {
staticDataTextArea.setCaretPosition(staticDataTextArea.getDocument().getLength());
}
appendAsciiData("[" + getCurrentTime() + "] 寮�濮嬫樉绀烘暟鎹甛n");
+ lunxun.DEBUG_ENABLED=true;
} else {
- scrollButton.setText("寮�濮�");
+ scrollButton.setText("鏆傚仠");
scrollButton.setBackground(WARNING_COLOR);
appendAsciiData("[" + getCurrentTime() + "] 鏆傚仠鏄剧ず鏁版嵁\n");
}
}
- private void togglePolling() {
- if (lunxun.isPolling()) {
- // 濡傛灉姝e湪杞锛屽垯鍋滄
- if (lunxun.stopPolling()) {
- pollingButton.setText("鍚姩鏌ヨ");
- pollingButton.setBackground(SECONDARY_COLOR);
- onDataReceivedascii("[" + getCurrentTime() + "] stop\n");
- lunxun.setDEBUG_ENABLED(false);
- }
- } else {
- // 濡傛灉鏈疆璇紝鍒欏惎鍔�
- if (lunxun.startPolling()) {
- lunxun.setDEBUG_ENABLED(true);
- pollingButton.setText("鍋滄鏌ヨ");
- pollingButton.setBackground(DANGER_COLOR);
- onDataReceivedascii("[" + getCurrentTime() + "] strat\n");
- } else {
- showMessage("閿欒", "鏃犳硶鍚姩杞鏌ヨ锛岃妫�鏌ヤ覆鍙h繛鎺�", "error");
- }
- }
- }
+
+
private void sendData() {
String text = sendTextField.getText().trim();
@@ -418,7 +390,7 @@
dataTextArea.setText(sb.toString());
}
} catch (Exception e) {
- System.err.println("淇壀琛屾暟鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ Errlog.logOperation("淇壀琛屾暟鏃跺彂鐢熼敊璇�: " + e.getMessage());
}
}
@@ -479,7 +451,7 @@
staticDataTextArea.setText(sb.toString());
}
} catch (Exception e) {
- System.err.println("淇壀琛屾暟鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ Errlog.logOperation("淇壀琛屾暟鏃跺彂鐢熼敊璇�: " + e.getMessage());
}
}
@@ -511,7 +483,7 @@
}
} catch (Exception e) {
- System.err.println("鏄剧ず鏁版嵁鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ Errlog.logOperation("鏄剧ず鏁版嵁鏃跺彂鐢熼敊璇�: " + e.getMessage());
}
});
}
@@ -531,14 +503,14 @@
displayText = displayText.substring(0, MAX_LINE_LENGTH) + "...";
}
- staticDataTextArea.append(displayText);
+ staticDataTextArea.append(displayText+"\n");
if (staticDataUpdateEnabled) {
staticDataTextArea.setCaretPosition(staticDataTextArea.getDocument().getLength());
}
} catch (Exception e) {
- System.err.println("鏄剧ずASCII鏁版嵁鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ Errlog.logOperation("鏄剧ずASCII鏁版嵁鏃跺彂鐢熼敊璇�: " + e.getMessage());
}
});
}
@@ -616,14 +588,13 @@
memoryMonitorTimer.stop();
}
- // 鍏抽棴鏃跺仠姝㈣疆璇�
- if (lunxun.isPolling()) {
- lunxun.stopPolling();
- }
+ // 閲嶈淇敼锛氫笉瑕佸仠姝㈣疆璇紝鍙殏鍋滆皟璇曡緭鍑�
+ lunxun.setDEBUG_ENABLED(false);
- // 鍋滄涓插彛鏁版嵁鎹曡幏
+ // 閲嶈淇敼锛氫笉瑕佸仠姝覆鍙f暟鎹崟鑾凤紝鍙Щ闄よ嚜宸辩殑鍥炶皟
if (serialService != null) {
- serialService.stopCapture();
+ // 浣跨敤鏂扮殑鏂规硶绉婚櫎鍥炶皟鑰屼笉鍋滄鏁翠釜鎹曡幏
+ removeDataReceivedCallback();
}
// 娓呯悊闈欐�佸紩鐢紝闃叉鍐呭瓨娉勬紡
@@ -634,4 +605,21 @@
super.dispose();
}
+
+ // 鏂板锛氱Щ闄ゆ暟鎹帴鏀跺洖璋冪殑鏂规硶
+ private void removeDataReceivedCallback() {
+ if (serialService != null) {
+ try {
+ // 閫氳繃鍙嶅皠鎴栧叾浠栨柟寮忕Щ闄ゅ洖璋冿紝鎴栬�呯畝鍗曞湴璁剧疆涓簄ull
+ // 杩欓噷鍋囪SerialPortService鏈夌Щ闄ゅ洖璋冪殑鏂规硶
+ serialService.setResponseConsumer(null);
+ } catch (Exception e) {
+ Errlog.logOperation("绉婚櫎鏁版嵁鎺ユ敹鍥炶皟鏃跺彂鐢熼敊璇�: " + e.getMessage());
+ }
+ }
+ }
+
+ // 鏂板锛氬惎鐢�/绂佺敤杞鎺у埗鐨勬柟娉�
+ public static void setPollingControlEnabled(boolean enabled) {
+ }
}
\ No newline at end of file
diff --git a/src/xitongshezhi/kacaoguanli.java b/src/xitongshezhi/kacaoguanli.java
index 13d30cb..bdf68e6 100644
--- a/src/xitongshezhi/kacaoguanli.java
+++ b/src/xitongshezhi/kacaoguanli.java
@@ -12,6 +12,7 @@
import java.util.Random;
import chushihua.SlotManager;
+import home.Fkj;
public class kacaoguanli extends JDialog {
// 灞忓箷灏哄甯搁噺 - 閫傞厤7瀵哥珫灞�
diff --git a/src/xitongshezhi/kuaisuquka.java b/src/xitongshezhi/kuaisuquka.java
index 94f2958..048e7ca 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,11 +9,11 @@
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;
@@ -26,14 +25,9 @@
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 +40,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() {
@@ -74,8 +62,6 @@
// 浼樺寲鐨勫璇濇绠$悊
private JDialog progressDialog;
- private JProgressBar progressBar;
- private JLabel progressLabel;
private JDialog resultDialog;
// 鍏变韩鐨勪簨浠剁洃鍚櫒
@@ -168,7 +154,7 @@
private void pausePollingWhenEntering() {
if (chushihua.lunxun.isPolling() && !chushihua.lunxun.isPaused()) {
chushihua.lunxun.pausePolling();
- //System.out.println("杩涘叆蹇�熷彇鍗¢〉闈紝杞宸叉殏鍋�");
+ System.out.println("杩涘叆蹇�熷彇鍗¢〉闈紝杞宸叉殏鍋�");
}
}
@@ -180,7 +166,7 @@
if (wasPollingRunning && !wasPollingPaused) {
if (chushihua.lunxun.isPolling() && chushihua.lunxun.isPaused()) {
chushihua.lunxun.resumePolling();
- //System.out.println("閫�鍑哄揩閫熷彇鍗¢〉闈紝杞宸叉仮澶�");
+ System.out.println("閫�鍑哄揩閫熷彇鍗¢〉闈紝杞宸叉仮澶�");
}
} else {
//System.out.println("閫�鍑哄揩閫熷彇鍗¢〉闈紝淇濇寔鍘熸湁杞鐘舵�� - 杩愯: " + wasPollingRunning + ", 鏆傚仠: " + wasPollingPaused);
@@ -285,7 +271,6 @@
openAllButton.setForeground(Color.WHITE);
openAllButton.setFocusPainted(false);
openAllButton.setBorder(BorderFactory.createEmptyBorder(12, 24, 12, 24));
- openAllButton.setIcon(getCachedIcon("馃毆", 20));
openAllButton.addActionListener(e -> openAllSlots());
// 娣诲姞鎮仠鏁堟灉
@@ -447,14 +432,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,38 +442,7 @@
}
}
- // 鏂板鏂规硶锛氬彂閫佸崟涓崱妲藉紑闂ㄦ寚浠�
- 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();
- }
// 浼樺寲鐨勫崱妲芥樉绀烘洿鏂�
// 淇敼鏇存柊鍗℃Ы鏄剧ず鐨勬柟娉�
@@ -537,63 +484,8 @@
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);
}
// 浼樺寲鐨勭粺璁¤绠�
@@ -606,107 +498,6 @@
}
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>");
}
private Color brighterColor(Color color) {
diff --git a/src/xitongshezhi/lishijilu.java b/src/xitongshezhi/lishijilu.java
index 77cb8ae..29c2daf 100644
--- a/src/xitongshezhi/lishijilu.java
+++ b/src/xitongshezhi/lishijilu.java
@@ -17,20 +17,27 @@
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 DELETE_COLOR = new Color(231, 76, 60); // 鍒犻櫎鎸夐挳棰滆壊
+ private static final Color ACTIVE_BUTTON_COLOR = new Color(41, 128, 185); // 婵�娲绘寜閽鑹�
private JPanel mainPanel;
- private JLabel titleLabel;
+ private JButton logButton; // 鏃ュ織璁板綍鎸夐挳
+ private JButton errorLogButton; // 閿欒鏃ュ織鎸夐挳
private JButton backButton;
+ private JButton deleteAllButton;
// 鏂囨湰鍩熺粍浠�
private JScrollPane textScrollPane;
private JTextArea contentTextArea;
+ // 褰撳墠鏄剧ず鐨勬棩蹇楃被鍨�
+ private String currentLogType = "log"; // "log" 鎴� "error"
+
public lishijilu(JFrame parent) {
super(parent, "", true);
initializeUI();
setupEventListeners();
- loadLogContent(); // 鍔犺浇鏃ュ織鍐呭
+ loadLogContent(); // 榛樿鍔犺浇鎿嶄綔鏃ュ織
}
private void initializeUI() {
@@ -71,12 +78,48 @@
headerPanel.setOpaque(false);
headerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 12, 0));
- // 鏍囬
- titleLabel = new JLabel("鍘嗗彶璁板綍");
- titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 22));
- titleLabel.setForeground(TEXT_COLOR);
+ // 鍒涘缓鏃ュ織绫诲瀷閫夋嫨鎸夐挳闈㈡澘
+ JPanel logTypePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0));
+ logTypePanel.setOpaque(false);
- // 杩斿洖鎸夐挳 - 浣跨敤涓嶉�忔槑璁捐
+ // 鏃ュ織璁板綍鎸夐挳
+ logButton = new JButton("鏃ュ織璁板綍");
+ logButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
+ logButton.setBackground(ACTIVE_BUTTON_COLOR); // 榛樿婵�娲荤姸鎬�
+ logButton.setForeground(Color.WHITE);
+ logButton.setOpaque(true);
+ logButton.setFocusPainted(false);
+ logButton.setBorder(BorderFactory.createEmptyBorder(8, 16, 8, 16));
+ logButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ // 閿欒鏃ュ織鎸夐挳
+ errorLogButton = new JButton("閿欒鏃ュ織");
+ errorLogButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
+ errorLogButton.setBackground(PRIMARY_COLOR); // 榛樿闈炴縺娲荤姸鎬�
+ errorLogButton.setForeground(Color.WHITE);
+ errorLogButton.setOpaque(true);
+ errorLogButton.setFocusPainted(false);
+ errorLogButton.setBorder(BorderFactory.createEmptyBorder(8, 16, 8, 16));
+ errorLogButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ logTypePanel.add(logButton);
+ logTypePanel.add(errorLogButton);
+
+ // 鎿嶄綔鎸夐挳闈㈡澘
+ JPanel actionButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0));
+ actionButtonPanel.setOpaque(false);
+
+ // 鍒犻櫎鍏ㄩ儴璁板綍鎸夐挳
+ deleteAllButton = new JButton("鍒犻櫎鍏ㄩ儴");
+ deleteAllButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
+ deleteAllButton.setBackground(DELETE_COLOR);
+ deleteAllButton.setForeground(Color.WHITE);
+ deleteAllButton.setOpaque(true);
+ deleteAllButton.setFocusPainted(false);
+ deleteAllButton.setBorder(BorderFactory.createEmptyBorder(8, 16, 8, 16));
+ deleteAllButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ // 杩斿洖鎸夐挳
backButton = new JButton("鍏抽棴");
backButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
backButton.setBackground(PRIMARY_COLOR);
@@ -85,6 +128,60 @@
backButton.setFocusPainted(false);
backButton.setBorder(BorderFactory.createEmptyBorder(8, 16, 8, 16));
backButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ actionButtonPanel.add(deleteAllButton);
+ actionButtonPanel.add(backButton);
+
+ // 鎸夐挳鎮仠鏁堟灉
+ setupButtonHoverEffects();
+
+ headerPanel.add(logTypePanel, BorderLayout.WEST);
+ headerPanel.add(actionButtonPanel, BorderLayout.EAST);
+
+ return headerPanel;
+ }
+
+ private void setupButtonHoverEffects() {
+ // 鏃ュ織鎸夐挳鎮仠鏁堟灉
+ logButton.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ if (!currentLogType.equals("log")) {
+ logButton.setBackground(brighterColor(PRIMARY_COLOR));
+ }
+ }
+
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ if (!currentLogType.equals("log")) {
+ logButton.setBackground(PRIMARY_COLOR);
+ }
+ }
+ });
+
+ // 閿欒鏃ュ織鎸夐挳鎮仠鏁堟灉
+ errorLogButton.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ if (!currentLogType.equals("error")) {
+ errorLogButton.setBackground(brighterColor(PRIMARY_COLOR));
+ }
+ }
+
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ if (!currentLogType.equals("error")) {
+ errorLogButton.setBackground(PRIMARY_COLOR);
+ }
+ }
+ });
+
+ // 鍒犻櫎鎸夐挳鎮仠鏁堟灉
+ deleteAllButton.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ deleteAllButton.setBackground(brighterColor(DELETE_COLOR));
+ }
+
+ public void mouseExited(java.awt.event.MouseEvent evt) {
+ deleteAllButton.setBackground(DELETE_COLOR);
+ }
+ });
// 杩斿洖鎸夐挳鎮仠鏁堟灉
backButton.addMouseListener(new java.awt.event.MouseAdapter() {
@@ -96,19 +193,6 @@
backButton.setBackground(PRIMARY_COLOR);
}
});
-
- JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- titlePanel.setOpaque(false);
- titlePanel.add(titleLabel);
-
- JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- buttonPanel.setOpaque(false);
- buttonPanel.add(backButton);
-
- headerPanel.add(titlePanel, BorderLayout.WEST);
- headerPanel.add(buttonPanel, BorderLayout.EAST);
-
- return headerPanel;
}
private JPanel createContentPanel() {
@@ -177,37 +261,138 @@
backButton.addActionListener(e -> {
dispose();
});
+
+ // 鍒犻櫎鍏ㄩ儴璁板綍鎸夐挳
+ deleteAllButton.addActionListener(e -> {
+ deleteAllRecords();
+ });
+
+ // 鏃ュ織璁板綍鎸夐挳
+ logButton.addActionListener(e -> {
+ switchToLogType("log");
+ });
+
+ // 閿欒鏃ュ織鎸夐挳
+ errorLogButton.addActionListener(e -> {
+ switchToLogType("error");
+ });
+ }
+
+ // 鍒囨崲鏃ュ織绫诲瀷
+ private void switchToLogType(String logType) {
+ if (currentLogType.equals(logType)) {
+ return; // 宸茬粡鏄綋鍓嶇被鍨嬶紝鏃犻渶鍒囨崲
+ }
+
+ currentLogType = logType;
+
+ // 鏇存柊鎸夐挳鐘舵��
+ if (logType.equals("log")) {
+ logButton.setBackground(ACTIVE_BUTTON_COLOR);
+ errorLogButton.setBackground(PRIMARY_COLOR);
+ } else {
+ logButton.setBackground(PRIMARY_COLOR);
+ errorLogButton.setBackground(ACTIVE_BUTTON_COLOR);
+ }
+
+ // 鍔犺浇瀵瑰簲绫诲瀷鐨勬棩蹇楀唴瀹�
+ loadLogContent();
+ }
+
+ // 鍒犻櫎鍏ㄩ儴璁板綍鐨勬柟娉�
+ private void deleteAllRecords() {
+ // 纭瀵硅瘽妗�
+ String logTypeName = currentLogType.equals("log") ? "鎿嶄綔" : "閿欒";
+ int result = JOptionPane.showConfirmDialog(
+ this,
+ "纭畾瑕佸垹闄ゆ墍鏈�" + logTypeName + "璁板綍鍚楋紵姝ゆ搷浣滀笉鍙仮澶嶏紒",
+ "纭鍒犻櫎",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE
+ );
+
+ if (result == JOptionPane.YES_OPTION) {
+ try {
+ String fileName = currentLogType.equals("log") ? "log.properties" : "err.properties";
+ File logFile = new File(fileName);
+
+ if (logFile.exists()) {
+ // 鍒涘缓绌虹殑Properties瀵硅薄骞跺啓鍏ユ枃浠�
+ Properties emptyProps = new Properties();
+ try (FileOutputStream out = new FileOutputStream(logFile);
+ OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8")) {
+ emptyProps.store(writer, "鍙戝崱鏈�" + logTypeName + "璁板綍 - 鎵�鏈夎褰曞凡娓呯┖");
+ }
+
+ // 鏇存柊鏂囨湰鍩熸樉绀�
+ contentTextArea.setText("鎵�鏈�" + logTypeName + "璁板綍宸叉垚鍔熷垹闄ゃ�俓n\n鏃ュ織鏂囦欢宸叉竻绌恒��");
+
+ // 鏄剧ず鎴愬姛娑堟伅
+ JOptionPane.showMessageDialog(
+ this,
+ "鎵�鏈�" + logTypeName + "璁板綍宸叉垚鍔熷垹闄ゃ��",
+ "鍒犻櫎鎴愬姛",
+ JOptionPane.INFORMATION_MESSAGE
+ );
+ } else {
+ contentTextArea.setText(logTypeName + "鏃ュ織鏂囦欢涓嶅瓨鍦紝鏃犻渶鍒犻櫎銆�");
+ }
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(
+ this,
+ "鍒犻櫎璁板綍鏃跺嚭閿�: " + ex.getMessage(),
+ "閿欒",
+ JOptionPane.ERROR_MESSAGE
+ );
+ }
+ }
}
// 鍔犺浇鏃ュ織鍐呭
private void loadLogContent() {
- File logFile = new File("log.properties");
+ String fileName = currentLogType.equals("log") ? "log.properties" : "err.properties";
+ String logTypeName = currentLogType.equals("log") ? "鎿嶄綔" : "閿欒";
+
+ File logFile = new File(fileName);
if (!logFile.exists()) {
- contentTextArea.setText("鏃ュ織鏂囦欢涓嶅瓨鍦ㄣ��");
+ contentTextArea.setText(logTypeName + "鏃ュ織鏂囦欢涓嶅瓨鍦ㄣ��");
return;
}
Properties logProps = new Properties();
- try (FileInputStream in = new FileInputStream(logFile)) {
- logProps.load(in);
+ try (FileInputStream in = new FileInputStream(logFile);
+ InputStreamReader reader = new InputStreamReader(in, "UTF-8")) {
+
+ logProps.load(reader);
// 妫�鏌ヨ褰曟暟閲忥紝濡傛灉瓒呰繃1000鏉″垯鍒犻櫎鏃ц褰�
if (logProps.size() > 1000) {
- trimLogProperties(logProps);
+ trimLogProperties(logProps, fileName);
}
// 鏋勫缓鏄剧ず鍐呭
StringBuilder content = new StringBuilder();
- content.append("鏃ュ織鏂囦欢鍐呭 (").append(logProps.size()).append(" 鏉¤褰�):\n\n");
+ content.append(logTypeName).append("鏃ュ織鍐呭 (").append(logProps.size()).append(" 鏉¤褰�):\n\n");
// 鎸夋椂闂存埑鎺掑簭鏄剧ず
logProps.stringPropertyNames().stream()
- .sorted((a, b) -> Long.compare(Long.parseLong(b), Long.parseLong(a)))
+ .sorted((a, b) -> {
+ try {
+ // 浠庨敭涓彁鍙栨椂闂存埑閮ㄥ垎杩涜姣旇緝
+ long timeA = extractTimestampFromKey(a);
+ long timeB = extractTimestampFromKey(b);
+ return Long.compare(timeB, timeA); // 闄嶅簭鎺掑垪锛屾渶鏂扮殑鍦ㄥ墠
+ } catch (Exception e) {
+ return b.compareTo(a); // 濡傛灉鎻愬彇澶辫触锛屼娇鐢ㄥ瓧绗︿覆姣旇緝
+ }
+ })
.forEach(key -> {
String value = logProps.getProperty(key);
- content.append("鏃堕棿鎴�: ").append(key).append("\n");
- content.append("鍐呭: ").append(value).append("\n");
+ content.append("鏃堕棿: ").append(extractTimeFromValue(value)).append("\n");
+ content.append("鍐呭: ").append(extractOperationFromValue(value)).append("\n");
content.append("----------------------------------------\n");
});
@@ -215,23 +400,71 @@
} catch (IOException e) {
e.printStackTrace();
- contentTextArea.setText("鍔犺浇鏃ュ織鏂囦欢鏃跺嚭閿�: " + e.getMessage());
- } catch (NumberFormatException e) {
- contentTextArea.setText("鏃ュ織鏂囦欢鏍煎紡閿欒銆�");
+ contentTextArea.setText("鍔犺浇" + logTypeName + "鏃ュ織鏂囦欢鏃跺嚭閿�: " + e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ contentTextArea.setText("澶勭悊" + logTypeName + "鏃ュ織鍐呭鏃跺嚭閿�: " + e.getMessage());
}
}
+ // 浠庨敭涓彁鍙栨椂闂存埑
+ private long extractTimestampFromKey(String key) {
+ try {
+ // 閿殑鏍煎紡: log_鏃堕棿鎴砡UUID 鎴� error_鏃堕棿鎴砡UUID
+ String[] parts = key.split("_");
+ if (parts.length >= 2) {
+ return Long.parseLong(parts[1]);
+ }
+ } catch (Exception e) {
+ // 濡傛灉瑙f瀽澶辫触锛岃繑鍥�0
+ }
+ return 0L;
+ }
+
+ // 浠庡�间腑鎻愬彇鏃堕棿閮ㄥ垎
+ private String extractTimeFromValue(String value) {
+ if (value == null) return "鏈煡鏃堕棿";
+ // 鍊肩殑鏍煎紡: [2025-11-21 14:44:39] 鍙栧崱鎿嶄綔锛氬崱妲�19琚鐞嗗憳鍙栧崱
+ int start = value.indexOf('[');
+ int end = value.indexOf(']');
+ if (start >= 0 && end > start) {
+ return value.substring(start + 1, end);
+ }
+ return value;
+ }
+
+ // 浠庡�间腑鎻愬彇鎿嶄綔閮ㄥ垎
+ private String extractOperationFromValue(String value) {
+ if (value == null) return "鏈煡鍐呭";
+ // 鍊肩殑鏍煎紡: [2025-11-21 14:44:39] 鍙栧崱鎿嶄綔锛氬崱妲�19琚鐞嗗憳鍙栧崱
+ int end = value.indexOf(']');
+ if (end >= 0 && end + 1 < value.length()) {
+ return value.substring(end + 1).trim();
+ }
+ return value;
+ }
+
// 淇壀鏃ュ織灞炴�э紝鍙繚鐣欐渶鏂扮殑1000鏉¤褰�
- private void trimLogProperties(Properties logProps) {
+ private void trimLogProperties(Properties logProps, String fileName) {
// 鎸夋椂闂存埑鎺掑簭锛屼繚鐣欐渶鏂扮殑1000鏉�
logProps.stringPropertyNames().stream()
- .sorted((a, b) -> Long.compare(Long.parseLong(b), Long.parseLong(a)))
+ .sorted((a, b) -> {
+ try {
+ long timeA = extractTimestampFromKey(a);
+ long timeB = extractTimestampFromKey(b);
+ return Long.compare(timeB, timeA);
+ } catch (Exception e) {
+ return b.compareTo(a);
+ }
+ })
.skip(1000)
.forEach(logProps::remove);
// 淇濆瓨淇壀鍚庣殑灞炴��
- try (FileOutputStream out = new FileOutputStream("log.properties")) {
- logProps.store(out, "UWB浜哄憳瀹氫綅鍗″彂鍗℃満鍘嗗彶璁板綍 - 鑷姩淇壀鑷�1000鏉¤褰�");
+ try (FileOutputStream out = new FileOutputStream(fileName);
+ OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8")) {
+ String logTypeName = fileName.equals("log.properties") ? "鎿嶄綔" : "閿欒";
+ logProps.store(writer, "鍙戝崱鏈�" + logTypeName + "璁板綍 - 鑷姩淇壀鑷�1000鏉¤褰�");
} catch (IOException e) {
e.printStackTrace();
}
@@ -252,5 +485,4 @@
dialog.setVisible(true);
});
}
-
}
\ No newline at end of file
--
Gitblit v1.9.3