From d0ae1a5baf919cf470d2ab2102587948623cc725 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期三, 24 十二月 2025 17:18:10 +0800
Subject: [PATCH] 将地块编号改成割草机编号+01的自增数字

---
 src/zhangaiwu/AddDikuai.java |   19 +++++++++++++++++++
 set.properties               |    2 +-
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/set.properties b/set.properties
index f406cc2..321c62c 100644
--- a/set.properties
+++ b/set.properties
@@ -1,5 +1,5 @@
 #Mower Configuration Properties - Updated
-#Wed Dec 24 17:05:51 CST 2025
+#Wed Dec 24 17:17:31 CST 2025
 appVersion=-1
 boundaryLengthVisible=false
 currentWorkLandNumber=LAND1
diff --git a/src/zhangaiwu/AddDikuai.java b/src/zhangaiwu/AddDikuai.java
index 65e96d6..8d6764a 100644
--- a/src/zhangaiwu/AddDikuai.java
+++ b/src/zhangaiwu/AddDikuai.java
@@ -2684,6 +2684,25 @@
 
     private String generateNewLandNumber() {
         Map<String, Dikuai> existing = Dikuai.getAllDikuai();
+        
+        // 鑾峰彇鍓茶崏鏈虹紪鍙�
+        String mowerId = Setsys.getPropertyValue("mowerId");
+        
+        // 濡傛灉鏈夊壊鑽夋満缂栧彿锛屼娇鐢� 缂栧彿+涓や綅鑷鏁板瓧 鏍煎紡
+        if (mowerId != null && !mowerId.trim().isEmpty() && !"-1".equals(mowerId)) {
+            int attempt = 1;
+            while (true) {
+                // 鏍煎紡鍖栦负涓や綅鏁板瓧锛屽 01, 02, ...
+                String suffix = String.format("%02d", attempt);
+                String candidate = mowerId + suffix;
+                if (!existing.containsKey(candidate)) {
+                    return candidate;
+                }
+                attempt++;
+            }
+        }
+        
+        // 濡傛灉娌℃湁鍓茶崏鏈虹紪鍙凤紝鍥為��鍒伴粯璁ら�昏緫
         int attempt = 1;
         while (true) {
             String candidate = "LAND" + attempt;

--
Gitblit v1.10.0