|
@@ -3,8 +3,6 @@ package com.grkj.iscs.features.main.fragment.job_manage
|
|
|
import android.widget.LinearLayout
|
|
import android.widget.LinearLayout
|
|
|
import androidx.core.view.isVisible
|
|
import androidx.core.view.isVisible
|
|
|
import androidx.fragment.app.viewModels
|
|
import androidx.fragment.app.viewModels
|
|
|
-import androidx.lifecycle.ViewModelProvider
|
|
|
|
|
-import androidx.navigation.NavOptions
|
|
|
|
|
import com.drake.brv.BindingAdapter
|
|
import com.drake.brv.BindingAdapter
|
|
|
import com.drake.brv.utils.grid
|
|
import com.drake.brv.utils.grid
|
|
|
import com.drake.brv.utils.linear
|
|
import com.drake.brv.utils.linear
|
|
@@ -16,8 +14,6 @@ import com.grkj.data.model.vo.SopManageVo
|
|
|
import com.grkj.data.model.vo.UserManageVo
|
|
import com.grkj.data.model.vo.UserManageVo
|
|
|
import com.grkj.iscs.R
|
|
import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.common.DataTransferConstants
|
|
import com.grkj.iscs.common.DataTransferConstants
|
|
|
-import com.grkj.iscs.databinding.FragmentCreateSopJobBinding
|
|
|
|
|
-import com.grkj.iscs.databinding.FragmentEditSopBinding
|
|
|
|
|
import com.grkj.iscs.databinding.FragmentEditSopJobBinding
|
|
import com.grkj.iscs.databinding.FragmentEditSopJobBinding
|
|
|
import com.grkj.iscs.databinding.ItemSelectMemberBinding
|
|
import com.grkj.iscs.databinding.ItemSelectMemberBinding
|
|
|
import com.grkj.iscs.databinding.ItemSelectPointBinding
|
|
import com.grkj.iscs.databinding.ItemSelectPointBinding
|
|
@@ -62,22 +58,6 @@ class EditSopJobFragment : BaseFragment<FragmentEditSopJobBinding>() {
|
|
|
navController.popBackStack()
|
|
navController.popBackStack()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- binding.startJob.setDebouncedClickListener {
|
|
|
|
|
- if (checkData()) {
|
|
|
|
|
- TipDialog.show(
|
|
|
|
|
- title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_hint).toString(),
|
|
|
|
|
- msg = CommonUtils.getStr(R.string.start_job_check).toString(),
|
|
|
|
|
- dialogType = TipDialog.DialogType.INFO,
|
|
|
|
|
- countDownTime = 10,
|
|
|
|
|
- onConfirmClick = {
|
|
|
|
|
- viewModel.startJob().observe(this) {
|
|
|
|
|
- GlobalDataTempStore.getInstance()
|
|
|
|
|
- .saveData(DataTransferConstants.KEY_JOB_TICKET_ID, viewModel.jobTicketData?.ticketId?:0)
|
|
|
|
|
- navController.navigate(R.id.action_editSopJobFragment_to_jobExecuteFragment)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
binding.cancel.setDebouncedClickListener {
|
|
binding.cancel.setDebouncedClickListener {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_hint).toString(),
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_hint).toString(),
|
|
@@ -88,7 +68,19 @@ class EditSopJobFragment : BaseFragment<FragmentEditSopJobBinding>() {
|
|
|
navController.popBackStack()
|
|
navController.popBackStack()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- binding.confirm.setDebouncedClickListener {
|
|
|
|
|
|
|
+ binding.save.setDebouncedClickListener {
|
|
|
|
|
+ if (checkData()) {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_hint).toString(),
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.job_save_tip).toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.INFO,
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ onConfirmClick = {
|
|
|
|
|
+ saveSopJob()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ binding.saveAndExecute.setDebouncedClickListener {
|
|
|
if (checkData()) {
|
|
if (checkData()) {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_confirm).toString(),
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_confirm).toString(),
|
|
@@ -99,7 +91,7 @@ class EditSopJobFragment : BaseFragment<FragmentEditSopJobBinding>() {
|
|
|
dialogType = TipDialog.DialogType.INFO,
|
|
dialogType = TipDialog.DialogType.INFO,
|
|
|
countDownTime = 10,
|
|
countDownTime = 10,
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
- saveSopJob()
|
|
|
|
|
|
|
+ saveSopJob(true)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -167,7 +159,7 @@ class EditSopJobFragment : BaseFragment<FragmentEditSopJobBinding>() {
|
|
|
/**
|
|
/**
|
|
|
* 保存sop作业
|
|
* 保存sop作业
|
|
|
*/
|
|
*/
|
|
|
- private fun saveSopJob() {
|
|
|
|
|
|
|
+ private fun saveSopJob(isExecute: Boolean = false) {
|
|
|
viewModel.saveSopJob(
|
|
viewModel.saveSopJob(
|
|
|
selectedPointData,
|
|
selectedPointData,
|
|
|
selectedLockerData,
|
|
selectedLockerData,
|
|
@@ -179,12 +171,37 @@ class EditSopJobFragment : BaseFragment<FragmentEditSopJobBinding>() {
|
|
|
viewModel.jobTicketData?.ticketId ?: 0
|
|
viewModel.jobTicketData?.ticketId ?: 0
|
|
|
).observe(this) {
|
|
).observe(this) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
- TipDialog.show(
|
|
|
|
|
- title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_succeed).toString(),
|
|
|
|
|
- msg = CommonUtils.getStr(R.string.sop_job_save_succeed).toString(),
|
|
|
|
|
- dialogType = TipDialog.DialogType.SUCCESS,
|
|
|
|
|
- countDownTime = 10,
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ if (isExecute) {
|
|
|
|
|
+ viewModel.startJob().observe(this) {
|
|
|
|
|
+ if (it) {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_succeed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.sop_job_save_and_execute_succeed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.SUCCESS,
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_succeed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.sop_job_save_and_execute_failed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.SUCCESS,
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_succeed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.sop_job_save_succeed).toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.SUCCESS,
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_failed).toString(),
|
|
title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_failed).toString(),
|