From ca07b97ea192888b6ec219fd5409517349789b70 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 21 三月 2025 09:40:49 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/NodeController.java | 114 ++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 81 insertions(+), 33 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("鏁版嵁鎻掑叆澶辫触");
+// }
+// }
+
}
}
--
Gitblit v1.9.1