|
|
|
@ -3,7 +3,10 @@ package com.rehome.bhdxj.activity
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
import android.text.TextUtils
|
|
|
|
import android.text.TextUtils
|
|
|
|
import android.view.View
|
|
|
|
import android.view.View
|
|
|
|
|
|
|
|
import androidx.activity.result.ActivityResultLauncher
|
|
|
|
|
|
|
|
import androidx.activity.result.contract.ActivityResultContracts
|
|
|
|
import com.rehome.bhdxj.base.BaseActivityOaToolbarViewBinding
|
|
|
|
import com.rehome.bhdxj.base.BaseActivityOaToolbarViewBinding
|
|
|
|
|
|
|
|
import com.rehome.bhdxj.bean.QxgdAddressBean
|
|
|
|
import com.rehome.bhdxj.bean.ZyNewBean
|
|
|
|
import com.rehome.bhdxj.bean.ZyNewBean
|
|
|
|
import com.rehome.bhdxj.contans.Contans
|
|
|
|
import com.rehome.bhdxj.contans.Contans
|
|
|
|
import com.rehome.bhdxj.databinding.ActivityQxgdNewBinding
|
|
|
|
import com.rehome.bhdxj.databinding.ActivityQxgdNewBinding
|
|
|
|
@ -28,21 +31,29 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
private val zyList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val zyList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gzlxList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gzlxList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gdjbList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gdjbList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
// private val zyList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gzlbList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
// private val zyList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
private val gzxxList: MutableList<ZyNewBean.DataBean> = mutableListOf()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private lateinit var launcherResultWz: ActivityResultLauncher<Intent>
|
|
|
|
|
|
|
|
|
|
|
|
private val jzDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val jzDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val zyDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val zyDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val gzlxDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val gzlxDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val gdjbDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
private val gdjbDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
|
|
|
|
private val gzlbDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
|
|
|
|
private val gzxxDialogDatas: MutableList<String> = mutableListOf()
|
|
|
|
|
|
|
|
|
|
|
|
private var jzValue: String? = null
|
|
|
|
private var jzValue: String? = null
|
|
|
|
private var zyValue: kotlin.String? = null
|
|
|
|
private var zyValue: kotlin.String? = null
|
|
|
|
private var lxvalue: kotlin.String? = null
|
|
|
|
private var lxvalue: kotlin.String? = null
|
|
|
|
private var qxdjValue: kotlin.String? = null
|
|
|
|
private var qxdjValue: kotlin.String? = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var wzbmValue: String? = null
|
|
|
|
|
|
|
|
private var deviceValue: kotlin.String? = null
|
|
|
|
|
|
|
|
private var gzlbValue: String? = null
|
|
|
|
|
|
|
|
private var gzxxValue: kotlin.String? = null
|
|
|
|
|
|
|
|
|
|
|
|
override fun getViewBinding() = ActivityQxgdNewBinding.inflate(layoutInflater)
|
|
|
|
override fun getViewBinding() = ActivityQxgdNewBinding.inflate(layoutInflater)
|
|
|
|
|
|
|
|
|
|
|
|
override fun getToolbar() = binding.toolbarView.toolbar
|
|
|
|
override fun getToolbar() = binding.toolbarView.toolbar
|
|
|
|
@ -52,6 +63,7 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
launcherResultWz = createWzActivityResultLauncher()
|
|
|
|
queueNoHttp = NoHttp.newRequestQueue(1)
|
|
|
|
queueNoHttp = NoHttp.newRequestQueue(1)
|
|
|
|
val userIdTemp = SPUtils.get(this, Contans.USERID, "") as String
|
|
|
|
val userIdTemp = SPUtils.get(this, Contans.USERID, "") as String
|
|
|
|
if (!TextUtils.isEmpty(userIdTemp)) {
|
|
|
|
if (!TextUtils.isEmpty(userIdTemp)) {
|
|
|
|
@ -106,12 +118,26 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
dialog.show()
|
|
|
|
dialog.show()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
binding.ilWz.setOnClickListener(View.OnClickListener { v: View? ->
|
|
|
|
binding.ilWz.setOnClickListener(View.OnClickListener {
|
|
|
|
|
|
|
|
val intent = Intent(context, QxgdSearchAddressActivity::class.java)
|
|
|
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
|
|
|
|
launcherResultWz.launch(intent)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
binding.ilSb.setOnClickListener(View.OnClickListener {
|
|
|
|
val intent = Intent(context, QxgdSearchAddressActivity::class.java)
|
|
|
|
val intent = Intent(context, QxgdSearchAddressActivity::class.java)
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
startActivity(intent)
|
|
|
|
launcherResultWz.launch(intent)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
binding.ilGzlb.setOnClickListener(View.OnClickListener { v: View? ->
|
|
|
|
|
|
|
|
val dialog = ListDialog(
|
|
|
|
|
|
|
|
context, gzlbDialogDatas
|
|
|
|
|
|
|
|
) { _: String?, position: Int ->
|
|
|
|
|
|
|
|
gzlbValue = gzlbList[position].value
|
|
|
|
|
|
|
|
binding.ilGzlb.content = gzlbList[position].description
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog.show()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -122,6 +148,34 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
checkConnectServer()
|
|
|
|
checkConnectServer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建一个ActivityResultLauncher
|
|
|
|
|
|
|
|
private fun createWzActivityResultLauncher(): ActivityResultLauncher<Intent> {
|
|
|
|
|
|
|
|
//kotlin写法
|
|
|
|
|
|
|
|
return registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
|
|
|
|
|
|
|
val data = it.data
|
|
|
|
|
|
|
|
val resultCode = it.resultCode
|
|
|
|
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
|
|
|
|
if (data != null) {
|
|
|
|
|
|
|
|
val qrCodeStr = data.getStringExtra("item") ?: ""
|
|
|
|
|
|
|
|
showLog("-------------qrCodeStr---item-----------")
|
|
|
|
|
|
|
|
showLog(qrCodeStr)
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(qrCodeStr)){
|
|
|
|
|
|
|
|
val item: QxgdAddressBean.DataBean = GsonUtils.GsonToBean(qrCodeStr,QxgdAddressBean.DataBean::class.java)
|
|
|
|
|
|
|
|
wzbmValue=item.wzbm
|
|
|
|
|
|
|
|
deviceValue=item.sbbm
|
|
|
|
|
|
|
|
binding.ilWz.content=item.description
|
|
|
|
|
|
|
|
binding.ilSb.content=item.description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gzlbValue = null
|
|
|
|
|
|
|
|
binding.ilGzlb.content = ""
|
|
|
|
|
|
|
|
checkConnectServerGzlb()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initJZdatas() {
|
|
|
|
private fun initJZdatas() {
|
|
|
|
jzDialogDatas.clear()
|
|
|
|
jzDialogDatas.clear()
|
|
|
|
for (bean in jzList) {
|
|
|
|
for (bean in jzList) {
|
|
|
|
@ -150,6 +204,13 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initGzlbData() {
|
|
|
|
|
|
|
|
gzlbDialogDatas.clear()
|
|
|
|
|
|
|
|
for (bean in gzlbList) {
|
|
|
|
|
|
|
|
gzlbDialogDatas.add(bean.description)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun getDropDown(type:String) {
|
|
|
|
private fun getDropDown(type:String) {
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
if(type=="jz"){
|
|
|
|
if(type=="jz"){
|
|
|
|
@ -167,12 +228,15 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
}else if(type=="gzlb"){
|
|
|
|
}else if(type=="gzlb"){
|
|
|
|
//故障类别
|
|
|
|
//故障类别
|
|
|
|
param["action"] = "QXGD_GZLB_GET";
|
|
|
|
param["action"] = "QXGD_GZLB_GET";
|
|
|
|
|
|
|
|
param["wzbm"] = wzbmValue?:"";
|
|
|
|
}else if(type=="gzxx"){
|
|
|
|
}else if(type=="gzxx"){
|
|
|
|
//故障现象
|
|
|
|
//故障现象
|
|
|
|
param["action"] = "QXGD_GZXX_GET";
|
|
|
|
param["action"] = "QXGD_GZXX_GET";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
|
|
|
|
showLog("--------------json param------------")
|
|
|
|
|
|
|
|
showLog(json)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val url = Contans.MAXIMOIP + Contans.QX_GET_ZY_DROP
|
|
|
|
val url = Contans.MAXIMOIP + Contans.QX_GET_ZY_DROP
|
|
|
|
@ -222,10 +286,20 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
}else if(type=="gzlb"){
|
|
|
|
}else if(type=="gzlb"){
|
|
|
|
//故障类别
|
|
|
|
//故障类别
|
|
|
|
showLog("故障类别")
|
|
|
|
showLog("故障类别")
|
|
|
|
|
|
|
|
gzlbList.clear()
|
|
|
|
|
|
|
|
gzlbList.addAll(bean.data)
|
|
|
|
|
|
|
|
initGzlbData()
|
|
|
|
}else if(type=="gzxx"){
|
|
|
|
}else if(type=="gzxx"){
|
|
|
|
//故障现象
|
|
|
|
//故障现象
|
|
|
|
showLog("故障现象")
|
|
|
|
showLog("故障现象")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(type=="gzlb"){
|
|
|
|
|
|
|
|
//故障类别
|
|
|
|
|
|
|
|
showLog("故障类别")
|
|
|
|
|
|
|
|
gzlbList.clear()
|
|
|
|
|
|
|
|
gzlbDialogDatas.clear()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {"state": 1,"msg":"查询成功","data":[
|
|
|
|
* {"state": 1,"msg":"查询成功","data":[
|
|
|
|
@ -291,6 +365,7 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun checkConnectServer() {
|
|
|
|
private fun checkConnectServer() {
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
@ -332,6 +407,7 @@ class QxgdNewActivity : BaseActivityOaToolbarViewBinding<ActivityQxgdNewBinding>
|
|
|
|
}, true, true, "连接服务器...")
|
|
|
|
}, true, true, "连接服务器...")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun checkConnectServerGzlb() {
|
|
|
|
private fun checkConnectServerGzlb() {
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
var param = HashMap<String,String>()
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
|