From 32524195d474b74e48916867b2a6c2f022a40d98 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期二, 09 十二月 2025 19:36:32 +0800
Subject: [PATCH] 20251209
---
src/set/Sets.java | 72 +++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 1 deletions(-)
diff --git a/src/set/Sets.java b/src/set/Sets.java
index 224795f..deaacd8 100644
--- a/src/set/Sets.java
+++ b/src/set/Sets.java
@@ -30,6 +30,7 @@
// 璁剧疆椤圭粍浠�
private JLabel mowerIdLabel;
+ private JLabel baseStationIdLabel;
private JLabel handheldMarkerLabel;
private JLabel simCardNumberLabel;
private JLabel baseStationSimLabel;
@@ -38,6 +39,7 @@
private JLabel idleTrailDurationLabel;
private JButton mowerIdEditBtn;
+ private JButton baseStationIdEditBtn;
private JButton handheldEditBtn;
private JButton checkUpdateBtn;
private JButton systemDebugButton;
@@ -105,6 +107,11 @@
setData.getMowerId() != null ? setData.getMowerId() : "鏈缃�", true);
mowerIdLabel = (JLabel) mowerIdPanel.getClientProperty("valueLabel");
mowerIdEditBtn = (JButton) mowerIdPanel.getClientProperty("editButton");
+
+ JPanel baseStationIdPanel = createSettingItemPanel("宸垎鍩哄噯绔欑紪鍙�",
+ resolveBaseStationId(), true);
+ baseStationIdLabel = (JLabel) baseStationIdPanel.getClientProperty("valueLabel");
+ baseStationIdEditBtn = (JButton) baseStationIdPanel.getClientProperty("editButton");
JPanel handheldPanel = createSettingItemPanel("渚挎惡鎵撶偣鍣ㄧ紪鍙�",
setData.getHandheldMarkerId() != null ? setData.getHandheldMarkerId() : "鏈缃�", true);
@@ -135,7 +142,8 @@
// APP鐗堟湰
JPanel appVersionPanel = createAppVersionPanel();
- addRowWithSpacing(panel, mowerIdPanel);
+ addRowWithSpacing(panel, mowerIdPanel);
+ addRowWithSpacing(panel, baseStationIdPanel);
addRowWithSpacing(panel, handheldPanel);
addRowWithSpacing(panel, simCardPanel);
addRowWithSpacing(panel, baseStationSimPanel);
@@ -432,6 +440,10 @@
mowerIdLabel.setText(setData.getMowerId() != null ? setData.getMowerId() : "鏈缃�");
}
+ if (baseStationIdLabel != null) {
+ baseStationIdLabel.setText(resolveBaseStationId());
+ }
+
if (handheldMarkerLabel != null) {
handheldMarkerLabel.setText(setData.getHandheldMarkerId() != null ? setData.getHandheldMarkerId() : "鏈缃�");
}
@@ -477,12 +489,31 @@
}
return trimmed;
}
+
+ private String resolveBaseStationId() {
+ if (baseStation == null) {
+ return "鏈缃�";
+ }
+ String value = baseStation.getDeviceId();
+ if (value == null) {
+ return "鏈缃�";
+ }
+ String trimmed = value.trim();
+ if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+ return "鏈缃�";
+ }
+ return trimmed;
+ }
private void setupEventHandlers() {
// 鍓茶崏鏈虹紪鍙风紪杈戞寜閽簨浠�
if (mowerIdEditBtn != null) {
mowerIdEditBtn.addActionListener(e -> editMowerId());
}
+
+ if (baseStationIdEditBtn != null) {
+ baseStationIdEditBtn.addActionListener(e -> editBaseStationId());
+ }
// 妫�鏌ユ洿鏂版寜閽簨浠�
if (checkUpdateBtn != null) {
@@ -559,6 +590,45 @@
}
}
+ private void editBaseStationId() {
+ String currentValue = "鏈缃�".equals(resolveBaseStationId()) ? "" : resolveBaseStationId();
+ String newValue = (String) JOptionPane.showInputDialog(this,
+ "璇疯緭鍏ュ樊鍒嗗熀鍑嗙珯缂栧彿:",
+ "淇敼宸垎鍩哄噯绔欑紪鍙�",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ currentValue);
+
+ if (newValue == null) {
+ return;
+ }
+
+ newValue = newValue.trim();
+ if (newValue.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "宸垎鍩哄噯绔欑紪鍙蜂笉鑳戒负绌�", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ try {
+ baseStation.updateByDeviceId(newValue,
+ baseStation.getInstallationCoordinates(),
+ baseStation.getIotSimCardNumber(),
+ baseStation.getDeviceActivationTime(),
+ baseStation.getDataUpdateTime());
+ baseStation.load();
+ if (baseStationIdLabel != null) {
+ baseStationIdLabel.setText(resolveBaseStationId());
+ }
+ JOptionPane.showMessageDialog(this, "宸垎鍩哄噯绔欑紪鍙锋洿鏂版垚鍔�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+ } catch (IllegalArgumentException ex) {
+ JOptionPane.showMessageDialog(this, ex.getMessage(), "杈撳叆閿欒", JOptionPane.WARNING_MESSAGE);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, "宸垎鍩哄噯绔欑紪鍙锋洿鏂板け璐�", "閿欒", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
private void editIdleTrailDuration() {
int currentSeconds = setData != null ? setData.getIdleTrailDurationSeconds() : Setsys.DEFAULT_IDLE_TRAIL_DURATION_SECONDS;
if (currentSeconds <= 0) {
--
Gitblit v1.10.0