[6.0.0] 处理开始任务和启动自驾嵌套问题
This commit is contained in:
@@ -163,7 +163,7 @@ data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* with task.currentStatus == StartTask
|
||||
* with task.currentStatus == CompleteTask
|
||||
*/
|
||||
fun isCompleteTaskType(data: QueryCurrentTaskRespBean.Result?): Boolean {
|
||||
if (data == null) {
|
||||
@@ -171,6 +171,16 @@ data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
|
||||
}
|
||||
return data.currentStatus == TaskStatusEnum.CompleteTask.code
|
||||
}
|
||||
|
||||
/**
|
||||
* with task.currentStatus == GetTask
|
||||
*/
|
||||
fun isGetTaskType(data: QueryCurrentTaskRespBean.Result?): Boolean {
|
||||
if (data == null) {
|
||||
return false
|
||||
}
|
||||
return data.currentStatus == TaskStatusEnum.GetTask.code
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
* 开启自动驾驶 自驾模式
|
||||
*/
|
||||
public void startAutoPilot() {
|
||||
TaxiTaskModel.INSTANCE.startAutoPilot();
|
||||
TaxiTaskModel.INSTANCE.startAutopilotByClick();
|
||||
}
|
||||
|
||||
// 登出
|
||||
|
||||
@@ -1087,6 +1087,19 @@ object TaxiTaskModel {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT,
|
||||
paramIndexes = [-1]
|
||||
)
|
||||
|
||||
fun startAutopilotByClick(){
|
||||
//订单状态流转成功, 点击了开启自驾按钮, 启动自驾
|
||||
if (QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)) {
|
||||
startAutoPilot()
|
||||
}else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
|
||||
startTask(mCurrentTaskWithOrder!!.lineId)
|
||||
}else{
|
||||
e(TAG, "task currentStatus is not StartTask.")
|
||||
DebugView.printInfoMsg("[启自驾] task currentStatus is not StartTask")
|
||||
}
|
||||
}
|
||||
|
||||
fun startAutoPilot() {
|
||||
DebugView.printInfoMsg("[启自驾] startAutoPilot")
|
||||
if (!checkCurrentTaskCondition()) {
|
||||
@@ -1100,6 +1113,7 @@ object TaxiTaskModel {
|
||||
e(TAG, "no order or order is empty.")
|
||||
DebugView.printErrorMsg("[启自驾] 轨迹信息不存在!")
|
||||
ToastUtils.showShort("轨迹信息不存在!")
|
||||
return
|
||||
}
|
||||
|
||||
//根据开关和后台是否发布轨迹启动自驾
|
||||
@@ -1137,12 +1151,6 @@ object TaxiTaskModel {
|
||||
return
|
||||
}
|
||||
|
||||
//在订单状态还没流转成功时, 点击了开启自驾按钮, 先去做状态流转成功再启动自驾
|
||||
if (mCurrentTaskWithOrder!!.currentStatus == TaskStatusEnum.GetTask.code) {
|
||||
startTask(mCurrentTaskWithOrder!!.lineId)
|
||||
return
|
||||
}
|
||||
|
||||
//点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
isRestartAutopilot = mCurrentTaskWithOrder!!.currentStatus != TaskStatusEnum.StartTask.code
|
||||
|
||||
@@ -1151,6 +1159,7 @@ object TaxiTaskModel {
|
||||
e(TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
|
||||
CallerAutoPilotControlManager.startAutoPilot(parameters)
|
||||
DebugView.printInfoMsg("[启自驾] 调用成功")
|
||||
d(
|
||||
|
||||
Reference in New Issue
Block a user