[6.0.0] 1、当接驾任务结束后, 立马获取下一个任务, 不等待30s

2、UI走查
This commit is contained in:
wangmingjun
2023-08-18 19:06:59 +08:00
parent 41609455a9
commit 011840b4cc
7 changed files with 95 additions and 69 deletions

View File

@@ -17,8 +17,10 @@
android:id="@+id/startAutopilotTip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_gravity="center_horizontal"
android:visibility="gone"
android:textSize="@dimen/dp_34"
android:textStyle="bold"
android:textSize="@dimen/dp_42"
android:textColor="@android:color/white"/>
</FrameLayout>

View File

@@ -720,16 +720,6 @@ object TaxiModel {
}
arriveSite(mUntruthTask!!.siteId, false)
}
/**
* 订单流转debug START
*/
fun setArriveAtStartStation() {
if (!checkCurrentTask()) {
ToastUtils.showShort("订单状态不匹配该操作!")
return
}
arriveSite(mCurrentTaskAndOrder?.startSite!!.siteId, false)
}
fun setArriveAtEndStation() {
if (!checkCurrentTask()) {

View File

@@ -270,6 +270,7 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
}
private fun queryCurrentTaskOnce(){
if (!LoginStatusManager.isLogin()) return // 未登陆则不去查询
CarServiceManager.queryCurrentTask(AbsMogoApplication.getApp().applicationContext,
object : OchCommonServiceCallback<QueryCurrentTaskRespBean> {
override fun onSuccess(data: QueryCurrentTaskRespBean?) {
@@ -287,13 +288,14 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order!= null &&
result != null && result.order == null) {
//本地根据订单 orderNo 去查询下(乘客取消订单)
d(TAG, "queryCurrentTaskOnce1 = result order is empty, query order by orderNo!")
queryCurrentOrderStatusByNo(mCurrentTaskAndOrder!!.order!!.orderNo)
return
}
//订单或者伪任务更新, 都去刷新下界面
if (mCurrentTaskAndOrder == null || !mCurrentTaskAndOrder!!.equals(result)){
d(TAG, "queryCurrentTaskOnce1 = mCurrentTaskAndOrder update " )
if (result == null) return
if (result.endSite == null && result.order == null){
@@ -302,32 +304,45 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
TaxiModel.updateCurrentTaskAndOrder(null)
}
//当前任务完成且订单状态到达乘客上车点, 则立马去拉取任务 不再等30s,否则送驾任务要等30s后才能去执行
if (result.currentStatus == TaskStatusEnum.CompleteTask.code){
startPrepareTask(result.endSite!!.siteId)
if (result.order != null && result.order!!.orderStatus
== TaxiOrderStatusEnum.ArriveAtStart.code){
pullTask(result.endSite!!.siteId)
d(TAG, "queryCurrentTaskOnce1 = pullTask" )
}else{
startPrepareTask30S(result.endSite!!.siteId)
d(TAG, "queryCurrentTaskOnce1 = startPrepareTask30S" )
}
}
mCurrentTaskAndOrder = result
TaxiModel.updateCurrentTaskAndOrder(result)
TaxiModel.updateStation()
updateTaskAndOrderUi()
if (result.order != null && result.order!!.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code){
queryCurrentOrderStatusByNo(mCurrentTaskAndOrder!!.order!!.orderNo) //查询全程里程和用时,更新
d(TAG, "queryCurrentTaskOnce1 = ArriveAtEnd query mileage and duration")
queryCurrentOrderStatusByNo(result.order!!.orderNo) //查询全程里程和用时,更新
}
//根据lineId集合去查轨迹集合, 返回的只是接驾任务的line集合,没有送驾任务
if (result.order != null && result.order!!.orderStatus <= TaxiOrderStatusEnum.OnTheWayToEnd.code){
var lines = result.order!!.planningLines
lines[lines.size] = result.order!!.orderLine
lines = lines.plus(result.order!!.orderLine)
d(TAG, "queryCurrentTaskOnce1 = by lineIds query Contrails" )
queryOrderPickUpContrails(lines)
}
if (result.currentStatus <= TaskStatusEnum.StartTask.code){//任务执行中, 去加载下轨迹
d(TAG, "queryCurrentTaskOnce1 = by lineId query Contrail" )
TaxiModel.queryTaskContrail(Array(1) {result.lineId})
}
if (result.taskType <= TaskTypeEnum.ToOrderStartTask.code
&& result.currentStatus == TaskStatusEnum.GetTask.code){//自动去启动自驾
d(TAG, "queryCurrentTaskOnce1 = autoStartDriving" )
TaxiModel.autoStartDriving()
}
}
@@ -383,7 +398,7 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
if (data.data.orderStatus == TaxiOrderStatusEnum.JourneyCompleted.code){//完成
//获取新的任务
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null){
startPrepareTask(mCurrentTaskAndOrder!!.endSite!!.siteId)
startPrepareTask30S(mCurrentTaskAndOrder!!.endSite!!.siteId)
}
mCurrentTaskAndOrder = null
updateNoTaskAndOrderUi()
@@ -409,28 +424,32 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
}
}
private fun startPrepareTask(siteId: Long) {
private fun startPrepareTask30S(siteId: Long) {
UiThreadHandler.postDelayed({
CarServiceManager.prepareTask(
mContext,
siteId,
object : OchCommonServiceCallback<PrepareTaskRespBean> {
override fun onSuccess(data: PrepareTaskRespBean?) {
d(SceneConstant.M_TAXI + TAG, "prepareTask = " + GsonUtil.jsonFromObject(data))
if (data == null || data.code != 0) return
//去下载轨迹, 下发给工控机下载
TaxiModel.queryTaskContrail(Array(1) {data.data.lineId})
}
override fun onFail(code: Int, msg: String?) {
d(SceneConstant.M_TAXI + TAG, "$code $msg")
startPrepareTask(siteId) //失败后30s再次调用获取下一任务
}
})
pullTask(siteId)
}, TaxiUnmannedConst.TIMER_PREPARE_TASK_INTERVAL)
}
private fun pullTask(siteId: Long) {
CarServiceManager.prepareTask(
mContext,
siteId,
object : OchCommonServiceCallback<PrepareTaskRespBean> {
override fun onSuccess(data: PrepareTaskRespBean?) {
d(SceneConstant.M_TAXI + TAG, "prepareTask = " + GsonUtil.jsonFromObject(data))
if (data == null || data.code != 0) return
//去下载轨迹, 下发给工控机下载
TaxiModel.queryTaskContrail(Array(1) {data.data.lineId})
}
override fun onFail(code: Int, msg: String?) {
d(SceneConstant.M_TAXI + TAG, "$code $msg")
startPrepareTask30S(siteId) //失败后30s再次调用获取下一任务
}
})
}
private fun startInAndWaitCurrentTaskLoop() {
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable!!.isDisposed) {

View File

@@ -49,12 +49,14 @@ import com.mogo.och.taxi.ui.unmanned.TaskAndOrderUiState
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
import kotlinx.android.synthetic.main.taxi_no_data_common_view.noOrderDataTv
import kotlinx.android.synthetic.main.unmanned_being_order.cancelOrder
import kotlinx.android.synthetic.main.unmanned_being_order.endPoint
import kotlinx.android.synthetic.main.unmanned_being_order.endStationName
import kotlinx.android.synthetic.main.unmanned_being_order.mBeingOrderLayout
import kotlinx.android.synthetic.main.unmanned_being_order.naviToEnd
import kotlinx.android.synthetic.main.unmanned_being_order.naviToStart
import kotlinx.android.synthetic.main.unmanned_being_order.noTaskData
import kotlinx.android.synthetic.main.unmanned_being_order.orderPhoneAndNum
import kotlinx.android.synthetic.main.unmanned_being_order.startPoint
import kotlinx.android.synthetic.main.unmanned_being_order.startStationName
import kotlinx.android.synthetic.main.unmanned_being_order.taskClickBtn
import kotlinx.android.synthetic.main.unmanned_being_order.taskOtherInfo
@@ -183,6 +185,17 @@ class TaxiBeingTaskFragment : BaseFragment(),
taskStatus.text = resources.getString(R.string.task_start_to_virtual_site)
startStationName.text = resources.getString(R.string.task_current_loc)
endStationName.text = siteName
setPointBlueGreen()
}
private fun setPointBlueGreen(){
startPoint.setImageResource(R.drawable.taxi_driver_circle_blue_big)
endPoint.setImageResource(R.drawable.taxi_driver_circle_green_big)
}
private fun setPointGreenBlue(){
startPoint.setImageResource(R.drawable.taxi_driver_circle_green_big)
endPoint.setImageResource(R.drawable.taxi_driver_circle_blue_big)
}
private fun updateUntruthTaskView() {
@@ -275,6 +288,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
taskTypeTv.text = resources.getString(R.string.task_exercise)
startStationName.text = startSite.siteName
endStationName.text = endSite.siteName
setPointBlueGreen()
}
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 送驾/接驾任务任务
if (order == null) return
@@ -296,7 +310,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
taskTypeTv.text = resources.getString(R.string.task_order)
taskTypeTv.background = resources.getDrawable(R.drawable.task_order_type_btn_bg,null)
orderPhoneAndNum.text = Html.fromHtml("<font color=\"#FFFFFF\"> " + order.bookingUserPhone + "</font>" +
"<font color=\"#3B4577\"> | </font>" +
"<font color=\"#6473B2\"> | </font>" +
"<font color=\"#FFFFFF\">" + order.passengerSize + "" + "</font>",Html.FROM_HTML_MODE_LEGACY)
startStationName.text = order.orderStartSite?.siteName
endStationName.text = order.orderEndSite?.siteName
@@ -322,7 +336,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
TaxiOrderStatusEnum.ArriveAtEnd.code -> { //到达目的地
taskStatus.text = resources.getString(R.string.task_start_end_site)
setPointBlueGreen()
updateOrderBottomBtn(
getString(R.string.module_och_taxi_order_server_end),
Color.parseColor("#FFFFFF"),
@@ -352,6 +366,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
}
TaxiOrderStatusEnum.OnTheWayToEnd.code -> { //送驾中
taskStatus.text = resources.getString(R.string.task_start_end_site)
setPointBlueGreen()
updateOrderBottomBtn(
getString(R.string.module_och_taxi_order_close),
Color.parseColor("#FFFFFF"),
@@ -381,7 +396,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
}
TaxiOrderStatusEnum.UserArriveAtStart.code,TaxiOrderStatusEnum.ArriveAtStart.code -> {
//乘客到达上车点,验证成功 ; 到达乘客上车点
setPointGreenBlue()
taskStatus.text = resources.getString(R.string.arrived_start_site)
updateOrderBottomBtn(
if (order.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.code)
@@ -417,6 +432,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
TaxiOrderStatusEnum.OnTheWayToStart.code -> { //前往上车地点
taskStatus.text = resources.getString(R.string.task_start_start_site)
setPointGreenBlue()
updateOrderBottomBtn(
getString(R.string.module_och_taxi_order_server_start),
Color.parseColor("#4DFFFFFF"),

View File

@@ -75,7 +75,7 @@ class TaxiReserveOrderFragment : BaseFragment() {
naviToEnd.visibility = View.GONE
orderPhoneAndNum.text = Html.fromHtml("<font color=\"#FFFFFF\"> " + order.bookingUserPhone + "</font>" +
"<font color=\"#3B4577\"> | </font>" +
"<font color=\"#6473B2\"> | </font>" +
"<font color=\"#FFFFFF\">" + order.passengerSize + "" + "</font>",Html.FROM_HTML_MODE_LEGACY)

View File

@@ -5,12 +5,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--自动启动自驾闪烁上边框-->
<com.mogo.och.common.module.wigets.StartAutopilotAnimationView
android:id="@+id/startAutopilotAnimationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_100"
@@ -91,16 +100,6 @@
</RelativeLayout>
<!--自动启动自驾闪烁上边框-->
<com.mogo.och.common.module.wigets.StartAutopilotAnimationView
android:id="@+id/startAutopilotAnimationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"

View File

@@ -66,7 +66,7 @@
android:layout_height="wrap_content"
android:text="上车:"
android:textSize="@dimen/dp_32"
app:layout_goneMarginTop="@dimen/dp_40"
app:layout_goneMarginTop="@dimen/dp_104"
android:layout_marginTop="@dimen/dp_52"
android:layout_marginStart="@dimen/dp_78"
android:textColor="@color/station_tag_color"
@@ -134,7 +134,7 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/greenPoint"
android:id="@+id/startPoint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/taxi_driver_circle_green_big"
@@ -148,13 +148,13 @@
android:layout_height="0dp"
android:src="@drawable/taxi_grab_dot_line"
android:scaleType="fitXY"
app:layout_constraintTop_toBottomOf="@+id/greenPoint"
app:layout_constraintBottom_toTopOf="@+id/bluePoint"
app:layout_constraintLeft_toLeftOf="@+id/greenPoint"
app:layout_constraintRight_toRightOf="@+id/greenPoint"/>
app:layout_constraintTop_toBottomOf="@+id/startPoint"
app:layout_constraintBottom_toTopOf="@+id/endPoint"
app:layout_constraintLeft_toLeftOf="@+id/startPoint"
app:layout_constraintRight_toRightOf="@+id/startPoint"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bluePoint"
android:id="@+id/endPoint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/taxi_driver_circle_blue_big"
@@ -162,20 +162,20 @@
app:layout_constraintBottom_toBottomOf="@+id/endStationName"
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/taskOtherInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_40"
app:layout_goneMarginBottom="@dimen/dp_172"
android:textSize="@dimen/dp_30"
android:textColor="@color/station_tag_color"
android:text="距离 -- 公里, 用时 -- 分钟"
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"
app:layout_constraintBottom_toTopOf="@+id/taskClickBtn" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/taskOtherInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="36dp"
android:text="距离 -- 公里, 用时 -- 分钟"
android:textColor="@color/station_tag_color"
android:textSize="@dimen/dp_30"
app:layout_constraintBottom_toTopOf="@+id/taskClickBtn"
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"
app:layout_goneMarginBottom="@dimen/dp_172" />
<androidx.appcompat.widget.AppCompatTextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/taskClickBtn"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_132"