跳站功能
This commit is contained in:
@@ -209,6 +209,15 @@ object LineModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun isPreLastStation(): Boolean? {
|
||||
return if (stationList.isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
// startStationIndex == stationList!!.size - 1
|
||||
startStationIndex == getLastStationPos(stationList!!)-1
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLastStationPos(stationList: MutableList<BusStationBean>): Int {
|
||||
for (index in stationList.indices.reversed()) {
|
||||
val item = stationList[index]
|
||||
|
||||
@@ -125,7 +125,7 @@ object OrderModel {
|
||||
private val ochAutopilotStatusListener = object : IOchAutopilotStatusListener {
|
||||
override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation?) {
|
||||
e(TAG, "行程日志-onAutopilotArriveAtStation arrive")
|
||||
onArriveAt(arrivedStation, "底盘触发进站")
|
||||
onArriveAt(arrivedStation, "底盘触发进站",false)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,7 +143,7 @@ object OrderModel {
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
if (isGoingToNextStation && !isArrivedStation) {
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
onArriveAt(null, "兜底:距离站点15m内 每秒钟向底盘查询是否到站 底盘返回")
|
||||
onArriveAt(null, "兜底:距离站点15m内 每秒钟向底盘查询是否到站 底盘返回",false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ object OrderModel {
|
||||
* @param data
|
||||
*/
|
||||
@JvmStatic
|
||||
fun onArriveAt(data: ArrivedStation?, type: String) {
|
||||
fun onArriveAt(data: ArrivedStation?, type: String,skipStation:Boolean) {
|
||||
if (LineManager.getStations().second == null) {
|
||||
e(TAG, "行程日志-到站异常,取消后续操作结束")
|
||||
OchChainLogManager.writeChainLog("shuttle弱网", "$type 行程日志-到站异常,取消后续操作结束")
|
||||
@@ -508,6 +508,9 @@ object OrderModel {
|
||||
}
|
||||
LineModel.arrivedStationSuccess()
|
||||
updateBusStatus()
|
||||
if(skipStation) {
|
||||
driveToNextStation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
@@ -531,6 +534,9 @@ object OrderModel {
|
||||
}
|
||||
LineModel.arrivedStationSuccess()
|
||||
updateBusStatus()
|
||||
if(skipStation) {
|
||||
driveToNextStation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
|
||||
fun arriveStation() {
|
||||
OrderModel.onArriveAt(null, "页面触发到站")
|
||||
OrderModel.onArriveAt(null, "页面触发到站",false)
|
||||
}
|
||||
|
||||
override fun onArriveStationSuccess() {
|
||||
@@ -80,5 +80,12 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
OrderModel.completeTask(false)
|
||||
}
|
||||
|
||||
fun skipStation() {
|
||||
if (LineModel.isLastStation() == true) {
|
||||
return
|
||||
}
|
||||
OrderModel.onArriveAt(null, "页面挑站触发到站",true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,12 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
|
||||
})
|
||||
unmanned_actv_arriver_station.onClick {
|
||||
unmanned_loading_arrive_station.visibility = VISIBLE
|
||||
viewModel?.arriveStation()
|
||||
if(LineModel.isPreLastStation()==true){
|
||||
viewModel?.arriveStation()
|
||||
}else{
|
||||
viewModel?.skipStation()
|
||||
}
|
||||
|
||||
}
|
||||
unmanned_actv_complete_task.onClick {
|
||||
CallerLogger.d(TAG, "启动自驾参数:${LineManager.initAutopilotControlParameters()}")
|
||||
@@ -176,5 +181,10 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
|
||||
private fun showArriverStationAndCompleteTask() {
|
||||
unmanned_aciv_task_leave_station_slide_bg.visibility = INVISIBLE
|
||||
unmanned_task_running_layout_btn.visibility = VISIBLE
|
||||
if(LineModel.isPreLastStation()==true){
|
||||
unmanned_actv_arriver_station.text = StringUtils.getString(R.string.unmanned_bus_running_task_arrive_station)
|
||||
}else{
|
||||
unmanned_actv_arriver_station.text = StringUtils.getString(R.string.unmanned_bus_running_task_jump_station)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/unmanned_bus_switch_task_selector"
|
||||
android:gravity="center"
|
||||
android:text="@string/unmanned_bus_running_task_arrive_station"
|
||||
android:text="@string/unmanned_bus_running_task_jump_station"
|
||||
android:textColor="@color/unmanned_bus_task_submit_text_color_selector"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<resources>
|
||||
<string name="unmanned_bus_switch_line_title">Please select task</string>
|
||||
<string name="unmanned_bus_running_task_arrive_station">Skip a Stop</string>
|
||||
<string name="unmanned_bus_running_task_jump_station">Skip a Stop</string>
|
||||
<string name="unmanned_bus_running_task_arrive_station">Arrived at Stop</string>
|
||||
<string name="unmanned_bus_running_task_complete">Complete</string>
|
||||
<string name="unmanned_bus_switch_task_submit">Confirm Schedule</string>
|
||||
<string name="unmanned_bus_switch_task_cancle">Return</string>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<resources>
|
||||
<string name="unmanned_bus_switch_line_title">请选择任务</string>
|
||||
<string name="unmanned_bus_running_task_arrive_station">跳站</string>
|
||||
<string name="unmanned_bus_running_task_jump_station">跳站</string>
|
||||
<string name="unmanned_bus_running_task_arrive_station">到站</string>
|
||||
<string name="unmanned_bus_running_task_complete">结束</string>
|
||||
<string name="unmanned_bus_switch_task_submit">确认班次</string>
|
||||
<string name="unmanned_bus_switch_task_cancle">返回</string>
|
||||
|
||||
Reference in New Issue
Block a user