| | |
| | | } |
| | | |
| | | /** |
| | | * 通过库位号获取 列 |
| | | */ |
| | | public static int getBay(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(2, 5)); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | /** |
| | | * 通过库位号获取 层 |
| | | */ |
| | | public static int getLev(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(5, 7)); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | /** |
| | | * 当检索到双深库位的浅库位时,如果深库位无货,则放入对应的深库位 |
| | | */ |
| | | public static void toDeepIfEmptyByShallow(String shallowLoc) { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | public static String getLocNo(Number row, Number bay, Number lev) { |
| | | return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); |
| | | } |
| | | |
| | | public static List<String> getGroupLoc(String locNo){ |
| | | int row = getRow(locNo); |
| | |
| | | } |
| | | return result; |
| | | } |
| | | if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)) { |
| | | List<String> result = new ArrayList<>(); |
| | | for (Integer row0 : CommonService.FIRST_GROUP_ROW_LIST_SHORT) { |
| | | result.add(zerofill(String.valueOf(row0), 2) + locNo.substring(2)); |
| | | } |
| | | return result; |
| | | } |
| | | if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)) { |
| | | List<String> result = new ArrayList<>(); |
| | | for (Integer row0 : CommonService.THIRD_GROUP_ROW_LIST) { |
| | | result.add(zerofill(String.valueOf(row0), 2) + locNo.substring(2)); |
| | | } |
| | | return result; |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | |
| | | public static Integer getOutLayerRow(String locNo, Boolean pakin){ |
| | | int row = getRow(locNo); |
| | | // 入库 |
| | | if (pakin) { |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return 17; |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return 18; |
| | | } else { |
| | | return -1; |
| | | // throw new RuntimeException("库位解析异常"); |
| | | } |
| | | // 出库 |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return 4; |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return 5; |
| | | } else { |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return 2; |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return 30; |
| | | } else { |
| | | return -1; |
| | | // throw new RuntimeException("库位解析异常"); |
| | | } |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | |
| | | public static List<Integer> getGroupLoc(Integer row){ |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return CommonService.FIRST_GROUP_ROW_LIST; |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)) { |
| | | return CommonService.FIRST_GROUP_ROW_LIST_SHORT; |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return CommonService.SECOND_GROUP_ROW_LIST; |
| | | } else if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)) { |
| | | return CommonService.THIRD_GROUP_ROW_LIST; |
| | | } else { |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | |
| | | int row = getRow(locNo); |
| | | List<String> result = new ArrayList<>(); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | for (Integer integer : CommonService.FIRST_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.FIRST_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.FIRST_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)){ |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.FIRST_GROUP_ROW_LIST_SHORT.size()]); |
| | | Collections.copy(clone, CommonService.FIRST_GROUP_ROW_LIST_SHORT); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)){ |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.SECOND_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.SECOND_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | // throw new RuntimeException("库位解析异常"); |
| | | } else if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)){ |
| | | for (Integer integer : CommonService.THIRD_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | // 外侧方向的货位 优先入库方向/优先出库方向 |
| | | public static List<String> getGroupOuterLocIoPri(String locNo){ |
| | | int row = getRow(locNo); |
| | | List<String> result = new ArrayList<>(); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | for (Integer integer : CommonService.FIRST_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)){ |
| | | for (Integer integer : CommonService.FIRST_GROUP_ROW_LIST_SHORT) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)){ |
| | | for (Integer integer : CommonService.SECOND_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)){ |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.THIRD_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.THIRD_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(JSON.toJSONString(getGroupInsideLoc("2300101"))); |
| | | System.out.println(JSON.toJSONString(getGroupOuterLoc("0200101"))); |
| | | } |
| | | |
| | | // 内侧方向的货位 优先入库方向/优先出库方向 ===>> 反之 |
| | |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.FIRST_GROUP_ROW_LIST_SHORT.size()]); |
| | | Collections.copy(clone, CommonService.FIRST_GROUP_ROW_LIST_SHORT); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | for (Integer integer : CommonService.SECOND_GROUP_ROW_LIST) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.SECOND_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.SECOND_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)) { |
| | | for (Integer integer : CommonService.THIRD_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | |
| | | return result; |
| | | } |
| | | |
| | | // 外侧方向的货位 优先入库方向/优先出库方向 ===>> 反之 |
| | | public static List<String> getGroupOutsideLoc(String locNo){ |
| | | int row = getRow(locNo); |
| | | List<String> result = new ArrayList<>(); |
| | | if (CommonService.THIRD_GROUP_ROW_LIST.contains(row)) { |
| | | for (Integer integer : CommonService.THIRD_GROUP_ROW_LIST) { |
| | | if (integer < row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.FIRST_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.FIRST_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.FIRST_GROUP_ROW_LIST_SHORT.contains(row)) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.FIRST_GROUP_ROW_LIST_SHORT.size()]); |
| | | Collections.copy(clone, CommonService.FIRST_GROUP_ROW_LIST_SHORT); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | List<Integer> clone = Arrays.asList(new Integer[CommonService.SECOND_GROUP_ROW_LIST.size()]); |
| | | Collections.copy(clone, CommonService.SECOND_GROUP_ROW_LIST); |
| | | Collections.reverse(clone); |
| | | for (Integer integer : clone) { |
| | | if (integer > row) { |
| | | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | // throw new RuntimeException("库位解析异常"); |
| | | } |
| | | if (!Cools.isEmpty(result)) { |
| | | Collections.reverse(result); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |