Преглед изворни кода

接入获取八大步骤详情接口并调整页面显示;地图文字缩放时改为一直显示

Frankensteinly пре 9 месеци
родитељ
комит
aa52de3e92

+ 5 - 0
app/src/main/java/com/grkj/iscs/model/UrlConsts.kt

@@ -136,4 +136,9 @@ object UrlConsts {
      * 设备工艺分页
      */
     const val MACHINERY_PAGE = "/iscs/machinery/getIsMachineryPage"
+
+    /**
+     * 获取八大步骤详细
+     */
+    const val TICKET_STEP = "/iscs/step/selectStepsByTicketId"
 }

+ 19 - 0
app/src/main/java/com/grkj/iscs/model/vo/ticket/StepDetailRespVO.kt

@@ -0,0 +1,19 @@
+package com.grkj.iscs.model.vo.ticket
+
+data class StepDetailRespVO(
+    val stepId: Long?,
+
+    val ticketId: Long?,
+
+    val stepIndex: Int?,
+
+    val stepStatus: String?,
+
+    val stepContent: String?,
+
+    val lockNum: Int?,
+
+    val userNum: Int?,
+
+    val conflictJobNum: Int?
+)

+ 19 - 0
app/src/main/java/com/grkj/iscs/util/NetApi.kt

@@ -13,6 +13,7 @@ import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO
 import com.grkj.iscs.model.vo.sop.SopInfoRespVO
 import com.grkj.iscs.model.vo.sop.SopPageRespVO
 import com.grkj.iscs.model.vo.ticket.LockPointUpdateReqVO
+import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
 import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO
 import com.grkj.iscs.model.vo.ticket.TicketEquipDetailRespVO
 import com.grkj.iscs.model.vo.ticket.TicketPageRespVO
@@ -502,4 +503,22 @@ object NetApi {
             }, isGet = true, isAuth = true
         )
     }
+
+    /**
+     * 获取八大步骤详细
+     */
+    fun getStepDetail(ticketId: Long, callBack: (MutableList<StepDetailRespVO>?) -> Unit) {
+        NetHttpManager.getInstance().doRequestNet(
+            UrlConsts.TICKET_STEP,
+            false,
+            mapOf(
+                "ticketId" to ticketId
+            ),
+            { res, _, _ ->
+                res?.let {
+                    callBack.invoke(getRefBean(it))
+                }
+            }, isGet = true, isAuth = true
+        )
+    }
 }

+ 1 - 0
app/src/main/java/com/grkj/iscs/view/fragment/JobExecutionFragment.kt

@@ -41,6 +41,7 @@ class JobExecutionFragment :
     fun refreshPage(ticketId: Long) {
         mTicketId = ticketId
         mBinding?.vp?.currentItem = 0
+        (mMenuList[0].fragment as StepFragment).refreshPage(ticketId)
     }
 
     private fun changePage(pageIndex: Int) {

+ 20 - 14
app/src/main/java/com/grkj/iscs/view/fragment/StepFragment.kt

@@ -3,6 +3,7 @@ package com.grkj.iscs.view.fragment
 import android.widget.ImageView
 import com.grkj.iscs.R
 import com.grkj.iscs.databinding.FragmentStepBinding
+import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
 import com.grkj.iscs.view.base.BaseMvpFragment
 import com.grkj.iscs.view.iview.IStepView
 import com.grkj.iscs.view.presenter.StepPresenter
@@ -21,14 +22,14 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
 
     override fun initView() {
         mStepList = mutableListOf(
-            StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), false, 1, "①"),
-            StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), false, 2, "②"),
-            StepBO(R.mipmap.step3, getString(R.string.notice_worker), false, 3, "③"),
-            StepBO(R.mipmap.step4, getString(R.string.shutdown), false, 4, "④"),
-            StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), false, 8, "⑧"),
-            StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), false, 7, "⑦"),
-            StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), false, 6, "⑥"),
-            StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), false, 5, "⑤")
+            StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), 1, "①"),
+            StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), 2, "②"),
+            StepBO(R.mipmap.step3, getString(R.string.notice_worker), 3, "③"),
+            StepBO(R.mipmap.step4, getString(R.string.shutdown), 4, "④"),
+            StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), 8, "⑧"),
+            StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), 7, "⑦"),
+            StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), 6, "⑥"),
+            StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), 5, "⑤")
         )
         mBinding?.rvStep?.adapter = object : CommonAdapter<StepBO>(requireContext(), R.layout.item_rv_step, mStepList) {
             override fun convert(holder: ViewHolder, step: StepBO, position: Int) {
@@ -41,10 +42,10 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
                     holder.getView<ImageView>(R.id.iv_arrow_right).rotation = 180f
                 }
                 holder.getView<ImageView>(R.id.iv_icon).setImageResource(step.pic)
-                holder.setText(R.id.tv_name, step.title)
+                holder.setText(R.id.tv_name, step.stepDetail?.stepContent)
                 holder.setText(R.id.tv_index, step.indexStr)
-                holder.getView<ImageView>(R.id.iv_status).setImageResource(if (step.isDone) R.mipmap.step_executed else R.mipmap.step_not_executed)
-                holder.setText(R.id.tv_status, if (step.isDone) getString(R.string.executed) else getString(R.string.not_executed))
+                holder.getView<ImageView>(R.id.iv_status).setImageResource(if (step.stepDetail?.stepStatus == "1") R.mipmap.step_executed else R.mipmap.step_not_executed)
+                holder.setText(R.id.tv_status, if (step.stepDetail?.stepStatus == "1") getString(R.string.executed) else getString(R.string.not_executed))
             }
         }
 
@@ -61,13 +62,18 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
         }
     }
 
-    fun refreshPage() {
-
+    fun refreshPage(ticketId: Long) {
+        presenter?.getStepDetail(ticketId) {
+            mStepList.forEach { step ->
+                step.stepDetail = it?.find { it.stepIndex == step.index }
+            }
+            mBinding?.rvStep?.adapter?.notifyDataSetChanged()
+        }
     }
 
     override fun initPresenter(): StepPresenter {
         return StepPresenter()
     }
 
-    data class StepBO(val pic: Int, val title: String, val isDone: Boolean = false, val index: Int, val indexStr: String)
+    data class StepBO(val pic: Int, val title: String, val index: Int, val indexStr: String, var stepDetail: StepDetailRespVO? = null)
 }

+ 11 - 0
app/src/main/java/com/grkj/iscs/view/presenter/StepPresenter.kt

@@ -1,7 +1,18 @@
 package com.grkj.iscs.view.presenter
 
+import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
+import com.grkj.iscs.util.Executor
+import com.grkj.iscs.util.NetApi
 import com.grkj.iscs.view.base.BasePresenter
 import com.grkj.iscs.view.iview.IStepView
 
 class StepPresenter : BasePresenter<IStepView>() {
+
+    fun getStepDetail(ticketId: Long, callBack: (MutableList<StepDetailRespVO>?) -> Unit) {
+        NetApi.getStepDetail(ticketId) {
+            Executor.runOnMain {
+                callBack(it)
+            }
+        }
+    }
 }

+ 10 - 6
app/src/main/java/com/grkj/iscs/view/presenter/TechnologySopPresenter.kt

@@ -35,12 +35,16 @@ class TechnologySopPresenter : BasePresenter<ITechnologySopView>() {
             ToastUtils.tip(R.string.please_select_sop_type)
             return
         }
-        NetApi.getSopPage(0, 100, list[machineryIdx].machineryId!!, list[machineryIdx].sysDictDatas?.get(sopTypeIdx)?.dictValue!!.toInt()) {
-            it?.let { itRst ->
-                NetApi.createTicket(itRst.records[0].sopId) { ticketId ->
-                    Executor.runOnMain {
-                        callBack(ticketId)
-                    }
+        NetApi.getSopPage(
+            0,
+            100,
+            list[machineryIdx].machineryId!!,
+            list[machineryIdx].sysDictDatas?.get(sopTypeIdx)?.dictValue!!.toInt()
+        ) {
+            it ?: return@getSopPage
+            NetApi.createTicket(it.records[0].sopId) { ticketId ->
+                Executor.runOnMain {
+                    callBack(ticketId)
                 }
             }
         }

+ 3 - 2
app/src/main/java/com/grkj/iscs/view/widget/CustomMarkLayer.kt

@@ -164,14 +164,15 @@ class CustomMarkLayer @JvmOverloads constructor(
 
                     paint.color = Color.parseColor("#FFFFFF")
                     paint.textSize = radiusMark
-                    if (mapView.currentZoom.toDouble() > 0.8) {
+//                    if (mapView.currentZoom.toDouble() > 0.8) {
+                    // 一直显示文字
                         canvas.drawText(
                             point.name,
                             goal[0] - width / 2,
                             goal[1] + radiusMark / 3.0f,
                             paint
                         )
-                    }
+//                    }
 
                     val list = point.ticketList
                     if (list.isNotEmpty()) {

+ 4 - 3
app/src/main/res/layout/item_rv_step.xml

@@ -12,7 +12,7 @@
         android:background="@drawable/item_rv_technology_sop_bg_normal"
         android:gravity="center"
         android:orientation="vertical"
-        android:padding="@dimen/common_spacing">
+        android:padding="@dimen/common_spacing_small">
 
         <LinearLayout
             android:layout_width="wrap_content"
@@ -32,13 +32,14 @@
 
         <ImageView
             android:id="@+id/iv_icon"
-            android:layout_width="58dp"
-            android:layout_height="34dp"
+            android:layout_width="55dp"
+            android:layout_height="26dp"
             android:layout_marginTop="5dp" />
 
         <TextView
             android:id="@+id/tv_name"
             style="@style/CommonTextView"
+            android:textSize="@dimen/common_text_size_small"
             android:layout_marginVertical="5dp" />
 
         <TextView