From dd984f63c67236c282d33ee45370d0424dadf5b5 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 14 三月 2025 15:26:26 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/node/node.js                       |    9 -
 src/main/webapp/views/node/node.html                         |   62 +++++++++++++--
 src/main/java/com/zy/asrs/controller/NodeController.java     |  114 ++++++++++++++++++++--------
 src/main/java/com/zy/asrs/entity/Node.java                   |    1 
 src/main/java/com/zy/asrs/entity/param/NodeLocInitParam.java |   39 +++++++++
 5 files changed, 177 insertions(+), 48 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/NodeController.java b/src/main/java/com/zy/asrs/controller/NodeController.java
index 62a3c53..506f8bc 100644
--- a/src/main/java/com/zy/asrs/controller/NodeController.java
+++ b/src/main/java/com/zy/asrs/controller/NodeController.java
@@ -13,9 +13,12 @@
 import com.core.common.DateUtils;
 import com.core.common.R;
 import com.core.exception.CoolException;
+import com.zy.asrs.entity.BasWhs;
+import com.zy.asrs.entity.LocMast;
 import com.zy.asrs.entity.ManLocDetl;
 import com.zy.asrs.entity.Node;
 import com.zy.asrs.entity.param.InitPakoutParam;
+import com.zy.asrs.entity.param.NodeLocInitParam;
 import com.zy.asrs.entity.param.PakinParam;
 import com.zy.asrs.entity.result.KeyValueVo;
 import com.zy.asrs.mapper.ManLocDetlMapper;
@@ -23,6 +26,7 @@
 import com.zy.common.entity.NodeExcel;
 import com.zy.common.entity.NodeExcelListener;
 import com.zy.common.entity.Parameter;
+import com.zy.common.model.Shelves;
 import com.zy.common.utils.ListUtils;
 import com.zy.common.utils.NodeUtils;
 import com.zy.common.utils.TreeUtils;
@@ -360,40 +364,84 @@
 
     @RequestMapping(value = "/node/init/auth")
     @ManagerAuth(memo = "骞冲簱搴撲綅鍒濆鍖�")
-    @Transactional
-    public R init(@RequestBody JSONObject param) {
-        String area = param.getString("name");
-        Integer value = param.getInteger("value");
-        Integer num = param.getInteger("startRow");
-        EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>();
-        nodeEntityWrapper.eq("id",value);
-        nodeEntityWrapper.eq("name",area);
-        Node node = nodeService.selectOne(nodeEntityWrapper);
-        String[] string = node.getNamePath().split(",");
-        for (int i = 1; i <= num; i++) {
-            String locNo =area + String.format("%04d", i);
-            String uuid = String.valueOf(System.currentTimeMillis());
-            Date now =  new Date();
-            Node node1 = new Node();
-            node1.setUuid(uuid);
-            node1.setName(locNo);
-            node1.setParentId(node.getId());
-            node1.setParentName(node.getName());
-            node1.setType(3);
-            node1.setPath(node.getPath()+","+node.getId());
-            node1.setNamePath(node.getNamePath()+","+node.getName());
-            node1.setLevel(3);
-            node1.setStatus(1);
-            node1.setCreateBy(getUserId());
-            node1.setCreateTime(now);
-            node1.setUpdateBy(getUserId());
-            node1.setUpdateTime(now);
-            if (!nodeService.insert(node1)){
-                return R.error("鏁版嵁鎻掑叆澶辫触");
-            }
-        }
+//    @Transactional
+    public R init(@RequestBody NodeLocInitParam param) {
+        try{
+            EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>();
+            nodeEntityWrapper.eq("id",param.getValue());
+            nodeEntityWrapper.eq("name",param.getName());
+            Node node = nodeService.selectOne(nodeEntityWrapper);
 
-        return R.ok("鍒濆鍖栨垚鍔�");
+            if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1){
+                nodeService.delete(new EntityWrapper<Node>().eq("parent_id",node.getId()));
+            }
+
+            List<Node> list = new ArrayList<>();
+            for (int r=param.getStartRow(); r<=param.getEndRow(); r++){
+                for (int b=param.getStartBay(); b<=param.getEndBay(); b++) {
+                    for (int l=param.getStartLev(); l<=param.getEndLev(); l++) {
+
+                        char rowCode = (char)(64+r);
+                        // 鑾峰彇搴撲綅鍙�
+                        String locNo = String.format("%02d", param.getCode())+rowCode + String.format("%02d", b) + String.format("%02d", l);
+
+                        String[] string = node.getNamePath().split(",");
+
+                        String uuid = String.valueOf(System.currentTimeMillis());
+                        Date now =  new Date();
+                        Node node1 = new Node();
+                        node1.setUuid(uuid);
+                        node1.setName(locNo);
+                        node1.setParentId(node.getId());
+                        node1.setParentName(node.getName());
+                        node1.setType(3);
+                        node1.setPath(node.getPath()+","+node.getId());
+                        node1.setNamePath(node.getNamePath()+","+node.getName());
+                        node1.setLevel(3);
+                        node1.setStatus(1);
+                        node1.setCreateBy(getUserId());
+                        node1.setCreateTime(now);
+                        node1.setUpdateBy(getUserId());
+                        node1.setUpdateTime(now);
+                        nodeService.insert(node1);
+                    }
+                }
+            }
+            return R.ok("鍒濆鍖栨垚鍔�");
+        }catch (Exception e){
+            return R.error("鍒濆鍖栧け璐�===>"+e.getMessage());
+        }
+//        String area = param.getString("name");
+//        Integer value = param.getInteger("value");
+//        Integer num = param.getInteger("startRow");
+//        EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>();
+//        nodeEntityWrapper.eq("id",value);
+//        nodeEntityWrapper.eq("name",area);
+//        Node node = nodeService.selectOne(nodeEntityWrapper);
+//        String[] string = node.getNamePath().split(",");
+//        for (int i = 1; i <= num; i++) {
+//            String locNo =area + String.format("%04d", i);
+//            String uuid = String.valueOf(System.currentTimeMillis());
+//            Date now =  new Date();
+//            Node node1 = new Node();
+//            node1.setUuid(uuid);
+//            node1.setName(locNo);
+//            node1.setParentId(node.getId());
+//            node1.setParentName(node.getName());
+//            node1.setType(3);
+//            node1.setPath(node.getPath()+","+node.getId());
+//            node1.setNamePath(node.getNamePath()+","+node.getName());
+//            node1.setLevel(3);
+//            node1.setStatus(1);
+//            node1.setCreateBy(getUserId());
+//            node1.setCreateTime(now);
+//            node1.setUpdateBy(getUserId());
+//            node1.setUpdateTime(now);
+//            if (!nodeService.insert(node1)){
+//                return R.error("鏁版嵁鎻掑叆澶辫触");
+//            }
+//        }
+
     }
 
 }
diff --git a/src/main/java/com/zy/asrs/entity/Node.java b/src/main/java/com/zy/asrs/entity/Node.java
index db7fe9d..fa63fe7 100644
--- a/src/main/java/com/zy/asrs/entity/Node.java
+++ b/src/main/java/com/zy/asrs/entity/Node.java
@@ -25,6 +25,7 @@
      */
     @ApiModelProperty(value= "ID")
     @TableId(value = "id", type = IdType.AUTO)
+    @TableField("id")
     private Long id;
 
     /**
diff --git a/src/main/java/com/zy/asrs/entity/param/NodeLocInitParam.java b/src/main/java/com/zy/asrs/entity/param/NodeLocInitParam.java
new file mode 100644
index 0000000..92da15e
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/NodeLocInitParam.java
@@ -0,0 +1,39 @@
+package com.zy.asrs.entity.param;
+
+import lombok.Data;
+
+@Data
+public class NodeLocInitParam {
+
+    // 璧峰鎺�
+    private String name;
+
+    // 缁堟鎺�
+    private Integer value;
+    // 璧峰鍒�
+    private Integer code;
+
+    // 璧峰鍒�
+    private Integer select;
+
+    // 缁堟鍒�
+    private Integer enable;
+
+    // 璧峰鎺�
+    private Integer startRow;
+
+    // 缁堟鎺�
+    private Integer endRow;
+
+    // 璧峰鍒�
+    private Integer startBay;
+
+    // 缁堟鍒�
+    private Integer endBay;
+
+    // 璧峰灞�
+    private Integer startLev;
+
+    // 缁堟灞�
+    private Integer endLev;
+}
diff --git a/src/main/webapp/static/js/node/node.js b/src/main/webapp/static/js/node/node.js
index ffd99f4..774b2a9 100644
--- a/src/main/webapp/static/js/node/node.js
+++ b/src/main/webapp/static/js/node/node.js
@@ -31,18 +31,15 @@
         cols: [[
             {type: 'checkbox'}
             // {type: 'numbers'}
-            ,{field: 'name', align: 'left',title: '缂栧彿/鍚嶇О', minWidth: 150}
+            ,{field: 'name', align: 'left',title: '缂栧彿/鍚嶇О'}
             // ,{field: 'uuid', left: 'center',title: '缂栧彿/鍚嶇О', minWidth: 150}
-            ,{field: 'type$', align: 'center',title: '绫诲瀷', templet: '#typeTpl'}
+            ,{field: 'type$', align: 'center',title: '绫诲瀷', templet: '#typeTpl', minWidth: 150}
             // ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
             // ,{field: 'img', align: 'center',title: '鍥剧墖', hide: true}
             // ,{field: 'brief', align: 'center',title: '绠�瑕佹弿杩�'}
             // ,{field: 'count', align: 'center',title: '鏁伴噺'}
             // ,{field: 'sort', align: 'center',title: '鎺掑簭'}
             ,{field: 'status$', align: 'center',title: '鐘舵��', hide: true}
-            ,{field: 'row1$', align: 'center',title: '鎺�'}
-            ,{field: 'bay1$', align: 'center',title: '鍒�'}
-            ,{field: 'lev1$', align: 'center',title: '灞�'}
             ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
             ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
             ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
@@ -52,7 +49,7 @@
         done: function (data) {
             console.log(data)
             $('.ew-tree-table-box').css('height', '100%');
-            insTb.expandAll();
+            // insTb.expandAll();
             tbDataList = data;
 
         }
diff --git a/src/main/webapp/views/node/node.html b/src/main/webapp/views/node/node.html
index 1c9e70a..5a18dc3 100644
--- a/src/main/webapp/views/node/node.html
+++ b/src/main/webapp/views/node/node.html
@@ -137,6 +137,16 @@
 <div id="resetLocDiv" style="margin: 20px 0 10px 30px; display: none">
     <div class="layui-form layui-form-pane">
 
+
+
+       <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">鍒犻櫎搴撲綅</label>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="checkbox" name="enable" lay-skin="switch" value="1" lay-text="鍒犻櫎|淇濈暀">
+                </div>
+            </div>
+        </div>
         <!-- 搴撲綅绫诲瀷 -->
         <div class="layui-form-item">
             <label class="layui-form-label">搴撳尯</label>
@@ -145,27 +155,61 @@
                 </div>
             </div>
         </div>
-
-        <!-- 鎺� -->
         <div class="layui-form-item">
             <div class="layui-inline">
-                <label class="layui-form-label">搴撲綅鏁伴噺</label>
+                <label class="layui-form-label">浠撳簱浠g爜</label>
                 <div class="layui-input-inline">
-                    <input type="number" name="startRow" autocomplete="off" class="layui-input" lay-verify="required|number">
+                    <input type="number" name="code" autocomplete="off" class="layui-input" lay-verify="required|number">
                 </div>
 
             </div>
         </div>
-
-
-
-        <div id="prompt" style="text-indent: 10px;">
-            <span class="not-null">鍒濆鍖栧簱浣嶅悗灏嗗垹闄ゅ簱瀛樻槑缁嗭紝璇疯皑鎱庢搷浣滐紒</span>
+        <!-- 鎺� -->
+        <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">璧锋鎺�</label>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="startRow" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+                <div class="layui-form-mid">-</div>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="endRow" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+            </div>
+        </div>
+        <!-- 鍒� -->
+        <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">璧锋鍒�</label>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="startBay" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+                <div class="layui-form-mid">-</div>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="endBay" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+            </div>
+        </div>
+        <!-- 灞� -->
+        <div class="layui-form-item">
+            <div class="layui-inline">
+                <label class="layui-form-label">璧锋灞�</label>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="startLev" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+                <div class="layui-form-mid">-</div>
+                <div class="layui-input-inline" style="width: 100px;">
+                    <input type="text" name="endLev" autocomplete="off" class="layui-input" lay-verify="required|number">
+                </div>
+            </div>
         </div>
         <!-- 鎸夐挳 -->
         <div style="text-align: center; margin-top: 20px">
             <button class="layui-btn layui-btn-radius layui-btn-normal" id="initDo" lay-submit lay-filter="initDo">纭畾</button>
         </div>
+
+
+
     </div>
 </div>
 

--
Gitblit v1.9.1