|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper.eq("STATUS",0))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | String locNo = null; | 
|---|
|  |  |  | long whsType = 0L; | 
|---|
|  |  |  | Integer crnNo = 0; | 
|---|
|  |  |  | Integer row1 = 0; | 
|---|
|  |  |  | Integer bay1 = 0; | 
|---|
|  |  |  | Integer lev1 = 0; | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : param.entrySet()) { | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (Cools.isEmpty(val)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (entry.getKey().equals("whsType")) { | 
|---|
|  |  |  | whsType = Long.getLong(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("locNo")) { | 
|---|
|  |  |  | locNo = val; | 
|---|
|  |  |  | }else if (entry.getKey().equals("crnNo")) { | 
|---|
|  |  |  | crnNo = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("row1")) { | 
|---|
|  |  |  | row1 = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("bay1")) { | 
|---|
|  |  |  | bay1 = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("lev1")) { | 
|---|
|  |  |  | lev1 = Integer.getInteger(val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocMast> locMastList = locMastService.selectLocMastListSix(locNo,whsType,crnNo,row1,bay1,lev1,0,10); | 
|---|
|  |  |  | Page<LocMast> page = new Page<LocMast>(0,10).setRecords(locMastList); | 
|---|
|  |  |  | page.setTotal(locMastService.selectLocMastListTotalSix(locNo,whsType,crnNo,row1,bay1,lev1)); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | return R.error("异常" + e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locMastQuery/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(String condition) { | 
|---|
|  |  |  | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.like("loc_no", condition); | 
|---|
|  |  |  | Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocMast> locMastList = locMastService.selectLocMastList(condition,0,10); | 
|---|
|  |  |  | Page<LocMast> page = new Page<LocMast>(0,10).setRecords(locMastList); | 
|---|
|  |  |  | page.setTotal(locMastService.selectLocMastListTotal(condition)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | for (LocMast locMast : page.getRecords()){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", locMast.getLocNo()); | 
|---|
|  |  |  | map.put("value", locMast.getLocNo()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | if (!Cools.isEmpty(locMast)){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", locMast.getLocNo()); | 
|---|
|  |  |  | map.put("value", locMast.getLocNo()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface LocMastMapper extends BaseMapper<LocMast> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库位模糊查询库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<LocMast> selectLocMastListSix(@Param("locNo") String locNo, | 
|---|
|  |  |  | @Param("whsType") Long whsType, | 
|---|
|  |  |  | @Param("crnNo") Integer crnNo, | 
|---|
|  |  |  | @Param("row1") Integer row1, | 
|---|
|  |  |  | @Param("bay1") Integer bay1, | 
|---|
|  |  |  | @Param("lev1") Integer lev1, | 
|---|
|  |  |  | @Param("pageNumber") Integer curr, | 
|---|
|  |  |  | @Param("pageSize") Integer limit); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机对应的排号集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long selectLocMastListTotalSix(@Param("locNo") String locNo, | 
|---|
|  |  |  | @Param("whsType") Long whsType, | 
|---|
|  |  |  | @Param("crnNo") Integer crnNo, | 
|---|
|  |  |  | @Param("row1") Integer row1, | 
|---|
|  |  |  | @Param("bay1") Integer bay1, | 
|---|
|  |  |  | @Param("lev1") Integer lev1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocMast> selectLocMastList(@Param("locNo") String locNo, | 
|---|
|  |  |  | @Param("pageNumber") Integer curr, | 
|---|
|  |  |  | @Param("pageSize") Integer limit); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long selectLocMastListTotal(@Param("locNo") String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    @Select("select distinct row1 from "SOURCE"."asr_loc_mast" where crn_no = #{crnNo}") | 
|---|
|  |  |  | @Select("select row1 from ( select distinct row1 from \"SOURCE\".\"asr_loc_mast\" where crn_no = #{crnNo} ) a " + | 
|---|
|  |  |  | "order by case row1 when 1 then 1 when 2 then 0 when 3 then 0 when 4 then 1 " + | 
|---|
|  |  |  | 
|---|
|  |  |  | public interface LocMastService extends IService<LocMast> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库位模糊查询库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<LocMast> selectLocMastListSix(String locNo,Long whsType,Integer crnNo,Integer row1,Integer bay1,Integer lev1, Integer curr, Integer limit); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机对应的排号集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long selectLocMastListTotalSix(String locNo,Long whsType,Integer crnNo,Integer row1,Integer bay1,Integer lev1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库位模糊查询库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<LocMast> selectLocMastList(String locNo, Integer curr, Integer limit); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机对应的排号集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long selectLocMastListTotal(String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机对应的排号集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<Integer> queryDistinctRow(Integer crnNo); | 
|---|
|  |  |  | 
|---|
|  |  |  | private ApiLogService apiLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocMast> selectLocMastListSix(String locNo,Long whsType,Integer crnNo,Integer row1,Integer bay1,Integer lev1,Integer curr,Integer limit) { | 
|---|
|  |  |  | return this.baseMapper.selectLocMastListSix(locNo,whsType,crnNo,row1,bay1,lev1,curr,limit); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Long selectLocMastListTotalSix(String locNo,Long whsType,Integer crnNo,Integer row1,Integer bay1,Integer lev1) { | 
|---|
|  |  |  | return this.baseMapper.selectLocMastListTotalSix(locNo,whsType,crnNo,row1,bay1,lev1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocMast> selectLocMastList(String locNo,Integer curr,Integer limit) { | 
|---|
|  |  |  | return this.baseMapper.selectLocMastList(locNo,curr,limit); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Long selectLocMastListTotal(String locNo) { | 
|---|
|  |  |  | return this.baseMapper.selectLocMastListTotal(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Integer> queryDistinctRow(Integer crnNo) { | 
|---|
|  |  |  | return this.baseMapper.queryDistinctRow(crnNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="batchSeq"> | 
|---|
|  |  |  | <if test="locNo != null and locNo != ''"> | 
|---|
|  |  |  | and LOC_NO like '%' + #{locNo} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="whsType != null and whsType != 0"> | 
|---|
|  |  |  | and WHS_TYPE = #{whsType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="crnNo != null and crnNo != 0"> | 
|---|
|  |  |  | and CRN_NO = #{crnNo} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="row1 != null and row1 != 0"> | 
|---|
|  |  |  | and ROW1 = #{row1} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="bay1 != null and bay1 != 0"> | 
|---|
|  |  |  | and BAY1 = #{bay1} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="lev1 != null and lev1 != 0"> | 
|---|
|  |  |  | and LEV1 = #{lev1} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectLocMastListSix" resultMap="BaseResultMap"> | 
|---|
|  |  |  | SELECT * FROM "SOURCE"."sys_role" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | ORDER BY ID DESC | 
|---|
|  |  |  | LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize}); | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectLocMastListTotalSix" resultType="Long"> | 
|---|
|  |  |  | SELECT count(1) FROM "SOURCE"."sys_role" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectLocMastList" resultMap="BaseResultMap"> | 
|---|
|  |  |  | SELECT * FROM "SOURCE"."sys_role" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <if test="locNo != null and locNo != ''"> | 
|---|
|  |  |  | and LOC_NO like '%' + #{locNo} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | ORDER BY ID DESC | 
|---|
|  |  |  | LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize}); | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectLocMastListTotal" resultType="Long"> | 
|---|
|  |  |  | SELECT count(1) FROM "SOURCE"."sys_role" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <if test="locNo != null and locNo != ''"> | 
|---|
|  |  |  | and LOC_NO like '%' + #{locNo} + '%' | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="queryFreeLocMast" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select top 1 * | 
|---|
|  |  |  | from "SOURCE"."asr_loc_mast" | 
|---|
|  |  |  | 
|---|
|  |  |  | <input class="layui-input" type="text" name="lev1" placeholder="层" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <select class="layui-input" id="loc_type1" name="loc_type1" autocomplete="off"> | 
|---|
|  |  |  | <option value>选择桶类型</option> | 
|---|
|  |  |  | <option value="1">油桶</option> | 
|---|
|  |  |  | <option value="2">净桶</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--    <div class="layui-inline">--> | 
|---|
|  |  |  | <!--        <div class="layui-input-inline">--> | 
|---|
|  |  |  | <!--            <select class="layui-input" id="loc_type1" name="loc_type1" autocomplete="off">--> | 
|---|
|  |  |  | <!--                <option value>选择桶类型</option>--> | 
|---|
|  |  |  | <!--                <option value="1">油桶</option>--> | 
|---|
|  |  |  | <!--                <option value="2">净桶</option>--> | 
|---|
|  |  |  | <!--            </select>--> | 
|---|
|  |  |  | <!--        </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> | 
|---|