|
|
|
@ -20,6 +20,7 @@ import com.rehome.zhdcoa.bean.WhpListItemBean
|
|
|
|
import com.rehome.zhdcoa.bean.WhpListItemListBean
|
|
|
|
import com.rehome.zhdcoa.bean.WhpListItemListBean
|
|
|
|
import com.rehome.zhdcoa.databinding.ActivityAddDagerEnterApplyBinding
|
|
|
|
import com.rehome.zhdcoa.databinding.ActivityAddDagerEnterApplyBinding
|
|
|
|
import com.rehome.zhdcoa.utils.HttpUtils
|
|
|
|
import com.rehome.zhdcoa.utils.HttpUtils
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.weiget.AuditDialog
|
|
|
|
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
|
|
|
|
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
|
|
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|
|
|
import okhttp3.RequestBody
|
|
|
|
import okhttp3.RequestBody
|
|
|
|
@ -36,15 +37,16 @@ class AddDagerEnterApplyActivity :
|
|
|
|
private var id: String? = null;
|
|
|
|
private var id: String? = null;
|
|
|
|
private val whpList: MutableList<WhpListItemBean> = mutableListOf()
|
|
|
|
private val whpList: MutableList<WhpListItemBean> = mutableListOf()
|
|
|
|
private val whpDeleteList: MutableList<WhpListItemBean> = mutableListOf()
|
|
|
|
private val whpDeleteList: MutableList<WhpListItemBean> = mutableListOf()
|
|
|
|
|
|
|
|
private val whpChangeList: MutableList<WhpListItemBean> = mutableListOf()
|
|
|
|
|
|
|
|
|
|
|
|
private lateinit var adapter: WhpListAdapter
|
|
|
|
private lateinit var adapter: WhpListAdapter
|
|
|
|
|
|
|
|
|
|
|
|
private val userInfos: ArrayList<StaffInfoBean.StaffInfo> = ArrayList()
|
|
|
|
private val userInfos: ArrayList<StaffInfoBean.StaffInfo> = ArrayList()
|
|
|
|
override fun getViewBinding() = ActivityAddDagerEnterApplyBinding.inflate(layoutInflater)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private lateinit var launcherResult: ActivityResultLauncher<Intent>
|
|
|
|
private lateinit var launcherResult: ActivityResultLauncher<Intent>
|
|
|
|
private lateinit var launcherResultAddList: ActivityResultLauncher<Intent>
|
|
|
|
private lateinit var launcherResultAddList: ActivityResultLauncher<Intent>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun getViewBinding() = ActivityAddDagerEnterApplyBinding.inflate(layoutInflater)
|
|
|
|
override fun getToolbar() = binding.toolbarView.toolbar
|
|
|
|
override fun getToolbar() = binding.toolbarView.toolbar
|
|
|
|
|
|
|
|
|
|
|
|
override fun initView() {
|
|
|
|
override fun initView() {
|
|
|
|
@ -53,25 +55,31 @@ class AddDagerEnterApplyActivity :
|
|
|
|
launcherResult = createActivityResultLauncher()
|
|
|
|
launcherResult = createActivityResultLauncher()
|
|
|
|
launcherResultAddList = createActivityResultLauncherAddList()
|
|
|
|
launcherResultAddList = createActivityResultLauncherAddList()
|
|
|
|
initToolbar("危化品入厂申请", "下一步") {
|
|
|
|
initToolbar("危化品入厂申请", "下一步") {
|
|
|
|
|
|
|
|
if (checkForm()) {
|
|
|
|
|
|
|
|
if(whpDeleteList.size>0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// userInfo = App.getInstance().getUserInfo();
|
|
|
|
// userInfo = App.getInstance().getUserInfo();
|
|
|
|
binding.ilDinnerApply.content = userInfo!!.usernames
|
|
|
|
binding.ilNAME.content = userInfo!!.usernames
|
|
|
|
|
|
|
|
|
|
|
|
// setAdapter();
|
|
|
|
// setAdapter();
|
|
|
|
binding.ilAddDagerList.setIbtnSelectIcon()
|
|
|
|
binding.ilAddDagerList.setIbtnSelectIcon()
|
|
|
|
binding.ilDinnerUnit.setTvContentOnClickListener {
|
|
|
|
binding.ilDCFZBZ.setTvContentOnClickListener {
|
|
|
|
//val intent = Intent(context, DeparmentTreeActivity::class.java)
|
|
|
|
//val intent = Intent(context, DeparmentTreeActivity::class.java)
|
|
|
|
val intent = Intent(context, PartDeparmentTreeActivity::class.java)
|
|
|
|
val intent = Intent(context, PartDeparmentTreeActivity::class.java)
|
|
|
|
launcherResult.launch(intent)
|
|
|
|
launcherResult.launch(intent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
binding.ilStartTime.setTvContentOnClickListener {
|
|
|
|
binding.ilSQSJ.setTvContentOnClickListener {
|
|
|
|
val calendar = Calendar.getInstance()
|
|
|
|
val calendar = Calendar.getInstance()
|
|
|
|
val dialog = DateTimeMinutePickDialog(
|
|
|
|
val dialog = DateTimeMinutePickDialog(
|
|
|
|
context, calendar, true
|
|
|
|
context, calendar, true
|
|
|
|
) { outPutDate: String?, outPutDate1: String?, outPutDate2: String? ->
|
|
|
|
) { outPutDate: String?, outPutDate1: String?, outPutDate2: String? ->
|
|
|
|
binding.ilStartTime.content = outPutDate
|
|
|
|
binding.ilSQSJ.content = outPutDate
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dialog.show()
|
|
|
|
dialog.show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -83,7 +91,8 @@ class AddDagerEnterApplyActivity :
|
|
|
|
this,
|
|
|
|
this,
|
|
|
|
AddDagerEnterApplyListActivity::class.java
|
|
|
|
AddDagerEnterApplyListActivity::class.java
|
|
|
|
)
|
|
|
|
)
|
|
|
|
//intent.putExtra("item", Contans.MODUETYPE.KQ_LEVEKIND)
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
|
|
|
|
intent.putExtra("position", -1)
|
|
|
|
launcherResultAddList.launch(intent)
|
|
|
|
launcherResultAddList.launch(intent)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -95,14 +104,49 @@ class AddDagerEnterApplyActivity :
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun checkForm(): Boolean {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(binding.ilSQGYS.content)) {
|
|
|
|
|
|
|
|
showToast("申请公司名称必填")
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(binding.ilXMNAME.content)) {
|
|
|
|
|
|
|
|
showToast("工程项目名称必填")
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(binding.ilSQSJ.content)) {
|
|
|
|
|
|
|
|
showToast("申请入厂时间必填")
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(binding.ilDCFZBZ.content)) {
|
|
|
|
|
|
|
|
showToast("责任分部必填")
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (whpList.size <= 0) {
|
|
|
|
|
|
|
|
showToast("请添加危化品清单")
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun setAdapter() {
|
|
|
|
private fun setAdapter() {
|
|
|
|
adapter = WhpListAdapter(context, whpList, object : WhpListAdapter.CallBack {
|
|
|
|
adapter = WhpListAdapter(context, whpList, object : WhpListAdapter.CallBack {
|
|
|
|
override fun deleteClick(position: Int) {
|
|
|
|
override fun deleteClick(position: Int) {
|
|
|
|
// val intent = Intent(context, AddDagerEnterApplyActivity::class.java)
|
|
|
|
val dialog =
|
|
|
|
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
AuditDialog(
|
|
|
|
// intent.putExtra("isEdit",true)
|
|
|
|
context,
|
|
|
|
// intent.putExtra("id",item.id)
|
|
|
|
"确定要删除当前这条危化品清单吗?",
|
|
|
|
// startActivity(intent)
|
|
|
|
object : AuditDialog.AuditDialogListener {
|
|
|
|
|
|
|
|
override fun confirm() {
|
|
|
|
|
|
|
|
val item = whpList[position]
|
|
|
|
|
|
|
|
whpDeleteList.add(item)
|
|
|
|
|
|
|
|
whpList.removeAt(position)
|
|
|
|
|
|
|
|
adapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun cancel() {}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
dialog.show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -114,6 +158,7 @@ class AddDagerEnterApplyActivity :
|
|
|
|
val intent = Intent(context, AddDagerEnterApplyListActivity::class.java)
|
|
|
|
val intent = Intent(context, AddDagerEnterApplyListActivity::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)
|
|
|
|
intent.putExtra("item", item)
|
|
|
|
intent.putExtra("item", item)
|
|
|
|
|
|
|
|
intent.putExtra("position", position)
|
|
|
|
launcherResultAddList.launch(intent)
|
|
|
|
launcherResultAddList.launch(intent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -128,7 +173,7 @@ class AddDagerEnterApplyActivity :
|
|
|
|
if (data != null) {
|
|
|
|
if (data != null) {
|
|
|
|
departmentId = data.getStringExtra("departmentId")
|
|
|
|
departmentId = data.getStringExtra("departmentId")
|
|
|
|
departmentName = data.getStringExtra("departmentName")
|
|
|
|
departmentName = data.getStringExtra("departmentName")
|
|
|
|
binding.ilDinnerUnit.content = departmentName
|
|
|
|
binding.ilDCFZBZ.content = departmentName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -145,6 +190,7 @@ class AddDagerEnterApplyActivity :
|
|
|
|
showLog("---------------------")
|
|
|
|
showLog("---------------------")
|
|
|
|
showLog("$callbackItem")
|
|
|
|
showLog("$callbackItem")
|
|
|
|
if (data != null) {
|
|
|
|
if (data != null) {
|
|
|
|
|
|
|
|
val position: Int = data.getIntExtra("position", -1)
|
|
|
|
val item: WhpListItemBean? =
|
|
|
|
val item: WhpListItemBean? =
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
data.getParcelableExtra("item", WhpListItemBean::class.java)
|
|
|
|
data.getParcelableExtra("item", WhpListItemBean::class.java)
|
|
|
|
@ -152,15 +198,27 @@ class AddDagerEnterApplyActivity :
|
|
|
|
data.getParcelableExtra("item")
|
|
|
|
data.getParcelableExtra("item")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val callbackItem1 =item != null
|
|
|
|
val callbackItem1 = item != null
|
|
|
|
showLog("$callbackItem1")
|
|
|
|
showLog("$callbackItem1")
|
|
|
|
if (item != null) {
|
|
|
|
if (item != null) {
|
|
|
|
if (item.id == null) {
|
|
|
|
if (item.id == null) {
|
|
|
|
whpList.add(item)
|
|
|
|
if(position==-1){
|
|
|
|
|
|
|
|
whpList.add(item)
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
val itemBean = whpList[position]
|
|
|
|
|
|
|
|
itemBean.hspmc = item.hspmc
|
|
|
|
|
|
|
|
itemBean.wslb = item.wslb
|
|
|
|
|
|
|
|
itemBean.sybm = item.sybm
|
|
|
|
|
|
|
|
itemBean.zrr = item.zrr
|
|
|
|
|
|
|
|
itemBean.srcl = item.srcl
|
|
|
|
|
|
|
|
itemBean.ccdd = item.ccdd
|
|
|
|
|
|
|
|
itemBean.rt = item.rt
|
|
|
|
|
|
|
|
itemBean.msds = item.msds
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (i in whpList.indices){
|
|
|
|
for (i in whpList.indices) {
|
|
|
|
val itemBean = whpList[i]
|
|
|
|
val itemBean = whpList[i]
|
|
|
|
if(itemBean.id.equals(item.id)){
|
|
|
|
if (itemBean.id.equals(item.id)) {
|
|
|
|
itemBean.hspmc = item.hspmc
|
|
|
|
itemBean.hspmc = item.hspmc
|
|
|
|
itemBean.wslb = item.wslb
|
|
|
|
itemBean.wslb = item.wslb
|
|
|
|
itemBean.sybm = item.sybm
|
|
|
|
itemBean.sybm = item.sybm
|
|
|
|
@ -169,6 +227,28 @@ class AddDagerEnterApplyActivity :
|
|
|
|
itemBean.ccdd = item.ccdd
|
|
|
|
itemBean.ccdd = item.ccdd
|
|
|
|
itemBean.rt = item.rt
|
|
|
|
itemBean.rt = item.rt
|
|
|
|
itemBean.msds = item.msds
|
|
|
|
itemBean.msds = item.msds
|
|
|
|
|
|
|
|
if(whpChangeList.size>0){
|
|
|
|
|
|
|
|
var needAddToChange:Boolean = true
|
|
|
|
|
|
|
|
for (j in whpChangeList.indices) {
|
|
|
|
|
|
|
|
val itemChangeBean = whpChangeList[j]
|
|
|
|
|
|
|
|
if (itemChangeBean.id.equals(item.id)) {
|
|
|
|
|
|
|
|
itemChangeBean.hspmc = item.hspmc
|
|
|
|
|
|
|
|
itemChangeBean.wslb = item.wslb
|
|
|
|
|
|
|
|
itemChangeBean.sybm = item.sybm
|
|
|
|
|
|
|
|
itemChangeBean.zrr = item.zrr
|
|
|
|
|
|
|
|
itemChangeBean.srcl = item.srcl
|
|
|
|
|
|
|
|
itemChangeBean.ccdd = item.ccdd
|
|
|
|
|
|
|
|
itemChangeBean.rt = item.rt
|
|
|
|
|
|
|
|
itemChangeBean.msds = item.msds
|
|
|
|
|
|
|
|
needAddToChange = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(needAddToChange){
|
|
|
|
|
|
|
|
whpChangeList.add(itemBean)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
whpChangeList.add(itemBean)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -193,11 +273,11 @@ class AddDagerEnterApplyActivity :
|
|
|
|
showToast(Gson().toJson(bean))
|
|
|
|
showToast(Gson().toJson(bean))
|
|
|
|
if (bean.datas != null && bean.datas.size > 0) {
|
|
|
|
if (bean.datas != null && bean.datas.size > 0) {
|
|
|
|
val rowsBean: DagerEnterApplyBean.RowsBean = bean.datas[0]
|
|
|
|
val rowsBean: DagerEnterApplyBean.RowsBean = bean.datas[0]
|
|
|
|
binding.ilDinnerApply.content = rowsBean.name
|
|
|
|
binding.ilNAME.content = rowsBean.name
|
|
|
|
binding.ilTravelAddress.content = rowsBean.sqgys
|
|
|
|
binding.ilSQGYS.content = rowsBean.sqgys
|
|
|
|
binding.ilTravelsRemark.content = rowsBean.xmname
|
|
|
|
binding.ilXMNAME.content = rowsBean.xmname
|
|
|
|
binding.ilStartTime.content = rowsBean.sqsj
|
|
|
|
binding.ilSQSJ.content = rowsBean.sqsj
|
|
|
|
binding.ilDinnerUnit.content = rowsBean.dcfzbzname
|
|
|
|
binding.ilDCFZBZ.content = rowsBean.dcfzbzname
|
|
|
|
departmentId = rowsBean.dcfzbz
|
|
|
|
departmentId = rowsBean.dcfzbz
|
|
|
|
departmentName = rowsBean.dcfzbzname
|
|
|
|
departmentName = rowsBean.dcfzbzname
|
|
|
|
id = rowsBean.id
|
|
|
|
id = rowsBean.id
|
|
|
|
|