src/main/java/com/zy/asrs/controller/LocRuleController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/entity/LocRule.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/mapper/LocRuleMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/LocRuleService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/LocRuleMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/webapp/views/locRule/locRule.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/LocRuleController.java
New file @@ -0,0 +1,150 @@ package com.zy.asrs.controller; 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.LocRule; import com.zy.asrs.service.LocRuleService; import com.zy.common.web.BaseController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; @RestController public class LocRuleController extends BaseController { @Autowired private LocRuleService locRuleService; @RequestMapping(value = "/locRule/{id}/auth") @ManagerAuth public R get(@PathVariable("id") String id) { return R.ok(locRuleService.selectById(String.valueOf(id))); } @RequestMapping(value = "/locRule/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(required = false)String condition, @RequestParam Map<String, Object> param){ EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); excludeTrash(param); convert(param, wrapper); allLike(LocRule.class, param.keySet(), wrapper, condition); if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} return R.ok(locRuleService.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()); 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 = "/locRule/add/auth") @ManagerAuth public R add(LocRule locRule) { if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { return R.error("排区间错误"); } if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { return R.error("列区间错误"); } if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { return R.error("层区间错误"); } Date now = new Date(); locRule.setStatus(1); locRule.setCreateBy(getUserId()); locRule.setCreateTime(now); locRule.setUpdateBy(getUserId()); locRule.setUpdateTime(now); locRuleService.insert(locRule); return R.ok(); } @RequestMapping(value = "/locRule/update/auth") @ManagerAuth public R update(LocRule locRule){ if (Cools.isEmpty(locRule) || null==locRule.getId()){ return R.error(); } if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { return R.error("排区间错误"); } if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { return R.error("列区间错误"); } if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { return R.error("层区间错误"); } locRule.setUpdateBy(getUserId()); locRule.setUpdateTime(new Date()); locRuleService.updateById(locRule); return R.ok(); } @RequestMapping(value = "/locRule/delete/auth") @ManagerAuth public R delete(@RequestParam(value="ids[]") Long[] ids){ for (Long id : ids){ locRuleService.deleteById(id); } return R.ok(); } @RequestMapping(value = "/locRule/export/auth") @ManagerAuth public R export(@RequestBody JSONObject param){ EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); Map<String, Object> map = excludeTrash(param.getJSONObject("locRule")); convert(map, wrapper); List<LocRule> list = locRuleService.selectList(wrapper); return R.ok(exportSupport(list, fields)); } @RequestMapping(value = "/locRuleQuery/auth") @ManagerAuth public R query(String condition) { EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); wrapper.like("id", condition); Page<LocRule> page = locRuleService.selectPage(new Page<>(0, 10), wrapper); List<Map<String, Object>> result = new ArrayList<>(); for (LocRule locRule : page.getRecords()){ Map<String, Object> map = new HashMap<>(); map.put("id", locRule.getId()); map.put("value", locRule.getId()); result.add(map); } return R.ok(result); } @RequestMapping(value = "/locRule/check/column/auth") @ManagerAuth public R query(@RequestBody JSONObject param) { Wrapper<LocRule> wrapper = new EntityWrapper<LocRule>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); if (null != locRuleService.selectOne(wrapper)){ return R.parse(BaseRes.REPEAT).add(getComment(LocRule.class, String.valueOf(param.get("key")))); } return R.ok(); } } src/main/java/com/zy/asrs/entity/LocRule.java
New file @@ -0,0 +1,253 @@ package com.zy.asrs.entity; import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.annotations.TableField; import com.core.common.SpringUtils; import com.zy.system.service.UserService; import com.zy.system.entity.User; import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.core.common.SpringUtils; import com.zy.system.service.UserService; import com.zy.system.entity.User; import java.text.SimpleDateFormat; import java.util.Date; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; @Data @TableName("asr_loc_rule") public class LocRule implements Serializable { private static final long serialVersionUID = 1L; /** * ID */ @ApiModelProperty(value= "ID") @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 商品编号 */ @ApiModelProperty(value= "商品编号") private String matnr; /** * 规格 */ @ApiModelProperty(value= "规格") private String specs; /** * 型号 */ @ApiModelProperty(value= "型号") private String model; /** * 客户 */ @ApiModelProperty(value= "客户") private String cstmr; /** * 批号 */ @ApiModelProperty(value= "批号") private String batch; /** * 其他 */ @ApiModelProperty(value= "其他") private String other; /** * 开始排 */ @ApiModelProperty(value= "开始排") @TableField("row_beg") private Integer rowBeg; /** * 结束排 */ @ApiModelProperty(value= "结束排") @TableField("row_end") private Integer rowEnd; /** * 开始列 */ @ApiModelProperty(value= "开始列") @TableField("bay_beg") private Integer bayBeg; /** * 结束列 */ @ApiModelProperty(value= "结束列") @TableField("bay_end") private Integer bayEnd; /** * 开始层 */ @ApiModelProperty(value= "开始层") @TableField("lev_beg") private Integer levBeg; /** * 结束层 */ @ApiModelProperty(value= "结束层") @TableField("lev_end") private Integer levEnd; /** * 上限 */ @ApiModelProperty(value= "上限") private Integer limit; /** * 状态 1: 正常 0: 禁用 */ @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") private Integer status; /** * 添加人员 */ @ApiModelProperty(value= "添加人员") @TableField("create_by") private Long createBy; /** * 添加时间 */ @ApiModelProperty(value= "添加时间") @TableField("create_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date createTime; /** * 修改人员 */ @ApiModelProperty(value= "修改人员") @TableField("update_by") private Long updateBy; /** * 修改时间 */ @ApiModelProperty(value= "修改时间") @TableField("update_time") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date updateTime; /** * 备注 */ @ApiModelProperty(value= "备注") private String memo; public LocRule() {} public LocRule(String matnr,String specs,String model,String cstmr,String batch,String other,Integer rowBeg,Integer rowEnd,Integer bayBeg,Integer bayEnd,Integer levBeg,Integer levEnd,Integer limit,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { this.matnr = matnr; this.specs = specs; this.model = model; this.cstmr = cstmr; this.batch = batch; this.other = other; this.rowBeg = rowBeg; this.rowEnd = rowEnd; this.bayBeg = bayBeg; this.bayEnd = bayEnd; this.levBeg = levBeg; this.levEnd = levEnd; this.limit = limit; this.status = status; this.createBy = createBy; this.createTime = createTime; this.updateBy = updateBy; this.updateTime = updateTime; this.memo = memo; } // LocRule locRule = new LocRule( // null, // 商品编号 // null, // 规格 // null, // 型号 // null, // 客户 // null, // 批号 // null, // 其他 // null, // 开始排 // null, // 结束排 // null, // 开始列 // null, // 结束列 // null, // 开始层 // null, // 结束层 // null, // 上限 // null, // 状态 // null, // 添加人员 // null, // 添加时间 // null, // 修改人员 // null, // 修改时间 // 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); } } src/main/java/com/zy/asrs/mapper/LocRuleMapper.java
New file @@ -0,0 +1,12 @@ package com.zy.asrs.mapper; import com.zy.asrs.entity.LocRule; import com.baomidou.mybatisplus.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @Mapper @Repository public interface LocRuleMapper extends BaseMapper<LocRule> { } src/main/java/com/zy/asrs/service/LocRuleService.java
New file @@ -0,0 +1,10 @@ package com.zy.asrs.service; import com.zy.asrs.entity.LocRule; import com.baomidou.mybatisplus.service.IService; public interface LocRuleService extends IService<LocRule> { LocRule find(String matnr, String batch, int startRow, int endRow); } src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
New file @@ -0,0 +1,50 @@ package com.zy.asrs.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; import com.zy.asrs.entity.Mat; import com.zy.asrs.mapper.LocRuleMapper; import com.zy.asrs.entity.LocRule; import com.zy.asrs.service.LocRuleService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.zy.asrs.service.MatService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("locRuleService") public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService { @Autowired private MatService matService; @Override public LocRule find(String matnr, String batch, int startRow, int endRow) { if (Cools.isEmpty(matnr)) { return null; } Mat mat = matService.selectByMatnr(matnr); if (Cools.isEmpty(mat)) { return null; } LocRule locRule = null; do { locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); if (null != locRule) { break; } locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); if (null != locRule) { break; } locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); if (null != locRule) { break; } locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); if (null != locRule) { break; } } while (false); return locRule; } } src/main/resources/mapper/LocRuleMapper.xml
New file @@ -0,0 +1,30 @@ <?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.LocRuleMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocRule"> <id column="id" property="id" /> <result column="matnr" property="matnr" /> <result column="specs" property="specs" /> <result column="model" property="model" /> <result column="cstmr" property="cstmr" /> <result column="batch" property="batch" /> <result column="other" property="other" /> <result column="row_beg" property="rowBeg" /> <result column="row_end" property="rowEnd" /> <result column="bay_beg" property="bayBeg" /> <result column="bay_end" property="bayEnd" /> <result column="lev_beg" property="levBeg" /> <result column="lev_end" property="levEnd" /> <result column="limit" property="limit" /> <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> </mapper> src/main/webapp/views/locRule/locRule.html
New file @@ -0,0 +1,179 @@ <!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"> </head> <body> <div class="layui-fluid"> <div class="layui-card"> <div class="layui-card-body"> <div class="layui-form toolbar" id="search-box"> <div class="layui-form-item"> <div class="layui-inline"> <div class="layui-input-inline"> <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> </div> </div> <div class="layui-inline" style="width: 300px"> <div class="layui-input-inline"> <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> </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 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> </div> <table class="layui-hide" id="locRule" lay-filter="locRule"></table> </div> </div> </div> <script type="text/html" id="toolbar"> <div class="layui-btn-container"> <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">导出</button> </div> </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-edit" lay-event="del">删除</a> </script> <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.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 type="text/javascript" src="../../static/js/locRule/locRule.js" charset="utf-8"></script> </body> <!-- 表单弹窗 --> <script type="text/html" id="editDialog"> <form id="detail" lay-filter="detail" class="layui-form admin-form model-form"> <input name="id" 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"> <input class="layui-input" name="matnr" placeholder="请输入商品编号"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">规格: </label> <div class="layui-input-block"> <input class="layui-input" name="specs" placeholder="请输入规格"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">型号: </label> <div class="layui-input-block"> <input class="layui-input" name="model" placeholder="请输入型号"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">客户: </label> <div class="layui-input-block"> <input class="layui-input" name="cstmr" placeholder="请输入客户"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">批号: </label> <div class="layui-input-block"> <input class="layui-input" name="batch" placeholder="请输入批号"> </div> </div> <!-- <div class="layui-form-item">--> <!-- <label class="layui-form-label">其他: </label>--> <!-- <div class="layui-input-block">--> <!-- <input class="layui-input" name="other" placeholder="请输入其他">--> <!-- </div>--> <!-- </div>--> <div class="layui-form-item"> <label class="layui-form-label">上限: </label> <div class="layui-input-block"> <input class="layui-input" name="limit" placeholder="请输入上限"> </div> </div> </div> <div class="layui-col-md6"> <!-- <div class="layui-inline">--> <!-- <label class="layui-form-label">排范围</label>--> <!-- <div class="layui-input-inline" style="width: 100px;">--> <!-- <input type="text" name="price_min" placeholder="¥" autocomplete="off" class="layui-input">--> <!-- </div>--> <!-- <div class="layui-form-mid">-</div>--> <!-- <div class="layui-input-inline" style="width: 100px;">--> <!-- <input type="text" name="price_max" placeholder="¥" autocomplete="off" class="layui-input">--> <!-- </div>--> <!-- </div>--> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">开始排: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="rowBeg" placeholder="请输入开始排" lay-vertype="tips" lay-verify="required" required=""> </div> </div> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">结束排: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="rowEnd" placeholder="请输入结束排" lay-vertype="tips" lay-verify="required" required=""> </div> </div> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">开始列: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="bayBeg" placeholder="请输入开始列" lay-vertype="tips" lay-verify="required" required=""> </div> </div> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">结束列: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="bayEnd" placeholder="请输入结束列" lay-vertype="tips" lay-verify="required" required=""> </div> </div> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">开始层: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="levBeg" placeholder="请输入开始层" lay-vertype="tips" lay-verify="required" required=""> </div> </div> <div class="layui-form-item"> <label class="layui-form-label layui-form-required">结束层: </label> <div class="layui-input-block"> <input type="number" min="1" class="layui-input" name="levEnd" placeholder="请输入结束层" lay-vertype="tips" lay-verify="required" required=""> </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> </html>