Преглед на файлове

接入设备工艺分页接口并根据高保真大致调整样式

Frankensteinly преди 10 месеца
родител
ревизия
8ef6c66e86

+ 7 - 2
app/src/main/java/com/grkj/iscs/model/UrlConsts.kt

@@ -1,8 +1,8 @@
 package com.grkj.iscs.model
 
 object UrlConsts {
-    const val BASE_URL = "http://192.168.28.82:9190"
-//    const val BASE_URL = "http://192.168.28.97:9190"
+//    const val BASE_URL = "http://192.168.28.82:9190"
+    const val BASE_URL = "http://192.168.28.97:9190"
     const val WEB_SOCKET = "ws://192.168.1.127:9090/websocket/iot/127"
 
     const val AUTOCODE_TICKET_NUMBER = "JOB_TICKET_CODE"
@@ -131,4 +131,9 @@ object UrlConsts {
      * 正在进行中的作业票列表
      */
     const val WORKSTATION_TICKET_LIST = "/iscs/ticket/getWorkstationTicketList"
+
+    /**
+     * 设备工艺分页
+     */
+    const val MACHINERY_PAGE = "/iscs/machinery/getIsMachineryPage"
 }

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

@@ -0,0 +1,56 @@
+package com.grkj.iscs.model.vo.machinery
+
+data class MachineryPageRespVO(
+    val countId: Any,
+    val current: Int,
+    val maxLimit: Any,
+    val optimizeCountSql: Boolean,
+    val orders: MutableList<Any>,
+    val pages: Int,
+    val records: MutableList<Record>,
+    val searchCount: Boolean,
+    val size: Int,
+    val total: Int
+) {
+    data class Record(
+        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: MutableList<SysDictData>?
+    ) {
+        data class SysDictData(
+            val dictLabel: String?,
+
+            /** 字典键值  */
+            val dictValue: String?,
+
+            /** 字典类型  */
+            val dictType: String?
+        )
+    }
+}

+ 23 - 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.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
@@ -473,5 +474,26 @@ object NetApi {
                 }
             }, isGet = true, isAuth = true
         )
-   }
+    }
+
+    /**
+     * 获取工艺分页
+     */
+    fun getMachineryPage(pages: Int, size: Int, workstationId: Int, callBack: (MachineryPageRespVO?) -> Unit) {
+        NetHttpManager.getInstance().doRequestNet(
+            UrlConsts.MACHINERY_PAGE,
+            false,
+            mapOf(
+                "pages" to pages,
+                "size" to size,
+                "workstationId" to workstationId,
+                "machineryType" to "工艺"
+            ),
+            { res, _, _ ->
+                res?.let {
+                    callBack.invoke(getRefBean(it))
+                }
+            }, isGet = true, isAuth = true
+        )
+    }
 }

+ 41 - 1
app/src/main/java/com/grkj/iscs/view/fragment/TechnologySopFragment.kt

@@ -1,9 +1,15 @@
 package com.grkj.iscs.view.fragment
 
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.grkj.iscs.R
 import com.grkj.iscs.databinding.FragmentTechnologySopBinding
+import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO
 import com.grkj.iscs.view.base.BaseMvpFragment
 import com.grkj.iscs.view.iview.ITechnologySopView
 import com.grkj.iscs.view.presenter.TechnologySopPresenter
+import com.zhy.adapter.recyclerview.CommonAdapter
+import com.zhy.adapter.recyclerview.base.ViewHolder
 
 /**
  * 工艺SOP页
@@ -11,15 +17,49 @@ import com.grkj.iscs.view.presenter.TechnologySopPresenter
 class TechnologySopFragment :
     BaseMvpFragment<ITechnologySopView, TechnologySopPresenter, FragmentTechnologySopBinding>() {
 
+    private val mMachineryList = mutableListOf<MachineryPageRespVO.Record>()
+
     override val viewBinding: FragmentTechnologySopBinding
         get() = FragmentTechnologySopBinding.inflate(layoutInflater)
 
     override fun initView() {
+        mBinding?.rvTechnology?.adapter = object : CommonAdapter<MachineryPageRespVO.Record>(
+            requireActivity(),
+            R.layout.item_rv_technology_sop,
+            mMachineryList
+        ) {
+            override fun convert(holder: ViewHolder, data: MachineryPageRespVO.Record?, position: Int) {
+                holder.setText(R.id.tv_name, data?.machineryName)
+                Glide.with(this@TechnologySopFragment).load(data?.machineryImg).into(holder.getView(R.id.iv_pic))
+                val recyclerView = holder.getView<RecyclerView>(R.id.rv_type)
+                recyclerView.adapter = object : CommonAdapter<MachineryPageRespVO.Record.SysDictData>(
+                    requireActivity(),
+                    R.layout.item_rv_technology_sop_type,
+                    data?.sysDictDatas ?: mutableListOf()
+                ) {
+                    override fun convert(holder: ViewHolder, type: MachineryPageRespVO.Record.SysDictData?, position: Int) {
+                        type?.dictLabel?.let {
+                            holder.setText(R.id.tv_name, it)
+                        }
+                    }
+                }
+            }
+        }
+
+        refreshPage(8)
+    }
 
+    fun refreshPage(workstationId: Int) {
+        presenter?.getMachineryPage(workstationId) {
+            mMachineryList.clear()
+            it?.records?.let {
+                mMachineryList.addAll(it)
+            }
+            mBinding?.rvTechnology?.adapter?.notifyDataSetChanged()
+        }
     }
 
     override fun initPresenter(): TechnologySopPresenter {
         return TechnologySopPresenter()
     }
-
 }

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

@@ -1,7 +1,18 @@
 package com.grkj.iscs.view.presenter
 
+import com.grkj.iscs.model.vo.machinery.MachineryPageRespVO
+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.ITechnologySopView
 
 class TechnologySopPresenter : BasePresenter<ITechnologySopView>() {
+
+    fun getMachineryPage(workstationId: Int, callBack: (MachineryPageRespVO?) -> Unit) {
+        NetApi.getMachineryPage(0, 10, workstationId) {
+            Executor.runOnMain {
+                callBack(it)
+            }
+        }
+    }
 }

+ 4 - 1
app/src/main/java/com/grkj/iscs/view/presenter/WorkshopPresenter.kt

@@ -1,6 +1,7 @@
 package com.grkj.iscs.view.presenter
 
 import com.grkj.iscs.model.vo.ticket.WorkstationTicketListRespVO
+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.IWorkshopView
@@ -9,7 +10,9 @@ class WorkshopPresenter : BasePresenter<IWorkshopView>() {
 
     fun getWorkstationTicketList(callBack: (MutableList<WorkstationTicketListRespVO>?) -> Unit) {
         NetApi.getWorkstationTicketList(0, 10) {
-            callBack(it)
+            Executor.runOnMain {
+                callBack(it)
+            }
         }
     }
 }

+ 5 - 0
app/src/main/res/drawable/item_rv_technology_sop_bg_normal.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/drawable/item_rv_technology_sop_bg_selected.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_30" />
+</shape>

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

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="false" android:drawable="@drawable/item_rv_technology_sop_bg_normal" />
+    <item android:state_selected="true" android:drawable="@drawable/item_rv_technology_sop_bg_selected" />
+</selector>

+ 5 - 0
app/src/main/res/drawable/item_rv_technology_sop_type_bg_normal.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/main_color" />
+</shape>

+ 8 - 0
app/src/main/res/drawable/item_rv_technology_sop_type_bg_selected.xml

@@ -0,0 +1,8 @@
+<?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/main_color" />
+    <stroke
+        android:width="@dimen/divider_line_width"
+        android:color="@color/white" />
+</shape>

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

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_selected="false" android:drawable="@drawable/item_rv_technology_sop_type_bg_normal" />
+    <item android:state_selected="true" android:drawable="@drawable/item_rv_technology_sop_type_bg_selected" />
+</selector>

+ 11 - 4
app/src/main/res/layout/fragment_technology_sop.xml

@@ -5,9 +5,16 @@
     android:layout_height="match_parent"
     tools:context=".view.fragment.TechnologySopFragment">
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/rv_technology"
-        style="@style/CommonRecyclerView"
+    <LinearLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="horizontal" />
+        android:orientation="vertical"
+        android:padding="@dimen/common_padding">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/rv_technology"
+            style="@style/CommonRecyclerView"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal" />
+    </LinearLayout>
 </RelativeLayout>

+ 13 - 7
app/src/main/res/layout/item_rv_technology_sop.xml

@@ -4,20 +4,26 @@
     android:id="@+id/root"
     android:layout_width="@dimen/item_rv_technology_width"
     android:layout_height="@dimen/item_rv_technology_height"
-    android:orientation="horizontal">
-
-    <ImageView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
+    android:layout_margin="5dp"
+    android:background="@drawable/item_rv_technology_sop_bg_selector"
+    android:gravity="center_horizontal"
+    android:orientation="vertical"
+    android:padding="10dp">
 
     <TextView
-        android:id="@+id/tv_number"
+        android:id="@+id/tv_name"
         style="@style/CommonTextView" />
 
+    <ImageView
+        android:id="@+id/iv_pic"
+        android:layout_width="54dp"
+        android:layout_height="54dp"
+        android:layout_marginTop="5dp"/>
+
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/rv_type"
         style="@style/CommonRecyclerView"
         android:layout_height="wrap_content"
         app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
-        app:spanCount="2"/>
+        app:spanCount="2" />
 </LinearLayout>

+ 7 - 4
app/src/main/res/layout/item_rv_technology_sop_type.xml

@@ -3,15 +3,18 @@
     android:id="@+id/root"
     android:layout_width="@dimen/item_rv_technology_type_width"
     android:layout_height="@dimen/item_rv_technology_type_height"
+    android:layout_margin="3dp"
+    android:background="@drawable/item_rv_technology_sop_type_bg_selector"
     android:orientation="horizontal"
     android:padding="@dimen/item_rv_technology_type_padding">
 
     <ImageView
         android:id="@+id/iv_type"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
+        android:layout_width="15dp"
+        android:layout_height="15dp" />
 
     <TextView
-        android:id="@+id/tv_type"
-        style="@style/CommonTextView" />
+        android:id="@+id/tv_name"
+        style="@style/CommonTextView"
+        android:textSize="@dimen/common_text_size_small" />
 </LinearLayout>

+ 6 - 4
app/src/main/res/values/dimens.xml

@@ -2,10 +2,12 @@
 <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_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_padding">10dp</dimen>
 
     <dimen name="common_btn_width">150dp</dimen>
     <dimen name="common_btn_height">50dp</dimen>
@@ -59,10 +61,10 @@
     <dimen name="divider_line_width">1dp</dimen>
     <dimen name="divider_line_margin">5dp</dimen>
     <dimen name="page_padding">20dp</dimen>
-    <dimen name="item_rv_technology_height">160dp</dimen>
-    <dimen name="item_rv_technology_width">100dp</dimen>
-    <dimen name="item_rv_technology_type_height">20dp</dimen>
-    <dimen name="item_rv_technology_type_width">50dp</dimen>
+    <dimen name="item_rv_technology_height">207dp</dimen>
+    <dimen name="item_rv_technology_width">118dp</dimen>
+    <dimen name="item_rv_technology_type_height">18dp</dimen>
+    <dimen name="item_rv_technology_type_width">40dp</dimen>
     <dimen name="item_rv_technology_type_padding">2dp</dimen>
     <dimen name="dialog_tip_width">256dp</dimen>
     <dimen name="dialog_tip_height">144dp</dimen>