| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.common.service.CommonService; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | SlaveProperties slaveProperties = new SlaveProperties(); |
| | | slaveProperties.setDoubleDeep(true); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(1);list.add(4);list.add(5);list.add(8);list.add(9);list.add(12); |
| | | slaveProperties.setDoubleLocs(list); |
| | | slaveProperties.setGroupCount(4); |
| | | Integer deepRow = getDeepRow(slaveProperties, 6); |
| | | System.out.println(deepRow); |
| | | |
| | | |
| | | public static List<String> getGroupLoc(String locNo){ |
| | | int row = getRow(locNo); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | List<String> result = new ArrayList<>(); |
| | | for (Integer row0 : CommonService.FIRST_GROUP_ROW_LIST) { |
| | | result.add(zerofill(String.valueOf(row0), 2) + locNo.substring(2)); |
| | | } |
| | | return result; |
| | | } |
| | | if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | List<String> result = new ArrayList<>(); |
| | | for (Integer row0 : CommonService.SECOND_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("库位解析异常"); |
| | | } |
| | | // 出库 |
| | | } 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("库位解析异常"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public static List<Integer> getGroupLoc(Integer row){ |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return CommonService.FIRST_GROUP_ROW_LIST; |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return CommonService.SECOND_GROUP_ROW_LIST; |
| | | } else { |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | } |
| | | |
| | | // 外侧方向的货位 优先入库方向/优先出库方向 |
| | | public static List<String> getGroupOuterLoc(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.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("库位解析异常"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | // 内侧方向的货位 优先入库方向/优先出库方向 ===>> 反之 |
| | | public static List<String> getGroupInsideLoc(String locNo){ |
| | | int row = getRow(locNo); |
| | | List<String> result = new ArrayList<>(); |
| | | 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.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 { |
| | | // throw new RuntimeException("库位解析异常"); |
| | | } |
| | | if (!Cools.isEmpty(result)) { |
| | | Collections.reverse(result); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | // 外侧方向的货位 优先入库方向/优先出库方向 ===>> 反之 |
| | | public static List<String> getGroupOutsideLoc(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.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; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(JSON.toJSONString(getGroupOutsideLoc("0500201"))); |
| | | } |
| | | |
| | | } |