|
|
@@ -7,7 +7,9 @@ import com.grkj.iscs.databinding.FragmentWorkerBinding
|
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_COLOCKER
|
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_LOCKER
|
|
|
import com.grkj.iscs.model.bo.PageChangeBO
|
|
|
+import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
|
|
|
import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO
|
|
|
+import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO.JobTicketUserVO
|
|
|
import com.grkj.iscs.model.vo.ticket.TicketUserReqVO
|
|
|
import com.grkj.iscs.model.vo.user.UserListRespVO
|
|
|
import com.grkj.iscs.util.SPUtils
|
|
|
@@ -31,8 +33,11 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
private val mLockerList = mutableListOf<UserListRespVO.Row>()
|
|
|
private val mColockerInsideList = mutableListOf<UserListRespVO.Row>()
|
|
|
private val mColockerOutsideList = mutableListOf<UserListRespVO.Row>()
|
|
|
+ private val ticketUserVOList = mutableListOf<JobTicketUserVO>()
|
|
|
private var mPageChangeBO: PageChangeBO? = null
|
|
|
private var mStep: Int = 0
|
|
|
+ private var mStepDetailList: MutableList<StepDetailRespVO> = mutableListOf()
|
|
|
+ private var isColockerChanged: Boolean = false
|
|
|
|
|
|
override val viewBinding: FragmentWorkerBinding
|
|
|
get() = FragmentWorkerBinding.inflate(layoutInflater)
|
|
|
@@ -45,9 +50,13 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
if (!checkUpdate()) {
|
|
|
return@setOnClickListener
|
|
|
}
|
|
|
- presenter?.updateTicketUser(mPageChangeBO?.ticketId!!, mSelectedList) {
|
|
|
- if (it) {
|
|
|
- goBack()
|
|
|
+ if (isColockerChanged) {
|
|
|
+ presenter?.checkColockerChangedStepJump(requireContext(), mStepDetailList, mStep) {
|
|
|
+ presenter?.updateTicketUser(mPageChangeBO?.ticketId!!, mSelectedList) {
|
|
|
+ if (it) {
|
|
|
+ goBack()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -69,6 +78,7 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
+ isColockerChanged = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -108,7 +118,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
user.userId!!,
|
|
|
user.nickName!!,
|
|
|
"0",
|
|
|
- USER_ROLE_LOCKER
|
|
|
+ USER_ROLE_LOCKER,
|
|
|
+ ticketUserVOList.find { ticketUser -> ticketUser.userId == user.userId }?.jobStatus
|
|
|
)
|
|
|
)
|
|
|
mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
|
@@ -130,22 +141,31 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
mSelectedList.any { it.userId == user.userId && it.userRole == USER_ROLE_COLOCKER }
|
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
|
holder.setOnClickListener(R.id.root) {
|
|
|
- // 内部共锁人选择
|
|
|
- if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
- mSelectedList.removeIf { it.userId == user.userId }
|
|
|
- mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
- } else {
|
|
|
- val addUser = TicketUserReqVO(
|
|
|
- user.userId!!,
|
|
|
- user.nickName!!,
|
|
|
- "0",
|
|
|
- USER_ROLE_COLOCKER
|
|
|
- )
|
|
|
- mSelectedList.add(addUser)
|
|
|
- mColockerSelectedShowList.add(addUser)
|
|
|
+ if (presenter?.colockerInsideCanAdd(
|
|
|
+ requireContext(),
|
|
|
+ user,
|
|
|
+ mStep
|
|
|
+ ) == true
|
|
|
+ ) {
|
|
|
+ // 内部共锁人选择
|
|
|
+ if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
+ mSelectedList.removeIf { it.userId == user.userId }
|
|
|
+ mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
+ } else {
|
|
|
+ val addUser = TicketUserReqVO(
|
|
|
+ user.userId!!,
|
|
|
+ user.nickName!!,
|
|
|
+ "0",
|
|
|
+ USER_ROLE_COLOCKER,
|
|
|
+ ticketUserVOList.find { ticketUser -> ticketUser.userId == user.userId }?.jobStatus
|
|
|
+ )
|
|
|
+ mSelectedList.add(addUser)
|
|
|
+ mColockerSelectedShowList.add(addUser)
|
|
|
+ }
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
+ mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
+ isColockerChanged = true
|
|
|
}
|
|
|
- mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
- mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -161,22 +181,31 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
mSelectedList.any { it.userId == user.userId }
|
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
|
holder.setOnClickListener(R.id.root) {
|
|
|
- // 外部共锁人选择
|
|
|
- if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
- mSelectedList.removeIf { it.userId == user.userId }
|
|
|
- mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
- } else {
|
|
|
- val addUser = TicketUserReqVO(
|
|
|
- user.userId!!,
|
|
|
- user.nickName!!,
|
|
|
- "1",
|
|
|
- USER_ROLE_COLOCKER
|
|
|
- )
|
|
|
- mSelectedList.add(addUser)
|
|
|
- mColockerSelectedShowList.add(addUser)
|
|
|
+ if (presenter?.colockerOutsideCanAdd(
|
|
|
+ requireContext(),
|
|
|
+ user,
|
|
|
+ mStep
|
|
|
+ ) == true
|
|
|
+ ) {
|
|
|
+ // 外部共锁人选择
|
|
|
+ if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
+ mSelectedList.removeIf { it.userId == user.userId }
|
|
|
+ mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
+ } else {
|
|
|
+ val addUser = TicketUserReqVO(
|
|
|
+ user.userId!!,
|
|
|
+ user.nickName!!,
|
|
|
+ "1",
|
|
|
+ USER_ROLE_COLOCKER,
|
|
|
+ ticketUserVOList.find { ticketUser -> ticketUser.userId == user.userId }?.jobStatus
|
|
|
+ )
|
|
|
+ mSelectedList.add(addUser)
|
|
|
+ mColockerSelectedShowList.add(addUser)
|
|
|
+ }
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
+ mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
+ isColockerChanged = true
|
|
|
}
|
|
|
- mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
- mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -211,6 +240,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
mBinding?.layoutLocker?.root?.visibility = View.INVISIBLE
|
|
|
|
|
|
presenter?.getTicketDetail(pageChangeBO.ticketId) {
|
|
|
+ ticketUserVOList.clear()
|
|
|
+ ticketUserVOList.addAll(it?.ticketUserVOList ?: mutableListOf())
|
|
|
mBinding?.tvTitle?.text = it?.ticketName
|
|
|
|
|
|
if (it?.ticketUserVOList.isNullOrEmpty()) {
|
|
|
@@ -227,7 +258,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
user.userId!!,
|
|
|
user.userName!!,
|
|
|
user.userType!!,
|
|
|
- user.userRole!!
|
|
|
+ user.userRole!!,
|
|
|
+ user.jobStatus
|
|
|
)
|
|
|
)
|
|
|
}
|
|
|
@@ -241,7 +273,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
it.userId!!,
|
|
|
it.userName!!,
|
|
|
it.userType!!,
|
|
|
- USER_ROLE_LOCKER
|
|
|
+ USER_ROLE_LOCKER,
|
|
|
+ user.jobStatus
|
|
|
)
|
|
|
)
|
|
|
mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
|
@@ -271,7 +304,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
it.userId!!,
|
|
|
it.nickName!!,
|
|
|
"0",
|
|
|
- USER_ROLE_LOCKER
|
|
|
+ USER_ROLE_LOCKER,
|
|
|
+ ticketUserVOList.find { ticketUser -> ticketUser.userId == it.userId }?.jobStatus
|
|
|
)
|
|
|
)
|
|
|
mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
|
@@ -298,6 +332,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
}
|
|
|
|
|
|
presenter?.getStepDetail(pageChangeBO.ticketId!!) {
|
|
|
+ mStepDetailList.clear()
|
|
|
+ mStepDetailList.addAll(it ?: mutableListOf())
|
|
|
mBinding?.tvWorker?.text =
|
|
|
"${it?.get(2)?.userNum}/${it?.get(4)?.userNum}/${it?.get(7)?.userNum}"
|
|
|
mBinding?.tvLock?.text =
|