| | |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return 0f; |
| | | } |
| | | return (float) Arith.multiplys(2, f, 1); |
| | | } |
| | | |
| | | public static Integer getStaNoByLocNo(String locNo) { |
| | | HashMap<String, Integer> map = new HashMap<>(); |
| | | map.put("0100101", 102); |
| | | map.put("0100202", 103); |
| | | map.put("0100102", 104); |
| | | map.put("0100203", 105); |
| | | map.put("0100103", 106); |
| | | map.put("0100204", 107); |
| | | map.put("0100104", 108); |
| | | map.put("0100205", 109); |
| | | map.put("0100105", 110); |
| | | map.put("0100206", 111); |
| | | map.put("0100106", 112); |
| | | map.put("0100207", 113); |
| | | map.put("0100107", 114); |
| | | map.put("0100208", 115); |
| | | map.put("0100108", 116); |
| | | map.put("0100209", 117); |
| | | map.put("0100109", 118); |
| | | map.put("0100210", 119); |
| | | map.put("0100110", 120); |
| | | |
| | | return map.get(locNo); |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count){ |
| | |
| | | */ |
| | | public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) { |
| | | int row = getRow(deepLoc); |
| | | int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount()); |
| | | int shallowRow = remainder == 1 ? (row + 1) : (row - 1); |
| | | if(row==31){ |
| | | shallowRow = row + 1; |
| | | }else if(row==34){ |
| | | shallowRow = row - 1; |
| | | int shallowRow = row; |
| | | if (slaveProperties.getDoubleLocsLeft().contains(row)) { |
| | | shallowRow = (row + 1); |
| | | }else { |
| | | return null; |
| | | shallowRow = (row - 1); |
| | | } |
| | | return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2); |
| | | } |
| | |
| | | * 获取 深库位排对应的浅库位排 |
| | | */ |
| | | public static Integer getShallowRow(SlaveProperties slaveProperties, Integer deepRow) { |
| | | int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount()); |
| | | return remainder == 1 ? (deepRow + 1) : (deepRow - 1); |
| | | int shallowRow = deepRow; |
| | | if (slaveProperties.getDoubleLocsLeft().contains(deepRow)) { |
| | | shallowRow = (deepRow + 1); |
| | | }else { |
| | | shallowRow = (deepRow - 1); |
| | | } |
| | | return shallowRow; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) { |
| | | int row = getRow(shallowLoc); |
| | | int targetRow; |
| | | switch (row){ |
| | | case 32: |
| | | targetRow = 31; |
| | | break; |
| | | case 33: |
| | | targetRow = 34; |
| | | break; |
| | | default: |
| | | throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙"); |
| | | int targetRow = row; |
| | | if (slaveProperties.getShallowLocsLeft().contains(row)) { |
| | | targetRow = (row - 1); |
| | | } else if (slaveProperties.getShallowLocsRight().contains(row)) { |
| | | targetRow = (row + 1); |
| | | } |
| | | return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2); |
| | | } |
| | | |
| | | /** |
| | | * 获取 浅库位对应的深库位号,如果没有深库位,则返回为空 |
| | | */ |
| | | public static String getDeepLoc2(SlaveProperties slaveProperties, String shallowLoc) { |
| | | int row = getRow(shallowLoc); |
| | | boolean deepLoc = isDeepLoc(slaveProperties, row);//判断是否为深库位 |
| | | if (deepLoc) { |
| | | return null; |
| | | } |
| | | if (row == 1 || row == 6) { |
| | | return null; |
| | | } |
| | | //2,8,11,15,19,23 |
| | | if (row == 5 || row == 8 || row == 12 || row == 16 || row == 20 || row == 24) { |
| | | return zerofill(String.valueOf(row - 1), 2) + shallowLoc.substring(2); |
| | | } else { |
| | | return zerofill(String.valueOf(row + 1), 2) + shallowLoc.substring(2); |
| | | } |
| | | } |
| | | /** |
| | | * 获取 浅库位排对应的深库位排 |
| | | */ |
| | | public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) { |
| | | int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount()); |
| | | int targetRow; |
| | | if (remainder == 2) { |
| | | targetRow = shallowRow - 1; |
| | | } else if (remainder == 3) { |
| | | targetRow = shallowRow + 1; |
| | | } else { |
| | | throw new RuntimeException(shallowRow + "不是浅库位排,系统繁忙"); |
| | | int targetRow = shallowRow; |
| | | if (slaveProperties.getShallowLocsLeft().contains(shallowRow)) { |
| | | targetRow = (shallowRow - 1); |
| | | } else if (slaveProperties.getShallowLocsRight().contains(shallowRow)) { |
| | | targetRow = (shallowRow + 1); |
| | | } |
| | | return targetRow; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 通过库位号获取所在巷道 |
| | | */ |
| | | public static int getLaneByLocNo(String locNo) { |
| | | int row = Utils.getRow(locNo); |
| | | switch (row) { |
| | | case 1: |
| | | case 2: |
| | | case 3: |
| | | return 1; |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | | return 2; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | SlaveProperties slaveProperties = new SlaveProperties(); |
| | | slaveProperties.setDoubleDeep(true); |