| | |
| | | } |
| | | |
| | | //获取最近并在当前位置前边的位置 |
| | | public static Integer LatelyAndLessThan(List<BasDevpPosition> devpPosition, long nowPosition){ |
| | | public static Integer LatelyAndLessThan(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | Integer result = 0; |
| | | long Difference = 1737000L; |
| | | long Difference = perimeter; |
| | | for (BasDevpPosition positions : devpPosition){ |
| | | Long position = positions.getPlcPosition(); |
| | | if (position<=nowPosition){ |
| | |
| | | result = positions.getDevNo(); |
| | | } |
| | | } else { |
| | | if ((nowPosition-(position - 1737000L)) < Difference){ |
| | | Difference = nowPosition-(position - 1737000L); |
| | | if ((nowPosition-(position - perimeter)) < Difference){ |
| | | Difference = nowPosition-(position - perimeter); |
| | | result = positions.getDevNo(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //获取最近并在当前位置后边的位置 |
| | | public static Integer LatelyAndLessThanWcs(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | Integer result = 0; |
| | | Integer integer = LatelyAndLessThan(devpPosition, nowPosition,perimeter); |
| | | for (BasDevpPosition basDevpPosition:devpPosition){ |
| | | if (basDevpPosition.getDevNo().equals(integer)){ |
| | | if (basDevpPosition.getDevNo() == 101){ |
| | | result = 133; |
| | | } |
| | | break; |
| | | } |
| | | result = basDevpPosition.getDevNo(); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | // } |
| | | |
| | | //获取最近并在当前位置后边的位置 |
| | | public static Integer LatelyAndGreaterThan(List<List<Long>> sitePosition, long nowPosition){ |
| | | public static Integer LatelyAndGreaterThan(List<List<Long>> sitePosition, long nowPosition ,long perimeter){ |
| | | int result = 0; |
| | | long Difference = 1737000L; |
| | | long Difference = perimeter; |
| | | for (List<Long> rgvPositions: sitePosition){ |
| | | Long position = rgvPositions.get(1); |
| | | if (position>nowPosition){ |
| | |
| | | result = rgvPositions.get(0).intValue(); |
| | | } |
| | | } else { |
| | | if ((1737000L - (nowPosition - position)) < Difference){ |
| | | Difference = 1737000L - (nowPosition - position); |
| | | if ((perimeter - (nowPosition - position)) < Difference){ |
| | | Difference = perimeter - (nowPosition - position); |
| | | result = rgvPositions.get(0).intValue(); |
| | | } |
| | | } |