| | |
| | | startUIUpdates(); // UI刷新定时器 |
| | | startSerialStatusMonitoring(); // 串口状态监控 |
| | | |
| | | System.out.println("主界面初始化完成"); |
| | | //System.out.println("主界面初始化完成"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | JOptionPane.showMessageDialog(null, |
| | |
| | | try { |
| | | // 初始化卡槽管理器 - 必须首先执行 |
| | | slotManager = new SlotManager(); |
| | | System.out.println("卡槽管理器初始化完成"); |
| | | //System.out.println("卡槽管理器初始化完成"); |
| | | |
| | | // 直接使用已经初始化的配置系统 |
| | | Chushihua configSystem = Chushihua.getInstance(); |
| | |
| | | PICKUP_PASSWORD = configSystem.getMachineConfig().getFetchCardPassword(); |
| | | } |
| | | |
| | | System.out.println("系统配置初始化完成"); |
| | | System.out.println("管理员密码长度: " + (ADMIN_PASSWORD != null ? ADMIN_PASSWORD.length() : "null")); |
| | | System.out.println("取卡密码长度: " + (PICKUP_PASSWORD != null ? PICKUP_PASSWORD.length() : "null")); |
| | | //System.out.println("系统配置初始化完成"); |
| | | //System.out.println("管理员密码长度: " + (ADMIN_PASSWORD != null ? ADMIN_PASSWORD.length() : "null")); |
| | | //System.out.println("取卡密码长度: " + (PICKUP_PASSWORD != null ? PICKUP_PASSWORD.length() : "null")); |
| | | |
| | | } catch (Exception e) { |
| | | System.err.println("系统初始化异常: " + e.getMessage()); |
| | |
| | | cardSlotsPanel.revalidate(); |
| | | cardSlotsPanel.repaint(); |
| | | |
| | | // System.out.println("卡槽显示更新完成: " + updatedSlots + " 个成功, " + errorSlots + " 个失败"); |
| | | // //System.out.println("卡槽显示更新完成: " + updatedSlots + " 个成功, " + errorSlots + " 个失败"); |
| | | } |
| | | |
| | | private Color brighterColor(Color color) { |
| | |
| | | boolean pickupSuccess = CardPickupDialog.showCardPickup(this, slotId, status); |
| | | |
| | | if (pickupSuccess) { |
| | | // 取卡成功,界面已经在对话框中更新,这里不需要额外操作 |
| | | System.out.println("卡槽 " + slotId + " 取卡成功"); |
| | | // 取卡成功,调用changgehaska方法改变卡槽属性 |
| | | SlotManager.changgehaska(slotId, "1"); // "1"表示管理员操作 |
| | | //System.out.println("卡槽 " + slotId + " 取卡成功,已更新卡槽状态"); |
| | | } |
| | | } |
| | | |
| | |
| | | // 停止轮询查询 |
| | | if (lunxun.isPolling()) { |
| | | lunxun.stopPolling(); |
| | | System.out.println("应用程序关闭,轮询查询已停止"); |
| | | //System.out.println("应用程序关闭,轮询查询已停止"); |
| | | } |
| | | |
| | | // 停止串口协议解析器(新增) |
| | |
| | | if (lunxun.checkSerialConnection()) { |
| | | boolean resumed = lunxun.setPollingPaused(false); |
| | | if (resumed) { |
| | | System.out.println("切换到主页面,轮询查询已恢复"); |
| | | //System.out.println("切换到主页面,轮询查询已恢复"); |
| | | } |
| | | } else { |
| | | System.err.println("切换到主页面,串口未连接,保持轮询暂停"); |