张世豪
2 天以前 d0ae1a5baf919cf470d2ab2102587948623cc725
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;