|  |  |  | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | 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.PakinParam; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ManLocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.common.entity.NodeExcel; | 
|---|
|  |  |  | import com.zy.common.entity.NodeExcelListener; | 
|---|
|  |  |  | 
|---|
|  |  |  | private NodeService nodeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TreeUtils treeUtils; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ManLocDetlMapper manLocDetlMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(Node node) { | 
|---|
|  |  |  | Node node1 = nodeService.selectByUuid(node.getName()); | 
|---|
|  |  |  | if (!Cools.isEmpty(node1)) { | 
|---|
|  |  |  | throw new CoolException("该编号/名称已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (node.getType() != 1) { | 
|---|
|  |  |  | Node parentNode = nodeService.selectById(node.getParentId()); | 
|---|
|  |  |  | if (parentNode == null || parentNode.getStatus() == 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | nodeUtils.executePath(node); | 
|---|
|  |  |  | node.setHostId(getHostId()); | 
|---|
|  |  |  | node.setUuid(node.getName().toString()); | 
|---|
|  |  |  | System.out.println(node.getUuid()); | 
|---|
|  |  |  | node.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | node.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  | node.setLevel(node.getType()); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/update/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R update(Node node){ | 
|---|
|  |  |  | Node node1 = nodeService.selectByUuid(node.getName()); | 
|---|
|  |  |  | if (!Cools.isEmpty(node1)) { | 
|---|
|  |  |  | throw new CoolException("该编号/名称已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Cools.isEmpty(node) || null==node.getId()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | nodeUtils.executePath(node); | 
|---|
|  |  |  | node.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | node.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  | node.setUuid(node.getName()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | manLocDetlMapper.updateLocNo0(node.getId(),node.getName()); | 
|---|
|  |  |  | node.setUpdateBy(getUserId()); | 
|---|
|  |  |  | node.setUpdateTime(new Date()); | 
|---|
|  |  |  | nodeService.updateById(node); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("成功同步"+listener.getTotal()+"个货位"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** 入库出相关 ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/work/stock/pakin") | 
|---|
|  |  |  | @ManagerAuth(memo = "入库") | 
|---|
|  |  |  | public R stockPakin(@RequestBody PakinParam number) { | 
|---|
|  |  |  | return nodeService.stockPakin(number, getUserId(), getHostId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/work/stock/pakout") | 
|---|
|  |  |  | @ManagerAuth(memo = "出库") | 
|---|
|  |  |  | public R initPakout(@RequestBody List<InitPakoutParam> params) { | 
|---|
|  |  |  | return nodeService.initPakout(params, getUserId(), getHostId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/work/empty/stock") | 
|---|
|  |  |  | public R getGroupEmptyStock(@RequestParam(required = false) String sourceLocNo) { | 
|---|
|  |  |  | List<Node> allEmptys = nodeService.selectList(new EntityWrapper<Node>() | 
|---|
|  |  |  | .eq("type","3")); | 
|---|
|  |  |  | return R.ok().add(allEmptys); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping("/work/move/start") | 
|---|
|  |  |  | @ManagerAuth(memo = "库位移转") | 
|---|
|  |  |  | public R locMoveStart(@RequestParam String sourceLocNo, | 
|---|
|  |  |  | @RequestParam String targetLocNo) { | 
|---|
|  |  |  | nodeService.locMove(sourceLocNo, targetLocNo, getUserId()); | 
|---|
|  |  |  | return R.ok("移库启动成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping(value = "/node/select/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R getById(@PathVariable("id") String id) { | 
|---|
|  |  |  | Node node = nodeService.selectOne(new EntityWrapper<Node>() | 
|---|
|  |  |  | .eq("uuid",id)); | 
|---|
|  |  |  | return R.ok(node); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|