|
@@ -31,6 +31,8 @@ public class RouteItem implements Serializable {
|
|
|
private String name;
|
|
private String name;
|
|
|
// 触发点位置
|
|
// 触发点位置
|
|
|
private BigDecimal trigPosition;
|
|
private BigDecimal trigPosition;
|
|
|
|
|
+ // 进路方向
|
|
|
|
|
+ private DirectionEnum direction;
|
|
|
// 进路状态
|
|
// 进路状态
|
|
|
private RouteStatusEnum routeStatus;
|
|
private RouteStatusEnum routeStatus;
|
|
|
// 下一条进路Id
|
|
// 下一条进路Id
|
|
@@ -47,6 +49,7 @@ public class RouteItem implements Serializable {
|
|
|
this.id = route.getId();
|
|
this.id = route.getId();
|
|
|
this.name = route.getName();
|
|
this.name = route.getName();
|
|
|
this.trigPosition = route.getTrigPosition();
|
|
this.trigPosition = route.getTrigPosition();
|
|
|
|
|
+ this.direction = route.getDirection();
|
|
|
this.routeStatus = RouteStatusEnum.IDLE;
|
|
this.routeStatus = RouteStatusEnum.IDLE;
|
|
|
this.nextId = route.getNextId();
|
|
this.nextId = route.getNextId();
|
|
|
this.switchStateMap = route.getSwitchMap();
|
|
this.switchStateMap = route.getSwitchMap();
|
|
@@ -69,24 +72,53 @@ public class RouteItem implements Serializable {
|
|
|
return this.getSelectionList().stream().map(SelectionEntity::getId).collect(Collectors.toCollection(LinkedList::new));
|
|
return this.getSelectionList().stream().map(SelectionEntity::getId).collect(Collectors.toCollection(LinkedList::new));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean isContain(Long selectionId) {
|
|
|
|
|
- return this.getSelectionIds().contains(selectionId);
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param kilometer 公里标
|
|
|
|
|
+ * @param direction 方向
|
|
|
|
|
+ * @return 公里标是否在当前进路中
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean isContain(BigDecimal kilometer, DirectionEnum direction) {
|
|
|
|
|
+ if (this.getDirection() != direction) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return NumberUtil.isContain(kilometer, this.getHeadKilometer(), this.getTailKilometer());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean isTrigger(BigDecimal kilometer, DirectionEnum direction) {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param tailKilometer 公里标
|
|
|
|
|
+ * @param direction 方向
|
|
|
|
|
+ * @return 是否已经通过当前进路
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean isPass(BigDecimal headKilometer, BigDecimal tailKilometer, DirectionEnum direction) {
|
|
|
|
|
+ if (isContain(headKilometer, direction)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isContain(tailKilometer, direction)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
return switch (direction) {
|
|
return switch (direction) {
|
|
|
- case UP -> NumberUtil.isContain(kilometer, this.getHeadKilometer(), this.getTrigPosition());
|
|
|
|
|
- case DOWN -> NumberUtil.isContain(kilometer, this.getTrigPosition(), this.getTailKilometer());
|
|
|
|
|
|
|
+ // 上行 车尾 <= 进路的开始里程
|
|
|
|
|
+ case UP -> NumberUtil.isLessOrEqual(tailKilometer, this.getHeadKilometer());
|
|
|
|
|
+ // 下行 车位 > 进路的结束里程
|
|
|
|
|
+ case DOWN -> NumberUtil.isGreater(tailKilometer, this.getTailKilometer());
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean isPass(BigDecimal tailKilometer, DirectionEnum direction) {
|
|
|
|
|
|
|
+ // 是否触发下一个进路
|
|
|
|
|
+ public boolean isTrigger(BigDecimal kilometer, DirectionEnum direction) {
|
|
|
|
|
+ if (!isContain(kilometer, direction)) {
|
|
|
|
|
+ // 车头不在进路中,直接返回false
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
return switch (direction) {
|
|
return switch (direction) {
|
|
|
- case UP -> NumberUtil.isLessOrEqual(tailKilometer, this.getHeadKilometer());
|
|
|
|
|
- case DOWN -> NumberUtil.isGreater(tailKilometer, this.getTailKilometer());
|
|
|
|
|
|
|
+ // 上行 进路开始公里数 <= 车头公里数 <= 触发点公里数
|
|
|
|
|
+ case UP -> NumberUtil.isIn(kilometer, this.getHeadKilometer(), this.getTrigPosition());
|
|
|
|
|
+ // 下行 触发点公里数 <= 车头公里数 <= 进路结束公里数
|
|
|
|
|
+ case DOWN -> NumberUtil.isIn(kilometer, this.getTrigPosition(), this.getTailKilometer());
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// 是否包含道岔
|
|
// 是否包含道岔
|
|
|
public boolean isEmptySwitch() {
|
|
public boolean isEmptySwitch() {
|
|
|
return this.getSwitchStateMap().isEmpty();
|
|
return this.getSwitchStateMap().isEmpty();
|
|
@@ -95,8 +127,5 @@ public class RouteItem implements Serializable {
|
|
|
// 改变状态
|
|
// 改变状态
|
|
|
public void setStatus(RouteStatusEnum status){
|
|
public void setStatus(RouteStatusEnum status){
|
|
|
this.routeStatus = status;
|
|
this.routeStatus = status;
|
|
|
- for (SelectionEntity selectionEntity : this.getSelectionList()) {
|
|
|
|
|
- selectionEntity.setStatus(status);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|