|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 { | 
|---|
|  |  |  | 
|---|
|  |  |  | @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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(","); | 
|---|
|  |  |  | int tno=1; int no=1; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | locNo = param.getName()+"-" +String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l); | 
|---|
|  |  |  | locNo = param.getName()+String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //客户要求格式位A-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(); | 
|---|
|  |  |  | 
|---|
|  |  |  | node1.setRow1(r); | 
|---|
|  |  |  | node1.setBay1(b); | 
|---|
|  |  |  | node1.setLev1(l); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!nodeService.insert(node1)){ | 
|---|
|  |  |  | return R.error("数据插入失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (param.getName().equals("DT-B")){ | 
|---|