[8.5.0]
[完整的跳站功能]
This commit is contained in:
@@ -109,7 +109,7 @@ object DebugDataDispatch {
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmMessage" --es message "前方100米有道路施工,施工长度100米,影响第1、2车道通行。" --ei id 128 --ef time 1880.0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmImage" --ef time 1880.0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stationMedia"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stationMedia" --ei startType 0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "startAutopilot" --ei startType 0
|
||||
|
||||
// adb shell am broadcast -a com.hmi.v2x.trafficlight -f 0x011000000 --ei trafficLightCheckType 1 --ei trafficLightCountDown 0 --ez trafficLightIsShow true // 红绿灯
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.amap.api.navi.AMapNaviView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/amapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
@@ -214,7 +214,7 @@ object LineModel {
|
||||
null
|
||||
} else {
|
||||
// startStationIndex == stationList!!.size - 1
|
||||
startStationIndex == getLastStationPos(stationList!!)-1
|
||||
nextStationIndex == getLastStationPos(stationList!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,13 +269,15 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
private fun onStartAutopilot(taskId: Long?) {
|
||||
private fun onStartAutopilot() {
|
||||
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||
isGoingToNextStation = true
|
||||
if (CallerTaskListenerManager.isCarRunningTask()) {
|
||||
LineManager.unmanneAutopilotContinue(false)
|
||||
d(TAG, "启动自驾:继续启动自驾")
|
||||
}else{
|
||||
LineManager.unmannedStartAutopilot(true)
|
||||
d(TAG, "启动自驾:下发轨迹启动自驾")
|
||||
}
|
||||
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
@@ -344,7 +346,7 @@ object OrderModel {
|
||||
}
|
||||
LineModel.leaveStationSuccess()
|
||||
isArrivedStation = false
|
||||
onStartAutopilot(task.taskId)
|
||||
onStartAutopilot()
|
||||
|
||||
ThirdDeviceData.leaveStation()
|
||||
|
||||
@@ -362,7 +364,7 @@ object OrderModel {
|
||||
if (data) {
|
||||
LineModel.leaveStationSuccess()
|
||||
isArrivedStation = false
|
||||
onStartAutopilot(task.taskId)
|
||||
onStartAutopilot()
|
||||
|
||||
ThirdDeviceData.leaveStation()
|
||||
|
||||
@@ -581,6 +583,88 @@ object OrderModel {
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun skipNextStation() {
|
||||
// 手动点击到站
|
||||
LineManager.getStations { start, end ->
|
||||
|
||||
if (isArrivedStation || end.siteId == LineManager.lastArrivedSiteId) return@getStations
|
||||
|
||||
OchChainLogManager.writeChainLog("触发跳站", "点击")
|
||||
end.tag = 2
|
||||
end.drivingStatus = TaskSiteDataBean.drivingStatusNotArrived
|
||||
RepositoryManager.skipStation()
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<Boolean> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
d(TAG, "onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
d(TAG, "onError${e.printStackTrace()}")
|
||||
if (e is DataException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
ThirdDeviceData.arriveStation()
|
||||
d(TAG, "skipNextStation onComplete")
|
||||
LineModel.stationList?.let {
|
||||
//此处始发站应为上段路程的终点站
|
||||
val startStation = LineManager.getStations().first
|
||||
if (LineModel.startStationIndex + 1 < it.size) {
|
||||
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||
val subStationList = it.subList(LineModel.startStationIndex + 1, it.size)
|
||||
val endStation = subStationList.firstOrNull { bean ->
|
||||
bean.tag != 2
|
||||
}
|
||||
LineModel.nextStationIndex = it.indexOf(endStation)
|
||||
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||
LineManager.setStartAndEndStation(startStation, endStation)
|
||||
LineModel.callEyeMap(5)
|
||||
}
|
||||
}
|
||||
LineModel.leaveStationSuccess()
|
||||
ThirdDeviceData.leaveStation()
|
||||
updateBusStatus()
|
||||
|
||||
isArrivedStation = false
|
||||
onStartAutopilot()
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
ThirdDeviceData.arriveStation()
|
||||
d(TAG, "skipNextStation onComplete")
|
||||
LineModel.stationList?.let {
|
||||
//此处始发站应为上段路程的终点站
|
||||
val startStation = LineManager.getStations().first
|
||||
if (LineModel.startStationIndex + 1 < it.size) {
|
||||
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||
val subStationList = it.subList(LineModel.startStationIndex + 1, it.size)
|
||||
val endStation = subStationList.firstOrNull { bean ->
|
||||
bean.tag != 2
|
||||
}
|
||||
LineModel.nextStationIndex = it.indexOf(endStation)
|
||||
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||
LineManager.setStartAndEndStation(startStation, endStation)
|
||||
LineModel.callEyeMap(6)
|
||||
}
|
||||
}
|
||||
LineModel.leaveStationSuccess()
|
||||
ThirdDeviceData.leaveStation()
|
||||
updateBusStatus()
|
||||
|
||||
isArrivedStation = false
|
||||
onStartAutopilot()
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 登出
|
||||
@JvmStatic
|
||||
fun logoutInner() {
|
||||
|
||||
@@ -138,6 +138,10 @@ object RepositoryManager {
|
||||
return lineRepository?.arriveStation(seq, siteId, taskId)
|
||||
}
|
||||
|
||||
fun skipStation(): Observable<Boolean>? {
|
||||
return lineRepository?.skipStation()
|
||||
}
|
||||
|
||||
fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||
return lineRepository?.endTask(shiftsId, taskId)
|
||||
}
|
||||
|
||||
@@ -178,5 +178,11 @@ data class TaskSiteDataBean(
|
||||
const val drivingStatusPassed = 1//1已经过
|
||||
const val drivingStatusCurrent = 2//2当前站
|
||||
const val drivingStatusNotArrived = 3//3未到站
|
||||
|
||||
const val tagInit = 0//0初始值
|
||||
const val tagNormal = 1//1正常停靠
|
||||
const val tagSkip = 2//2 需要跳过
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ interface TaskSiteDataDao {
|
||||
@Query("UPDATE ${TaskSiteDataBean.tableName} SET leaving = :leave , driving_status = :drivingStatusCurrent WHERE task_id = :taskId and site_id = :siteId")
|
||||
fun updateDrivingStatusANdLeave(taskId: Long, siteId: Long, drivingStatusCurrent: Int, leave: Int)
|
||||
|
||||
// 跳站中把tag 值为2 仅置运行表中
|
||||
@Query("UPDATE ${TaskSiteDataBean.tableName} SET leaving = :leave , driving_status = :drivingStatusCurrent , tag = :tag WHERE task_id = :taskId and site_id = :siteId")
|
||||
fun updateDrivingStatusTagAndLeave(taskId: Long, siteId: Long, drivingStatusCurrent: Int, leave: Int , tag:Int)
|
||||
|
||||
|
||||
@Query("UPDATE ${TaskSiteDataBean.tableName} SET driving_status = :drivingStatusCurrent WHERE task_id = :taskId and site_id = :siteId")
|
||||
fun updateDrivingStatus(taskId: Long, siteId: Long, drivingStatusCurrent: Int)
|
||||
|
||||
|
||||
@@ -95,6 +95,23 @@ object TaskSiteDb : IDbRepository {
|
||||
)
|
||||
}
|
||||
}
|
||||
fun updateDrivingStatusTagAndLeave(
|
||||
taskId: Long,
|
||||
siteId: Long,
|
||||
drivingStatus: Int,
|
||||
leave: Boolean,
|
||||
tag:Int
|
||||
) {
|
||||
BizLoopManager.runInIoThread {
|
||||
taskSiteDataDao?.updateDrivingStatusTagAndLeave(
|
||||
taskId,
|
||||
siteId,
|
||||
drivingStatus,
|
||||
if (leave) 1 else 0,
|
||||
tag
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun queryRunningTask(taskId: Long): List<TaskSiteDataBean>? {
|
||||
return taskSiteDataDao?.queryRunningTask(taskId)
|
||||
|
||||
@@ -32,6 +32,8 @@ interface ILineRepository {
|
||||
|
||||
fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>?
|
||||
|
||||
fun skipStation(): Observable<Boolean>?
|
||||
|
||||
fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>?
|
||||
|
||||
fun queryCarExecutableTaskList(ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>)
|
||||
|
||||
@@ -201,6 +201,10 @@ class NormalRepository : ILineRepository {
|
||||
)
|
||||
}
|
||||
|
||||
override fun skipStation(): Observable<Boolean>? {
|
||||
return Observable.just(false)
|
||||
}
|
||||
|
||||
override fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||
return normalLineInterface?.endTask(taskId)
|
||||
}
|
||||
|
||||
@@ -476,6 +476,39 @@ class WeaknetRepository : ILineRepository {
|
||||
|
||||
}
|
||||
|
||||
override fun skipStation(): Observable<Boolean>? {
|
||||
return Observable.just(12)
|
||||
.flatMap {temp->
|
||||
//1 恢复end站点的值并置tag为临时不停靠运行表中
|
||||
LineManager.getStations { start, end ->
|
||||
if (currentTask != null && currentTask!!.taskId != null) {
|
||||
currentTask?.let { task ->
|
||||
if (task.taskId != null && task.lineId != null) {
|
||||
TaskSiteDb.updateDrivingStatusTagAndLeave(
|
||||
task.taskId!!,
|
||||
end.siteId.toLong(),
|
||||
TaskSiteDataBean.drivingStatusNotArrived,
|
||||
false,
|
||||
TaskSiteDataBean.tagSkip
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
OchChainLogManager.writeChainLog(
|
||||
"跳站点_数据更新_error",
|
||||
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||
)
|
||||
CallerLogger.d(TAG, "跳斩_数据更新_error:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||
}
|
||||
val changeInfo =
|
||||
"taskId:${currentTask?.taskId}--lineId:${currentTask?.lineId}--currentStationName:${start.name}--finalNextStationName:${end.name}"
|
||||
OchChainLogManager.writeChainLog("到站", changeInfo)
|
||||
CallerLogger.d(TAG, "到站:$changeInfo")
|
||||
}
|
||||
return@flatMap Observable.just(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||
return Observable.just(taskId).flatMap {
|
||||
currentTask?.let { task ->
|
||||
|
||||
@@ -84,7 +84,7 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
if (LineModel.isLastStation() == true) {
|
||||
return
|
||||
}
|
||||
OrderModel.onArriveAt(null, "页面挑站触发到站",true)
|
||||
OrderModel.skipNextStation()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
|
||||
}else{
|
||||
viewModel?.skipStation()
|
||||
}
|
||||
viewModel?.arriveStation()
|
||||
}
|
||||
unmanned_actv_arriver_station_new.setOnLongClickListener {
|
||||
viewModel?.arriveStation()
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.och.shuttle.weaknet.passenger.ui.linenew
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
@@ -30,7 +32,6 @@ import kotlinx.android.synthetic.main.b4_driving_info_full_fragment.cl_empty_ser
|
||||
import kotlinx.android.synthetic.main.b4_driving_info_full_fragment.cl_line_info_station
|
||||
import kotlinx.android.synthetic.main.b4_driving_info_full_fragment.end_station_name
|
||||
import kotlinx.android.synthetic.main.b4_driving_info_full_fragment.group_station_empty
|
||||
import kotlinx.android.synthetic.main.m2_arrive_view.view.ochtv_arrive_station_value
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@@ -186,6 +187,7 @@ class PB4DrivingInfoFullSFragment :
|
||||
}
|
||||
|
||||
private fun showBottom1Station(station:BusStationBean?,isShow:Boolean){
|
||||
setTextColor(station,actv_station_pre_1)
|
||||
if(isShow) {
|
||||
actv_station_pre_1.text = station?.name
|
||||
aciv_arrow_station_1.visibility = View.VISIBLE
|
||||
@@ -199,6 +201,7 @@ class PB4DrivingInfoFullSFragment :
|
||||
}
|
||||
|
||||
private fun showBottom2Station(station:BusStationBean?,isShow:Boolean){
|
||||
setTextColor(station, actv_station_pre_2)
|
||||
if(isShow) {
|
||||
actv_station_pre_2.text = station?.name
|
||||
aciv_arrow_station_2.visibility = View.VISIBLE
|
||||
@@ -212,6 +215,7 @@ class PB4DrivingInfoFullSFragment :
|
||||
}
|
||||
|
||||
private fun showBottom3Station(station:BusStationBean?,isShow:Boolean){
|
||||
setTextColor(station, actv_station_pre_3)
|
||||
if(isShow) {
|
||||
actv_station_pre_3.text = station?.name
|
||||
aciv_arrow_station_3.visibility = View.VISIBLE
|
||||
@@ -225,6 +229,7 @@ class PB4DrivingInfoFullSFragment :
|
||||
}
|
||||
|
||||
private fun showBottom4Station(station:BusStationBean?,isShow:Boolean){
|
||||
setTextColor(station, actv_station_pre_4)
|
||||
if(isShow) {
|
||||
actv_station_pre_4.text = station?.name
|
||||
aciv_arrow_station_4.visibility = View.VISIBLE
|
||||
@@ -237,6 +242,16 @@ class PB4DrivingInfoFullSFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextColor(station: BusStationBean?, textView: AppCompatTextView){
|
||||
context?.let {
|
||||
if(station?.tag==2){
|
||||
textView.setTextColor(ContextCompat.getColor(it, R.color.b4_5E5E5E))
|
||||
}else{
|
||||
textView.setTextColor(ContextCompat.getColor(it, R.color.white))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun updateLineName(lineName: String){
|
||||
actvLineName.text = lineName
|
||||
|
||||
@@ -22,4 +22,5 @@
|
||||
<color name="b4_9AFF98">#9AFF98</color>
|
||||
<color name="b4_EDBE2B">#EDBE2B</color>
|
||||
<color name="b4_FF8300">#FF8300</color>
|
||||
<color name="b4_5E5E5E">#5E5E5E</color>
|
||||
</resources>
|
||||
@@ -39,6 +39,7 @@ public class TaskContinueNotification {
|
||||
public String toString() {
|
||||
return "TaskContinueNotification{" +
|
||||
"curStation=" + curStation +
|
||||
", nextStation=" + nextStation +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user