From 2d69236d4361213ebd98b57aca4f36b6d299754f Mon Sep 17 00:00:00 2001 From: LSH Date: 星期三, 15 十一月 2023 09:09:22 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/utils/RouteUtils.java | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zy/asrs/utils/RouteUtils.java b/src/main/java/com/zy/asrs/utils/RouteUtils.java index 90cbf42..d0514e8 100644 --- a/src/main/java/com/zy/asrs/utils/RouteUtils.java +++ b/src/main/java/com/zy/asrs/utils/RouteUtils.java @@ -12,11 +12,11 @@ // 姝e簭 public static final List<Integer> TRACK_POSITION_POSITIVE_SEQUENCE = new ArrayList<Integer>() {{ - add(1);add(2);add(3);add(4);add(5);add(6);add(7);add(8);add(9);add(10);add(11);add(12); + add(101);add(102);add(104);add(105);add(107);add(118);add(108);add(119);add(110);add(120);add(111);add(121);add(113);add(114);add(116);add(117); }}; // 鍙嶅簭 public static final List<Integer> TRACK_POSITION_REVERSE_SEQUENCE = new ArrayList<Integer>() {{ - add(12);add(11);add(10);add(9);add(8);add(7);add(6);add(5);add(4);add(3);add(2);add(1); + add(117);add(116);add(114);add(113);add(121);add(111);add(120);add(110);add(119);add(108);add(118);add(107);add(105);add(104);add(102);add(101); }}; public static String zerofill(String msg, Integer count){ @@ -35,9 +35,9 @@ // 鑾峰彇褰撳墠灏忚溅鏈璧扮殑璺嚎闆嗗悎 public static List<Integer> getRoute(Integer groupStart,Integer groupEnd){ - boolean sign = groupStart < groupEnd; + boolean sign = TRACK_POSITION_POSITIVE_SEQUENCE.indexOf(groupStart) < TRACK_POSITION_POSITIVE_SEQUENCE.indexOf(groupEnd); List<Integer> result = new ArrayList<>(); - List<Integer> groupRoute = null; + List<Integer> groupRoute = new ArrayList<>(); if (sign){ groupRoute = TRACK_POSITION_POSITIVE_SEQUENCE; }else { @@ -97,9 +97,21 @@ } } + /* + * a 灏忚溅褰撳墠浣嶇疆 + * b 灏忚溅浠诲姟寮�濮嬩綅缃� + * c 灏忚溅浠诲姟缁撴潫浣嶇疆 + * sign 鍙︿竴涓皬杞︾┖闂叉爣璁� + * */ + public static boolean RouteAutoBoolean(Integer a,Integer b,Integer c,Integer aa,Integer bb,Integer cc,boolean idleOther){ + List<Integer> routeCurrent = getRouteIntersection(getRoute(a, c), getRoute(b, c), RouteCollectCountType.DEDUPLICATIONUNION);//骞堕泦 + List<Integer> routeOther = getRouteIntersection(getRoute(aa, cc), getRoute(bb, cc), RouteCollectCountType.DEDUPLICATIONUNION);// + return !getRouteBoolean(routeCurrent, routeOther); //鏄惁鏈変氦闆� + } + public static void main(String[] arge){ - List<Integer> routeCurrent = getRoute(2, 9); //鑾峰彇褰撳墠灏忚溅璺緞 - List<Integer> routeOther = getRoute(12, 5); //鑾峰彇鍏跺畠灏忚溅璺緞 + List<Integer> routeCurrent = getRoute(104, 119); //鑾峰彇褰撳墠灏忚溅璺緞 + List<Integer> routeOther = getRoute(117, 118); //鑾峰彇鍏跺畠灏忚溅璺緞 System.out.println("褰撳墠灏忚溅璺緞:\t"+routeCurrent); System.out.println("鍏跺畠灏忚溅璺緞:\t"+routeOther); @@ -117,6 +129,8 @@ List<Integer> routeIntersection3 = getRouteIntersection(routeCurrent, routeOther, RouteCollectCountType.DEDUPLICATIONUNION);//鍘婚噸骞堕泦 System.out.println("璺緞鍘婚噸骞堕泦锛歕t"+routeIntersection3); + + System.out.println(RouteAutoBoolean(101,104,119,114,116,120,true)); } } -- Gitblit v1.9.1