Selaa lähdekoodia

refactor(模式校验):
- 增加交叉作业的最后一步有交叉隔离点的时候的解锁逻辑判断

周文健 6 kuukautta sitten
vanhempi
sitoutus
5770be77d7

+ 3 - 1
app/src/main/java/com/grkj/iscs/view/fragment/JobProgressFragment.kt

@@ -32,6 +32,7 @@ class JobProgressFragment(val goBack: () -> Unit) :
 
     private val mPointList = mutableListOf<TicketDetailMonitorRespVO.IsJobTicketPointsVO>()
     private val mUserList = mutableListOf<TicketDetailMonitorRespVO.IsJobTicketUser>()
+    private var mTicketDetail: TicketDetailRespVO? = null
     private var mStep = 0
     private var mPageChangeBO: PageChangeBO? = null
     private var mTipDialog: TipDialog? = null
@@ -173,6 +174,7 @@ class JobProgressFragment(val goBack: () -> Unit) :
 
         presenter?.getTicketDetail(pageChangeBO.ticketId) {
             mBinding?.tvTitle?.text = it?.ticketName
+            mTicketDetail = it
             handleBottomTip(it)
         }
 
@@ -311,7 +313,7 @@ class JobProgressFragment(val goBack: () -> Unit) :
             }
 
             7 -> {
-                if (presenter?.showGoToUnlock(requireContext(), mPointList, mUserList) == true) {
+                if (presenter?.showGoToUnlock(requireContext(), mTicketDetail,mPointList, mUserList) == true) {
                     mBinding?.cbAction?.visibility = View.VISIBLE
                     mBinding?.cbAction?.setIcon(R.mipmap.ticket_unlocked)
                     mBinding?.cbAction?.setText(getString(R.string.go_unlocking))

+ 2 - 1
app/src/main/java/com/grkj/iscs/view/presenter/JobProgressPresenter.kt

@@ -320,10 +320,11 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
      */
     fun showGoToUnlock(
         context: Context,
+        mTicketDetail: TicketDetailRespVO?,
         mPointList: MutableList<TicketDetailMonitorRespVO.IsJobTicketPointsVO>,
         mUserList: MutableList<TicketDetailMonitorRespVO.IsJobTicketUser>
     ): Boolean {
-        return IStepMode.getStepMode(context)?.showGoToUnlock(mPointList, mUserList) == true
+        return IStepMode.getStepMode(context)?.showGoToUnlock(mTicketDetail,mPointList, mUserList) == true
     }
 
     /**

+ 1 - 0
app/src/main/java/com/grkj/iscs/view/step_mode/IStepMode.kt

@@ -35,6 +35,7 @@ interface IStepMode {
      * 是否显示去解锁
      */
     fun showGoToUnlock(
+        mTicketDetail: TicketDetailRespVO?,
         mPointList: MutableList<TicketDetailMonitorRespVO.IsJobTicketPointsVO>,
         mUserList: MutableList<TicketDetailMonitorRespVO.IsJobTicketUser>
     ): Boolean

+ 1 - 0
app/src/main/java/com/grkj/iscs/view/step_mode/StepMode1.kt

@@ -29,6 +29,7 @@ class StepMode1 : IStepMode {
     }
 
     override fun showGoToUnlock(
+        mTicketDetail: TicketDetailRespVO?,
         mPointList: MutableList<TicketDetailMonitorRespVO.IsJobTicketPointsVO>,
         mUserList: MutableList<TicketDetailMonitorRespVO.IsJobTicketUser>
     ): Boolean {

+ 9 - 3
app/src/main/java/com/grkj/iscs/view/step_mode/StepMode2.kt

@@ -50,8 +50,12 @@ class StepMode2 : IStepMode {
             }
 
             8 -> {
+                //交叉作业要检查非不可解锁的区域外的所有区域的锁状态
                 if (mTicketDetailData?.ticketUserVOList?.filter { it.userRole == Constants.USER_ROLE_COLOCKER }
-                        ?.all { it.jobStatus!! == 5 } == true && mTicketDetailData.ticketPointsVOList?.all { it.pointStatus == "2" } == true) {
+                        ?.all { it.jobStatus!! == 5 } == true && mTicketDetailData.ticketPointsVOList?.filter {
+                        it.pointId !in (mTicketDetailData.noUnlockTicketPointsVOSet?.map { it.pointId }
+                            ?: mutableListOf())
+                    }?.all { it.pointStatus == "2" } == true) {
                     ""
                 } else {
                     ContextCompat.getString(
@@ -66,10 +70,12 @@ class StepMode2 : IStepMode {
     }
 
     override fun showGoToUnlock(
+        mTicketDetail: TicketDetailRespVO?,
         mPointList: MutableList<TicketDetailMonitorRespVO.IsJobTicketPointsVO>,
         mUserList: MutableList<TicketDetailMonitorRespVO.IsJobTicketUser>
     ): Boolean {
-        return !mPointList.all { it.pointStatus == "2" } && mUserList.all { it.jobStatus == 5 }
+        //交叉作业要检查非不可解锁的区域外的所有区域的锁状态
+        return !mPointList.filter { it.pointId !in (mTicketDetail?.noUnlockTicketPointsVOSet?.map { it.pointId }?: mutableListOf()) }.all { it.pointStatus == "2" } && mUserList.all { it.jobStatus == 5 }
     }
 
     override fun colockerInsideCanAdd(user: UserListRespVO.Row, mStep: Int): Boolean {
@@ -162,6 +168,6 @@ class StepMode2 : IStepMode {
     }
 
     override fun getMinColockerSize(): Int {
-        return 2
+        return 1
     }
 }