Jelajahi Sumber

接入获取电柜map解析数据接口;完成作业执行页锁定站的显示;将dimens里的sp统一成dp

Frankensteinly 9 bulan lalu
induk
melakukan
7b41afb36f

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

@@ -146,4 +146,9 @@ object UrlConsts {
      * 获取设备工艺详细信息
      */
     const val MACHINERY_DETAIL = "/iscs/machinery/selectIsMachineryById"
+
+    /**
+     * 获取电柜map解析数据
+     */
+    const val LOTO_MAP = "/iscs/station/selectLotoMapById"
 }

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

@@ -0,0 +1,31 @@
+package com.grkj.iscs.model.vo.ticket
+
+data class LotoMapRespVO(
+    val row: Int?,
+
+    val col: Int?,
+
+    val pointId: Long?,
+
+    val pointName: String?,
+
+    val remark: String?,
+
+    val prePointId: Long?,
+
+    val pointType: String?,
+
+    val pointTypeName: String?,
+
+    val powerType: String?,
+
+    val powerTypeName: String?,
+
+    val state: Boolean?,
+
+    val pointIcon: String?,
+
+    val pointPicture: String?,
+
+    val mapImg: String?,
+)

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

@@ -14,6 +14,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.LotoMapRespVO
 import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
 import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO
 import com.grkj.iscs.model.vo.ticket.TicketEquipDetailRespVO
@@ -540,4 +541,22 @@ object NetApi {
             }, isGet = true, isAuth = true
         )
     }
+
+    /**
+     * 获取电柜map解析数据
+     */
+    fun getLotoMapData(lotoId: Long, callBack: (MutableList<LotoMapRespVO>?) -> Unit) {
+        NetHttpManager.getInstance().doRequestNet(
+            UrlConsts.LOTO_MAP,
+            false,
+            mapOf(
+                "lotoId" to lotoId
+            ),
+            { res, _, _ ->
+                res?.let {
+                    callBack.invoke(getRefBean(it))
+                }
+            }, isGet = true, isAuth = true
+        )
+   }
 }

+ 21 - 13
app/src/main/java/com/grkj/iscs/view/fragment/StepFragment.kt

@@ -6,6 +6,7 @@ import com.google.android.material.card.MaterialCardView
 import com.grkj.iscs.R
 import com.grkj.iscs.databinding.FragmentStepBinding
 import com.grkj.iscs.model.bo.PageChangeBO
+import com.grkj.iscs.model.vo.ticket.LotoMapRespVO
 import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
 import com.grkj.iscs.util.log.LogUtil
 import com.grkj.iscs.view.base.BaseMvpFragment
@@ -17,9 +18,11 @@ import com.zhy.adapter.recyclerview.base.ViewHolder
 /**
  * 作业票执行步骤页 - 八大步骤
  */
-class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Unit) : BaseMvpFragment<IStepView, StepPresenter, FragmentStepBinding>() {
+class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Unit) :
+    BaseMvpFragment<IStepView, StepPresenter, FragmentStepBinding>() {
 
     private lateinit var mStepList: MutableList<StepBO>
+    private var mLotoList = mutableListOf<LotoMapRespVO>()
 
     override val viewBinding: FragmentStepBinding
         get() = FragmentStepBinding.inflate(layoutInflater)
@@ -53,22 +56,22 @@ class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Uni
                 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") {
-                        if (step.index == 3) {
-                            getString(R.string.allocated)
-                        } else {
-                            getString(R.string.executed)
-                        }
+                        if (step.index == 3) getString(R.string.allocated) else getString(R.string.executed)
                     } else {
-                        if (step.index == 3) {
-                            getString(R.string.not_allocated)
-                        } else {
-                            getString(R.string.not_executed)
-                        }
+                        if (step.index == 3) getString(R.string.not_allocated) else getString(R.string.not_executed)
                     }
                 )
             }
         }
 
+        mBinding?.rvLoto?.adapter = object : CommonAdapter<LotoMapRespVO>(requireContext(), R.layout.item_rv_loto, mLotoList) {
+            override fun convert(holder: ViewHolder, loto: LotoMapRespVO, position: Int) {
+                Glide.with(this@StepFragment).load(loto.pointIcon).into(holder.getView(R.id.iv_icon))
+                holder.setText(R.id.tv_name, loto.pointName)
+                holder.setVisible(R.id.rl_cover, loto.state == true)
+            }
+        }
+
         mBinding?.cbBack?.setOnClickListener {
             goBack()
         }
@@ -90,8 +93,13 @@ class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Uni
             }
             mBinding?.rvStep?.adapter?.notifyDataSetChanged()
         }
-        presenter?.getMachineryDetail(changeBO.machineryId!!) {
-            Glide.with(this).load(it?.machineryImg).into(mBinding?.ivMachinery!!)
+        presenter?.getMachineryDetail(changeBO.machineryId!!,
+            { Glide.with(this).load(it?.machineryImg).into(mBinding?.ivMachinery!!) }) { itList ->
+            itList?.let {
+                mLotoList.clear()
+                mLotoList.addAll(it)
+            } ?: mLotoList.clear()
+            mBinding?.rvLoto?.adapter?.notifyDataSetChanged()
         }
     }
 

+ 7 - 1
app/src/main/java/com/grkj/iscs/view/presenter/StepPresenter.kt

@@ -2,6 +2,7 @@ package com.grkj.iscs.view.presenter
 
 import com.grkj.iscs.model.vo.machinery.MachineryDetailRespVO
 import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO
+import com.grkj.iscs.model.vo.ticket.LotoMapRespVO
 import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
 import com.grkj.iscs.util.Executor
 import com.grkj.iscs.util.NetApi
@@ -18,8 +19,13 @@ class StepPresenter : BasePresenter<IStepView>() {
         }
     }
 
-    fun getMachineryDetail(machineryId: Long, callBack: (MachineryDetailRespVO?) -> Unit) {
+    fun getMachineryDetail(machineryId: Long, callBack: (MachineryDetailRespVO?) -> Unit, mapCallBack: (MutableList<LotoMapRespVO>?) -> Unit) {
         NetApi.getMachineryDetail(machineryId) {
+            NetApi.getLotoMapData(it?.lotoId!!) {
+                Executor.runOnMain {
+                    mapCallBack(it?.sortedWith(compareBy({ it.row }, { it.col }))?.toMutableList())
+                }
+            }
             Executor.runOnMain {
                 callBack(it)
             }

+ 9 - 0
app/src/main/res/drawable/item_rv_loto_bg.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="3dp" />
+    <stroke
+        android:width="@dimen/divider_line_width"
+        android:color="@color/lock_status_locked" />
+    <solid android:color="@color/white" />
+</shape>

+ 6 - 0
app/src/main/res/drawable/item_rv_loto_cover_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="3dp" />
+    <solid android:color="@color/common_bg_black_30" />
+</shape>

+ 17 - 1
app/src/main/res/layout/fragment_step.xml

@@ -94,13 +94,15 @@
                 <TextView
                     style="@style/CommonTextView"
                     android:background="@drawable/common_btn_blue_bg"
+                    android:paddingHorizontal="@dimen/common_spacing_small"
+                    android:paddingVertical="@dimen/common_spacing_smallest"
                     android:text="@string/machinery_pic" />
 
                 <ImageView
                     android:id="@+id/iv_machinery"
                     android:layout_width="80dp"
                     android:layout_height="80dp"
-                    android:layout_marginTop="@dimen/common_spacing"/>
+                    android:layout_marginTop="@dimen/common_spacing" />
             </LinearLayout>
 
             <!-- 锁定站 -->
@@ -114,8 +116,22 @@
                 <TextView
                     style="@style/CommonTextView"
                     android:background="@drawable/common_btn_blue_bg"
+                    android:paddingHorizontal="@dimen/common_spacing_small"
+                    android:paddingVertical="@dimen/common_spacing_smallest"
                     android:text="@string/lock_station" />
 
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_loto"
+                    style="@style/CommonRecyclerView"
+                    android:layout_marginHorizontal="@dimen/common_spacing"
+                    android:layout_marginVertical="@dimen/common_spacing_small"
+                    android:background="@mipmap/cabinet"
+                    android:paddingHorizontal="14dp"
+                    android:paddingTop="10dp"
+                    android:paddingBottom="12dp"
+                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+                    app:spanCount="3"
+                    tools:listitem="@layout/item_rv_loto" />
             </LinearLayout>
         </LinearLayout>
 

+ 39 - 0
app/src/main/res/layout/item_rv_loto.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/root"
+    android:layout_width="15dp"
+    android:layout_height="20dp"
+    android:layout_margin="@dimen/divider_line_width">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/item_rv_loto_bg"
+        android:gravity="center"
+        android:orientation="vertical">
+
+        <ImageView
+            android:id="@+id/iv_icon"
+            android:layout_width="10dp"
+            android:layout_height="10dp" />
+
+        <TextView
+            android:id="@+id/tv_name"
+            style="@style/CommonTextView"
+            android:textColor="@color/lock_status_locked"
+            android:textSize="4dp" />
+    </LinearLayout>
+
+    <RelativeLayout
+        android:id="@+id/rl_cover"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/item_rv_loto_cover_bg"
+        android:visibility="gone">
+
+        <TextView
+            style="@style/CommonTextView"
+            android:layout_centerInParent="true"
+            android:text="√" />
+    </RelativeLayout>
+</RelativeLayout>

TEMPAT SAMPAH
app/src/main/res/mipmap/cabinet.png


+ 7 - 5
app/src/main/res/values/dimens.xml

@@ -1,14 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <dimen name="common_text_size">10sp</dimen>
-    <dimen name="common_text_size_big">14sp</dimen>
-    <dimen name="common_text_size_small">8sp</dimen>
+    <dimen name="common_text_size">10dp</dimen>
+    <dimen name="common_text_size_big">14dp</dimen>
+    <dimen name="common_text_size_small">8dp</dimen>
     <dimen name="common_text_padding">5dp</dimen>
     <dimen name="common_font_txt_size_page_title">14dp</dimen>
     <dimen name="common_radius">10dp</dimen>
     <dimen name="common_radius_small">5dp</dimen>
     <dimen name="common_spacing">10dp</dimen>
+    <dimen name="common_spacing_big">15dp</dimen>
     <dimen name="common_spacing_small">5dp</dimen>
+    <dimen name="common_spacing_smallest">2dp</dimen>
     <dimen name="common_icon_size">15dp</dimen>
     <dimen name="common_icon_size_small">12dp</dimen>
 
@@ -17,8 +19,8 @@
 
     <dimen name="title_bar_height">50dp</dimen>
     <dimen name="title_bar_padding">7dp</dimen>
-    <dimen name="title_bar_title_text_size">20sp</dimen>
-    <dimen name="title_bar_sub_title_text_size">10sp</dimen>
+    <dimen name="title_bar_title_text_size">20dp</dimen>
+    <dimen name="title_bar_sub_title_text_size">10dp</dimen>
     <dimen name="title_bar_back_size">17dp</dimen>
 
     <dimen name="switch_width">46dp</dimen>