From 4d6818950197da8c87e23d70211bd5bc963ad8c9 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Wed, 9 Oct 2024 17:57:56 +0800 Subject: [PATCH] =?UTF-8?q?[6.7.0]=E6=95=85=E9=9A=9C=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/hmi/bone/tab/FaultReasonView.kt | 130 +++++++++++------- .../src/main/res/layout/view_fault_reason.xml | 8 +- 2 files changed, 87 insertions(+), 51 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt index 9c9dcac4e8..34f1fc6804 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/FaultReasonView.kt @@ -39,6 +39,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.JsonParser import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils @@ -110,6 +111,9 @@ class FaultReasonView @JvmOverloads constructor( private val type = 1 //故障类接口请求Type值为1 + private val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand) + private val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract) + init { LayoutInflater.from(context).inflate(R.layout.view_fault_reason, this, true) initView() @@ -166,9 +170,7 @@ class FaultReasonView @JvmOverloads constructor( @SuppressLint("SetTextI18n") private fun initEvent() { CallerDevaToolsListenerManager.addListener(TAG, this) - val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand) iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight) - val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract) iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight) //获取一级分类 CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0) @@ -300,53 +302,57 @@ class FaultReasonView @JvmOverloads constructor( } //上报 tvFaultReport.setOnClickListener { - if (level2Name.isEmpty()) { - ToastUtils.showShort("请完整填写再上报") - return@setOnClickListener - } - if (hasLevel3 && level3Name.isEmpty()) { - ToastUtils.showShort("请完整填写再上报") - return@setOnClickListener - } - reportNote = etNoteInput.text.toString() - //故障码列表赋值 - BadCaseConfig.newFMInfoMsg?.fmInfoList?.forEach { - faultCodeList.add(it.faultId) - } - val geocodeSearch = GeocodeSearch(context) - geocodeSearch.setOnGeocodeSearchListener(object : - GeocodeSearch.OnGeocodeSearchListener { - override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { - regeocodeResult?.regeocodeAddress?.formatAddress?.let { - address = it - } - val padProblemList = ArrayList() - val note = if (reportNote.isEmpty()) { - "$level1Name-$level2Name-$level3Name" - } else { - "$level1Name-$level2Name-$level3Name($reportNote)" - } - val padProblemInfo = PadProblemInfo( - address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id, - level2Id, level3Id, BadCaseConfig.lineName, note, reportType, - SharedPrefsMgr.getInstance().getString("och_account", "") - ) - padProblemList.add(padProblemInfo) - val padAddProblemReq = - PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber) - CallerDevaToolsManager.problemPadAdd(padAddProblemReq) + if(ClickUtils.isFastClick()){ + if (level2Name.isEmpty()) { + ToastUtils.showShort("请完整填写再上报") + return@setOnClickListener } - - override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { - + if (hasLevel3 && level3Name.isEmpty()) { + ToastUtils.showShort("请完整填写再上报") + return@setOnClickListener } - }) - val latLon = LatLonPoint( - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude - ) - val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP) - geocodeSearch.getFromLocationAsyn(q) + reportNote = etNoteInput.text.toString() + //故障码列表赋值 + BadCaseConfig.newFMInfoMsg?.fmInfoList?.forEach { + faultCodeList.add(it.faultId) + } + val geocodeSearch = GeocodeSearch(context) + geocodeSearch.setOnGeocodeSearchListener(object : + GeocodeSearch.OnGeocodeSearchListener { + override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) { + regeocodeResult?.regeocodeAddress?.formatAddress?.let { + address = it + } + val padProblemList = ArrayList() + val note = if (reportNote.isEmpty()) { + "$level1Name-$level2Name-$level3Name" + } else { + "$level1Name-$level2Name-$level3Name($reportNote)" + } + val padProblemInfo = PadProblemInfo( + address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id, + level2Id, level3Id, BadCaseConfig.lineName, note, reportType, + SharedPrefsMgr.getInstance().getString("och_account", "") + ) + padProblemList.add(padProblemInfo) + val padAddProblemReq = + PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber) + CallerDevaToolsManager.problemPadAdd(padAddProblemReq) + } + + override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) { + + } + }) + val latLon = LatLonPoint( + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude + ) + val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP) + geocodeSearch.getFromLocationAsyn(q) + }else{ + ToastUtils.showShort("请勿连续上报,稍后再试") + } } //取消 @@ -531,4 +537,34 @@ class FaultReasonView @JvmOverloads constructor( ToastUtils.showShort("故障列表获取失败:$msg") } + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(visibility == View.VISIBLE){ + //弹窗展示时间 + tvFaultTime.text = + millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat()) + //故障发生时间 + workOrderOccurrenceTime = System.currentTimeMillis() + tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat()) + //关闭故障类型选择 + faultTypeSelectStatus = false + tvFaultType.setCompoundDrawables(null, null, iconDown, null) + //关闭故障原因选择 + faultReasonSelectStatus = false + tvFaultReason.setCompoundDrawables(null, null, iconDown, null) + //隐藏列表 + rvFaultList.visibility = View.GONE + //补充描述 + etNoteInput.setText("") + //问题描述录音 + ivNoteAudio.setImageDrawable( + ContextCompat.getDrawable( + context, + R.drawable.icon_reason_audio_normal + ) + ) + setAudio(false) + } + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml index 2e93918dc9..4315bbcaff 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_fault_reason.xml @@ -94,7 +94,7 @@ app:layout_constraintTop_toBottomOf="@id/tvFaultType" app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="@dimen/dp_103" - android:layout_marginTop="@dimen/dp_30" + android:layout_marginTop="@dimen/dp_33" />