package com.zy.asrs.utils;
|
|
import com.core.common.Arith;
|
import com.core.common.Cools;
|
import com.zy.core.properties.SlaveProperties;
|
|
import java.text.DecimalFormat;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* Created by vincent on 2020/8/27
|
*/
|
public class Utils {
|
|
private static final DecimalFormat fmt = new DecimalFormat("##0.00");
|
|
public static float scale(Float f){
|
if (f == null || f == 0f || Float.isNaN(f)) {
|
return 0f;
|
}
|
return (float) Arith.multiplys(2, f, 1);
|
}
|
|
/**
|
* 通过库位号获取 排
|
*/
|
public static int getRow(String locNo) {
|
if (!Cools.isEmpty(locNo)) {
|
return Integer.parseInt(locNo.substring(0, 2));
|
}
|
throw new RuntimeException("库位解析异常");
|
}
|
|
/**
|
* 通过库位号获取 排
|
*/
|
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 main(String[] args) {
|
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 = 882;
|
} else if (b > 217980 && b <= 227777) {
|
x = 121;
|
y = 882;
|
} else if (b > 227777 && b <= 237574) {
|
x = 132;
|
y = 882;
|
} else if (b > 237574 && b <= 247371) {
|
x = 143;
|
y = 882;
|
} else if (b > 247371 && b <= 257168) {
|
x = 154;
|
y = 882;
|
} else if (b > 257168 && b <= 257668) { // 132 站点 257418
|
x = 165;
|
y = 882;
|
} else if (b > 257668 && b <= 262455) {
|
x = 176;
|
y = 882;
|
} else if (b > 262455 && b <= 267242) {
|
x = 187;
|
y = 882;
|
} else if (b > 267242 && b <= 272029) {
|
x = 198;
|
y = 882;
|
} else if (b > 272029 && b <= 276817) {
|
x = 209;
|
y = 882;
|
} else if (b > 276817 && b <= 277317) { // 131 站点 277067
|
x = 220;
|
y = 882;
|
} else if (b > 277317 && b <= 284630) {
|
x = 231;
|
y = 882;
|
} else if (b > 284630 && b <= 291943) {
|
x = 242;
|
y = 882;
|
} else if (b > 291943 && b <= 299256) {
|
x = 253;
|
y = 882;
|
} else if (b > 299256 && b <= 306570) {
|
x = 264;
|
y = 882;
|
} else if (b > 306570 && b <= 307070) { // 130 站点 306820
|
x = 275;
|
y = 882;
|
} else if (b > 307070 && b <= 314399) {
|
x = 286;
|
y = 882;
|
} else if (b > 314399 && b <= 321729) {
|
x = 297;
|
y = 882;
|
} else if (b > 321729 && b <= 329058) {
|
x = 308;
|
y = 882;
|
} else if (b > 329058 && b <= 336388) {
|
x = 319;
|
y = 882;
|
} else if (b > 336388 && b <= 336888) { // 129 站点 336638
|
x = 330;
|
y = 882;
|
} else if (b > 336888 && b <= 344181) {
|
x = 341;
|
y = 882;
|
} else if (b > 344181 && b <= 351474) {
|
x = 352;
|
y = 882;
|
} else if (b > 257168 && b <= 358767) {
|
x = 363;
|
y = 882;
|
} else if (b > 358767 && b <= 366061) {
|
x = 374;
|
y = 882;
|
} else if (b > 366061 && b <= 366561) { // 128 站点 366311
|
x = 385;
|
y = 882;
|
} else if (b > 366561 && b <= 370134) {
|
x = 396;
|
y = 882;
|
} else if (b > 370134 && b <= 373708) {
|
x = 407;
|
y = 882;
|
} else if (b > 373708 && b <= 377282) {
|
x = 418;
|
y = 882;
|
} else if (b > 377282 && b <= 380856) {
|
x = 429;
|
y = 882;
|
} else if (b > 380856 && b <= 381356) { // 127 站点 381106
|
x = 440;
|
y = 882;
|
} else if (b > 381356 && b <= 385021) {
|
x = 451;
|
y = 882;
|
} else if (b > 385021 && b <= 388687) {
|
x = 462;
|
y = 882;
|
} else if (b > 388687 && b <= 392352) {
|
x = 473;
|
y = 882;
|
} else if (b > 392352 && b <= 396018) {
|
x = 484;
|
y = 882;
|
} else if (b > 396018 && b <= 396518) { // 126 站点 396268
|
x = 495;
|
y = 882;
|
} else if (b > 396518 && b <= 403768) {
|
x = 506;
|
y = 882;
|
} else if (b > 403768 && b <= 411018) {
|
x = 517;
|
y = 882;
|
} else if (b > 411018 && b <= 418268) {
|
x = 528;
|
y = 882;
|
} else if (b > 418268 && b <= 425518) {
|
x = 539;
|
y = 882;
|
} else if (b > 425518 && b <= 426018) { // 125 站点 425768
|
x = 550;
|
y = 882;
|
} else if (b > 426018 && b <= 433329) {
|
x = 561;
|
y = 882;
|
} else if (b > 433329 && b <= 440641) {
|
x = 572;
|
y = 882;
|
} else if (b > 440641 && b <= 447952) {
|
x = 583;
|
y = 882;
|
} else if (b > 426018 && b <= 455264) {
|
x = 594;
|
y = 882;
|
} else if (b > 455264 && b <= 455764) { // 124 站点 455514
|
x = 605;
|
y = 882;
|
} else if (b > 455764 && b <= 459352) {
|
x = 616;
|
y = 882;
|
} else if (b > 459352 && b <= 462940) {
|
x = 627;
|
y = 882;
|
} else if (b > 462940 && b <= 466528) {
|
x = 638;
|
y = 882;
|
} else if (b > 466528 && b <= 470117) {
|
x = 649;
|
y = 882;
|
} else if (b > 470117 && b <= 470617) { // 123 站点 470367
|
x = 660;
|
y = 882;
|
} else if (b > 470617 && b <= 474207) {
|
x = 671;
|
y = 882;
|
} else if (b > 474207 && b <= 477797) {
|
x = 682;
|
y = 882;
|
} else if (b > 477797 && b <= 481387) {
|
x = 693;
|
y = 882;
|
} else if (b > 481387 && b <= 484977) {
|
x = 704;
|
y = 882;
|
} else if (b > 484977 && b <= 485477) { // 122 站点 485227
|
x = 715;
|
y = 882;
|
} else if (b > 485477 && b <= 492773) {
|
x = 726;
|
y = 882;
|
} else if (b > 492773 && b <= 500069) {
|
x = 737;
|
y = 882;
|
} else if (b > 500069 && b <= 507365) {
|
x = 748;
|
y = 882;
|
} else if (b > 507365 && b <= 514662) {
|
x = 759;
|
y = 882;
|
} else if (b > 514662 && b <= 515162) { // 121 站点 514912
|
x = 770;
|
y = 882;
|
} else if (b > 515162 && b <= 522479) {
|
x = 781;
|
y = 882;
|
} else if (b > 522479 && b <= 529797) {
|
x = 792;
|
y = 882;
|
} else if (b > 529797 && b <= 537114) {
|
x = 803;
|
y = 882;
|
} else if (b > 537114 && b <= 544432) {
|
x = 814;
|
y = 882;
|
} else if (b > 544432 && b <= 544932) { // 120 站点 544682
|
x = 825;
|
y = 882;
|
} else if (b > 544932 && b <= 548520) {
|
x = 836;
|
y = 882;
|
} else if (b > 548520 && b <= 552108) {
|
x = 847;
|
y = 882;
|
} else if (b > 552108 && b <= 555696) {
|
x = 858;
|
y = 882;
|
} else if (b > 555696 && b <= 559284) {
|
x = 869;
|
y = 882;
|
} else if (b > 559284 && b <= 559784) { // 119 站点 559534
|
x = 880;
|
y = 882;
|
} else if (b > 559784 && b <= 563356) {
|
x = 891;
|
y = 882;
|
} else if (b > 563356 && b <= 566928) {
|
x = 908;
|
y = 882;
|
} else if (b > 566928 && b <= 570500) {
|
x = 919;
|
y = 882;
|
} else if (b > 570500 && b <= 574073) {
|
x = 930;
|
y = 882;
|
} else if (b > 574073 && b <= 574573) { // 118 站点 574323
|
x = 941;
|
y = 882;
|
} else if (b > 574573 && b <= 581878) {
|
x = 952;
|
y = 882;
|
} else if (b > 581878 && b <= 589183) {
|
x = 963;
|
y = 882;
|
} else if (b > 589183 && b <= 596488) {
|
x = 974;
|
y = 882;
|
} else if (b > 596488 && b <= 603793) {
|
x = 985;
|
y = 882;
|
} else if (b > 603793 && b <= 604293) { // 117 站点 604043
|
x = 996;
|
y = 882;
|
} else if (b > 604293 && b <= 611652) {
|
x = 1007;
|
y = 882;
|
} else if (b > 611652 && b <= 619011) {
|
x = 1018;
|
y = 882;
|
} else if (b > 619011 && b <= 626370) {
|
x = 1029;
|
y = 882;
|
} else if (b > 626370 && b <= 633730) {
|
x = 1;
|
y = 882;
|
} else if (b > 633730 && b <= 634230) { // 116 站点 633980
|
x = 1040;
|
y = 882;
|
} else if (b > 634230 && b <= 641833) {
|
x = 1050;
|
y = 882;
|
} else if (b > 641833 && b <= 649437) {
|
x = 1060;
|
y = 882;
|
} else if (b > 649437 && b <= 657041) {
|
x = 1070;
|
y = 882;
|
} else if (b > 657041 && b <= 664645) {
|
x = 1080;
|
y = 882;
|
} else if (b > 664645 && b <= 672249) {
|
x = 1090;
|
y = 882;
|
} else if (b > 672249 && b <= 679853) {
|
x = 1100;
|
y = 882;
|
|
} else if (b > 679853 && b <= 680353) { // 116 拐点 680103
|
x = 1115;
|
y = 882;
|
|
|
} else if (b > 680353 && b <= 685447) {
|
x = 1125;
|
y = 882;
|
} else if (b > 685447 && b <= 690542) {
|
x = 1125;
|
y = 880;
|
} else if (b > 690542 && b <= 695637) {
|
x = 1135;
|
y = 878;
|
} else if (b > 695637 && b <= 700731) {
|
x = 1145;
|
y = 877;
|
} else if (b > 700731 && b <= 705826) {
|
x = 1155;
|
y = 875;
|
} else if (b > 705826 && b <= 710921) {
|
x = 1190;
|
y = 855;
|
} else if (b > 710921 && b <= 716015) {
|
x = 1200;
|
y = 840;
|
} else if (b > 716015 && b <= 721110) {
|
x = 1210;
|
y = 820;
|
} else if (b > 721110 && b <= 726205) {
|
x = 1215;
|
y = 800;
|
} else if (b > 726205 && b <= 746783) { // 115 拐点 731550
|
x = 1215;
|
y = 775;
|
|
} else if (b > 746783 && b <= 750168) {
|
x = 1215;
|
y = 770;
|
} else if (b > 750168 && b <= 753554) {
|
x = 1215;
|
y = 735;
|
|
} else if (b > 753554 && b <= 756940) {
|
x = 1215;
|
y = 700;
|
} else if (b > 756940 && b <= 760326) {
|
x = 1215;
|
y = 665;
|
} else if (b > 760326 && b <= 763712) {
|
x = 1215;
|
y = 630;
|
} else if (b > 763712 && b <= 767098) {
|
x = 1215;
|
y = 595;
|
} else if (b > 767098 && b <= 770484) {
|
x = 1215;
|
y = 560;
|
} else if (b > 770484 && b <= 773870) {
|
x = 1215;
|
y = 535;
|
} else if (b > 773870 && b <= 774370) { // 115 站点 774120
|
x = 1215;
|
y = 520;
|
} else if (b > 774370 && b <= 780052) {
|
x = 1215;
|
y = 502;
|
} else if (b > 780052 && b <= 785735) {
|
x = 1215;
|
y = 484;
|
} else if (b > 785735 && b <= 791417) {
|
x = 1215;
|
y = 466;
|
} else if (b > 791417 && b <= 797100) {
|
x = 1215;
|
y = 448;
|
} else if (b > 797100 && b <= 797600) { // 114 站点 797100
|
x = 1215;
|
y = 430;
|
} else if (b > 797600 && b <= 815742) {
|
x = 1215;
|
y = 412;
|
} else if (b > 815742 && b <= 833885) {
|
x = 1215;
|
y = 394;
|
} else if (b > 833885 && b <= 852027) {
|
x = 1215;
|
y = 376;
|
} else if (b > 852027 && b <= 870170) {
|
x = 1215;
|
y = 358;
|
} else if (b > 870170 && b <= 870670) { // 113 站点 870420
|
x = 1215;
|
y = 340;
|
} else if (b > 870670 && b <= 877815) {
|
x = 1215;
|
y = 322;
|
} else if (b > 877815 && b <= 884960) {
|
x = 1215;
|
y = 304;
|
} else if (b > 884960 && b <= 892105) {
|
x = 1215;
|
y = 286;
|
} else if (b > 892105 && b <= 899250) {
|
x = 1215;
|
y = 268;
|
} else if (b > 899250 && b <= 899750) { // 112 站点 899500
|
x = 1215;
|
y = 250;
|
} else if (b > 899750 && b <= 914290) {
|
x = 1215;
|
y = 225;
|
} else if (b > 914290 && b <= 928830) {
|
x = 1215;
|
y = 200;
|
} else if (b > 928830 && b <= 943370) {
|
x = 1215;
|
y = 175;
|
} else if (b > 943370 && b <= 957910) {
|
x = 1215;
|
y = 150;
|
} 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 <= 1188214) { // 105 站点 1187564
|
x = 1115;
|
y = 450;
|
} else if (b > 1188214 && 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 <= 1737000){
|
double unit = (1737000 - 1322829) / 100.0;
|
double startX = 1090;
|
double unitX = 7;
|
y = 775;
|
|
for (int i = 0; i < 100; i++) {
|
if (b > 1322829 + i * unit && b <= 1322829 + (i + 1) * unit) {
|
x = startX - i * unitX;
|
}
|
}
|
|
} else if (b >= 0 && b <= 134400){
|
double unit = 134400 / 41.0;
|
double startX = 390;
|
double unitX = 8.17;
|
y = 775;
|
|
for (int i = 0; i < 41; i++) {
|
if (b >= 0 + i * unit && b <= 0 + (i + 1) * unit) {
|
x = startX - i * unitX;
|
}
|
}
|
} else if (b > 134400 && b <= 134900) {
|
x = 25;
|
y = 830;
|
} else if (b > 134900 && b <= 196000) {
|
x = 65;
|
y = 882;
|
} else if (b > 196000 && b <= 217480) {
|
x = 83;
|
y = 882;
|
}
|
|
|
|
return new double[]{x, y};
|
}
|
|
}
|