|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.core.common.Arith; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.zy.core.properties.SlaveProperties; | 
|---|
|  |  |  | 
|---|
|  |  |  | public class Utils { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static final List<Integer> FIRST_GROUP_ROW_LIST = new ArrayList<Integer>() {{ | 
|---|
|  |  |  | add(2);add(3);add(4);add(5);add(6);add(7);add(8);add(9);add(10); | 
|---|
|  |  |  | add(11);add(12);add(13);add(14);add(15);add(16);add(17); | 
|---|
|  |  |  | add(1);add(2);add(3);add(4); | 
|---|
|  |  |  | }}; | 
|---|
|  |  |  | public static final List<Integer> SECOND_GROUP_ROW_LIST = new ArrayList<Integer>() {{ | 
|---|
|  |  |  | add(18);add(19);add(20); | 
|---|
|  |  |  | add(21);add(22);add(23);add(24);add(25);add(26);add(27);add(28);add(29);add(30); | 
|---|
|  |  |  | add(5);add(6);add(7);add(8);add(9);add(10);add(11); | 
|---|
|  |  |  | }}; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final DecimalFormat fmt = new DecimalFormat("##0.00"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static Integer getGroupRow(Integer row, Boolean pakin) { | 
|---|
|  |  |  | if (pakin) { | 
|---|
|  |  |  | if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 17; | 
|---|
|  |  |  | } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 18; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 4; | 
|---|
|  |  |  | } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 5; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | return 30; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        if (pakin) { | 
|---|
|  |  |  | //            if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | //                return 2; | 
|---|
|  |  |  | //            } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | //                return 18; | 
|---|
|  |  |  | //            } else { | 
|---|
|  |  |  | //                return 0; | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } else { | 
|---|
|  |  |  | //            if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | //                return 12; | 
|---|
|  |  |  | //            } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | //                return 30; | 
|---|
|  |  |  | //            } else { | 
|---|
|  |  |  | //                return 0; | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 判断库位是否为穿梭库位 | 
|---|
|  |  |  | * @param locNo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static Boolean isShuttle(String locNo) { | 
|---|
|  |  |  | int row = Utils.getRow(locNo); | 
|---|
|  |  |  | if (row >= 2 && row <= 12) { | 
|---|
|  |  |  | return Boolean.TRUE; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return Boolean.FALSE; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ------------------------------------------------------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  | System.out.println(JSON.toJSONString(getGroupOutsideLoc("0200101"))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 外侧方向的货位  优先入库方向/优先出库方向 ===>> 反之 | 
|---|
|  |  |  | public static List<String> getGroupOutsideLoc(String locNo){ | 
|---|
|  |  |  | int row = getRow(locNo); | 
|---|
|  |  |  | List<String> result = new ArrayList<>(); | 
|---|
|  |  |  | if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | for (Integer integer : FIRST_GROUP_ROW_LIST) { | 
|---|
|  |  |  | if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | for (Integer integer : SECOND_GROUP_ROW_LIST) { | 
|---|
|  |  |  | if (integer < row) { | 
|---|
|  |  |  | result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | List<Integer> clone = Arrays.asList(new Integer[SECOND_GROUP_ROW_LIST.size()]); | 
|---|
|  |  |  | Collections.copy(clone, SECOND_GROUP_ROW_LIST); | 
|---|
|  |  |  | } else if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
|---|
|  |  |  | List<Integer> clone = Arrays.asList(new Integer[FIRST_GROUP_ROW_LIST.size()]); | 
|---|
|  |  |  | Collections.copy(clone, FIRST_GROUP_ROW_LIST); | 
|---|
|  |  |  | Collections.reverse(clone); | 
|---|
|  |  |  | for (Integer integer : clone) { | 
|---|
|  |  |  | if (integer > row) { | 
|---|