| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | List<WrkMast> currentCrnTask = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", currentCircleTaskCrnNo)); |
| | | if (currentCrnTask.size() <= 1) { |
| | | if (basCrnp != null) { |
| | | String controlRowsStr = basCrnp.getControlRows(); |
| | | if(!Cools.isEmpty(controlRowsStr)){ |
| | | List<Integer> rows = JSON.parseArray(controlRowsStr, Integer.class); |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | list.addAll(rows); |
| | | wrapper.ne("crn_no", currentCircleTaskCrnNo); |
| | | } |
| | | wrapper.ne("crn_no", currentCircleTaskCrnNo); |
| | | } |
| | | } |
| | | } |
| | |
| | | enabledCrnps.sort(Comparator.comparingInt(o -> map.getOrDefault(o.getCrnNo(), 0))); |
| | | |
| | | for (BasCrnp basCrnp : enabledCrnps) { |
| | | String controlRowsStr = basCrnp.getControlRows(); |
| | | if (Cools.isEmpty(controlRowsStr)) { |
| | | continue; |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | list.addAll(rows); |
| | | } |
| | | List<Integer> rows = JSON.parseArray(controlRowsStr, Integer.class); |
| | | list.addAll(rows); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static Map<String, Object> convertObjectToMap(Object obj) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //获取深库位排号 |
| | | public static List<Integer> getDeepRowList() { |
| | | List<Integer> rowList = new ArrayList<>(); |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return rowList; |
| | | } |
| | | |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | String deepRowsStr = basCrnp.getDeepRows(); |
| | | if(!Cools.isEmpty(deepRowsStr)){ |
| | | List<Integer> rows = JSON.parseArray(deepRowsStr, Integer.class); |
| | | rowList.addAll(rows); |
| | | } |
| | | } |
| | | return rowList; |
| | | } |
| | | |
| | | //获取浅库位排号 |
| | | public static Integer getShallowRowByDeepRow(Integer deepRow) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> deepRowList = getDeepRowList(); |
| | | if (!deepRowList.contains(deepRow)) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> controlRowList = null; |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | if (rows.contains(deepRow)) { |
| | | controlRowList = rows; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (controlRowList != null) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (Integer row : controlRowList) { |
| | | if (deepRow.equals(row)) { |
| | | continue; |
| | | } |
| | | |
| | | return row; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //获取深库位排号 |
| | | public static Integer getDeepRowByShallowRow(Integer shallowRow) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> controlRowList = null; |
| | | List<Integer> deepRowList = null; |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | if (rows.contains(shallowRow)) { |
| | | controlRowList = rows; |
| | | deepRowList = JSON.parseArray(basCrnp.getDeepRows(), Integer.class); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (controlRowList != null) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (deepRowList == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (Integer row : controlRowList) { |
| | | if (!deepRowList.contains(row)) { |
| | | continue; |
| | | } |
| | | |
| | | return row; |
| | | } |
| | | return null; |
| | | } |
| | | } |