张世豪
2 天以前 d0ae1a5baf919cf470d2ab2102587948623cc725
将地块编号改成割草机编号+01的自增数字
已修改2个文件
21 ■■■■■ 文件已修改
set.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/zhangaiwu/AddDikuai.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
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;