[6.6.0]接管记录
This commit is contained in:
@@ -119,7 +119,7 @@ object RecordManager {
|
||||
/**
|
||||
* 获取接管记录列表
|
||||
*/
|
||||
suspend fun getAllRecord(context: Context): List<RecordInfo>{
|
||||
suspend fun getAllRecord(context: Context): MutableList<RecordInfo>{
|
||||
return RecordDb.getDb(context)
|
||||
.recordDao()
|
||||
.getAllRecord()
|
||||
|
||||
@@ -36,20 +36,16 @@ class TakeOverRecordProvider: ITakeOverProvider {
|
||||
RecordManager.deleteAllRecord(context)
|
||||
}
|
||||
|
||||
override suspend fun getAllRecord(context: Context): List<TakeOverRecordInfo> {
|
||||
override suspend fun getAllRecord(context: Context): MutableList<TakeOverRecordInfo> {
|
||||
val list = RecordManager.getAllRecord(context)
|
||||
return if(list.isEmpty()){
|
||||
emptyList()
|
||||
}else{
|
||||
val recordInfoList = mutableListOf<TakeOverRecordInfo>()
|
||||
list.forEach {
|
||||
recordInfoList.add(
|
||||
TakeOverRecordInfo(it.faultStartTime,it.address,it.level1Id,
|
||||
it.level2Id,it.level3Id,it.lineName,it.reportNote,it.reportStatus)
|
||||
)
|
||||
}
|
||||
recordInfoList
|
||||
val recordInfoList = mutableListOf<TakeOverRecordInfo>()
|
||||
list.forEach {
|
||||
recordInfoList.add(
|
||||
TakeOverRecordInfo(it.faultStartTime,it.address,it.level1Id,
|
||||
it.level2Id,it.level3Id,it.lineName,it.reportNote,it.reportStatus,false)
|
||||
)
|
||||
}
|
||||
return recordInfoList
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ interface RecordDao {
|
||||
fun deleteRecord(info: RecordInfo)
|
||||
//查询数据
|
||||
@Query("SELECT * FROM take_over_record")
|
||||
suspend fun getAllRecord(): List<RecordInfo>
|
||||
suspend fun getAllRecord(): MutableList<RecordInfo>
|
||||
//清空数据
|
||||
@Query("DELETE FROM take_over_record")
|
||||
fun deleteAllRecord()
|
||||
|
||||
@@ -262,11 +262,11 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
setAudio(audioStatus)
|
||||
}
|
||||
//上报
|
||||
//保存
|
||||
tvTakeOverSave.setOnClickListener{
|
||||
mTakeOverRecordInfo.reportNote = etNoteInput.text.toString()
|
||||
CallerTakeOverManager.updateRecord(mActivity,mTakeOverRecordInfo)
|
||||
clickListener?.onSaveReason()
|
||||
clickListener?.onSaveReason(mTakeOverRecordInfo)
|
||||
hideFloatWindow()
|
||||
}
|
||||
//取消
|
||||
@@ -425,7 +425,7 @@ class TakeOverReasonWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun onSaveReason()
|
||||
fun onSaveReason(info: TakeOverRecordInfo)
|
||||
}
|
||||
|
||||
override fun getCategoriesSuccess(list: List<CategoryInfo>) {
|
||||
|
||||
@@ -51,6 +51,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
private var takeOverListAdapter: TakeOverListAdapter ?= null
|
||||
private var clickListener: ClickListener? = null
|
||||
private val selectedUploadRecord = ArrayList<TakeOverRecordInfo>()
|
||||
private var recordList: MutableList<TakeOverRecordInfo> ?= null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_take_over_record, this, true)
|
||||
@@ -74,9 +75,8 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
?: throw IllegalStateException("please ensure context is FragmentActivity.")
|
||||
val takeOverReasonWindow = TakeOverReasonWindow(activity)
|
||||
takeOverReasonWindow.setClickListener(object: TakeOverReasonWindow.ClickListener{
|
||||
override fun onSaveReason() {
|
||||
//刷新列表 TODO 应该局部刷新
|
||||
refreshList()
|
||||
override fun onSaveReason(info: TakeOverRecordInfo) {
|
||||
takeOverListAdapter?.notifyRecordItemChanged(info)
|
||||
}
|
||||
})
|
||||
takeOverReasonWindow.showFloatWindow(takeOverRecordInfo)
|
||||
@@ -109,12 +109,16 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
if(selectedUploadRecord.isEmpty()){
|
||||
ToastUtils.showShort("请选择需要删除的接管记录")
|
||||
}else{
|
||||
selectedUploadRecord.forEach {
|
||||
CallerTakeOverManager.deleteRecord(context,it)
|
||||
val iterator = selectedUploadRecord.iterator()
|
||||
while (iterator.hasNext()){
|
||||
val removeRecord = iterator.next()
|
||||
CallerTakeOverManager.deleteRecord(context,removeRecord)
|
||||
takeOverListAdapter?.notifyRecordItemRemoved(removeRecord)
|
||||
iterator.remove()
|
||||
}
|
||||
refreshList()
|
||||
}
|
||||
}
|
||||
//获取接管记录列表
|
||||
refreshList()
|
||||
}
|
||||
|
||||
@@ -123,16 +127,16 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun refreshList(){
|
||||
scope.launch(Dispatchers.IO){
|
||||
val recordList= CallerTakeOverManager.getAllRecord(context)
|
||||
recordList = CallerTakeOverManager.getAllRecord(context)
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(recordList.isEmpty()){
|
||||
if(recordList.isNullOrEmpty()){
|
||||
tvRecordNoData.visibility = View.VISIBLE
|
||||
recordGroup.visibility = View.GONE
|
||||
}else{
|
||||
tvRecordNoData.visibility = View.GONE
|
||||
recordGroup.visibility = View.VISIBLE
|
||||
//更新列表
|
||||
takeOverListAdapter?.setData(recordList)
|
||||
takeOverListAdapter?.setData(recordList!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhjt.mogo_core_function_devatools.workorder.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -21,14 +22,36 @@ import com.zhjt.mogo_core_function_devatools.R
|
||||
*/
|
||||
class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<TakeOverListAdapter.TakeOverRecordHolder>() {
|
||||
|
||||
private var data:List<TakeOverRecordInfo> ?= null
|
||||
private var data:MutableList<TakeOverRecordInfo> ?= null
|
||||
private var clickListener: RecordClickListener ?= null
|
||||
|
||||
fun setData(data: List<TakeOverRecordInfo>){
|
||||
fun setData(data: MutableList<TakeOverRecordInfo>){
|
||||
this.data = data
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除元素
|
||||
*/
|
||||
fun notifyRecordItemRemoved(info: TakeOverRecordInfo){
|
||||
val pos = data?.indexOf(info)
|
||||
pos?.let {
|
||||
data?.removeAt(it)
|
||||
notifyItemRemoved(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改元素
|
||||
*/
|
||||
fun notifyRecordItemChanged(info: TakeOverRecordInfo){
|
||||
val pos = data?.indexOf(info)
|
||||
pos?.let {
|
||||
data!![pos] = info
|
||||
notifyItemChanged(pos)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TakeOverRecordHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_take_over_record, parent, false)
|
||||
@@ -45,7 +68,11 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter<Ta
|
||||
holder.ivCannotCheck.visibility = View.INVISIBLE
|
||||
holder.cbRecordSelect.visibility = View.VISIBLE
|
||||
}
|
||||
holder.cbRecordSelect.setOnCheckedChangeListener(null)
|
||||
holder.cbRecordSelect.isChecked = recordEntity.selectStatus
|
||||
holder.cbRecordSelect.tag = recordEntity
|
||||
holder.cbRecordSelect.setOnCheckedChangeListener { _, isChecked ->
|
||||
it[position].selectStatus = isChecked
|
||||
clickListener?.onSelectRecord(recordEntity,isChecked)
|
||||
}
|
||||
holder.ivCannotCheck.setOnClickListener {
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
|
||||
import com.mogo.eagle.core.data.deva.report.TakeOverRecordInfo
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
@@ -23,7 +22,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.takeover.CallerTakeOverManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.KeyBoardUtil
|
||||
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
|
||||
@@ -137,20 +135,10 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
clickListener?.onClose(it)
|
||||
}
|
||||
rlKillLayout.setOnClickListener {
|
||||
// killApp()
|
||||
val takeOverRecordInfo = TakeOverRecordInfo(
|
||||
System.currentTimeMillis(),"地址1",1,2,3,"测试路线2",
|
||||
"",false
|
||||
)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfo)
|
||||
killApp()
|
||||
}
|
||||
sopLayout.setOnClickListener {
|
||||
// clickListener?.showSOPSettingView()
|
||||
val takeOverRecordInfo = TakeOverRecordInfo(
|
||||
System.currentTimeMillis(),"地址1",1,2,3,"测试路线3",
|
||||
"",true
|
||||
)
|
||||
CallerTakeOverManager.insertRecord(context,takeOverRecordInfo)
|
||||
clickListener?.showSOPSettingView()
|
||||
}
|
||||
//录包
|
||||
CallerDevaToolsManager.initBadCase(badCaseReportLayout)
|
||||
|
||||
@@ -10,7 +10,9 @@ package com.mogo.eagle.core.data.deva.report
|
||||
* @param lineName 行驶路线
|
||||
* @param reportNote 上报描述
|
||||
* @param reportStatus 上传状态 false:未上传,可编辑 true:已上传,不可编辑
|
||||
* @param selectStatus 选择状态
|
||||
*/
|
||||
data class TakeOverRecordInfo(var faultStartTime: Long, var address:String,
|
||||
var level1Id: Int, var level2Id: Int, var level3Id: Int,
|
||||
var lineName: String, var reportNote: String, var reportStatus: Boolean)
|
||||
var lineName: String, var reportNote: String,
|
||||
var reportStatus: Boolean,var selectStatus: Boolean)
|
||||
@@ -32,6 +32,6 @@ interface ITakeOverProvider: IMoGoFunctionServerProvider {
|
||||
/**
|
||||
* 获取接管记录列表
|
||||
*/
|
||||
suspend fun getAllRecord(context: Context): List<TakeOverRecordInfo>
|
||||
suspend fun getAllRecord(context: Context): MutableList<TakeOverRecordInfo>
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ object CallerTakeOverManager {
|
||||
/**
|
||||
* 获取接管记录列表
|
||||
*/
|
||||
suspend fun getAllRecord(context: Context): List<TakeOverRecordInfo>{
|
||||
suspend fun getAllRecord(context: Context): MutableList<TakeOverRecordInfo>{
|
||||
return providerApi.getAllRecord(context)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user