[routing]
[fix]
[站点设置]
This commit is contained in:
yangyakun
2025-07-14 11:56:43 +08:00
parent c66c4739a9
commit 2dc31c20ff
2 changed files with 37 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ class TaskRunningModel : ViewModel() {
/**
* 是否可以进行进站操作
*/
private var arrivedStation:Boolean = false
var arrivedStation:Boolean = false
companion object {
var currentIndex = -1
@@ -74,6 +74,9 @@ class TaskRunningModel : ViewModel() {
this.currentContrailBean = data.contrail
this.currentGrayId = data.taskId
this.stationList = data.stationList
this.stationList?.forEach {
it.isLeaving = false
}
currentIndex = 0
this.stationList?.let {
val startStationNext = it[currentIndex]
@@ -134,7 +137,7 @@ class TaskRunningModel : ViewModel() {
startStation.isLeaving = true
arrivedStation = true
startStation.drivingStatus = 2
CallerLogger.d(TAG,"setNewData index:${currentIndex} ${startStation.name}---${endStation.name}")
CallerLogger.d(TAG,"leaveStation index:${currentIndex} ${startStation.name}---${endStation.name}")
this.viewCallback?.notifyItemChange(currentIndex)
this.viewCallback?.showArriverStationAndCompleteTask()
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
@@ -150,29 +153,34 @@ class TaskRunningModel : ViewModel() {
fun arriveStation() {
stationList?.let {
val startStation = it[currentIndex]
startStation.isLeaving = false
arrivedStation = false
startStation.drivingStatus = 1
if (currentIndex + 2 >= it.size) {
startStation.isLeaving = true
this.viewCallback?.showCompleteTask()
}else {
startStation.isLeaving = false
arrivedStation = false
startStation.drivingStatus = 1
currentIndex += 1
val startStationNext = it[currentIndex]
val endStation = it[currentIndex + 1]
CallerLogger.d(TAG, "setNewData index:${currentIndex} ${startStationNext.name}----${endStation.name}")
LineManager.setStartAndEndStation(startStationNext, endStation)
}
LineManager.getStations { start, end ->
BizLoopManager.runInMainThread{
this.viewCallback?.onArrivedStation(start.isLeaving)
}
}
}
BizLoopManager.runInMainThread{
this.viewCallback?.onArrivedStation()
}
}
interface SwtichLineViewCallback {
// 到站
fun onArrivedStation()
fun onArrivedStation(leaving: Boolean)
// 结束服务成功
fun onSubmitEndTaskSuccess()

View File

@@ -82,10 +82,17 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener {
override fun slideEnd() {
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
aciv_task_leave_station_slide_bg.reset()
viewModel?.data?.taskId?.let {
showFeedbackDialog(it)
LineManager.getStations { start, end ->
if (viewModel?.arrivedStation == true && start.isLeaving) {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
aciv_task_leave_station_slide_bg.reset()
viewModel?.data?.taskId?.let {
showFeedbackDialog(it)
}
}else{
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
viewModel?.leaveStation()
}
}
} else {
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
@@ -190,13 +197,20 @@ class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallbac
/**
* 到达目的地
*/
override fun onArrivedStation() {
override fun onArrivedStation(leaving: Boolean) {
//
showLeaveStationView()
loading_arrive_station.visibility = GONE
notifyItemChange(0)
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
LineManager.getStations { start, end ->
if(start.isLeaving){
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
}else{
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
}
}
} else {
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
}