master
hwf452 2 years ago
parent 04b00a5dff
commit 6ee51a3599

@ -532,6 +532,11 @@ public class Contans {
public static String DAGER_ENTER_APPLY_CHANGE_ITEM_LIST_URL="CBS/WHP/Api/EidtHWPSQ_QD.ashx"; public static String DAGER_ENTER_APPLY_CHANGE_ITEM_LIST_URL="CBS/WHP/Api/EidtHWPSQ_QD.ashx";
//安防-新增危化品清单一条数据 //安防-新增危化品清单一条数据
public static String DAGER_ENTER_APPLY_ADD_ITEM_LIST_URL="CBS/WHP/Api/AddHWPSQ_QD.ashx"; public static String DAGER_ENTER_APPLY_ADD_ITEM_LIST_URL="CBS/WHP/Api/AddHWPSQ_QD.ashx";
//安防-新增危化一条数据
public static String DAGER_ENTER_APPLY_ADD_WHP_URL="CBS/WHP/Api/AddHWPSQ.ashx";
//修改危化品入厂申请
public static String DAGER_ENTER_APPLY_UPDATE_WHP_URL="CBS/WHP/Api/EidtHWPSQ.ashx";
//移动仓库 //移动仓库

@ -3,7 +3,6 @@ package com.rehome.zhdcoa.ui.activity
import android.content.Intent import android.content.Intent
import android.os.Build import android.os.Build
import android.text.TextUtils import android.text.TextUtils
import android.util.Log
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.ActivityResultLauncher
@ -15,9 +14,7 @@ import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.zhdcoa.base.BaseCallBack import com.rehome.zhdcoa.base.BaseCallBack
import com.rehome.zhdcoa.bean.DagerEnterApplyBaseBean import com.rehome.zhdcoa.bean.DagerEnterApplyBaseBean
import com.rehome.zhdcoa.bean.DagerEnterApplyBean import com.rehome.zhdcoa.bean.DagerEnterApplyBean
import com.rehome.zhdcoa.bean.GetAuditBean
import com.rehome.zhdcoa.bean.StaffInfoBean import com.rehome.zhdcoa.bean.StaffInfoBean
import com.rehome.zhdcoa.bean.UserInfoBean
import com.rehome.zhdcoa.bean.WhpListItemBean 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
@ -28,14 +25,12 @@ import com.rehome.zhdcoa.utils.NoProgresshttpUtils
import com.rehome.zhdcoa.utils.NohttpUtils import com.rehome.zhdcoa.utils.NohttpUtils
import com.rehome.zhdcoa.weiget.AuditDialog import com.rehome.zhdcoa.weiget.AuditDialog
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
import com.rehome.zhdcoa.weiget.SaveOrCommitDialog
import com.yolanda.nohttp.NoHttp import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response import com.yolanda.nohttp.rest.Response
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import retrofit2.Call import retrofit2.Call
import java.util.Calendar import java.util.Calendar
import java.util.TreeMap
class AddDagerEnterApplyActivity : class AddDagerEnterApplyActivity :
BaseActivityOaToolbarViewBinding<ActivityAddDagerEnterApplyBinding>() { BaseActivityOaToolbarViewBinding<ActivityAddDagerEnterApplyBinding>() {
@ -65,11 +60,19 @@ class AddDagerEnterApplyActivity :
launcherResultAddList = createActivityResultLauncherAddList() launcherResultAddList = createActivityResultLauncherAddList()
initToolbar("危化品入厂申请", "下一步") { initToolbar("危化品入厂申请", "下一步") {
if (checkForm()) { if (checkForm()) {
if (whpList.size > 0) {
//弹框提示 保存或提交 //弹框提示 保存或提交
} else { val dialog = SaveOrCommitDialog(
//危化品清单没有添加,提示添加危化品清单 context,
object : SaveOrCommitDialog.SaveOrCommitDialogListener {
override fun saveData() {
saveOrCommitApply(false)
}
override fun commitData() {
saveOrCommitApply(true)
} }
})
dialog.show()
} }
} }
@ -111,6 +114,28 @@ class AddDagerEnterApplyActivity :
} }
} }
//创建一个ActivityResultLauncher添加一条危化品清单数据
private fun saveOrCommitApply(isSubmit: Boolean) {
if (isSubmit) {
//保存并提交
if (isEdit) {
//编辑,新增一条危化品清单
//addWhpListByID(item)
} else {
}
} else {
//仅保存
if (isEdit) {
//编辑
updateWhpByFirst()
} else {
//新增
addWhpByFirst()
}
}
}
private fun checkForm(): Boolean { private fun checkForm(): Boolean {
if (TextUtils.isEmpty(binding.ilSQGYS.content)) { if (TextUtils.isEmpty(binding.ilSQGYS.content)) {
@ -330,7 +355,8 @@ class AddDagerEnterApplyActivity :
override fun onSucceed(what: Int, response: Response<String?>?) { override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get() val result = response?.get()
showLog(result) showLog(result)
val bean: DagerEnterApplyBaseBean? = GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java) val bean: DagerEnterApplyBaseBean? =
GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java)
if (bean != null && bean.isFlag) { if (bean != null && bean.isFlag) {
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
} else { } else {
@ -354,7 +380,8 @@ class AddDagerEnterApplyActivity :
override fun onSucceed(what: Int, response: Response<String?>?) { override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get() val result = response?.get()
showLog(result) showLog(result)
val bean: DagerEnterApplyBaseBean? = GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java) val bean: DagerEnterApplyBaseBean? =
GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java)
if (bean != null && bean.isFlag) { if (bean != null && bean.isFlag) {
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
} else { } else {
@ -379,9 +406,9 @@ class AddDagerEnterApplyActivity :
override fun onSucceed(what: Int, response: Response<String?>?) { override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get() val result = response?.get()
showLog(result) showLog(result)
val bean: DagerEnterApplyBaseBean? = GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java) val bean: DagerEnterApplyBaseBean? =
GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java)
if (bean != null && bean.isFlag) { if (bean != null && bean.isFlag) {
showToast("新增危化品清单成功")
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
} else { } else {
showToast("新增危化品清单失败") showToast("新增危化品清单失败")
@ -394,4 +421,72 @@ class AddDagerEnterApplyActivity :
}) })
} }
//新增危化品入厂申请
private fun addWhpByFirst() {
val url: String = Contans.BASE_URL + Contans.DAGER_ENTER_APPLY_ADD_WHP_URL
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
val map: MutableMap<String, String> = mutableMapOf()
map["NAME"] = userInfo!!.usernames
map["SQSJ"] = binding.ilSQSJ.content
map["SQGYS"] = binding.ilSQGYS.content
map["XMNAME"] = binding.ilXMNAME.content
map["DCFZBZ"] = departmentId!!
map["SQRID"] = userInfo!!.manid
map["SQRDEPTID"] = userInfo!!.bzbh
request.setDefineRequestBodyForJson(Gson().toJson(map))
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get()
showLog(result)
val bean: DagerEnterApplyBaseBean? =
GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java)
if (bean != null && bean.isFlag) {
showToast("新增危化品成功")
adapter.notifyDataSetChanged()
} else {
showToast("新增危化品失败")
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
}
}, true, true, "提交数据中...")
}
//修改危化品入厂申请
private fun updateWhpByFirst() {
val url: String = Contans.BASE_URL + Contans.DAGER_ENTER_APPLY_UPDATE_WHP_URL
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
val map: MutableMap<String, String> = mutableMapOf()
map["ID"] = id!!
map["SQSJ"] = binding.ilSQSJ.content
map["SQGYS"] = binding.ilSQGYS.content
map["XMNAME"] = binding.ilXMNAME.content
map["DCFZBZ"] = departmentId!!
request.setDefineRequestBodyForJson(Gson().toJson(map))
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get()
showLog(result)
val bean: DagerEnterApplyBaseBean? =
GsonUtils.GsonToBean(result, DagerEnterApplyBaseBean::class.java)
if (bean != null && bean.isFlag) {
showToast("修改危化品成功")
adapter.notifyDataSetChanged()
} else {
showToast("修改危化品失败")
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
}
}, true, true, "提交数据中...")
}
} }
Loading…
Cancel
Save