| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | |
| | | @RequestMapping(value = "/node/{id}/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_detail") |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(nodeService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/list/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_list") |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/list/tree/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_tree_list") |
| | | public R listTree(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | |
| | | convert(param, wrapper); |
| | | hostEq(wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.parse("0-操作成功").add(nodeService.selectList(wrapper)); |
| | | R r = R.ok(); |
| | | r.put("data",nodeService.selectList(wrapper)); |
| | | return r; |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/tree/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_tree") |
| | | public R tree(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | |
| | | convert(param, wrapper); |
| | | hostEq(wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.parse("0-操作成功").add(nodeService.selectList(wrapper)); |
| | | R r = R.ok(); |
| | | r.put("data",nodeService.selectList(wrapper)); |
| | | return r; |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/add/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_add") |
| | | public R add(Node node) { |
| | | Node node1 = nodeService.selectByUuid(node.getName()); |
| | | if (!Cools.isEmpty(node1)) { |
| | | throw new CoolException("该编号/名称已存在"); |
| | | throw new CoolException("response.code_or_name_exists"); |
| | | } |
| | | if (node.getType() != 1) { |
| | | Node parentNode = nodeService.selectById(node.getParentId()); |
| | | if (parentNode == null || parentNode.getStatus() == 0) { |
| | | return R.error(node.getType()==2?"所属仓库不存在":"所属库区不存在"); |
| | | return R.error(node.getType()==2?"response.parent_warehouse_not_exist":"response.parent_zone_not_exist"); |
| | | } |
| | | node.setParentName(parentNode.getName()); |
| | | node.setLevel(parentNode.getLevel() + 1); |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/node/update/auth") |
| | | @ManagerAuth |
| | | public R update(Node node){ |
| | | @ManagerAuth(memo = "response.node_update") |
| | | public R update(Node node) { |
| | | Node node1 = nodeService.selectByUuid(node.getName()); |
| | | if (!Cools.isEmpty(node1)) { |
| | | throw new CoolException("该编号/名称已存在"); |
| | | throw new CoolException("response.code_or_name_exists"); |
| | | } |
| | | if (Cools.isEmpty(node) || null==node.getId()){ |
| | | return R.error(); |
| | | return R.error("response.param_error"); |
| | | } |
| | | if (node.getType() != 1) { |
| | | Node parentNode = nodeService.selectById(node.getParentId()); |
| | | if (parentNode == null || parentNode.getStatus() == 0) { |
| | | return R.error(node.getType()==2?"所属仓库不存在":"所属库区不存在"); |
| | | return R.error(node.getType()==2?"response.parent_warehouse_not_exist":"response.parent_zone_not_exist"); |
| | | } |
| | | node.setParentName(parentNode.getName()); |
| | | node.setLevel(parentNode.getLevel() + 1); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/delete/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_delete") |
| | | public R delete(@RequestParam String param){ |
| | | List<Node> list = JSONArray.parseArray(param, Node.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | return R.error("response.param_error"); |
| | | } |
| | | for (Node entity : list){ |
| | | nodeService.delete(new EntityWrapper<>(entity)); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/delete0/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_delete") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | nodeService.deleteById(id); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/node/export/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.node_export") |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<Node> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<Node> wrapper = new EntityWrapper<Node>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != nodeService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(Node.class, String.valueOf(param.get("key")))); |
| | | R r = R.parse(BaseRes.REPEAT); |
| | | r.put("data", getComment(Node.class, String.valueOf(param.get("key")))); |
| | | return r; |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | map.put("val", node.getName()); |
| | | result.add(map); |
| | | } |
| | | return R.ok().add(result); |
| | | R r = R.ok(); |
| | | r.put("data",result); |
| | | return r; |
| | | } |
| | | |
| | | @PostMapping(value = "/node/tree/auth") |
| | |
| | | List<NodeExcel> excels = new ArrayList<>(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("货位档案Excel导入模板", "UTF-8"); |
| | | String fileName = URLEncoder.encode("response.node_excel_template_name", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), NodeExcel.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | |
| | | |
| | | // excel导入 |
| | | @PostMapping(value = "/node/excel/import/auth") |
| | | @ManagerAuth(memo = "货位档案数据导入") |
| | | @ManagerAuth(memo = "response.node_excel_import") |
| | | @Transactional |
| | | public R nodeExcelImport(MultipartFile file) throws IOException { |
| | | NodeExcelListener listener = new NodeExcelListener(getUserId(), getHostId()); |
| | | EasyExcel.read(file.getInputStream(), NodeExcel.class, listener).sheet().doRead(); |
| | | return R.ok("成功同步"+listener.getTotal()+"个货位"); |
| | | R r = R.ok("response.sync_success_count"); |
| | | r.put("count", listener.getTotal()); |
| | | return r; |
| | | } |
| | | |
| | | /*************************************** 入库出相关 ***********************************************/ |
| | | |
| | | @RequestMapping("/work/stock/pakin") |
| | | @ManagerAuth(memo = "入库") |
| | | @ManagerAuth(memo = "response.inbound") |
| | | public R stockPakin(@RequestBody PakinParam number) { |
| | | return nodeService.stockPakin(number, getUserId(), getHostId()); |
| | | } |
| | | |
| | | @RequestMapping("/work/stock/pakout") |
| | | @ManagerAuth(memo = "生成拣货单") |
| | | @ManagerAuth(memo = "response.outbound") |
| | | public R initPakout(@RequestBody List<InitPakoutParam> params) { |
| | | return nodeService.initPakout(params, getUserId(), getHostId()); |
| | | } |
| | |
| | | public R getGroupEmptyStock(@RequestParam(required = false) String sourceLocNo) { |
| | | List<Node> allEmptys = nodeService.selectList(new EntityWrapper<Node>() |
| | | .eq("type","3")); |
| | | return R.ok().add(allEmptys); |
| | | R r = R.ok(); |
| | | r.put("data", allEmptys); |
| | | return r; |
| | | } |
| | | @RequestMapping("/work/move/start") |
| | | @ManagerAuth(memo = "库位移转") |
| | | @ManagerAuth(memo = "response.location_transfer") |
| | | public R locMoveStart(@RequestParam String sourceLocNo, |
| | | @RequestParam String targetLocNo) { |
| | | nodeService.locMove(sourceLocNo, targetLocNo, getUserId()); |
| | | return R.ok("移库启动成功"); |
| | | return R.ok("response.move_start_success"); |
| | | } |
| | | @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); |
| | | } |
| | | |
| | | } |