| | |
| | | return (float) Arith.multiplys(2, f, 1); |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count){ |
| | | if (msg.length() == count){ |
| | | return msg; |
| | | } else if (msg.length() > count){ |
| | | return msg.substring(0, 16); |
| | | } else { |
| | | StringBuilder msgBuilder = new StringBuilder(msg); |
| | | for (int i = 0; i<count-msg.length(); i++){ |
| | | msgBuilder.insert(0,"0"); |
| | | } |
| | | return msgBuilder.toString(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为深库位 |
| | | */ |
| | | public static boolean isDeepLoc(SlaveProperties slaveProperties, String locNo){ |
| | | if (slaveProperties.isDoubleDeep()) { |
| | | int row = getRow(locNo); |
| | | return slaveProperties.getDoubleLocs().contains(row); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为深库位 |
| | | */ |
| | | public static boolean isDeepLoc(SlaveProperties slaveProperties, Integer row){ |
| | | if (slaveProperties.isDoubleDeep()) { |
| | | return slaveProperties.getDoubleLocs().contains(row); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为浅库位 |
| | | */ |
| | | public static boolean isShallowLoc(SlaveProperties slaveProperties, String locNo){ |
| | | if (slaveProperties.isDoubleDeep()) { |
| | | int row = getRow(locNo); |
| | | return !slaveProperties.getDoubleLocs().contains(row); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为浅库位 |
| | | */ |
| | | public static boolean isShallowLoc(SlaveProperties slaveProperties, Integer row){ |
| | | if (slaveProperties.isDoubleDeep()) { |
| | | return !slaveProperties.getDoubleLocs().contains(row); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取 深库位对应的浅库位号 |
| | | */ |
| | | 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); |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 获取 浅库位对应的深库位号 |
| | | */ |
| | | public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) { |
| | | int row = getRow(shallowLoc); |
| | | int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount()); |
| | | int targetRow; |
| | | if (remainder == 2) { |
| | | targetRow = row - 1; |
| | | } else if (remainder == 3) { |
| | | targetRow = row + 1; |
| | | } else { |
| | | throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙"); |
| | | } |
| | | return zerofill(String.valueOf(targetRow), 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 + "不是浅库位排,系统繁忙"); |
| | | } |
| | | return targetRow; |
| | | } |
| | | |
| | | /** |
| | | * 通过库位号获取 排 |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 当检索到双深库位的浅库位时,如果深库位无货,则放入对应的深库位 |
| | | * 通过库位号获取 排 |
| | | */ |
| | | public static void toDeepIfEmptyByShallow(String shallowLoc) { |
| | | int row = getRow(shallowLoc); |
| | | int remainder = (int) Arith.remainder(row, 4); |
| | | int targetRow = 0; |
| | | if (remainder == 2) { |
| | | targetRow = row - 1; |
| | | } else if (remainder == 3) { |
| | | targetRow = row + 1; |
| | | } else { |
| | | throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙"); |
| | | public static int getBay(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(2, 5)); |
| | | } |
| | | String targetLoc = zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2); |
| | | 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 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); |
| | | |
| | | double[] lev = RingThroughXY(183.0, 1830.0); |
| | | System.out.printf("点的坐标为: (%.2f, %.2f)%n", lev[0], lev[1]); |
| | | } |
| | | |
| | | public static double[] RingThroughXY(double a,double b) { |
| | | // while (true){ |
| | | // if (b>=a){ |
| | | // b=b-a; |
| | | // }else { |
| | | // break; |
| | | // } |
| | | // } |
| | | double l = b/a; |
| | | // 已知数据 |
| | | double circumference = 314; // 圆周长 |
| | | double arcLength = 314*l; // 给出的弧长 |
| | | |
| | | // 计算圆的半径 |
| | | double radius = circumference / (2 * Math.PI); |
| | | |
| | | // 圆心坐标 |
| | | double centerX = 50; |
| | | double centerY = 50; |
| | | |
| | | // 求弧度 |
| | | double theta = arcLength / radius; |
| | | |
| | | // 计算点的坐标 |
| | | double x = 100-(centerX + radius * Math.cos(theta)); |
| | | double y = centerY + radius * Math.sin(theta); |
| | | |
| | | return new double[]{x,y}; |
| | | } |
| | | |
| | | public static double[] RingThroughXYRgv(double a,double b) { |
| | | double l = b / a; |
| | | |
| | | // 圆的已知参数 |
| | | double radius = 47.52; // 半径为48 |
| | | // double circumference = ; // 计算圆周长 |
| | | double arcLength = 2 * Math.PI * radius * l; // 给出的弧长 |
| | | |
| | | // 圆心坐标 |
| | | double centerX = 50; |
| | | double centerY = 50; |
| | | |
| | | // 求弧度 |
| | | double theta = arcLength / radius; |
| | | |
| | | // 计算点的坐标 |
| | | double x = 100-(centerX + radius * Math.cos(theta)); |
| | | double y = centerY + radius * Math.sin(theta); |
| | | |
| | | return new double[]{x, y}; |
| | | } |
| | | |
| | | public static double[] RingThroughXYSta(double a,double b) { |
| | | double l = b / a; |
| | | |
| | | // 圆的已知参数 |
| | | double radius = 50; // 半径为48 |
| | | // double circumference = ; // 计算圆周长 |
| | | double arcLength = 2 * Math.PI * radius * l; // 给出的弧长 |
| | | |
| | | // 圆心坐标 |
| | | double centerX = 55; |
| | | double centerY = 45; |
| | | |
| | | // 求弧度 |
| | | double theta = arcLength / radius; |
| | | |
| | | // 计算点的坐标 |
| | | double x = 100-(centerX + radius * Math.cos(theta)); |
| | | double y = centerY + radius * Math.sin(theta); |
| | | |
| | | return new double[]{x, y}; |
| | | } |
| | | |
| | | public static double[] getRgvPos(double a,double b) { |
| | | // a 是总长度 |
| | | // b 是当前位置 |
| | | |
| | | // 计算点的坐标 |
| | | double x = 0; |
| | | double y = 0; |
| | | if (b > 217480 && b <= 217980) { // 133 站点 217730 |
| | | x = 110; |
| | | y = 878; |
| | | } else if (b > 217980 && b <= 257168) { |
| | | x = 138; |
| | | y = 878; |
| | | } else if (b > 257168 && b <= 257668) { // 132 站点 257418 |
| | | x = 165; |
| | | y = 878; |
| | | } else if (b > 257668 && b <= 276817) { |
| | | x = 193; |
| | | y = 878; |
| | | } else if (b > 276817 && b <= 277317) { // 131 站点 277067 |
| | | x = 220; |
| | | y = 878; |
| | | } else if (b > 277317 && b <= 306570) { |
| | | x = 248; |
| | | y = 878; |
| | | } else if (b > 306570 && b <= 307070) { // 130 站点 306820 |
| | | x = 275; |
| | | y = 878; |
| | | } else if (b > 307070 && b <= 336388) { |
| | | x = 303; |
| | | y = 878; |
| | | } else if (b > 336388 && b <= 336888) { // 129 站点 336638 |
| | | x = 330; |
| | | y = 878; |
| | | } else if (b > 336888 && b <= 366061) { |
| | | x = 358; |
| | | y = 878; |
| | | } else if (b > 366061 && b <= 366561) { // 128 站点 366311 |
| | | x = 385; |
| | | y = 878; |
| | | } else if (b > 366561 && b <= 380856) { |
| | | x = 413; |
| | | y = 878; |
| | | } else if (b > 380856 && b <= 381356) { // 127 站点 381106 |
| | | x = 440; |
| | | y = 878; |
| | | } else if (b > 381356 && b <= 396018) { |
| | | x = 468; |
| | | y = 878; |
| | | } else if (b > 396018 && b <= 396518) { // 126 站点 396268 |
| | | x = 495; |
| | | y = 878; |
| | | } else if (b > 396518 && b <= 425518) { |
| | | x = 523; |
| | | y = 878; |
| | | } else if (b > 425518 && b <= 426018) { // 125 站点 425768 |
| | | x = 550; |
| | | y = 878; |
| | | } else if (b > 426018 && b <= 455264) { |
| | | x = 578; |
| | | y = 878; |
| | | } else if (b > 455264 && b <= 455764) { // 124 站点 455514 |
| | | x = 605; |
| | | y = 878; |
| | | } else if (b > 455764 && b <= 470117) { |
| | | x = 633; |
| | | y = 878; |
| | | } else if (b > 470117 && b <= 470617) { // 123 站点 470367 |
| | | x = 660; |
| | | y = 878; |
| | | } else if (b > 470617 && b <= 484977) { |
| | | x = 688; |
| | | y = 878; |
| | | } else if (b > 484977 && b <= 485477) { // 122 站点 485227 |
| | | x = 715; |
| | | y = 878; |
| | | } else if (b > 485477 && b <= 514662) { |
| | | x = 743; |
| | | y = 878; |
| | | } else if (b > 514662 && b <= 515162) { // 121 站点 514912 |
| | | x = 770; |
| | | y = 878; |
| | | } else if (b > 515162 && b <= 544432) { |
| | | x = 798; |
| | | y = 878; |
| | | } else if (b > 544432 && b <= 544932) { // 120 站点 544682 |
| | | x = 825; |
| | | y = 878; |
| | | } else if (b > 544932 && b <= 559284) { |
| | | x = 853; |
| | | y = 878; |
| | | } else if (b > 559284 && b <= 559784) { // 119 站点 559534 |
| | | x = 880; |
| | | y = 878; |
| | | } else if (b > 559784 && b <= 574073) { |
| | | x = 908; |
| | | y = 878; |
| | | } else if (b > 574073 && b <= 574573) { // 118 站点 574323 |
| | | x = 935; |
| | | y = 878; |
| | | } else if (b > 574573 && b <= 603793) { |
| | | x = 963; |
| | | y = 878; |
| | | } else if (b > 603793 && b <= 604293) { // 117 站点 604043 |
| | | x = 990; |
| | | y = 878; |
| | | } else if (b > 604293 && b <= 633730) { |
| | | x = 1018; |
| | | y = 878; |
| | | } else if (b > 633730 && b <= 634230) { // 116 站点 633980 |
| | | x = 1045; |
| | | y = 878; |
| | | } else if (b > 634230 && b <= 634730) { |
| | | x = 1073; |
| | | y = 878; |
| | | } else if (b > 634730 && b <= 679853) { |
| | | x = 1073; |
| | | y = 878; |
| | | |
| | | } else if (b > 679853 && b <= 680353) { // 116 拐点 680103 |
| | | x = 1115; |
| | | y = 878; |
| | | |
| | | |
| | | } else if (b > 680353 && b <= 731300) { |
| | | x = 1215; |
| | | y = 565; |
| | | |
| | | } else if (b > 731300 && b <= 746783) { // 115 拐点 731550 |
| | | x = 1215; |
| | | y = 775; |
| | | |
| | | } else if (b > 746783 && b <= 762266) { |
| | | x = 1215; |
| | | y = 680; |
| | | } else if (b > 762266 && b <= 777750) { |
| | | x = 1215; |
| | | y = 610; |
| | | |
| | | } else if (b > 777750 && b <= 779750) { |
| | | x = 1215; |
| | | y = 565; |
| | | } else if (b > 779750 && b <= 780250) { // 115 站点 780000 |
| | | x = 1215; |
| | | y = 520; |
| | | } else if (b > 780250 && b <= 799750) { |
| | | x = 1215; |
| | | y = 475; |
| | | } else if (b > 799750 && b <= 800250) { // 114 站点 800000 |
| | | x = 1215; |
| | | y = 430; |
| | | } else if (b > 800250 && b <= 864750) { |
| | | x = 1215; |
| | | y = 385; |
| | | } else if (b > 864750 && b <= 865250) { // 113 站点 865000 |
| | | x = 1215; |
| | | y = 340; |
| | | } else if (b > 856250 && b <= 890750) { |
| | | x = 1215; |
| | | y = 295; |
| | | } else if (b > 890750 && b <= 891250) { // 112 站点 891000 |
| | | x = 1215; |
| | | y = 250; |
| | | } else if (b > 891250 && b <= 972450) { |
| | | x = 1215; |
| | | y = 205; |
| | | } else if (b > 972450 && b <= 972950) { |
| | | x = 1215; |
| | | y = 125; |
| | | |
| | | } else if (b > 972950 && b <= 1016193) { // 顶点 |
| | | x = 1164; |
| | | y = 80; |
| | | } else if (b > 1016193 && b <= 1063563) { |
| | | x = 1115; |
| | | y = 125; |
| | | |
| | | } else if (b > 1063563 && b <= 1064063) { // 111 站点 1063813 |
| | | x = 1115; |
| | | y = 150; |
| | | } else if (b > 1064063 && b <= 1077711) { |
| | | x = 1115; |
| | | y = 175; |
| | | } else if (b > 1077711 && b <= 1078211) { // 110 站点 1077961 |
| | | x = 1115; |
| | | y = 200; |
| | | } else if (b > 1078211 && b <= 1104788) { |
| | | x = 1115; |
| | | y = 225; |
| | | } else if (b > 1104788 && b <= 1105288) { // 109 站点 1105038 |
| | | x = 1115; |
| | | y = 250; |
| | | } else if (b > 1105288 && b <= 1119213) { |
| | | x = 1115; |
| | | y = 275; |
| | | } else if (b > 1119213 && b <= 1119713) { // 108 站点 1119463 |
| | | x = 1115; |
| | | y = 300; |
| | | } else if (b > 1119713 && b <= 1145902) { |
| | | x = 1115; |
| | | y = 325; |
| | | } else if (b > 1145902 && b <= 1146402) { // 107 站点 1146152 |
| | | x = 1115; |
| | | y = 350; |
| | | } else if (b > 1146402 && b <= 1160380) { |
| | | x = 1115; |
| | | y = 375; |
| | | } else if (b > 1160380 && b <= 1160880) { // 106 站点 1160630 |
| | | x = 1115; |
| | | y = 400; |
| | | } else if (b > 1160880 && b <= 1187314) { |
| | | x = 1115; |
| | | y = 425; |
| | | } else if (b > 1187314 && b <= 1187814) { // 105 站点 1187564 |
| | | x = 1115; |
| | | y = 450; |
| | | } else if (b > 1187814 && b <= 1201849) { |
| | | x = 1115; |
| | | y = 475; |
| | | } else if (b > 1201849 && b <= 1202349) { // 104 站点 1202099 |
| | | x = 1115; |
| | | y = 500; |
| | | } else if (b > 1202349 && b <= 1228831) { |
| | | x = 1115; |
| | | y = 525; |
| | | } else if (b > 1228831 && b <= 1229331) { // 103 站点 1229081 |
| | | x = 1115; |
| | | y = 550; |
| | | } else if (b > 1229331 && b <= 1243204) { |
| | | x = 1115; |
| | | y = 575; |
| | | } else if (b > 1243204 && b <= 1243704) { // 102 站点 1243454 |
| | | x = 1115; |
| | | y = 600; |
| | | } else if (b > 1243704 && b <= 1269708) { |
| | | x = 1115; |
| | | y = 625; |
| | | } else if (b > 1269708 && b <= 1284750) { // 101 站点 1269958 |
| | | x = 1115; |
| | | y = 650; |
| | | } else if (b > 1284750 && b <= 1285250) { // 101 拐点 |
| | | x = 1115; |
| | | y = 720; |
| | | |
| | | } else if (b > 1285250 && b <= 1322829) { // 101 拐点 |
| | | x = 1100; |
| | | y = 750; |
| | | |
| | | |
| | | } else if (b > 1322829 && b <= 1323329) { |
| | | x = 1075; |
| | | y = 775; |
| | | } else if (b > 1323329 && b <= 1371551) { |
| | | x = 1025; |
| | | y = 775; |
| | | } else if (b > 1371551 && b <= 1372051) { |
| | | x = 975; |
| | | y = 775; |
| | | } else if (b > 1372051 && b <= 1420273) { |
| | | x = 925; |
| | | y = 775; |
| | | } else if (b > 1420273 && b <= 1420773) { |
| | | x = 875; |
| | | y = 775; |
| | | } else if (b > 1420773 && b <= 1468995) { |
| | | x = 825; |
| | | y = 775; |
| | | } else if (b > 1468995 && b <= 1469495) { |
| | | x = 775; |
| | | y = 650; |
| | | } else if (b > 1469495 && b <= 1517717) { |
| | | x = 725; |
| | | y = 650; |
| | | } else if (b > 1517717 && b <= 1518217) { |
| | | x = 675; |
| | | y = 775; |
| | | } else if (b > 1566439 && b <= 1566939) { |
| | | x = 575; |
| | | y = 775; |
| | | } else if (b > 1566939 && b <= 1614661) { |
| | | x = 525; |
| | | y = 775; |
| | | } else if (b > 1614661 && b <= 1615161) { |
| | | x = 475; |
| | | y = 775; |
| | | } else if (b > 1615161 && b <= 1662883) { |
| | | x = 425; |
| | | y = 775; |
| | | } else if (b > 1662883 && b <= 1663383) { |
| | | x = 375; |
| | | y = 775; |
| | | } else if (b > 1663383 && b <= 1711105) { |
| | | x = 325; |
| | | y = 775; |
| | | } else if (b > 1711105 && b <= 1711605) { |
| | | x = 275; |
| | | y = 775; |
| | | } else if (b > 1711605 && b <= 1736500) { |
| | | x = 225; |
| | | y = 775; |
| | | } else if (b > 1736500 && b <= 1737000) { |
| | | x = 175; |
| | | y = 775; |
| | | } else if (b > 0 && b <= 47822) { |
| | | x = 125; |
| | | y = 775; |
| | | } else if (b > 47822 && b <= 73050) { |
| | | x = 75; |
| | | y = 775; |
| | | } else if (b > 73050 && b <= 73550) { |
| | | x = 65; |
| | | y = 775; |
| | | |
| | | |
| | | } else if (b > 134400 && b <= 134900) { |
| | | x = 25; |
| | | y = 830; |
| | | } else if (b > 134900 && b <= 196000) { |
| | | x = 65; |
| | | y = 878; |
| | | } else if (b > 196000 && b <= 217480) { |
| | | x = 83; |
| | | y = 878; |
| | | } |
| | | |
| | | |
| | | |
| | | return new double[]{x, y}; |
| | | } |
| | | |
| | | } |