master
hwf452 2 years ago
parent 0174a6cb3b
commit 04b00a5dff

@ -112,7 +112,6 @@ dependencies {
implementation 'com.github.xuexiangjys:XUI:1.1.5'
implementation 'com.haibin:calendarview:3.6.3'
implementation 'com.github.baoyachi:StepView:1.9'
//implementation 'com.azhon:appupdateX:2.9.0'
implementation 'io.github.azhon:appupdate:4.2.6'
implementation 'com.king.zxing:zxing-lite:1.1.6-androidx'
implementation 'com.tencent.bugly:crashreport:3.2.1'
@ -126,7 +125,6 @@ dependencies {
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.5.9'
//
// PictureSelector basic (Necessary)
implementation 'io.github.lucksiege:pictureselector:v3.10.7'
@ -139,15 +137,10 @@ dependencies {
//
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
//X5 office
//api 'com.tencent.tbs:tbssdk:44226'
//mqtt
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.4'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.47'
implementation 'commons-codec:commons-codec:1.15'
implementation project(':videocompressor')
//LeakCanary
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
//releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
}

@ -526,6 +526,13 @@ public class Contans {
public static String DAGER_ENTER_APPLY_GETLIST_URL="CBS/WHP/Api/GetWHPSQList.ashx?Login_User_ID=";
//安防-危化品入厂申请详细数据
public static String DAGER_ENTER_APPLY_DETAIL_URL="CBS/WHP/Api/getDetailData.ashx?id=";
//安防-删除危化品清单一条数据
public static String DAGER_ENTER_APPLY_DELETE_ITEM_LIST_URL="CBS/WHP/Api/DelHWPSQ_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";
//移动仓库
//母货架
@ -539,4 +546,5 @@ public class Contans {
//上传视频
public static String YDCK_WZ_UPLOAD_VIDEO_URL="WLJS/WLUP/SetFilesNew.aspx";
}

@ -13,15 +13,24 @@ import com.rehome.zhdcoa.Contans
import com.rehome.zhdcoa.adapter.WhpListAdapter
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.zhdcoa.base.BaseCallBack
import com.rehome.zhdcoa.bean.DagerEnterApplyBaseBean
import com.rehome.zhdcoa.bean.DagerEnterApplyBean
import com.rehome.zhdcoa.bean.GetAuditBean
import com.rehome.zhdcoa.bean.StaffInfoBean
import com.rehome.zhdcoa.bean.UserInfoBean
import com.rehome.zhdcoa.bean.WhpListItemBean
import com.rehome.zhdcoa.bean.WhpListItemListBean
import com.rehome.zhdcoa.databinding.ActivityAddDagerEnterApplyBinding
import com.rehome.zhdcoa.utils.GsonUtils
import com.rehome.zhdcoa.utils.HttpListener
import com.rehome.zhdcoa.utils.HttpUtils
import com.rehome.zhdcoa.utils.NoProgresshttpUtils
import com.rehome.zhdcoa.utils.NohttpUtils
import com.rehome.zhdcoa.weiget.AuditDialog
import com.rehome.zhdcoa.weiget.DateTimeMinutePickDialog
import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import retrofit2.Call
@ -36,8 +45,8 @@ class AddDagerEnterApplyActivity :
private var isEdit = false;
private var id: String? = null;
private val whpList: MutableList<WhpListItemBean> = mutableListOf()
private val whpDeleteList: MutableList<WhpListItemBean> = mutableListOf()
private val whpChangeList: MutableList<WhpListItemBean> = mutableListOf()
// private val whpDeleteList: MutableList<WhpListItemBean> = mutableListOf()
// private val whpChangeList: MutableList<WhpListItemBean> = mutableListOf()
private lateinit var adapter: WhpListAdapter
@ -56,18 +65,16 @@ class AddDagerEnterApplyActivity :
launcherResultAddList = createActivityResultLauncherAddList()
initToolbar("危化品入厂申请", "下一步") {
if (checkForm()) {
if(whpDeleteList.size>0){
if (whpList.size > 0) {
//弹框提示 保存或提交
} else {
//危化品清单没有添加,提示添加危化品清单
}
}
}
// userInfo = App.getInstance().getUserInfo();
binding.ilNAME.content = userInfo!!.usernames
// setAdapter();
binding.ilAddDagerList.setIbtnSelectIcon()
binding.ilDCFZBZ.setTvContentOnClickListener {
//val intent = Intent(context, DeparmentTreeActivity::class.java)
@ -139,9 +146,12 @@ class AddDagerEnterApplyActivity :
object : AuditDialog.AuditDialogListener {
override fun confirm() {
val item = whpList[position]
whpDeleteList.add(item)
whpList.removeAt(position)
adapter.notifyDataSetChanged()
if (item.id != null) {
//调接口,删除一条危化品清单数据
deleteWhpListByID(item.id)
}
}
override fun cancel() {}
@ -202,9 +212,16 @@ class AddDagerEnterApplyActivity :
showLog("$callbackItem1")
if (item != null) {
if (item.id == null) {
//新增
if (position == -1) {
//添加一条危化品清单
whpList.add(item)
if (isEdit) {
//编辑,新增一条危化品清单
addWhpListByID(item)
}
} else {
//更新一条危化品清单
val itemBean = whpList[position]
itemBean.hspmc = item.hspmc
itemBean.wslb = item.wslb
@ -216,6 +233,7 @@ class AddDagerEnterApplyActivity :
itemBean.msds = item.msds
}
} else {
//编辑
for (i in whpList.indices) {
val itemBean = whpList[i]
if (itemBean.id.equals(item.id)) {
@ -227,27 +245,10 @@ class AddDagerEnterApplyActivity :
itemBean.ccdd = item.ccdd
itemBean.rt = item.rt
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)
//更新危化品一条清单数据
if (isEdit) {
//编辑
changeWhpListByID(itemBean)
}
}
}
@ -270,7 +271,7 @@ class AddDagerEnterApplyActivity :
) {
val bean = response?.body()
if (bean != null && bean.isFlag) {
showToast(Gson().toJson(bean))
//showToast(Gson().toJson(bean))
if (bean.datas != null && bean.datas.size > 0) {
val rowsBean: DagerEnterApplyBean.RowsBean = bean.datas[0]
binding.ilNAME.content = rowsBean.name
@ -304,7 +305,7 @@ class AddDagerEnterApplyActivity :
) {
val bean = response?.body()
if (bean != null && bean.isFlag) {
showToast(Gson().toJson(bean))
showLog(Gson().toJson(bean))
if (bean.datas != null && bean.datas.size > 0) {
whpList.addAll(bean.datas)
adapter.notifyDataSetChanged()
@ -317,4 +318,80 @@ class AddDagerEnterApplyActivity :
}
})
}
//删除危化品清单
private fun deleteWhpListByID(listId: String) {
val map: MutableMap<String, String> = mutableMapOf()
map["ID"] = listId
val url: String = Contans.BASE_URL + Contans.DAGER_ENTER_APPLY_DELETE_ITEM_LIST_URL
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
request.setDefineRequestBodyForJson(Gson().toJson(map))
NoProgresshttpUtils.getInstance().add(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) {
adapter.notifyDataSetChanged()
}else{
showToast("删除危化品清单失败")
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
}
})
}
//修改危化品清单
private fun changeWhpListByID(item: WhpListItemBean) {
val url: String = Contans.BASE_URL + Contans.DAGER_ENTER_APPLY_CHANGE_ITEM_LIST_URL
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
request.setDefineRequestBodyForJson(Gson().toJson(item))
NoProgresshttpUtils.getInstance().add(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) {
adapter.notifyDataSetChanged()
}else{
showToast("修改危化品清单失败")
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
}
})
}
//新增危化品清单
private fun addWhpListByID(item: WhpListItemBean) {
val url: String = Contans.BASE_URL + Contans.DAGER_ENTER_APPLY_ADD_ITEM_LIST_URL
val request = NoHttp.createStringRequest(url, RequestMethod.POST)
item.mainid = id
request.setDefineRequestBodyForJson(Gson().toJson(item))
NoProgresshttpUtils.getInstance().add(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?>?) {
}
})
}
}

@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.1'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20'
}
}

Loading…
Cancel
Save