[6.7.0]故障上报修改
This commit is contained in:
@@ -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<PadProblemInfo>()
|
||||
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<PadProblemInfo>()
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -136,7 +136,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFaultReason"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_103"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -144,7 +144,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fault_time"
|
||||
android:textSize="@dimen/sp_32"
|
||||
android:textSize="@dimen/sp_38"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="@id/viewFaultTimeLabel"
|
||||
@@ -207,7 +207,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/viewTimeBg"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_103"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user