Просмотр исходного кода

补充八大步骤页面进度颜色变换逻辑;适配人员分配步骤文字显示;添加获取设备工艺详细信息接口;完成显示工艺图

Frankensteinly 9 месяцев назад
Родитель
Сommit
7a334d9b3e

+ 6 - 1
app/src/main/java/com/grkj/iscs/model/UrlConsts.kt

@@ -45,7 +45,7 @@ object UrlConsts {
     /**
      * 获取部门列表
      */
-    const val DEPT_List = "/system/dept/list"
+    const val DEPT_LIST = "/system/dept/list"
 
     /**
      * 创建工作票
@@ -141,4 +141,9 @@ object UrlConsts {
      * 获取八大步骤详细
      */
     const val TICKET_STEP = "/iscs/step/selectStepsByTicketId"
+
+    /**
+     * 获取设备工艺详细信息
+     */
+    const val MACHINERY_DETAIL = "/iscs/machinery/selectIsMachineryById"
 }

+ 36 - 0
app/src/main/java/com/grkj/iscs/model/vo/machinery/MachineryDetailRespVO.kt

@@ -0,0 +1,36 @@
+package com.grkj.iscs.model.vo.machinery
+
+import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO.Record.SysDictData
+
+
+data class MachineryDetailRespVO(
+    val machineryId: Long?,
+
+    val machineryCode: String?,
+
+    val machineryName: String?,
+
+    val machineryType: String?,
+
+    val workstationId: Long?,
+
+    val workstationName: String?,
+
+    val lotoId: Long?,
+
+    val lotoName: String?,
+
+    val machineryImg: String?,
+
+    val parentId: Long?,
+
+    val ancestors: String?,
+
+    val status: String?,
+
+    val delFlag: String?,
+
+    val pointIdList: List<Long>?,
+
+    val sysDictDatas: List<SysDictData>?,
+)

+ 20 - 1
app/src/main/java/com/grkj/iscs/util/NetApi.kt

@@ -9,6 +9,7 @@ import com.grkj.iscs.model.vo.dept.DeptListRespVO
 import com.grkj.iscs.model.vo.key.KeyInfoRespVO
 import com.grkj.iscs.model.vo.lock.LockInfoRespVO
 import com.grkj.iscs.model.vo.lock.LockTakeUpdateReqVO
+import com.grkj.iscs.model.vo.machinery.MachineryDetailRespVO
 import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO
 import com.grkj.iscs.model.vo.sop.SopInfoRespVO
 import com.grkj.iscs.model.vo.sop.SopPageRespVO
@@ -175,7 +176,7 @@ object NetApi {
      */
     fun getDeptList(pageNum: Int, pageSize: Int, callBack: (MutableList<DeptListRespVO>?) -> Unit) {
         NetHttpManager.getInstance().doRequestNet(
-            UrlConsts.DEPT_List,
+            UrlConsts.DEPT_LIST,
             false,
             mapOf(
                 "pageNum" to pageNum,
@@ -521,4 +522,22 @@ object NetApi {
             }, isGet = true, isAuth = true
         )
     }
+
+    /**
+     * 获取设备工艺详细信息
+     */
+    fun getMachineryDetail(machineryId: Long, callBack: (MachineryDetailRespVO?) -> Unit) {
+        NetHttpManager.getInstance().doRequestNet(
+            UrlConsts.MACHINERY_DETAIL,
+            false,
+            mapOf(
+                "machineryId" to machineryId
+            ),
+            { res, _, _ ->
+                res?.let {
+                    callBack.invoke(getRefBean(it))
+                }
+            }, isGet = true, isAuth = true
+        )
+    }
 }

+ 27 - 1
app/src/main/java/com/grkj/iscs/view/fragment/StepFragment.kt

@@ -1,6 +1,8 @@
 package com.grkj.iscs.view.fragment
 
 import android.widget.ImageView
+import com.bumptech.glide.Glide
+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
@@ -35,6 +37,13 @@ class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Uni
         )
         mBinding?.rvStep?.adapter = object : CommonAdapter<StepBO>(requireContext(), R.layout.item_rv_step, mStepList) {
             override fun convert(holder: ViewHolder, step: StepBO, position: Int) {
+                if (step.stepDetail?.stepStatus == "1") {
+                    holder.getView<MaterialCardView>(R.id.cv_step).setCardBackgroundColor(requireContext().getColor(R.color.item_rv_step_bg_done))
+                }
+                val first = mStepList.filter { it.stepDetail?.stepStatus == "0" }.minByOrNull { it.index }
+                if (first?.index == step.index) {
+                    holder.getView<MaterialCardView>(R.id.cv_step).setCardBackgroundColor(requireContext().getColor(R.color.item_rv_step_bg_doing))
+                }
                 holder.setVisible(R.id.iv_arrow_right, step.index !in 4..5)
                 holder.setVisible(R.id.iv_arrow_bottom, step.index == 4)
                 holder.getView<ImageView>(R.id.iv_arrow_right).rotation = if (step.index > 5) 180f else 0f
@@ -42,7 +51,21 @@ class StepFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Uni
                 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.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))
+                holder.setText(R.id.tv_status,
+                    if (step.stepDetail?.stepStatus == "1") {
+                        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)
+                        }
+                    }
+                )
             }
         }
 
@@ -67,6 +90,9 @@ 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!!)
+        }
     }
 
     override fun initPresenter(): StepPresenter {

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

@@ -1,5 +1,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.StepDetailRespVO
 import com.grkj.iscs.util.Executor
 import com.grkj.iscs.util.NetApi
@@ -15,4 +17,12 @@ class StepPresenter : BasePresenter<IStepView>() {
             }
         }
     }
+
+    fun getMachineryDetail(machineryId: Long, callBack: (MachineryDetailRespVO?) -> Unit) {
+        NetApi.getMachineryDetail(machineryId) {
+            Executor.runOnMain {
+                callBack(it)
+            }
+        }
+    }
 }

+ 5 - 0
app/src/main/res/drawable/item_rv_step_bg_done.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="@dimen/common_radius_small" />
+    <solid android:color="@color/common_bg_white_10" />
+</shape>

+ 5 - 0
app/src/main/res/layout/fragment_step.xml

@@ -96,6 +96,11 @@
                     android:background="@drawable/common_btn_blue_bg"
                     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"/>
             </LinearLayout>
 
             <!-- 锁定站 -->

+ 45 - 37
app/src/main/res/layout/item_rv_step.xml

@@ -1,51 +1,59 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/root"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="@dimen/common_spacing_small">
 
-    <LinearLayout
-        android:id="@+id/ll_step"
-        android:layout_width="@dimen/item_rv_step_width"
-        android:layout_height="@dimen/item_rv_step_height"
-        android:background="@drawable/item_rv_technology_sop_bg_normal"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:padding="@dimen/common_spacing_small">
+    <com.google.android.material.card.MaterialCardView
+        android:id="@+id/cv_step"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:cardBackgroundColor="@color/common_bg_white_10"
+        app:cardCornerRadius="@dimen/common_radius_small"
+        app:strokeColor="@color/common_transparent">
 
         <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
+            android:layout_width="@dimen/item_rv_step_width"
+            android:layout_height="@dimen/item_rv_step_height"
+            android:gravity="center"
+            android:orientation="vertical"
+            android:padding="@dimen/common_spacing_small">
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <ImageView
+                    android:id="@+id/iv_status"
+                    android:layout_width="12dp"
+                    android:layout_height="12dp" />
+
+                <TextView
+                    android:id="@+id/tv_status"
+                    style="@style/CommonTextView"
+                    android:layout_marginLeft="5dp" />
+            </LinearLayout>
 
             <ImageView
-                android:id="@+id/iv_status"
-                android:layout_width="12dp"
-                android:layout_height="12dp" />
+                android:id="@+id/iv_icon"
+                android:layout_width="55dp"
+                android:layout_height="26dp"
+                android:layout_marginTop="5dp" />
 
             <TextView
-                android:id="@+id/tv_status"
+                android:id="@+id/tv_name"
                 style="@style/CommonTextView"
-                android:layout_marginLeft="5dp" />
-        </LinearLayout>
-
-        <ImageView
-            android:id="@+id/iv_icon"
-            android:layout_width="55dp"
-            android:layout_height="26dp"
-            android:layout_marginTop="5dp" />
+                android:layout_marginVertical="5dp"
+                android:textSize="@dimen/common_text_size_small" />
 
-        <TextView
-            android:id="@+id/tv_name"
-            style="@style/CommonTextView"
-            android:layout_marginVertical="5dp"
-            android:textSize="@dimen/common_text_size_small" />
-
-        <TextView
-            android:id="@+id/tv_index"
-            style="@style/CommonTextView" />
-    </LinearLayout>
+            <TextView
+                android:id="@+id/tv_index"
+                style="@style/CommonTextView" />
+        </LinearLayout>
+    </com.google.android.material.card.MaterialCardView>
 
     <ImageView
         android:id="@+id/iv_arrow_right"
@@ -53,16 +61,16 @@
         android:layout_height="11dp"
         android:layout_centerVertical="true"
         android:layout_marginLeft="@dimen/common_spacing_small"
-        android:layout_toRightOf="@id/ll_step"
+        android:layout_toRightOf="@id/cv_step"
         android:src="@mipmap/arrow" />
 
     <ImageView
         android:id="@+id/iv_arrow_bottom"
         android:layout_width="11dp"
         android:layout_height="11dp"
-        android:layout_below="@id/ll_step"
+        android:layout_below="@id/cv_step"
         android:layout_centerHorizontal="true"
         android:layout_marginVertical="5dp"
-        android:src="@mipmap/arrow"
-        android:rotation="90" />
+        android:rotation="90"
+        android:src="@mipmap/arrow" />
 </RelativeLayout>

+ 4 - 0
app/src/main/res/values/colors.xml

@@ -30,4 +30,8 @@
     <color name="lock_status_unlocked">#99008000</color>
     <color name="lock_status_locked">#CCFF0000</color>
     <color name="point_text_bg">#70b26f</color>
+
+    <color name="item_rv_step_bg_done">#1d7153</color>
+    <color name="item_rv_step_bg_doing">#838a53</color>
+    <color name="item_rv_step_bg_ready">#B3FFFFFF</color>
 </resources>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -120,6 +120,8 @@
     <string name="action_confirm">操作确认</string>
     <string name="executed">已执行</string>
     <string name="not_executed">待执行</string>
+    <string name="allocated">已分配</string>
+    <string name="not_allocated">待分配</string>
     <string name="recognize_work_content">识别工作内容</string>
     <string name="power_isolation_way">能源隔离方式</string>
     <string name="notice_worker">通知人员</string>