diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 08c267c..5e26df8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -82,7 +82,6 @@
tools:replace="android:allowBackup"
tools:targetApi="s">
-
@@ -1145,6 +1144,10 @@
android:name=".ui.activity.WorkTickerCustomListActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" />
+
() {
+
+ //private lateinit var headView: View
+ //private lateinit var cb: CheckBox
+
+ private var datas: MutableList = mutableListOf()
+ private lateinit var mAdapter: WorkTickerCustomListAdapter
+
+ //工作票主键数组,来源查询每日作业风险清单
+ private var ticketIdList : MutableList = mutableListOf()
+ //要取消的工作票主键
+ private var deleteIdList : MutableList = mutableListOf()
+
+ private var selectList: MutableList = mutableListOf()
+ private var jobNoList: MutableList = mutableListOf()
+
+ var items: Array = arrayOf("机械", "输煤", "热控", "燃料电仪", "环化", "码头", "MIS", "电气", "辅助维护", "燃料", "综合服务", "燃料机械", "生产公用", "保卫")
+ //机械、输煤、热控、燃料电仪、环化、
+ //码头、MIS、电气、辅助维护、燃料、综合服
+ //务、燃料机械、生产公用、保卫
+ //info.setJz(jzs.get(et_jz.getSelectedItemPosition()).getKey());
+
+ private lateinit var adapter: ArrayAdapter
+
+
+ private lateinit var calendarSt: Calendar
+ private lateinit var calendarEt: Calendar
+
+ //格式化日期的对象(转化成习惯的时间格式)
+ private val sdFormat = SimpleDateFormat("yyyy-MM-dd HH:mm")
+
+ override fun getViewBinding() = ActivityWorkTickerCustomAddBinding.inflate(layoutInflater)
+
+ override fun getToolbar() = binding.toolbarView.toolbar
+
+ override fun initView() {
+
+ initToolbar("手动添加工作票", "") {
+
+ }
+
+
+ resetToday()
+ adapter = ArrayAdapter(this, R.layout.simple_spinner_item, items)
+ binding.spinnerZy.adapter = adapter
+
+
+
+ binding.tvSt.setOnClickListener(View.OnClickListener { view: View? ->
+ val dialog = DateTimeMinutePickDialog(
+ context, calendarSt, true,true,
+ ) { outPutDate: String?, outPutDate1: String?, outPutDate2: String? ->
+ binding.tvSt.text = outPutDate
+ }
+ dialog.show()
+ })
+
+ binding.tvEt.setOnClickListener(View.OnClickListener { view: View? ->
+ val dialog = DateTimeMinutePickDialog(
+ context, calendarEt, true,true,
+ ) { outPutDate: String?, outPutDate1: String?, outPutDate2: String? ->
+ binding.tvEt.text = outPutDate
+ }
+ dialog.show()
+ })
+
+
+
+
+
+ binding.tvSubmit.setOnClickListener {
+ var canSubmit = false
+ ticketIdList.clear()
+ for (i in datas.indices) {
+ if (datas[i].isChecked) {
+ canSubmit = true
+ ticketIdList.add(datas[i].id)
+ }
+ }
+ if (canSubmit||deleteIdList.size>0) {
+ val dialog = CommitDialog(context, object : CommitDialogListener {
+ override fun confirm() {
+ showLog(GsonUtils.GsonString(ticketIdList))
+ showLog(ticketIdList.size.toString())
+ //authenticationLoginAISubmit()
+ }
+
+ override fun cancel() {
+ }
+ })
+ dialog.setTvMsg("您确定要设置工作票作业?")
+ dialog.show()
+ }else{
+ showToast("致少选择一个工作票才能提交")
+ }
+ }
+
+ binding.rb1.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = true
+ binding.rb2.isChecked = false
+ binding.rb3.isChecked = false
+ binding.rb4.isChecked = false
+ binding.rb5.isChecked = false
+ binding.rb6.isChecked = false
+ }
+ }
+ })
+ binding.rb2.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = false
+ binding.rb2.isChecked = true
+ binding.rb3.isChecked = false
+ binding.rb4.isChecked = false
+ binding.rb5.isChecked = false
+ binding.rb6.isChecked = false
+ }
+ }
+ })
+ binding.rb3.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = false
+ binding.rb2.isChecked = false
+ binding.rb3.isChecked = true
+ binding.rb4.isChecked = false
+ binding.rb5.isChecked = false
+ binding.rb6.isChecked = false
+ }
+ }
+ })
+ binding.rb4.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = false
+ binding.rb2.isChecked = false
+ binding.rb3.isChecked = false
+ binding.rb4.isChecked = true
+ binding.rb5.isChecked = false
+ binding.rb6.isChecked = false
+ }
+ }
+ })
+ binding.rb5.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = false
+ binding.rb2.isChecked = false
+ binding.rb3.isChecked = false
+ binding.rb4.isChecked = false
+ binding.rb5.isChecked = true
+ binding.rb6.isChecked = false
+ }
+ }
+ })
+ binding.rb6.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
+ override fun onCheckedChanged(
+ buttonView: CompoundButton,
+ isChecked: Boolean
+ ) {
+ if(isChecked){
+ binding.rb1.isChecked = false
+ binding.rb2.isChecked = false
+ binding.rb3.isChecked = false
+ binding.rb4.isChecked = false
+ binding.rb5.isChecked = false
+ binding.rb6.isChecked = true
+ }
+ }
+ })
+ }
+
+ override fun initData() {
+ authenticationLoginAI()
+ }
+
+ private fun authenticationLoginAI() {
+ try {
+ //AI三维登录接口
+ val userName = Contans.SP.AI_ACCOUNT
+ //String strPrivateEncode=RSAAndroid.encryptByPrivateKeyForSpiltStr(Contans.SP.AI_PWD,RSAAndroid.privateRsaKeyLocal);
+ val strPublicDecode = RSAAndroid.decryptByPublicKeyForSpiltStr(
+ Contans.SP.AI_PWD_ENCODE,
+ RSAAndroid.publicRsaKeyLocal
+ )
+ AuthenticationLoginAIUtils.authenticationAILoginShowProgress(
+ this, userName, strPublicDecode
+ ) { _, token ->
+ if (token != null && token == "") {
+ showToast("AI三维平台登录失败")
+ } else {
+ getWorkRiskListData()
+ }
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+ private fun getWorkRiskListData() {
+ val request = NoHttp.createStringRequest(
+ Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_NEW,
+ RequestMethod.GET
+ )
+
+ request.add("filter",false);
+
+ if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
+ val socketFactory = NohttpUtils.getSSLSocketFactory(context)
+ if (socketFactory != null) {
+ request.sslSocketFactory = socketFactory
+ request.hostnameVerifier = HostnameVerifier { _, _ -> true }
+ }
+ }
+
+ NohttpUtils.getInstance().add(this, 0, request, object : HttpListener {
+
+ override fun onSucceed(what: Int, response: Response?) {
+ val result = response?.get()
+ showLog("----------------")
+ showLog(result)
+ val bean = GsonUtils.GsonToBean(
+ result,
+ WorkRiskLevelListBean::class.java
+ )
+ if (bean != null && bean.data != null) {
+ val workRiskLevelLists = bean.data
+ if (workRiskLevelLists != null && workRiskLevelLists.isNotEmpty()) {
+
+ } else {
+
+ }
+ }
+ }
+
+ override fun onFailed(what: Int, response: Response?) {
+
+ }
+ })
+ }
+
+ private fun resetToday(){
+ //开始时间
+ calendarSt = Calendar.getInstance()
+ calendarSt.set(
+ calendarSt.get(Calendar.YEAR), calendarSt.get(Calendar.MONTH),
+ calendarSt.get(Calendar.DAY_OF_MONTH), 8,
+ 30, 0)
+ val startDateStr = sdFormat.format(calendarSt.time)
+ binding.tvSt.text = startDateStr
+ //结束时间
+ calendarEt = Calendar.getInstance()
+ calendarEt.set(
+ calendarEt.get(Calendar.YEAR), calendarEt.get(Calendar.MONTH),
+ calendarEt.get(Calendar.DAY_OF_MONTH), 16,
+ 0, 0)
+ val endDateStr = sdFormat.format(calendarEt.time)
+ binding.tvEt.text = endDateStr
+ }
+
+ private fun authenticationLoginAISubmit() {
+ try {
+ //AI三维登录接口
+ val userName = Contans.SP.AI_ACCOUNT
+ //String strPrivateEncode=RSAAndroid.encryptByPrivateKeyForSpiltStr(Contans.SP.AI_PWD,RSAAndroid.privateRsaKeyLocal);
+ val strPublicDecode = RSAAndroid.decryptByPublicKeyForSpiltStr(
+ Contans.SP.AI_PWD_ENCODE,
+ RSAAndroid.publicRsaKeyLocal
+ )
+ AuthenticationLoginAIUtils.authenticationAILoginShowProgress(
+ this, userName, strPublicDecode
+ ) { _, token ->
+ if (token != null && token == "") {
+ showToast("AI三维平台登录失败")
+ } else {
+ submitWorkTicketData()
+ }
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+ private fun getSubmitJsonData(): String {
+ val param = HashMap()
+ param["assignmentDate"] = binding.tvSt.text.toString().trim()
+ param["ticketIdList"] = ticketIdList
+ param["deleteIdList"]= deleteIdList
+ param["jobNo"]= App.getInstance().userInfo.manid
+ param["type"]= "custom"
+
+ val json = GsonUtils.GsonString(param)
+ showLog(json)
+ return json
+ }
+
+ private fun submitWorkTicketData() {
+ val request = NoHttp.createStringRequest(
+ Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST,
+ RequestMethod.POST
+ )
+
+ val json: String = getSubmitJsonData()
+ request.setDefineRequestBodyForJson(json)
+
+ if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
+ val socketFactory = NohttpUtils.getSSLSocketFactory(context)
+ if (socketFactory != null) {
+ request.sslSocketFactory = socketFactory
+ request.hostnameVerifier = HostnameVerifier { _, _ -> true }
+ }
+ }
+
+ NohttpUtils.getInstance().add(this, 0, request, object : HttpListener {
+
+ override fun onSucceed(what: Int, response: Response?) {
+ val result = response?.get()
+ showLog("----------------")
+ showLog(result)
+ val bean = GsonUtils.GsonToBean(
+ result,
+ AIBaseBean::class.java
+ )
+ if (bean != null && bean.isSuccess) {
+ //提交成功
+ val confirmDialog = ConfirmDialog(
+ context, "设置工作票作业日期成功"
+ ) { finish() }
+ confirmDialog.setTvTitle("提示")
+ confirmDialog.setCancelable(true)
+ confirmDialog.show()
+ }else{
+ showToast("设置工作票作业日期失败")
+ }
+ }
+
+ override fun onFailed(what: Int, response: Response?) {
+
+ }
+ })
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/rehome/zhdcoa/ui/activity/WorkTickerCustomListActivity.kt b/app/src/main/java/com/rehome/zhdcoa/ui/activity/WorkTickerCustomListActivity.kt
index fd878a6..9c1f343 100644
--- a/app/src/main/java/com/rehome/zhdcoa/ui/activity/WorkTickerCustomListActivity.kt
+++ b/app/src/main/java/com/rehome/zhdcoa/ui/activity/WorkTickerCustomListActivity.kt
@@ -1,6 +1,7 @@
package com.rehome.zhdcoa.ui.activity
+import android.content.Intent
import android.view.View
import android.widget.CheckBox
import com.google.gson.Gson
@@ -64,9 +65,13 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file