Merge branch 'hylyasrs' of http://47.97.1.152:5880/r/zy-asrs into hylyasrs
|  |  |  | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.mapper.LocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.ManLocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlMapper locDetlMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetl/list/auth") | 
|---|
|  |  |  | @RequestMapping(value = "/error/locDetl/list/auth")// /locDetl/list/auth 接口问题 | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R list(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.service.ManLocDetlService; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class ManLocDetlController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ManLocDetlService manLocDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/manLocDetl/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R list(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | Long hostId = getHostId(); | 
|---|
|  |  |  | System.out.println(hostId); | 
|---|
|  |  |  | if (hostId != null) { | 
|---|
|  |  |  | param.put("host_id", hostId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Object nodeId = param.get("node_id"); | 
|---|
|  |  |  | if (Cools.isEmpty(nodeId)) { | 
|---|
|  |  |  | nodeId = getOriginNode().getId(); | 
|---|
|  |  |  | param.put("node_id", String.valueOf(nodeId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Object tagId = param.get("tag_id"); | 
|---|
|  |  |  | if (Cools.isEmpty(tagId)) { | 
|---|
|  |  |  | tagId = getOriginTag().getId(); | 
|---|
|  |  |  | param.put("tag_id", String.valueOf(tagId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("update_time"))){ | 
|---|
|  |  |  | String val = String.valueOf(param.get("update_time")); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)) { | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | param.put("startTime", DateUtils.convert(dates[0])); | 
|---|
|  |  |  | param.put("endTime", DateUtils.convert(dates[1])); | 
|---|
|  |  |  | param.remove("update_time"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | System.out.println(param); | 
|---|
|  |  |  | return R.ok(manLocDetlService.getPage(toPage(curr, limit, param, ManLocDetl.class))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PackService packService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 商品上架 | 
|---|
|  |  |  | @RequestMapping("/mat/onSale/auth") | 
|---|
|  |  |  | //@ManagerAuth | 
|---|
|  |  |  | public R matOnSale(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | mobileService.onSale(combParam); | 
|---|
|  |  |  | return R.ok("上架成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 商品下架 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 组托 ---------------------------------------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.EasyExcel; | 
|---|
|  |  |  | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.BaseRes; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.common.entity.NodeExcel; | 
|---|
|  |  |  | import com.zy.common.entity.NodeExcelListener; | 
|---|
|  |  |  | import com.zy.common.utils.ListUtils; | 
|---|
|  |  |  | import com.zy.common.utils.NodeUtils; | 
|---|
|  |  |  | import com.zy.common.utils.TreeUtils; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | 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 { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NodeService nodeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TreeUtils treeUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R get(@PathVariable("id") String id) { | 
|---|
|  |  |  | return R.ok(nodeService.selectById(String.valueOf(id))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R list(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | hostEq(wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(nodeService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/list/tree/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R listTree(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | hostEq(wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.parse("0-操作成功").add(nodeService.selectList(wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/tree/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R tree(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | hostEq(wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.parse("0-操作成功").add(nodeService.selectList(wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void convert(Map<String, Object> map, EntityWrapper wrapper){ | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)){ | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
|---|
|  |  |  | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.like(entry.getKey(), val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(Node node) { | 
|---|
|  |  |  | if (node.getType() != 1) { | 
|---|
|  |  |  | Node parentNode = nodeService.selectById(node.getParentId()); | 
|---|
|  |  |  | if (parentNode == null || parentNode.getStatus() == 0) { | 
|---|
|  |  |  | return R.error(node.getType()==2?"所属仓库不存在":"所属库区不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | node.setParentName(parentNode.getName()); | 
|---|
|  |  |  | node.setLevel(parentNode.getLevel() + 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // path | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | node.setCreateBy(getUserId()); | 
|---|
|  |  |  | node.setCreateTime(new Date()); | 
|---|
|  |  |  | node.setUpdateBy(getUserId()); | 
|---|
|  |  |  | node.setUpdateTime(new Date()); | 
|---|
|  |  |  | node.setStatus(1); | 
|---|
|  |  |  | nodeService.insert(node); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/update/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R update(Node node){ | 
|---|
|  |  |  | if (Cools.isEmpty(node) || null==node.getId()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (node.getType() != 1) { | 
|---|
|  |  |  | Node parentNode = nodeService.selectById(node.getParentId()); | 
|---|
|  |  |  | if (parentNode == null || parentNode.getStatus() == 0) { | 
|---|
|  |  |  | return R.error(node.getType()==2?"所属仓库不存在":"所属库区不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | node.setParentName(parentNode.getName()); | 
|---|
|  |  |  | node.setLevel(parentNode.getLevel() + 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // path | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | nodeUtils.executePath(node); | 
|---|
|  |  |  | node.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | node.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | node.setUpdateBy(getUserId()); | 
|---|
|  |  |  | node.setUpdateTime(new Date()); | 
|---|
|  |  |  | nodeService.updateById(node); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/delete/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R delete(@RequestParam String param){ | 
|---|
|  |  |  | List<Node> list = JSONArray.parseArray(param, Node.class); | 
|---|
|  |  |  | if (Cools.isEmpty(list)){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (Node entity : list){ | 
|---|
|  |  |  | nodeService.delete(new EntityWrapper<>(entity)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/delete0/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R delete(@RequestParam(value="ids[]") Long[] ids){ | 
|---|
|  |  |  | for (Long id : ids){ | 
|---|
|  |  |  | nodeService.deleteById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/export/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R export(@RequestBody JSONObject param){ | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | Map<String, Object> map = excludeTrash(param.getJSONObject("node")); | 
|---|
|  |  |  | convert(map, wrapper); | 
|---|
|  |  |  | List<Node> list = nodeService.selectList(wrapper); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/nodeQuery/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(String condition) { | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.like("name", condition).or().like("uuid", condition).eq("type", 3); | 
|---|
|  |  |  | hostEq(wrapper); | 
|---|
|  |  |  | Page<Node> page = nodeService.selectPage(new Page<>(0, 10), wrapper); | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | for (Node node : page.getRecords()){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", node.getId()); | 
|---|
|  |  |  | map.put("value", node.getUuid() + "(" +node.getName()+ ")"); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/node/check/column/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 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")))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/parent/node/group") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R getParentNodeGroup(@RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam Integer type) { | 
|---|
|  |  |  | EntityWrapper<Node> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("type", type).eq("status", 1); | 
|---|
|  |  |  | hostEq(wrapper); | 
|---|
|  |  |  | List<Node> nodes = nodeService.selectList(wrapper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | for (Node node : nodes) { | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("key", node.getId()); | 
|---|
|  |  |  | map.put("val", node.getName()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/node/tree/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException { | 
|---|
|  |  |  | ArrayList<Map> tree = treeUtils.getNodeTree(String.valueOf(getOriginNode().getId()), getHostId()); | 
|---|
|  |  |  | // 深拷贝 | 
|---|
|  |  |  | List<Map> result = ListUtils.deepCopy(tree); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | treeUtils.remove(condition, result); | 
|---|
|  |  |  | treeUtils.remove(condition, result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** 数据相关 ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * excel导入模板下载 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping(value = "/node/excel/import/mould") | 
|---|
|  |  |  | public void nodeExcelImportMould(HttpServletResponse response) throws IOException { | 
|---|
|  |  |  | List<NodeExcel> excels = new ArrayList<>(); | 
|---|
|  |  |  | response.setContentType("application/vnd.ms-excel"); | 
|---|
|  |  |  | response.setCharacterEncoding("utf-8"); | 
|---|
|  |  |  | String fileName = URLEncoder.encode("货位档案Excel导入模板", "UTF-8"); | 
|---|
|  |  |  | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); | 
|---|
|  |  |  | EasyExcel.write(response.getOutputStream(), NodeExcel.class) | 
|---|
|  |  |  | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) | 
|---|
|  |  |  | .sheet("sheet1") | 
|---|
|  |  |  | .doWrite(excels); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // excel导入 | 
|---|
|  |  |  | @PostMapping(value = "/node/excel/import/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "货位档案数据导入") | 
|---|
|  |  |  | @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()+"个货位"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.annotation.ExcelProperty; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableName; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.enums.IdType; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.system.entity.Host; | 
|---|
|  |  |  | import com.zy.system.entity.User; | 
|---|
|  |  |  | import com.zy.system.service.HostService; | 
|---|
|  |  |  | import com.zy.system.service.UserService; | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.Serializable; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @TableName("man_loc_detl") | 
|---|
|  |  |  | public class ManLocDetl implements Serializable { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final long serialVersionUID = 1L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 所属项目 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "所属项目") | 
|---|
|  |  |  | @TableField("host_id") | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 货位编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "货位编号") | 
|---|
|  |  |  | @TableId(value = "loc_no", type = IdType.INPUT) | 
|---|
|  |  |  | @TableField("loc_no") | 
|---|
|  |  |  | private String locNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 所属货位 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "所属货位") | 
|---|
|  |  |  | @TableField("node_id") | 
|---|
|  |  |  | private Long nodeId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 托盘码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "托盘码") | 
|---|
|  |  |  | private String zpallet; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库存余量 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "库存余量") | 
|---|
|  |  |  | @ExcelProperty(value = "库存总量") | 
|---|
|  |  |  | private Double anfme; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 商品编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "商品编号") | 
|---|
|  |  |  | @TableId(value = "matnr", type = IdType.INPUT) | 
|---|
|  |  |  | @ExcelProperty(value = "商品编号") | 
|---|
|  |  |  | private String matnr; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 商品名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "商品名称") | 
|---|
|  |  |  | @ExcelProperty(value = "商品名称") | 
|---|
|  |  |  | private String maktx; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "名称") | 
|---|
|  |  |  | private String name; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 规格 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "规格") | 
|---|
|  |  |  | @ExcelProperty(value = "规格") | 
|---|
|  |  |  | private String specs; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 型号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "型号") | 
|---|
|  |  |  | private String model; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 批号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "批号") | 
|---|
|  |  |  | @TableId(value = "batch", type = IdType.INPUT) | 
|---|
|  |  |  | private String batch; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单位 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "单位") | 
|---|
|  |  |  | @ExcelProperty(value = "单位") | 
|---|
|  |  |  | private String unit; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * SKC | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "SKC") | 
|---|
|  |  |  | @ExcelProperty(value = "SKC") | 
|---|
|  |  |  | private String barcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单据类型 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "单据类型") | 
|---|
|  |  |  | @TableField("doc_id") | 
|---|
|  |  |  | private Long docId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单据编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "单据编号") | 
|---|
|  |  |  | @TableField("doc_num") | 
|---|
|  |  |  | private String docNum; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 客户名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "客户名称") | 
|---|
|  |  |  | @TableField("cust_name") | 
|---|
|  |  |  | private String custName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 品项数 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "品项数") | 
|---|
|  |  |  | @TableField("item_num") | 
|---|
|  |  |  | private Integer itemNum; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 数量 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "数量") | 
|---|
|  |  |  | private Integer count; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单价 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "单价") | 
|---|
|  |  |  | private Double price; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 重量 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "重量") | 
|---|
|  |  |  | private Double weight; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 状态 1: 正常  0: 禁用 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ") | 
|---|
|  |  |  | private Integer status; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加人员 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "添加人员") | 
|---|
|  |  |  | @TableField("create_by") | 
|---|
|  |  |  | private Long createBy; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "添加时间") | 
|---|
|  |  |  | @TableField("create_time") | 
|---|
|  |  |  | private Date createTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改人员 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "修改人员") | 
|---|
|  |  |  | @TableField("update_by") | 
|---|
|  |  |  | private Long updateBy; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "修改时间") | 
|---|
|  |  |  | @TableField("update_time") | 
|---|
|  |  |  | private Date updateTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 备注 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "备注") | 
|---|
|  |  |  | private String memo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ManLocDetl() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ManLocDetl(Long hostId, String locNo,Long nodeId,String zpallet,Double anfme,String matnr,String maktx,String name,String specs,String model,String batch,String unit,String barcode,Long docId,String docNum,String custName,Integer itemNum,Integer count,Double weight,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | this.nodeId = nodeId; | 
|---|
|  |  |  | this.zpallet = zpallet; | 
|---|
|  |  |  | this.anfme = anfme; | 
|---|
|  |  |  | this.maktx = maktx; | 
|---|
|  |  |  | this.name = name; | 
|---|
|  |  |  | this.specs = specs; | 
|---|
|  |  |  | this.model = model; | 
|---|
|  |  |  | this.batch = batch; | 
|---|
|  |  |  | this.unit = unit; | 
|---|
|  |  |  | this.barcode = barcode; | 
|---|
|  |  |  | this.docId = docId; | 
|---|
|  |  |  | this.docNum = docNum; | 
|---|
|  |  |  | this.custName = custName; | 
|---|
|  |  |  | this.itemNum = itemNum; | 
|---|
|  |  |  | this.count = count; | 
|---|
|  |  |  | this.weight = weight; | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | this.createBy = createBy; | 
|---|
|  |  |  | this.createTime = createTime; | 
|---|
|  |  |  | this.updateBy = updateBy; | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | this.memo = memo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    LocDetl locDetl = new LocDetl( | 
|---|
|  |  |  | //            null,    // 货位编号[非空] | 
|---|
|  |  |  | //            null,    // 所属货位 | 
|---|
|  |  |  | //            null,    // 托盘码 | 
|---|
|  |  |  | //            null,    // 库存余量[非空] | 
|---|
|  |  |  | //            null,    // 商品编号[非空] | 
|---|
|  |  |  | //            null,    // 商品名称 | 
|---|
|  |  |  | //            null,    // 名称 | 
|---|
|  |  |  | //            null,    // 规格 | 
|---|
|  |  |  | //            null,    // 型号 | 
|---|
|  |  |  | //            null,    // 批号 | 
|---|
|  |  |  | //            null,    // 单位 | 
|---|
|  |  |  | //            null,    // SKC | 
|---|
|  |  |  | //            null,    // 单据类型 | 
|---|
|  |  |  | //            null,    // 单据编号 | 
|---|
|  |  |  | //            null,    // 客户名称 | 
|---|
|  |  |  | //            null,    // 品项数 | 
|---|
|  |  |  | //            null,    // 数量 | 
|---|
|  |  |  | //            null,    // 重量 | 
|---|
|  |  |  | //            null,    // 状态 | 
|---|
|  |  |  | //            null,    // 添加人员 | 
|---|
|  |  |  | //            null,    // 添加时间 | 
|---|
|  |  |  | //            null,    // 修改人员 | 
|---|
|  |  |  | //            null,    // 修改时间 | 
|---|
|  |  |  | //            null    // 备注 | 
|---|
|  |  |  | //    ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getHostId$(){ | 
|---|
|  |  |  | HostService service = SpringUtils.getBean(HostService.class); | 
|---|
|  |  |  | Host host = service.selectById(this.hostId); | 
|---|
|  |  |  | if (!Cools.isEmpty(host)){ | 
|---|
|  |  |  | return String.valueOf(host.getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getNodeId() { | 
|---|
|  |  |  | return nodeId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getNodeId$(){ | 
|---|
|  |  |  | NodeService service = SpringUtils.getBean(NodeService.class); | 
|---|
|  |  |  | Node node = service.selectById(this.nodeId); | 
|---|
|  |  |  | if (!Cools.isEmpty(node)){ | 
|---|
|  |  |  | return String.valueOf(node.getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getStatus$(){ | 
|---|
|  |  |  | if (null == this.status){ return null; } | 
|---|
|  |  |  | switch (this.status){ | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | return "正常"; | 
|---|
|  |  |  | case 0: | 
|---|
|  |  |  | return "禁用"; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return String.valueOf(this.status); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCreateBy$(){ | 
|---|
|  |  |  | UserService service = SpringUtils.getBean(UserService.class); | 
|---|
|  |  |  | User user = service.selectById(this.createBy); | 
|---|
|  |  |  | if (!Cools.isEmpty(user)){ | 
|---|
|  |  |  | return String.valueOf(user.getNickname()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCreateTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.createTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getUpdateBy$(){ | 
|---|
|  |  |  | UserService service = SpringUtils.getBean(UserService.class); | 
|---|
|  |  |  | User user = service.selectById(this.updateBy); | 
|---|
|  |  |  | if (!Cools.isEmpty(user)){ | 
|---|
|  |  |  | return String.valueOf(user.getNickname()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getUpdateTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.updateTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableName; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.enums.IdType; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.system.entity.Host; | 
|---|
|  |  |  | import com.zy.system.entity.User; | 
|---|
|  |  |  | import com.zy.system.service.HostService; | 
|---|
|  |  |  | import com.zy.system.service.UserService; | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.Serializable; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @TableName("man_node") | 
|---|
|  |  |  | public class Node implements Serializable { | 
|---|
|  |  |  | private static final long serialVersionUID = 1L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * ID | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "ID") | 
|---|
|  |  |  | @TableId(value = "id", type = IdType.AUTO) | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 所属项目 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "所属项目") | 
|---|
|  |  |  | @TableField("host_id") | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "编号") | 
|---|
|  |  |  | private String uuid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "名称") | 
|---|
|  |  |  | private String name; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 父级 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "父级") | 
|---|
|  |  |  | @TableField("parent_id") | 
|---|
|  |  |  | private Long parentId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 父级名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "父级名称") | 
|---|
|  |  |  | @TableField("parent_name") | 
|---|
|  |  |  | private String parentName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 类型 1: 仓库  2: 库区  3: 货位 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "类型 1: 仓库  2: 库区  3: 货位  ") | 
|---|
|  |  |  | private Integer type; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 关联路径 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "关联路径") | 
|---|
|  |  |  | private String path; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 关联路径名 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "关联路径名") | 
|---|
|  |  |  | @TableField("name_path") | 
|---|
|  |  |  | private String namePath; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 等级 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "等级") | 
|---|
|  |  |  | private Integer level; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 负责人 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "负责人") | 
|---|
|  |  |  | private String leading; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 排序 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "排序") | 
|---|
|  |  |  | private Integer sort; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 条码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "条码") | 
|---|
|  |  |  | private String barcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 推荐位 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "推荐位") | 
|---|
|  |  |  | private Integer major; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 状态 1: 正常  0: 禁用 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ") | 
|---|
|  |  |  | private Integer status; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "添加时间") | 
|---|
|  |  |  | @TableField("create_time") | 
|---|
|  |  |  | private Date createTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加人员 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "添加人员") | 
|---|
|  |  |  | @TableField("create_by") | 
|---|
|  |  |  | private Long createBy; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "修改时间") | 
|---|
|  |  |  | @TableField("update_time") | 
|---|
|  |  |  | private Date updateTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改人员 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "修改人员") | 
|---|
|  |  |  | @TableField("update_by") | 
|---|
|  |  |  | private Long updateBy; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 备注 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "备注") | 
|---|
|  |  |  | private String memo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Node() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Node(Long hostId, String uuid,String name,Long parentId,String parentName,Integer type,String path,String namePath,Integer level,String leading,Integer sort,String barcode,Integer major,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | this.uuid = uuid; | 
|---|
|  |  |  | this.name = name; | 
|---|
|  |  |  | this.parentId = parentId; | 
|---|
|  |  |  | this.parentName = parentName; | 
|---|
|  |  |  | this.type = type; | 
|---|
|  |  |  | this.path = path; | 
|---|
|  |  |  | this.namePath = namePath; | 
|---|
|  |  |  | this.level = level; | 
|---|
|  |  |  | this.leading = leading; | 
|---|
|  |  |  | this.sort = sort; | 
|---|
|  |  |  | this.barcode = barcode; | 
|---|
|  |  |  | this.major = major; | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | this.createTime = createTime; | 
|---|
|  |  |  | this.createBy = createBy; | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | this.updateBy = updateBy; | 
|---|
|  |  |  | this.memo = memo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    Node node = new Node( | 
|---|
|  |  |  | //            null,    // 编号 | 
|---|
|  |  |  | //            null,    // 名称 | 
|---|
|  |  |  | //            null,    // 父级 | 
|---|
|  |  |  | //            null,    // 父级名称 | 
|---|
|  |  |  | //            null,    // 类型 | 
|---|
|  |  |  | //            null,    // 关联路径 | 
|---|
|  |  |  | //            null,    // 关联路径名 | 
|---|
|  |  |  | //            null,    // 等级 | 
|---|
|  |  |  | //            null,    // 负责人 | 
|---|
|  |  |  | //            null,    // 排序 | 
|---|
|  |  |  | //            null,    // 条码 | 
|---|
|  |  |  | //            null,    // 推荐位 | 
|---|
|  |  |  | //            null,    // 状态 | 
|---|
|  |  |  | //            null,    // 添加时间 | 
|---|
|  |  |  | //            null,    // 添加人员 | 
|---|
|  |  |  | //            null,    // 修改时间 | 
|---|
|  |  |  | //            null,    // 修改人员 | 
|---|
|  |  |  | //            null    // 备注 | 
|---|
|  |  |  | //    ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getId() { | 
|---|
|  |  |  | return id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setId(Long id) { | 
|---|
|  |  |  | this.id = id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getHostId() { | 
|---|
|  |  |  | return hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setHostId(Long hostId) { | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getHostId$(){ | 
|---|
|  |  |  | HostService service = SpringUtils.getBean(HostService.class); | 
|---|
|  |  |  | Host host = service.selectById(this.hostId); | 
|---|
|  |  |  | if (!Cools.isEmpty(host)){ | 
|---|
|  |  |  | return String.valueOf(host.getName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getUuid() { | 
|---|
|  |  |  | return uuid; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setUuid(String uuid) { | 
|---|
|  |  |  | this.uuid = uuid; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getName() { | 
|---|
|  |  |  | return name; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setName(String name) { | 
|---|
|  |  |  | this.name = name; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getParentId() { | 
|---|
|  |  |  | return parentId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setParentId(Long parentId) { | 
|---|
|  |  |  | this.parentId = parentId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getParentName() { | 
|---|
|  |  |  | return parentName; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setParentName(String parentName) { | 
|---|
|  |  |  | this.parentName = parentName; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Integer getType() { | 
|---|
|  |  |  | return type; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getType$(){ | 
|---|
|  |  |  | if (null == this.type){ return null; } | 
|---|
|  |  |  | switch (this.type){ | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | return "仓库"; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | return "库区"; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | return "货位"; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return String.valueOf(this.type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setType(Integer type) { | 
|---|
|  |  |  | this.type = type; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getPath() { | 
|---|
|  |  |  | return path; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setPath(String path) { | 
|---|
|  |  |  | this.path = path; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getNamePath() { | 
|---|
|  |  |  | return namePath; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setNamePath(String namePath) { | 
|---|
|  |  |  | this.namePath = namePath; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Integer getLevel() { | 
|---|
|  |  |  | return level; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setLevel(Integer level) { | 
|---|
|  |  |  | this.level = level; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getLeading() { | 
|---|
|  |  |  | return leading; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setLeading(String leading) { | 
|---|
|  |  |  | this.leading = leading; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Integer getSort() { | 
|---|
|  |  |  | return sort; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setSort(Integer sort) { | 
|---|
|  |  |  | this.sort = sort; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getBarcode() { | 
|---|
|  |  |  | return barcode; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setBarcode(String barcode) { | 
|---|
|  |  |  | this.barcode = barcode; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Integer getMajor() { | 
|---|
|  |  |  | return major; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setMajor(Integer major) { | 
|---|
|  |  |  | this.major = major; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Integer getStatus() { | 
|---|
|  |  |  | return status; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getStatus$(){ | 
|---|
|  |  |  | if (null == this.status){ return null; } | 
|---|
|  |  |  | switch (this.status){ | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | return "正常"; | 
|---|
|  |  |  | case 0: | 
|---|
|  |  |  | return "禁用"; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return String.valueOf(this.status); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setStatus(Integer status) { | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Date getCreateTime() { | 
|---|
|  |  |  | return createTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCreateTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.createTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setCreateTime(Date createTime) { | 
|---|
|  |  |  | this.createTime = createTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getCreateBy() { | 
|---|
|  |  |  | return createBy; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCreateBy$(){ | 
|---|
|  |  |  | UserService service = SpringUtils.getBean(UserService.class); | 
|---|
|  |  |  | User user = service.selectById(this.createBy); | 
|---|
|  |  |  | if (!Cools.isEmpty(user)){ | 
|---|
|  |  |  | return String.valueOf(user.getUsername()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setCreateBy(Long createBy) { | 
|---|
|  |  |  | this.createBy = createBy; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Date getUpdateTime() { | 
|---|
|  |  |  | return updateTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getUpdateTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.updateTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setUpdateTime(Date updateTime) { | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getUpdateBy() { | 
|---|
|  |  |  | return updateBy; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getUpdateBy$(){ | 
|---|
|  |  |  | UserService service = SpringUtils.getBean(UserService.class); | 
|---|
|  |  |  | User user = service.selectById(this.updateBy); | 
|---|
|  |  |  | if (!Cools.isEmpty(user)){ | 
|---|
|  |  |  | return String.valueOf(user.getUsername()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setUpdateBy(Long updateBy) { | 
|---|
|  |  |  | this.updateBy = updateBy; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getMemo() { | 
|---|
|  |  |  | return memo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setMemo(String memo) { | 
|---|
|  |  |  | this.memo = memo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 
|---|
|  |  |  | import com.alibaba.excel.annotation.ExcelProperty; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @ExcelIgnoreUnannotated | 
|---|
|  |  |  | public class NodeExcel { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ExcelProperty(index = 0, value = "仓库") | 
|---|
|  |  |  | private String warehouse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ExcelProperty(index = 1, value = "库区") | 
|---|
|  |  |  | private String area; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ExcelProperty(index = 2, value = "货位") | 
|---|
|  |  |  | private String allo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | // 托盘条码 | 
|---|
|  |  |  | private String barcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 库位编号 | 
|---|
|  |  |  | private String locno; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private List<CombMat> combMats; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface LocDetlMapper extends BaseMapper<LocDetl> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> listByPage(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer listByPageCount(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LocDetl selectItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int deleteItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.mapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.BaseMapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Select; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Update; | 
|---|
|  |  |  | import org.springframework.stereotype.Repository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Set; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface ManLocDetlMapper extends BaseMapper<ManLocDetl> { | 
|---|
|  |  |  | List<ManLocDetl> listByPage(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer listByPageCount(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ManLocDetl selectItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int deleteItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int updateAnfme(@Param("anfme")Double anfme, @Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> getStockOutPage(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer getStockOutPageCount(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Update("update asr_loc_detl set loc_no = #{newLocNo}, modi_time=getDate() where loc_no = #{oldLocNo}") | 
|---|
|  |  |  | int updateLocNo(String newLocNo, String oldLocNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("SELECT ld.loc_no FROM asr_loc_detl ld LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no WHERE (1 = 1 AND ld.matnr = #{matnr} AND (lm.row1 >= #{start} AND lm.row1 <= #{end})  AND lm.loc_sts = 'F' AND DateDiff(dd, lm.appe_time, getdate()) = 0) ORDER BY lm.appe_time ASC") | 
|---|
|  |  |  | List<String> selectSameDetlToday(@Param("matnr") String matnr, @Param("start") Integer start, @Param("end") Integer end); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> getStockStatis(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer getStockStatisCount(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> getStockStatisExcel(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Select("select sum(a.anfme) as sum from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr}") | 
|---|
|  |  |  | Double selectSumAnfmeByMatnr(@Param("matnr") String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> selectPakoutByRule(String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> getAsrsLocDetl(String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer countLocNoNum(String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer sum(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> unreason(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double selectLocDetlSumQty(String locNo); | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.mapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.BaseMapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  | import org.springframework.stereotype.Repository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface NodeMapper extends BaseMapper<Node> { | 
|---|
|  |  |  | Node selectByUuid(@Param("uuid") String uuid, @Param("hostId") Long hostId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Set; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface LocDetlService extends IService<LocDetl> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<LocDetl> getPage(Page<LocDetl> page); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LocDetl selectItem(String locNo, String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<LocDetl> getStockOut(Page<LocDetl> page); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Set; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface ManLocDetlService  extends IService<ManLocDetl> { | 
|---|
|  |  |  | Page<ManLocDetl> getPage(Page<ManLocDetl> page); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ManLocDetl selectItem(String locNo, String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<ManLocDetl> getStockOut(Page<ManLocDetl> page); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改库存明细数量,如果数量为0,则删除记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | boolean updateAnfme(Double anfme, String locNo, String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean updateLocNo(String newLocNo, String oldLocNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取当天相同规格货物的深库位号 | 
|---|
|  |  |  | * @param matnr 商品编号 | 
|---|
|  |  |  | * @return locNo 库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<String> getSameDetlToday(String matnr, Integer start, Integer end); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<ManLocDetl> getStockStatis(Page<ManLocDetl> page); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double getSumAnfme(String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> selectPakoutByRule(String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> getAsrsLocDetl(String matnr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer countLocNoNum(String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // -------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer sum(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ManLocDetl> unreason(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double getLocDetlSumQty(String locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | void comb(CombParam param, Long userId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 上架 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | void onSale(CombParam param); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 盘点 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | void adjust(MobileAdjustParam param, Long userId); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface NodeService extends IService<Node> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Node getTop(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Node selectByUuid(String uuid); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Node selectByUuid(String uuid, Long hostId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Node selectByUuid(String uuid, Long hostId, Integer type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Node selectByUuid(String uuid, Long hostId, Integer type, Long parentId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Page<LocDetl> getPage(Page<LocDetl> page) { | 
|---|
|  |  |  | page.setRecords(baseMapper.listByPage(page.getCondition())); | 
|---|
|  |  |  | page.setTotal(baseMapper.listByPageCount(page.getCondition())); | 
|---|
|  |  |  | return page; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Page<LocDetl> getStockOut(Page<LocDetl> page) { | 
|---|
|  |  |  | page.setRecords(baseMapper.getStockOutPage(page.getCondition())); | 
|---|
|  |  |  | page.setTotal(baseMapper.getStockOutPageCount(page.getCondition())); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ManLocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.ManLocDetlService; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Set; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service("manLocDetlService") | 
|---|
|  |  |  | public class ManLocDetlServiceImpl extends ServiceImpl<ManLocDetlMapper, ManLocDetl> implements ManLocDetlService{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Page<ManLocDetl> getPage(Page<ManLocDetl> page) { | 
|---|
|  |  |  | page.setRecords(baseMapper.listByPage(page.getCondition())); | 
|---|
|  |  |  | page.setTotal(baseMapper.listByPageCount(page.getCondition())); | 
|---|
|  |  |  | return page; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Page<ManLocDetl> getStockOut(Page<ManLocDetl> page) { | 
|---|
|  |  |  | page.setRecords(baseMapper.getStockOutPage(page.getCondition())); | 
|---|
|  |  |  | page.setTotal(baseMapper.getStockOutPageCount(page.getCondition())); | 
|---|
|  |  |  | return page; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean updateAnfme(Double anfme, String locNo, String matnr, String batch) { | 
|---|
|  |  |  | if (anfme <= 0) { | 
|---|
|  |  |  | return this.baseMapper.deleteItem(locNo, matnr, batch) > 0; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return baseMapper.updateAnfme(anfme, locNo, matnr, batch) > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean updateLocNo(String newLocNo, String oldLocNo) { | 
|---|
|  |  |  | return baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<String> getSameDetlToday(String matnr, Integer start, Integer end) { | 
|---|
|  |  |  | return this.baseMapper.selectSameDetlToday(matnr, start, end); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Page<ManLocDetl> getStockStatis(Page<ManLocDetl> page) { | 
|---|
|  |  |  | page.setRecords(baseMapper.getStockStatis(page.getCondition())); | 
|---|
|  |  |  | page.setTotal(baseMapper.getStockStatisCount(page.getCondition())); | 
|---|
|  |  |  | return page; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Double getSumAnfme(String matnr) { | 
|---|
|  |  |  | return this.baseMapper.selectSumAnfmeByMatnr(matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<ManLocDetl> selectPakoutByRule(String matnr) { | 
|---|
|  |  |  | return this.baseMapper.selectPakoutByRule(matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<ManLocDetl> getAsrsLocDetl(String matnr) { | 
|---|
|  |  |  | return this.baseMapper.getAsrsLocDetl(matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer countLocNoNum(String locNo) { | 
|---|
|  |  |  | return this.baseMapper.countLocNoNum(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { | 
|---|
|  |  |  | return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Double queryStockAnfme(String matnr, String batch) { | 
|---|
|  |  |  | return this.baseMapper.queryStockAnfme(matnr, batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<StockVo> queryStockTotal() { | 
|---|
|  |  |  | return this.baseMapper.queryStockTotal(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取库存总数 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer sum() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.baseMapper.sum(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<ManLocDetl> unreason() { | 
|---|
|  |  |  | return this.baseMapper.unreason(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ManLocDetl selectItem(String locNo, String matnr, String batch) { | 
|---|
|  |  |  | return this.baseMapper.selectItem(locNo, matnr, batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Double getLocDetlSumQty(String locNo) { | 
|---|
|  |  |  | return this.baseMapper.selectLocDetlSumQty(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private StaDescService staDescService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CommonService commonService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NodeService nodeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ManLocDetlService manLocDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onSale(CombParam param) { | 
|---|
|  |  |  | // 获取库位号 | 
|---|
|  |  |  | String locno = param.getLocno(); | 
|---|
|  |  |  | Node node = nodeService.selectByUuid(locno); | 
|---|
|  |  |  | if (Cools.isEmpty(node)) { | 
|---|
|  |  |  | throw new CoolException(param.getLocno() + ":库位不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取商品列表 | 
|---|
|  |  |  | for(CombParam.CombMat combMat : param.getCombMats()){ | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(combMat.getMatnr()); | 
|---|
|  |  |  | if (Cools.isEmpty(mat)){ | 
|---|
|  |  |  | throw new CoolException(combMat.getMatnr() + ":商品档案不存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ | 
|---|
|  |  |  | throw new CoolException(combMat.getMatnr() + ":商品数量有误!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Cools.isEmpty(combMat.getBatch())){ | 
|---|
|  |  |  | throw new CoolException(combMat.getMatnr() + ":商品批号有误!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ManLocDetl manLocDetl = new ManLocDetl(); | 
|---|
|  |  |  | manLocDetl.setLocNo(locno); | 
|---|
|  |  |  | manLocDetl.setNodeId(node.getId()); | 
|---|
|  |  |  | manLocDetl.setMatnr(combMat.getMatnr()); | 
|---|
|  |  |  | manLocDetl.setBatch(combMat.getBatch()); | 
|---|
|  |  |  | manLocDetl.setAnfme(combMat.getAnfme()); | 
|---|
|  |  |  | if (!manLocDetlService.insert(manLocDetl)) { | 
|---|
|  |  |  | throw new CoolException("商品上架失败!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public void adjust(MobileAdjustParam param, Long userId) { | 
|---|
|  |  |  | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.mapper.NodeMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service("nodeService") | 
|---|
|  |  |  | public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements NodeService { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Node getTop() { | 
|---|
|  |  |  | Node top = this.selectOne(new EntityWrapper<Node>().eq("type", 0).eq("level", 0)); | 
|---|
|  |  |  | if (top == null) { | 
|---|
|  |  |  | top = new Node(); | 
|---|
|  |  |  | top.setName("全部"); | 
|---|
|  |  |  | top.setUuid("全部"); | 
|---|
|  |  |  | top.setType(0); | 
|---|
|  |  |  | top.setLevel(0); | 
|---|
|  |  |  | top.setSort(0); | 
|---|
|  |  |  | top.setStatus(1); | 
|---|
|  |  |  | top.setCreateTime(new Date()); | 
|---|
|  |  |  | top.setUpdateTime(new Date()); | 
|---|
|  |  |  | Integer insert = this.baseMapper.insert(top); | 
|---|
|  |  |  | if (insert == 0) { | 
|---|
|  |  |  | throw new CoolException("服务器异常"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return top; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Node selectByUuid(String uuid) { | 
|---|
|  |  |  | return selectOne(new EntityWrapper<Node>().eq("uuid", uuid)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Node selectByUuid(String uuid, Long hostId) { | 
|---|
|  |  |  | return this.baseMapper.selectByUuid(uuid, hostId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Node selectByUuid(String uuid, Long hostId, Integer type) { | 
|---|
|  |  |  | return selectOne(new EntityWrapper<Node>().eq("host_id", hostId).eq("uuid", uuid).eq("type", type)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Node selectByUuid(String uuid, Long hostId, Integer type, Long parentId) { | 
|---|
|  |  |  | return selectOne(new EntityWrapper<Node>().eq("host_id", hostId).eq("uuid", uuid).eq("type", type).eq("parent_id", parentId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.common.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 
|---|
|  |  |  | import com.alibaba.excel.annotation.ExcelProperty; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @ExcelIgnoreUnannotated | 
|---|
|  |  |  | public class NodeExcel { | 
|---|
|  |  |  | @ExcelProperty(index = 0, value = "仓库") | 
|---|
|  |  |  | private String warehouse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ExcelProperty(index = 1, value = "库区") | 
|---|
|  |  |  | private String area; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ExcelProperty(index = 2, value = "货位") | 
|---|
|  |  |  | private String allo; | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.common.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.context.AnalysisContext; | 
|---|
|  |  |  | import com.alibaba.excel.event.AnalysisEventListener; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.mapper.NodeMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.common.utils.NodeUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class NodeExcelListener extends AnalysisEventListener<NodeExcel> { | 
|---|
|  |  |  | private int total = 0; | 
|---|
|  |  |  | private Long userId; | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public NodeExcelListener() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public NodeExcelListener(Long userId, Long hostId) { | 
|---|
|  |  |  | this.userId = userId; | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private static final int BATCH_COUNT = 50; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final List<NodeExcel> list = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 这里会一行行的返回头 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 这个每一条数据解析都会来调用 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void invoke(NodeExcel excel, AnalysisContext ctx) { | 
|---|
|  |  |  | NodeService nodeService = SpringUtils.getBean(NodeService.class); | 
|---|
|  |  |  | NodeMapper nodeMapper = SpringUtils.getBean(NodeMapper.class); | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | Node top = nodeService.getTop(); | 
|---|
|  |  |  | // 仓库 | 
|---|
|  |  |  | if (!Cools.isEmpty(excel.getWarehouse())) { | 
|---|
|  |  |  | Node wareHouse = nodeService.selectByUuid(excel.getWarehouse(), hostId, 1, top.getId()); | 
|---|
|  |  |  | if (wareHouse == null) { | 
|---|
|  |  |  | wareHouse = new Node(); | 
|---|
|  |  |  | wareHouse.setHostId(this.hostId); | 
|---|
|  |  |  | wareHouse.setUuid(excel.getWarehouse()); | 
|---|
|  |  |  | wareHouse.setName(excel.getWarehouse()); | 
|---|
|  |  |  | wareHouse.setType(1); | 
|---|
|  |  |  | wareHouse.setParentId(top.getId()); | 
|---|
|  |  |  | wareHouse.setParentName(top.getName()); | 
|---|
|  |  |  | wareHouse.setLevel(top.getLevel() + 1); | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | nodeUtils.executePath(wareHouse); | 
|---|
|  |  |  | wareHouse.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | wareHouse.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  | wareHouse.setStatus(1); | 
|---|
|  |  |  | wareHouse.setCreateTime(now); | 
|---|
|  |  |  | wareHouse.setUpdateTime(now); | 
|---|
|  |  |  | if (nodeMapper.insert(wareHouse) == 0) { | 
|---|
|  |  |  | throw new CoolException("保存仓库数据失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | total ++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 库区 | 
|---|
|  |  |  | if (!Cools.isEmpty(excel.getArea())) { | 
|---|
|  |  |  | Node area = nodeService.selectByUuid(excel.getArea(), hostId, 2, wareHouse.getId()); | 
|---|
|  |  |  | if (area == null) { | 
|---|
|  |  |  | area = new Node(); | 
|---|
|  |  |  | area.setHostId(this.hostId); | 
|---|
|  |  |  | area.setUuid(excel.getArea()); | 
|---|
|  |  |  | area.setName(excel.getArea()); | 
|---|
|  |  |  | area.setType(2); | 
|---|
|  |  |  | area.setParentId(wareHouse.getId()); | 
|---|
|  |  |  | area.setParentName(wareHouse.getName()); | 
|---|
|  |  |  | area.setLevel(wareHouse.getLevel() + 1); | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | nodeUtils.executePath(area); | 
|---|
|  |  |  | area.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | area.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  | area.setStatus(1); | 
|---|
|  |  |  | area.setCreateTime(now); | 
|---|
|  |  |  | area.setUpdateTime(now); | 
|---|
|  |  |  | if (nodeMapper.insert(area) == 0) { | 
|---|
|  |  |  | throw new CoolException("保存库区数据失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | total ++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 货位 | 
|---|
|  |  |  | if (!Cools.isEmpty(excel.getAllo())) { | 
|---|
|  |  |  | Node allo = nodeService.selectByUuid(excel.getAllo(), hostId, 3); | 
|---|
|  |  |  | if (allo == null) { | 
|---|
|  |  |  | allo = new Node(); | 
|---|
|  |  |  | allo.setHostId(this.hostId); | 
|---|
|  |  |  | allo.setUuid(excel.getAllo()); | 
|---|
|  |  |  | allo.setName(excel.getAllo()); | 
|---|
|  |  |  | allo.setType(3); | 
|---|
|  |  |  | allo.setParentId(area.getId()); | 
|---|
|  |  |  | allo.setParentName(area.getName()); | 
|---|
|  |  |  | allo.setLevel(area.getLevel() + 1); | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | nodeUtils.executePath(allo); | 
|---|
|  |  |  | allo.setPath(nodeUtils.path.toString()); | 
|---|
|  |  |  | allo.setNamePath(nodeUtils.pathName.toString()); | 
|---|
|  |  |  | allo.setStatus(1); | 
|---|
|  |  |  | allo.setCreateTime(now); | 
|---|
|  |  |  | allo.setUpdateTime(now); | 
|---|
|  |  |  | if (nodeMapper.insert(allo) == 0) { | 
|---|
|  |  |  | throw new CoolException("保存货位数据失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | total ++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 所有数据解析完成了调用 | 
|---|
|  |  |  | * 适合事务 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void doAfterAllAnalysed(AnalysisContext ctx) { | 
|---|
|  |  |  | //log.info("新增{}条物料信息!", total); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int getTotal() { | 
|---|
|  |  |  | return total; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | package com.zy.common.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.EasyExcel; | 
|---|
|  |  |  | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.entity.Tag; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.asrs.service.TagService; | 
|---|
|  |  |  | import com.zy.common.entity.NodeExcel; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.net.URLEncoder; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Created by vincent on 2021/1/19 | 
|---|
|  |  |  | 
|---|
|  |  |  | public StringBuilder path = new StringBuilder(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public StringBuilder pathName = new StringBuilder(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void executePath(Node node) { | 
|---|
|  |  |  | NodeService bean = SpringUtils.getBean(NodeService.class); | 
|---|
|  |  |  | Node parent = bean.selectById(node.getParentId()); | 
|---|
|  |  |  | if (null != parent) { | 
|---|
|  |  |  | path.insert(0, parent.getId()).insert(0,","); | 
|---|
|  |  |  | pathName.insert(0, parent.getName()).insert(0,","); | 
|---|
|  |  |  | if (parent.getParentId() != null) { | 
|---|
|  |  |  | executePath(parent); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | path.deleteCharAt(0); | 
|---|
|  |  |  | pathName.deleteCharAt(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void executePath(Tag tag) { | 
|---|
|  |  |  | TagService bean = SpringUtils.getBean(TagService.class); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /*************************************** 数据相关 ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * excel导入模板下载 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping(value = "/node/excel/import/mould") | 
|---|
|  |  |  | public void nodeExcelImportMould(HttpServletResponse response) throws IOException { | 
|---|
|  |  |  | List<NodeExcel> excels = new ArrayList<>(); | 
|---|
|  |  |  | response.setContentType("application/vnd.ms-excel"); | 
|---|
|  |  |  | response.setCharacterEncoding("utf-8"); | 
|---|
|  |  |  | String fileName = URLEncoder.encode("货位档案Excel导入模板", "UTF-8"); | 
|---|
|  |  |  | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); | 
|---|
|  |  |  | EasyExcel.write(response.getOutputStream(), NodeExcel.class) | 
|---|
|  |  |  | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) | 
|---|
|  |  |  | .sheet("sheet1") | 
|---|
|  |  |  | .doWrite(excels); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | package com.zy.common.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.entity.Tag; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.asrs.service.TagService; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.cache.annotation.Cacheable; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TagService tagService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NodeService nodeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /******************************** 归类树 *********************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /******************************** 节点树 *********************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取树图数据结构 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Cacheable(cacheNames="nodeTree",key="#id") | 
|---|
|  |  |  | public ArrayList<Map> getNodeTree(String id, Long hostId){ | 
|---|
|  |  |  | ArrayList<Map> result = new ArrayList<>(); | 
|---|
|  |  |  | Node node = nodeService.selectById(id); | 
|---|
|  |  |  | // 主节点 | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("title", node.getName()); | 
|---|
|  |  |  | map.put("id", node.getId()); | 
|---|
|  |  |  | map.put("spread", true); | 
|---|
|  |  |  | List<Map> childrens = new ArrayList<>(); | 
|---|
|  |  |  | map.put("children", childrens); | 
|---|
|  |  |  | dealNode(node, childrens, hostId); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | // 开始处理字节点 | 
|---|
|  |  |  | //        deal(tag, childrens); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 递归获取子节点数据 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void dealNode(Node parent, List<Map> list, Long hostId) { | 
|---|
|  |  |  | Wrapper<Node> wrapper = new EntityWrapper<Node>() | 
|---|
|  |  |  | .eq("parent_id", parent.getId()) | 
|---|
|  |  |  | .eq("status", "1"); | 
|---|
|  |  |  | if (hostId != null) { | 
|---|
|  |  |  | wrapper.eq("host_id", hostId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Node> nodes = nodeService.selectList(wrapper); | 
|---|
|  |  |  | for (Node node : nodes) { | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("title", node.getName()); | 
|---|
|  |  |  | map.put("id", node.getId()); | 
|---|
|  |  |  | map.put("spread", true); | 
|---|
|  |  |  | List<Map> childrens = new ArrayList<>(); | 
|---|
|  |  |  | map.put("children", childrens); | 
|---|
|  |  |  | dealNode(node, childrens, hostId); | 
|---|
|  |  |  | list.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ------------------------------------------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.controller.AbstractBaseController; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.Node; | 
|---|
|  |  |  | import com.zy.asrs.entity.Tag; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.asrs.service.TagService; | 
|---|
|  |  |  | import com.zy.system.entity.User; | 
|---|
|  |  |  | import com.zy.system.entity.UserLogin; | 
|---|
|  |  |  | import com.zy.system.service.UserLoginService; | 
|---|
|  |  |  | import com.zy.system.service.UserService; | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | private UserService userService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TagService tagService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NodeService nodeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UserLoginService userLoginService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Node getOriginNode(){ | 
|---|
|  |  |  | Node node = nodeService.getTop(); | 
|---|
|  |  |  | if (node == null) { | 
|---|
|  |  |  | throw new CoolException("库区数据错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return node; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Long getHostId(){ | 
|---|
|  |  |  | if (getUserId() == 9527) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | User user = getUser(); | 
|---|
|  |  |  | if (user.getRoleId() == 1) { | 
|---|
|  |  |  | String hostId = String.valueOf(request.getAttribute("hostId")); | 
|---|
|  |  |  | if (Cools.isEmpty(hostId)) { | 
|---|
|  |  |  | UserLogin userLogin = userLoginService.selectOne(new EntityWrapper<UserLogin>().eq("user_id", user.getId())); | 
|---|
|  |  |  | if (userLogin != null) { | 
|---|
|  |  |  | return userLogin.getHostId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return Long.parseLong(hostId); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return user.getHostId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Long getUserId(){ | 
|---|
|  |  |  | return Long.parseLong(String.valueOf(request.getAttribute("userId"))); | 
|---|
|  |  |  | 
|---|
|  |  |  | return tagService.getTop(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected <T> void hostEq(EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | Long hostId = getHostId(); | 
|---|
|  |  |  | if (hostId != null) { | 
|---|
|  |  |  | wrapper.eq("host_id", hostId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 分页组装 | 
|---|
|  |  |  | * @param pageNumber | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.system.service.UserService; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.Serializable; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | 
|---|
|  |  |  | @TableId(value = "id", type = IdType.AUTO) | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 所属项目 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "所属项目") | 
|---|
|  |  |  | @TableField("host_id") | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 员工 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | this.id = id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Long getHostId() { | 
|---|
|  |  |  | return hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setHostId(Long hostId) { | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public Long getUserId() { | 
|---|
|  |  |  | return userId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | server: | 
|---|
|  |  |  | port: 8081 | 
|---|
|  |  |  | port: 8088 | 
|---|
|  |  |  | servlet: | 
|---|
|  |  |  | context-path: /@pom.build.finalName@ | 
|---|
|  |  |  |  | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
|---|
|  |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.zy.asrs.mapper.ManLocDetlMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 通用查询映射结果 --> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.ManLocDetl"> | 
|---|
|  |  |  | <result column="host_id" property="hostId" /> | 
|---|
|  |  |  | <result column="loc_no" property="locNo" /> | 
|---|
|  |  |  | <result column="node_id" property="nodeId" /> | 
|---|
|  |  |  | <result column="zpallet" property="zpallet" /> | 
|---|
|  |  |  | <result column="anfme" property="anfme" /> | 
|---|
|  |  |  | <result column="matnr" property="matnr" /> | 
|---|
|  |  |  | <result column="maktx" property="maktx" /> | 
|---|
|  |  |  | <result column="name" property="name" /> | 
|---|
|  |  |  | <result column="specs" property="specs" /> | 
|---|
|  |  |  | <result column="model" property="model" /> | 
|---|
|  |  |  | <result column="batch" property="batch" /> | 
|---|
|  |  |  | <result column="unit" property="unit" /> | 
|---|
|  |  |  | <result column="barcode" property="barcode" /> | 
|---|
|  |  |  | <result column="doc_id" property="docId" /> | 
|---|
|  |  |  | <result column="doc_num" property="docNum" /> | 
|---|
|  |  |  | <result column="cust_name" property="custName" /> | 
|---|
|  |  |  | <result column="item_num" property="itemNum" /> | 
|---|
|  |  |  | <result column="count" property="count" /> | 
|---|
|  |  |  | <result column="price" property="price" /> | 
|---|
|  |  |  | <result column="weight" property="weight" /> | 
|---|
|  |  |  | <result column="status" property="status" /> | 
|---|
|  |  |  | <result column="create_by" property="createBy" /> | 
|---|
|  |  |  | <result column="create_time" property="createTime" /> | 
|---|
|  |  |  | <result column="update_by" property="updateBy" /> | 
|---|
|  |  |  | <result column="update_time" property="updateTime" /> | 
|---|
|  |  |  | <result column="memo" property="memo" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="locDetlCondition"> | 
|---|
|  |  |  | <if test="host_id != null and host_id != ''"> | 
|---|
|  |  |  | and mld.host_id = #{host_id} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="loc_no != null and loc_no != ''"> | 
|---|
|  |  |  | and mld.loc_no like concat('%',#{loc_no},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="matnr != null and matnr != ''"> | 
|---|
|  |  |  | and mld.matnr like concat('%',#{matnr},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="maktx != null and maktx != ''"> | 
|---|
|  |  |  | and mld.maktx like concat('%',#{maktx},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="startTime!=null and endTime!=null"> | 
|---|
|  |  |  | and mld.update_time between #{startTime} and #{endTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="listByPage" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select * from | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | ROW_NUMBER() over (order by mld.create_time desc) as row, | 
|---|
|  |  |  | mld.* | 
|---|
|  |  |  | FROM man_loc_detl mld | 
|---|
|  |  |  | LEFT JOIN man_node mn ON mld.node_id = mn.id | 
|---|
|  |  |  | LEFT JOIN man_mat mm ON mld.matnr = mm.matnr | 
|---|
|  |  |  | LEFT JOIN man_tag mt ON mm.tag_id = mt.id | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id}) | 
|---|
|  |  |  | AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id}) | 
|---|
|  |  |  | <include refid="locDetlCondition"></include> | 
|---|
|  |  |  | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="listByPageCount" parameterType="java.util.Map" resultType="java.lang.Integer"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | count(1) | 
|---|
|  |  |  | FROM man_loc_detl mld | 
|---|
|  |  |  | LEFT JOIN man_node mn ON mld.node_id = mn.id | 
|---|
|  |  |  | LEFT JOIN man_mat mm ON mld.matnr = mm.matnr | 
|---|
|  |  |  | LEFT JOIN man_tag mt ON mm.tag_id = mt.id | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id}) | 
|---|
|  |  |  | AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id}) | 
|---|
|  |  |  | <include refid="locDetlCondition"></include> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByLocNoAndMatnr" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select top 1 * | 
|---|
|  |  |  | from man_loc_detl | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and anfme > 0 | 
|---|
|  |  |  | <if test="nodeId != null and nodeId != ''"> | 
|---|
|  |  |  | and node_id = #{nodeId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="matnr != null and matnr != ''"> | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | order by create_time asc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectCountByMatnr" resultType="java.lang.Double"> | 
|---|
|  |  |  | select sum(anfme) as count from man_loc_detl where 1=1 and matnr = #{matnr} and host_id = #{hostId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="reduceStock"> | 
|---|
|  |  |  | update man_loc_detl | 
|---|
|  |  |  | set anfme = anfme - #{anfme} | 
|---|
|  |  |  | , update_time = getdate() | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and node_id = #{nodeId} | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="incrementStock"> | 
|---|
|  |  |  | update man_loc_detl | 
|---|
|  |  |  | set anfme = anfme + #{anfme} | 
|---|
|  |  |  | , update_time = getdate() | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and node_id = #{nodeId} | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="removeStock"> | 
|---|
|  |  |  | delete from man_loc_detl | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and node_id = #{nodeId} | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByPrior" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | mld.* | 
|---|
|  |  |  | from man_loc_detl mld | 
|---|
|  |  |  | left join man_prior mp on mld.node_id = mp.node_id and mld.matnr = mp.matnr | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | <if test="hostId != null and hostId != ''"> | 
|---|
|  |  |  | and mld.host_id = #{hostId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="nodeId != null and nodeId != ''"> | 
|---|
|  |  |  | and mld.node_id = #{nodeId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="matnr != null and matnr != ''"> | 
|---|
|  |  |  | and mld.matnr = #{matnr} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | and mld.anfme > 0 | 
|---|
|  |  |  | and mp.status = 1 | 
|---|
|  |  |  | order by mp.prio desc, mld.create_time asc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getLocDetlStatis" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | ROW_NUMBER() over (order by sum(a.anfme) desc) as row | 
|---|
|  |  |  | , a.matnr | 
|---|
|  |  |  | , sum(a.anfme) as anfme | 
|---|
|  |  |  | from man_loc_detl a | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | group by a.matnr | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByNodeUuid" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select * from man_loc_detl mld left join man_node mn on mld.node_id = mn.id | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and mn.uuid = #{uuid} | 
|---|
|  |  |  | and mld.hostId = #{hostId} | 
|---|
|  |  |  | and mld.status = 1 | 
|---|
|  |  |  | order by mld.create_time | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getStockStatis" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select * from | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select | 
|---|
|  |  |  | ROW_NUMBER() over (order by a.matnr, sum(a.anfme) desc) as row | 
|---|
|  |  |  | , a.matnr | 
|---|
|  |  |  | , sum(a.anfme) as anfme | 
|---|
|  |  |  | from man_loc_detl a | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | <include refid="stockOutCondition"></include> | 
|---|
|  |  |  | group by a.matnr | 
|---|
|  |  |  | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getStockStatisCount" parameterType="java.util.Map" resultType="java.lang.Integer"> | 
|---|
|  |  |  | select count(1) as count from | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select | 
|---|
|  |  |  | a.matnr | 
|---|
|  |  |  | from man_loc_detl a | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | <include refid="stockOutCondition"></include> | 
|---|
|  |  |  | group by a.matnr | 
|---|
|  |  |  | ) b | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="stockOutCondition"> | 
|---|
|  |  |  | <if test="host_id!=null and host_id!='' "> | 
|---|
|  |  |  | and a.host_id = #{host_id} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="node_id!=null and node_id!='' "> | 
|---|
|  |  |  | and a.node_id like '%' + #{node_id} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="loc_no!=null and loc_no!='' "> | 
|---|
|  |  |  | and a.loc_no like '%' + #{loc_no} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="matnr!=null and matnr!='' "> | 
|---|
|  |  |  | and a.matnr like '%' + #{matnr} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="maktx!=null and maktx!='' "> | 
|---|
|  |  |  | and a.maktx like '%' + #{maktx} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getStockStatisExcel" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | ROW_NUMBER() over (order by a.matnr, sum(a.anfme) desc) as row | 
|---|
|  |  |  | , a.matnr | 
|---|
|  |  |  | , sum(a.anfme) as anfme | 
|---|
|  |  |  | from man_loc_detl a | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and a.host_id = #{hostId} | 
|---|
|  |  |  | group by a.matnr | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | elem: '#locDetl', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/locDetl/list/auth', | 
|---|
|  |  |  | url: baseUrl+'/manLocDetl/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: 16, | 
|---|
|  |  |  | limits: [16, 30, 50, 100, 200, 500], | 
|---|
|  |  |  | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | parseData: function (res) { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 'code': res.code, | 
|---|
|  |  |  | 'msg': res.msg, | 
|---|
|  |  |  | 
|---|
|  |  |  | content: 'locDetl_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-edit', index).hide(); | 
|---|
|  |  |  | clearFormVal(layer.getChildFrame('#detail', index)); | 
|---|
|  |  |  | clearFormVal(layer.getChildFrame('#detail', index)); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (param === undefined) { | 
|---|
|  |  |  | layer.msg("无数据"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '库位号详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../locMast/locMast_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locMast/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '库位号详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../locMast/locMast_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/locMast/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'modiUser': | 
|---|
|  |  |  | 
|---|
|  |  |  | if (param === undefined) { | 
|---|
|  |  |  | layer.msg("无数据"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '修改人员详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../user/user_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/user/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '修改人员详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../user/user_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/user/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'appeUser': | 
|---|
|  |  |  | 
|---|
|  |  |  | if (param === undefined) { | 
|---|
|  |  |  | layer.msg("无数据"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '创建者详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../user/user_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/user/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '创建者详情', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | content: '../user/user_detail.html', | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/user/"+ param +"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | setFormVal(layer.getChildFrame('#detail', index), res.data, true); | 
|---|
|  |  |  | top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); | 
|---|
|  |  |  | layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); | 
|---|
|  |  |  | layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('select'); | 
|---|
|  |  |  | layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = "/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function method(name){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var index = layer.load(1, { | 
|---|
|  |  |  | shade: [0.5,'#000'] //0.1透明度的背景 | 
|---|
|  |  |  | }); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | var currentTemId; | 
|---|
|  |  |  | var currentTemName; | 
|---|
|  |  |  | var currentTemSsbm; | 
|---|
|  |  |  | var init = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/"  // 配置模块所在的目录 | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'tree', 'xmSelect'], function() { | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var tree = layui.tree; | 
|---|
|  |  |  | var xmSelect = layui.xmSelect; | 
|---|
|  |  |  | var selObj, treeData;  // 左树选中数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var organizationTree; | 
|---|
|  |  |  | window.loadTree = function(condition){ | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/node/tree/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | 'condition': condition | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | // 树形图 | 
|---|
|  |  |  | organizationTree = tree.render({ | 
|---|
|  |  |  | elem: '#organizationTree', | 
|---|
|  |  |  | id: 'organizationTree', | 
|---|
|  |  |  | onlyIconControl: true, | 
|---|
|  |  |  | data: res.data, | 
|---|
|  |  |  | click: function (obj) { | 
|---|
|  |  |  | currentTemId = obj.data.id; | 
|---|
|  |  |  | currentTemName = obj.data.title.split(" - ")[0]; | 
|---|
|  |  |  | currentTemSsbm = obj.data.title.split(" - ")[1]; | 
|---|
|  |  |  | selObj = obj; | 
|---|
|  |  |  | $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); | 
|---|
|  |  |  | $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click'); | 
|---|
|  |  |  | tableIns.reload({ | 
|---|
|  |  |  | where: {node_id: obj.data.id}, | 
|---|
|  |  |  | page: {curr: 1} | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | treeData = res.data; | 
|---|
|  |  |  | if (isEmpty(condition) && init) { | 
|---|
|  |  |  | tableIns.reload({ | 
|---|
|  |  |  | where: {node_id: ""}, | 
|---|
|  |  |  | page: {curr: 1} | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!init) { | 
|---|
|  |  |  | init = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | loadTree(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 树形图重置 */ | 
|---|
|  |  |  | $('#treeReset').click(function () { | 
|---|
|  |  |  | $("#condition").val(""); | 
|---|
|  |  |  | loadTree(""); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function closeDialog() { | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 树形图搜索 */ | 
|---|
|  |  |  | function findData(el) { | 
|---|
|  |  |  | var condition = $(el).val(); | 
|---|
|  |  |  | loadTree(condition) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/common.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/tree.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | body { | 
|---|
|  |  |  | color: #595959; | 
|---|
|  |  |  | background-color: #f5f7f9; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-fluid { | 
|---|
|  |  |  | padding: 15px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-form.layui-border-box.layui-table-view { | 
|---|
|  |  |  | /*margin: 15px 0 35px 0;*/ | 
|---|
|  |  |  | width: 100%; | 
|---|
|  |  |  | border-width: 1px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-form.layui-border-box.layui-table-view { | 
|---|
|  |  |  | height: calc(100vh - 160px); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-form.layui-border-box.layui-table-view { | 
|---|
|  |  |  | margin: 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #search-box { | 
|---|
|  |  |  | padding: 30px 30px 10px 0px; | 
|---|
|  |  |  | margin-left: 0px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-form.layui-border-box.layui-table-view { | 
|---|
|  |  |  | height: 100%; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 搜索栏 --> | 
|---|
|  |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off"> | 
|---|
|  |  |  | <div class="layui-fluid"> | 
|---|
|  |  |  | <!-- 左 --> | 
|---|
|  |  |  | <div class="layui-row layui-col-space15"> | 
|---|
|  |  |  | <div class="layui-col-md3"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body" style="padding: 10px;"> | 
|---|
|  |  |  | <!-- 树工具栏 --> | 
|---|
|  |  |  | <div class="layui-form toolbar" id="organizationTreeBar"> | 
|---|
|  |  |  | <div class="layui-inline" style="max-width: 200px;"> | 
|---|
|  |  |  | <input id="condition" onkeyup="findData(this)" type="text" class="layui-input" placeholder="请输入关键字" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <button class="layui-btn icon-btn  layui-btn-sm" id="treeReset" style="padding: 0 10px;"> | 
|---|
|  |  |  | <i class="layui-icon layui-icon-close"></i> | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 树 --> | 
|---|
|  |  |  | <div class="layui-form toolbar" id="organizationTree"></div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 右 --> | 
|---|
|  |  |  | <div class="layui-col-md9"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body" style="padding: 10px;"> | 
|---|
|  |  |  | <!-- 表格工具栏2 --> | 
|---|
|  |  |  | <div id="search-box" class="layui-form toolbar"  style="padding-top: 5px"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label" style="padding: 8px 15px 8px 15px">货位:</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input name="loc_no" class="layui-input" placeholder="输入货位"/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label" style="padding: 8px 15px 8px 15px">商品编号:</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input name="matnr" class="layui-input" placeholder="输入商品编号"/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label" style="padding: 8px 15px 8px 15px">商品名称:</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input name="maktx" class="layui-input" placeholder="输入商品名称"/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline">  | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>搜索 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>重置 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <table class="layui-hide" id="locDetl" lay-filter="locDetl"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="zpallet" placeholder="托盘码" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--    <div class="layui-inline">--> | 
|---|
|  |  |  | <!--        <div class="layui-input-inline">--> | 
|---|
|  |  |  | <!--            <input class="layui-input" type="text" name="row" placeholder="排数" autocomplete="off">--> | 
|---|
|  |  |  | <!--        </div>--> | 
|---|
|  |  |  | <!--    </div>--> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 待添加 --> | 
|---|
|  |  |  | <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> | 
|---|
|  |  |  | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
|---|
|  |  |  | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
|---|
|  |  |  | <!--        <button id="unreason" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="unreason">查看异常数据</button>--> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表格 --> | 
|---|
|  |  |  | <div class="layui-form"> | 
|---|
|  |  |  | <table class="layui-hide" id="locDetl" lay-filter="locDetl"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <script type="text/html" id="toolbar"> | 
|---|
|  |  |  | <div class="layui-btn-container"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button> | 
|---|
|  |  |  | <!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>--> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right;margin-right: -10px">导出</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="locNoTpl"> | 
|---|
|  |  |  | <span name="locNo" class="layui-badge layui-badge-gray">{{d.locNo}}</span> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="operate"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a> | 
|---|
|  |  |  | <!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>--> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/locDetl/locDetl.js" charset="utf-8"></script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> | 
|---|
|  |  |  | <!--<script type="text/javascript" src="../../static/js/tagTree.js" charset="utf-8"></script>--> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/nodeTree.js" charset="utf-8"></script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | </html> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <!DOCTYPE html> | 
|---|
|  |  |  | <html lang="en"> | 
|---|
|  |  |  | <head> | 
|---|
|  |  |  | <meta charset="utf-8"> | 
|---|
|  |  |  | <title></title> | 
|---|
|  |  |  | <meta name="renderer" content="webkit"> | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | #detail { | 
|---|
|  |  |  | padding: 25px 30px 0 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .ew-tree-table-box { | 
|---|
|  |  |  | height: 100%; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 正文开始 --> | 
|---|
|  |  |  | <div class="layui-fluid"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  | <!-- 数据表格 --> | 
|---|
|  |  |  | <table id="node"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="toolbar"> | 
|---|
|  |  |  | <div class="layui-btn-container" style="width: 100%"> | 
|---|
|  |  |  | <button lay-event="add" class="layui-btn layui-btn-sm layui-btn-normal icon-btn"><i class="layui-icon"></i>添加</button>  | 
|---|
|  |  |  | <button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon"></i>删除</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="printBatch">批量打印</button> | 
|---|
|  |  |  | <!-- 商品/物料 数据中心 --> | 
|---|
|  |  |  | <div class="dropdown-menu" style="margin-left: 0"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm icon-btn layui-btn-primary" style="margin-top: 2px"> 数据同步 <i class="layui-icon layui-icon-drop"></i></button> | 
|---|
|  |  |  | <ul class="dropdown-menu-nav dark"> | 
|---|
|  |  |  | <div class="dropdown-anchor"></div> | 
|---|
|  |  |  | <li class="title">1st menu</li> | 
|---|
|  |  |  | <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>模板下载</a></li> | 
|---|
|  |  |  | <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>导入 Excel</a></li> | 
|---|
|  |  |  | <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li> | 
|---|
|  |  |  | <hr> | 
|---|
|  |  |  | <li class="title">2nd menu</li> | 
|---|
|  |  |  | <li><a onclick="exportExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-export"></i>导出 Excel</a></li> | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="typeTpl"> | 
|---|
|  |  |  | {{# if( d.type === 1){ }} | 
|---|
|  |  |  | <span name="type" class="layui-badge layui-badge-red" ><span style="display: none">{{d.number}}</span>仓库</span> | 
|---|
|  |  |  | {{# } else if(d.type === 2){ }} | 
|---|
|  |  |  | <span name="type" class="layui-badge layui-badge-blue" ><span style="display: none">{{d.number}}</span>库区</span> | 
|---|
|  |  |  | {{# } else if(d.type === 3){ }} | 
|---|
|  |  |  | <span name="type" class="layui-badge layui-badge-green" ><span style="display: none">{{d.number}}</span>货位</span> | 
|---|
|  |  |  | {{# } else { }} | 
|---|
|  |  |  | <span name="type" class="layui-badge layui-badge-gray" ><span style="display: none">{{d.number}}</span>其他</span> | 
|---|
|  |  |  | {{# } }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="operate"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-danger layui-btn-xs btn-del" lay-event="del">删除</a> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表单弹窗 --> | 
|---|
|  |  |  | <script type="text/html" id="editDialog"> | 
|---|
|  |  |  | <form id="detail" lay-filter="detail" class="layui-form"> | 
|---|
|  |  |  | <input name="id" type="hidden"> | 
|---|
|  |  |  | <input name="uuid" type="hidden"> | 
|---|
|  |  |  | <input name="path" type="hidden"> | 
|---|
|  |  |  | <input name="pathName" type="hidden"> | 
|---|
|  |  |  | <input name="level" type="hidden"> | 
|---|
|  |  |  | <input name="sort" type="hidden"> | 
|---|
|  |  |  | <input name="leading" type="hidden"> | 
|---|
|  |  |  | <input name="barcode" type="hidden"> | 
|---|
|  |  |  | <input name="major" type="hidden"> | 
|---|
|  |  |  | <input name="createTime$" type="hidden"> | 
|---|
|  |  |  | <input name="createBy" type="hidden"> | 
|---|
|  |  |  | <input name="updateTime$" type="hidden"> | 
|---|
|  |  |  | <input name="updateBy" type="hidden"> | 
|---|
|  |  |  | <div class="layui-row"> | 
|---|
|  |  |  | <div class="layui-col-md6"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">上级菜单</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <div id="nodeParentSel" class="ew-xmselect-tree"></div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">类型</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <select name="type" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | <option value="">请选择类型</option> | 
|---|
|  |  |  | <option value="1">仓库</option> | 
|---|
|  |  |  | <option value="2">库区</option> | 
|---|
|  |  |  | <option value="3">货位</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-col-md6"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">编号/名称</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input name="name" placeholder="请输入编号/名称" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">备注</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input name="memo" placeholder="请输入备注" class="layui-input"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <hr class="layui-bg-gray"> | 
|---|
|  |  |  | <div class="layui-form-item text-right"> | 
|---|
|  |  |  | <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <!-- 打印模板 --> | 
|---|
|  |  |  | <script type="text/template" id="locPrintTpl"> | 
|---|
|  |  |  | {{#each data}} | 
|---|
|  |  |  | <img class="template-code" src="{{this.barcodeUrl}}" width="100%"> | 
|---|
|  |  |  | <div style="letter-spacing: 2px;margin-top: 1px; text-align: center"> | 
|---|
|  |  |  | <span>{{this.item}}</span> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | {{/each}} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <div id="printBox" style="display: none;"></div> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/jquery/jQuery.print.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | var insTb; | 
|---|
|  |  |  | var admin; | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | dropdown: 'dropdown/dropdown', | 
|---|
|  |  |  | }).use(['form','treeTable', 'admin', 'xmSelect', 'dropdown', 'element'], function() { | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | admin = layui.admin; | 
|---|
|  |  |  | var treeTable = layui.treeTable; | 
|---|
|  |  |  | var xmSelect = layui.xmSelect; | 
|---|
|  |  |  | var tbDataList = []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | insTb = treeTable.render({ | 
|---|
|  |  |  | elem: '#node', | 
|---|
|  |  |  | url: baseUrl+'/node/list/tree/auth', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | height: 'full-200', | 
|---|
|  |  |  | toolbar: '#toolbar', | 
|---|
|  |  |  | tree: { | 
|---|
|  |  |  | iconIndex: 2,           // 折叠图标显示在第几列 | 
|---|
|  |  |  | isPidData: true,        // 是否是id、pid形式数据 | 
|---|
|  |  |  | idName: 'id',           // id字段名称 | 
|---|
|  |  |  | pidName: 'parentId'     // pid字段名称 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{type: 'numbers'} | 
|---|
|  |  |  | ,{field: 'name', align: 'left',title: '编号/名称', minWidth: 150} | 
|---|
|  |  |  | // ,{field: 'uuid', left: 'center',title: '编号/名称', minWidth: 150} | 
|---|
|  |  |  | ,{field: 'type$', align: 'center',title: '类型', templet: '#typeTpl'} | 
|---|
|  |  |  | // ,{field: 'leading', align: 'center',title: '负责人'} | 
|---|
|  |  |  | // ,{field: 'img', align: 'center',title: '图片', hide: true} | 
|---|
|  |  |  | // ,{field: 'brief', align: 'center',title: '简要描述'} | 
|---|
|  |  |  | // ,{field: 'count', align: 'center',title: '数量'} | 
|---|
|  |  |  | // ,{field: 'sort', align: 'center',title: '排序'} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '状态', hide: true} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '修改时间'} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '修改人员'} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注', hide: true} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | done: function (data) { | 
|---|
|  |  |  | console.log(data) | 
|---|
|  |  |  | $('.ew-tree-table-box').css('height', '100%'); | 
|---|
|  |  |  | insTb.expandAll(); | 
|---|
|  |  |  | tbDataList = data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格头工具栏点击事件 */ | 
|---|
|  |  |  | treeTable.on('toolbar(node)', function (obj) { | 
|---|
|  |  |  | var checkRows = insTb.checkStatus(); | 
|---|
|  |  |  | if (obj.event === 'add') { // 添加 | 
|---|
|  |  |  | showEditModel(); | 
|---|
|  |  |  | } else if (obj.event === 'del') { // 删除 | 
|---|
|  |  |  | if (checkRows.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择要删除的数据', {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var ids = checkRows.map(function (d) { | 
|---|
|  |  |  | if (!d.LAY_INDETERMINATE) { | 
|---|
|  |  |  | return d.id; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | doDel({ids: ids}); | 
|---|
|  |  |  | } else if (obj.event === 'printBatch') { | 
|---|
|  |  |  | if (checkRows.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择要打印的数据', {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var printContent = checkRows.map(function (d) { | 
|---|
|  |  |  | if (!d.LAY_INDETERMINATE && d.type === 3) { | 
|---|
|  |  |  | return d.name; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | printBatch(printContent, 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格操作列点击事件 */ | 
|---|
|  |  |  | treeTable.on('tool(node)', function (obj) { | 
|---|
|  |  |  | if (obj.event === 'edit') { // 修改 | 
|---|
|  |  |  | showEditModel(obj.data); | 
|---|
|  |  |  | } else if (obj.event === 'del') { // 删除 | 
|---|
|  |  |  | doDel(obj); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 显示表单弹窗 */ | 
|---|
|  |  |  | function showEditModel(mData) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | area: '600px', | 
|---|
|  |  |  | title: (mData ? '修改' : '添加') + '货位', | 
|---|
|  |  |  | content: $('#editDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | // 回显表单数据 | 
|---|
|  |  |  | form.val('detail', mData); | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(editSubmit)', function (data) { | 
|---|
|  |  |  | data.field.parentId = insXmSel.getValue('valueStr'); | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/node/"+(mData?'update':'add')+"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: data.field, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.refresh(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 渲染下拉树 | 
|---|
|  |  |  | var insXmSel = xmSelect.render({ | 
|---|
|  |  |  | el: '#nodeParentSel', | 
|---|
|  |  |  | height: '250px', | 
|---|
|  |  |  | data: insTb.options.data, | 
|---|
|  |  |  | initValue: mData ? [mData.parentId] : [], | 
|---|
|  |  |  | model: {label: {type: 'text'}}, | 
|---|
|  |  |  | prop: { | 
|---|
|  |  |  | name: 'name', | 
|---|
|  |  |  | value: 'id' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | radio: true, | 
|---|
|  |  |  | clickClose: true, | 
|---|
|  |  |  | tree: { | 
|---|
|  |  |  | show: true, | 
|---|
|  |  |  | indent: 15, | 
|---|
|  |  |  | strict: false, | 
|---|
|  |  |  | expandedKeys: true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 弹窗不出现滚动条 | 
|---|
|  |  |  | $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
|---|
|  |  |  | layui.form.render('select'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 删除 */ | 
|---|
|  |  |  | function doDel(obj) { | 
|---|
|  |  |  | layer.confirm('确定要删除选中数据吗?', { | 
|---|
|  |  |  | skin: 'layui-layer-admin', | 
|---|
|  |  |  | shade: .1 | 
|---|
|  |  |  | }, function (i) { | 
|---|
|  |  |  | layer.close(i); | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | var ids; | 
|---|
|  |  |  | if (obj.data) { | 
|---|
|  |  |  | ids = []; | 
|---|
|  |  |  | ids[0] = obj.data.id; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | ids = obj.ids; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/node/delete0/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {ids: ids}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.refresh(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 批量打印 | 
|---|
|  |  |  | function printBatch(printMsgList, type) { | 
|---|
|  |  |  | var data = []; | 
|---|
|  |  |  | for (var i = 0; i<printMsgList.length; i ++) { | 
|---|
|  |  |  | if (printMsgList[i] != null && printMsgList[i] !== '') { | 
|---|
|  |  |  | var barcodeUrl; | 
|---|
|  |  |  | if (type === 1) { | 
|---|
|  |  |  | barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+200+"&height="+70; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | barcodeUrl = baseUrl+"/barcode/qrcode/auth?type="+type+"¶m="+printMsgList[i]+"&width="+400+"&height="+180; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.push({ | 
|---|
|  |  |  | item: printMsgList[i], | 
|---|
|  |  |  | barcodeUrl: barcodeUrl | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var tpl = $('#locPrintTpl').html(); | 
|---|
|  |  |  | var template = Handlebars.compile(tpl); | 
|---|
|  |  |  | var html = template({data: data}); | 
|---|
|  |  |  | var box = $("#printBox"); | 
|---|
|  |  |  | box.html(html); | 
|---|
|  |  |  | box.show(); | 
|---|
|  |  |  | box.print({mediaPrint:true}); | 
|---|
|  |  |  | box.hide(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // excel导入模板下载 | 
|---|
|  |  |  | function excelMouldDownload(){ | 
|---|
|  |  |  | layer.load(1, {shade: [0.1,'#fff']}); | 
|---|
|  |  |  | location.href = baseUrl + "/node/excel/import/mould"; | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // excel导入 | 
|---|
|  |  |  | function importExcel() { | 
|---|
|  |  |  | $("#importExcel").trigger("click"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function upload(obj){ | 
|---|
|  |  |  | if(!obj.files) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var file = obj.files[0]; | 
|---|
|  |  |  | admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) { | 
|---|
|  |  |  | layer.load(1, {shade: [0.1,'#fff']}); | 
|---|
|  |  |  | var url = baseUrl + "/node/excel/import/auth"; | 
|---|
|  |  |  | var form = new FormData(); | 
|---|
|  |  |  | form.append("file", file); | 
|---|
|  |  |  | xhr = new XMLHttpRequest(); | 
|---|
|  |  |  | xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。 | 
|---|
|  |  |  | xhr.setRequestHeader('token', localStorage.getItem('token')); | 
|---|
|  |  |  | xhr.onload = uploadComplete; //请求完成 | 
|---|
|  |  |  | xhr.onerror =  uploadFailed; //请求失败 | 
|---|
|  |  |  | xhr.onloadend = function () { // // 上传完成重置文件流 | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | $("#importExcel").val(""); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】 | 
|---|
|  |  |  | xhr.upload.onloadstart = function(){//上传开始执行方法 | 
|---|
|  |  |  | ot = new Date().getTime();   //设置上传开始时间 | 
|---|
|  |  |  | oloaded = 0;//设置上传开始时,以上传的文件大小为0 | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | xhr.send(form); | 
|---|
|  |  |  | }, function(index){ | 
|---|
|  |  |  | $("#importExcel").val(""); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadComplete(evt) { | 
|---|
|  |  |  | var res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | if(res.code === 200) { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.refresh(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function uploadFailed(evt) { | 
|---|
|  |  |  | var res = JSON.parse(evt.target.responseText); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // excel导出 | 
|---|
|  |  |  | function exportExcel() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | </html> | 
|---|
|  |  |  |  | 
|---|