From 24527aa9d2f522faa574ac3f3bdb1544d0b2a9bf Mon Sep 17 00:00:00 2001 From: pjb <123456> Date: 星期二, 31 十二月 2024 11:58:13 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/NodeController.java | 123 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 109 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/NodeController.java b/src/main/java/com/zy/asrs/controller/NodeController.java index 918c71c..b6836cf 100644 --- a/src/main/java/com/zy/asrs/controller/NodeController.java +++ b/src/main/java/com/zy/asrs/controller/NodeController.java @@ -13,9 +13,8 @@ import com.core.common.DateUtils; import com.core.common.R; import com.core.exception.CoolException; -import com.zy.asrs.entity.*; +import com.zy.asrs.entity.Node; import com.zy.asrs.entity.param.InitPakoutParam; -import com.zy.asrs.entity.param.LocMastInitParam; import com.zy.asrs.entity.param.NodeInitPatam; import com.zy.asrs.entity.param.PakinParam; import com.zy.asrs.entity.result.KeyValueVo; @@ -24,7 +23,6 @@ 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; @@ -38,8 +36,6 @@ import java.io.IOException; import java.net.URLEncoder; import java.util.*; - -import static jdk.nashorn.api.scripting.ScriptUtils.convert; @RestController public class NodeController extends BaseController { @@ -155,10 +151,10 @@ @RequestMapping(value = "/node/update/auth") @ManagerAuth public R update(Node node){ - Node node1 = nodeService.selectByUuid(node.getName()); - if (!Cools.isEmpty(node1)) { - throw new CoolException("璇ョ紪鍙�/鍚嶇О宸插瓨鍦�"); - } +// Node node1 = nodeService.selectByUuid(node.getName()); +// if (!Cools.isEmpty(node1)) { +// throw new CoolException("璇ョ紪鍙�/鍚嶇О宸插瓨鍦�"); +// } if (Cools.isEmpty(node) || null==node.getId()){ return R.error(); } @@ -345,25 +341,67 @@ } @RequestMapping(value = "/node/init/auth") - @ManagerAuth(memo = "鍒濆鍖栧簱浣�") + @ManagerAuth(memo = "骞冲簱搴撲綅鍒濆鍖�") @Transactional public R init(NodeInitPatam param) { List<Node> list = new ArrayList<>(); EntityWrapper<Node> nodeEntityWrapper = new EntityWrapper<>(); nodeEntityWrapper.eq("id",param.getValue()); nodeEntityWrapper.eq("name",param.getName()); - nodeService.delete(new EntityWrapper<Node>().eq("parent_id",param.getValue())); +// nodeService.delete(new EntityWrapper<Node>().eq("parent_id",param.getValue())); Node node = nodeService.selectOne(nodeEntityWrapper); String[] string = node.getNamePath().split(","); - for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ - for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { + int tno=1; int no=1; + for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { + for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ for (int l=param.getStartLev(); l<=param.getEndLev(); l++) { // 鑾峰彇搴撲綅鍙� String locNo; - locNo = param.getName()+"-" +String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l); + if (param.getName().equals("DT-B")){ + if (b == 2 || b ==4 || b == 7){ + if (l == 1){ + locNo = param.getName()+"T-" +String.format("%02d", tno) + String.format("%02d", r) + String.format("%02d", l); + }else { + locNo = null; + } + }else { + locNo = param.getName()+"-" +String.format("%02d", no) + String.format("%02d", r) + String.format("%02d", l); + + } + }else if (param.getName().equals("DT-C") || param.getName().equals("DT-D")){ + if (b == 3 || b ==6 || b == 9 || b == 12 || b == 15 || b == 17 || b == 20 || b == 23){ + if (l == 1){ + locNo = param.getName()+"T-" +String.format("%02d", tno) + String.format("%02d", r) + String.format("%02d", l); + }else { + locNo = null; + } + + }else { + locNo = param.getName()+"-" +String.format("%02d", no) + String.format("%02d", r) + String.format("%02d", l); + + } + + }else { + locNo = param.getName()+String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l); + } + + //瀹㈡埛瑕佹眰鏍煎紡浣岮-01-01-01 + StringBuilder sb = new StringBuilder(locNo); + sb.insert(sb.length()-4,"-"); + sb.insert(sb.length()-2,"-"); + locNo = sb.toString(); + + if (locNo == null){ + continue; + } + + List<Node> nodeList = nodeService.selectList(new EntityWrapper<Node>().eq("name", locNo)); + if (!Cools.isEmpty(nodeList)){ + throw new CoolException("搴撲綅鍙烽噸澶�"); + } Date now = new Date(); Node node1 = new Node(); @@ -383,12 +421,31 @@ node1.setRow1(r); node1.setBay1(b); node1.setLev1(l); + if (!nodeService.insert(node1)){ return R.error("鏁版嵁鎻掑叆澶辫触"); } + + } } + if (param.getName().equals("DT-B")){ + if (b == 2 || b ==4 || b == 7){ + tno++; + }else { + no++; + } + }else if (param.getName().equals("DT-C") || param.getName().equals("DT-D")){ + if (b == 3 || b ==6 || b == 9 || b == 12 || b == 15 || b == 17 || b == 20 || b == 23){ + tno++; + }else { + no++; + } + + } + + } // // nodeService.delete(new EntityWrapper<Node>().eq("parent_id",param.getValue())); @@ -422,7 +479,45 @@ return R.ok(keyValueVoList); } + @RequestMapping(value = "/node/recommendLoc") + public R recommendLoc(@RequestParam String matnr){ + List<String> remmendLoc = nodeService.getRemmendLoc(matnr); + return R.ok(remmendLoc); + } + @RequestMapping(value = "/node/updateStatus") + @ManagerAuth(memo = "搴撲綅鍐荤粨") + public R updateStockFreeze(@RequestParam String param){ + List<Node> list = JSONArray.parseArray(param, Node.class); + if (Cools.isEmpty(list)){ + return R.error("鏃犳暟鎹�"); + } + for (Node node : list){ + node.setStatus(0); + if (nodeService.updateStockFreeze(node.getName(), node.getStatus()) != 1){ + return R.error(node.getName()+"鍐荤粨澶辫触"); + } + + } + return R.ok("鍐荤粨鎴愬姛"); + } + + @RequestMapping(value = "/node/updateDisStatus") + @ManagerAuth(memo = "搴撲綅瑙i櫎鍐荤粨") + public R updateStockDisFreeze(@RequestParam String param){ + List<Node> list = JSONArray.parseArray(param, Node.class); + if (Cools.isEmpty(list)){ + return R.error("鏃犳暟鎹�"); + } + for (Node node : list){ + node.setStatus(1); + if (nodeService.updateStockFreeze(node.getName(), node.getStatus()) != 1){ + return R.error(node.getName()+"瑙i櫎鍐荤粨澶辫触"); + } + + } + return R.ok("瑙e喕鎴愬姛"); + } } -- Gitblit v1.9.1