Frankensteinly 1 год назад
Родитель
Сommit
5e0b82440d

+ 3 - 0
app/src/main/AndroidManifest.xml

@@ -21,6 +21,9 @@
         android:supportsRtl="true"
         android:supportsRtl="true"
         android:theme="@style/Theme.ISCS"
         android:theme="@style/Theme.ISCS"
         tools:targetApi="31">
         tools:targetApi="31">
+        <activity
+            android:name=".activity.CreateTicketActivity"
+            android:exported="false" />
         <activity
         <activity
             android:name=".presentation.CurrentTicketActivity"
             android:name=".presentation.CurrentTicketActivity"
             android:exported="false" />
             android:exported="false" />

+ 44 - 0
app/src/main/java/com/grkj/iscs/activity/CreateTicketActivity.kt

@@ -0,0 +1,44 @@
+package com.grkj.iscs.activity
+
+import com.grkj.iscs.base.BaseMvpActivity
+import com.grkj.iscs.databinding.ActivityCreateTicketBinding
+import com.grkj.iscs.iview.ICreateTicketView
+import com.grkj.iscs.model.vo.SopPageVO
+import com.grkj.iscs.presentation.PresentationManager
+import com.grkj.iscs.presenter.CreateTicketPresenter
+import com.grkj.iscs.widget.SelectableInput
+import java.util.stream.Collectors
+
+class CreateTicketActivity : BaseMvpActivity<ICreateTicketView, CreateTicketPresenter, ActivityCreateTicketBinding>(),ICreateTicketView {
+
+    private var mSelectedSopIdx: Int? = null
+
+    override val viewBinding: ActivityCreateTicketBinding
+        get() = ActivityCreateTicketBinding.inflate(layoutInflater)
+
+    override fun initView() {
+        presenter?.getSopList()
+    }
+
+    override fun showSopList(sopList: MutableList<SopPageVO.Record>) {
+        mBinding?.siSop?.mOptionList = sopList.stream().map { it.sopName }.collect(Collectors.toList())
+        mBinding?.siSop?.setOnSpinnerSelectListener(object : SelectableInput.OnSpinnerSelectListener {
+            override fun onSelect(str: String?, index: Int) {
+                mSelectedSopIdx = index
+                val sop = sopList[index]
+                mBinding?.siWorkshop?.setText(sop.workshopName)
+                mBinding?.siLine?.setText(sop.workareaName)
+                mBinding?.siTicketName?.setText("${sop.sopName}-${sop.workshopName}-${sop.workareaName}")
+//                mBinding?.siTicketNumber?.setText(sop.ticketNumber)
+                mBinding?.siTicketType?.setText(sop.sopType)
+//                mBinding?.siSegregationPoint?.setText(sop.pointList.map { it.name }.toString())
+            }
+        })
+    }
+
+    override fun initPresenter(): CreateTicketPresenter {
+        return CreateTicketPresenter()
+    }
+
+
+}

+ 4 - 0
app/src/main/java/com/grkj/iscs/activity/MainActivity.kt

@@ -47,5 +47,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
         mBinding?.presentationLogin?.setOnClickListener {
         mBinding?.presentationLogin?.setOnClickListener {
             startActivity(Intent(this, PresentationLoginActivity::class.java))
             startActivity(Intent(this, PresentationLoginActivity::class.java))
         }
         }
+
+        mBinding?.createTicket?.setOnClickListener {
+            startActivity(Intent(this, CreateTicketActivity::class.java))
+        }
     }
     }
 }
 }

+ 9 - 0
app/src/main/java/com/grkj/iscs/iview/ICreateTicketView.kt

@@ -0,0 +1,9 @@
+package com.grkj.iscs.iview
+
+import com.grkj.iscs.base.IView
+import com.grkj.iscs.model.vo.SopPageVO
+
+interface ICreateTicketView : IView {
+
+    fun showSopList(sopList: MutableList<SopPageVO.Record>)
+}

+ 19 - 18
app/src/main/java/com/grkj/iscs/model/vo/SopPageVO.kt

@@ -13,23 +13,24 @@ data class SopPageVO(
     override fun toString(): String {
     override fun toString(): String {
         return "SopPageVO(current=$current, optimizeCountSql=$optimizeCountSql, orders=$orders, pages=$pages, records=$records, searchCount=$searchCount, size=$size, total=$total)"
         return "SopPageVO(current=$current, optimizeCountSql=$optimizeCountSql, orders=$orders, pages=$pages, records=$records, searchCount=$searchCount, size=$size, total=$total)"
     }
     }
+
+    data class Record(
+        val createBy: String,
+        val createTime: String,
+        val delFlag: String,
+        val pointCount: Int,
+        val sopCode: String,
+        val sopContent: String,
+        val sopId: String,
+        val sopName: String,
+        val sopStatus: String,
+        val sopType: String,
+        val updateBy: String,
+        val updateTime: String,
+        val workareaId: String,
+        val workareaName: String,
+        val workshopId: String,
+        val workshopName: String
+    )
 }
 }
 
 
-data class Record(
-    val createBy: String,
-    val createTime: String,
-    val delFlag: String,
-    val pointCount: Int,
-    val sopCode: String,
-    val sopContent: String,
-    val sopId: String,
-    val sopName: String,
-    val sopStatus: String,
-    val sopType: String,
-    val updateBy: String,
-    val updateTime: String,
-    val workareaId: String,
-    val workareaName: String,
-    val workshopId: String,
-    val workshopName: String
-)

+ 18 - 0
app/src/main/java/com/grkj/iscs/presenter/CreateTicketPresenter.kt

@@ -0,0 +1,18 @@
+package com.grkj.iscs.presenter
+
+import com.grkj.iscs.base.BasePresenter
+import com.grkj.iscs.iview.ICreateTicketView
+import com.grkj.iscs.model.vo.SopPageVO
+import com.grkj.iscs.util.NetApi
+
+class CreateTicketPresenter : BasePresenter<ICreateTicketView>() {
+
+    var mSopList = mutableListOf<SopPageVO.Record>()
+
+    fun getSopList() {
+        NetApi.getSopPage(0, 10) {
+            mSopList = it?.records as MutableList<SopPageVO.Record>
+            mvpView?.showSopList(mSopList)
+        }
+    }
+}

+ 177 - 0
app/src/main/res/layout/activity_create_ticket.xml

@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/main"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:overScrollMode="never"
+    android:paddingHorizontal="33dp"
+    android:paddingTop="7dp"
+    android:scrollbars="none">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_sop"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:edittext_hint="@string/presentation_hint_name"
+            app:mode="select"
+            app:name="@string/presentation_select_sop"
+            app:required="true" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_workshop"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_workshop"
+            app:enabled="false"
+            app:mode="input"
+            app:name="@string/presentation_select_workshop" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_line"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_line"
+            app:enabled="false"
+            app:mode="input"
+            app:name="@string/presentation_select_line" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_ticket_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_name"
+            app:mode="input"
+            app:name="@string/presentation_ticket_name" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_ticket_number"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_number"
+            app:enabled="false"
+            app:mode="input"
+            app:name="@string/presentation_ticket_number" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_ticket_type"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_type"
+            app:enabled="false"
+            app:mode="input"
+            app:name="@string/presentation_ticket_type" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_segregation_point"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_point"
+            app:enabled="false"
+            app:mode="input"
+            app:name="@string/presentation_segregation_point" />
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_person_lock"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_locker"
+            app:mode="select"
+            app:name="@string/presentation_person_lock"
+            app:required="true" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/tv_name"
+                android:layout_width="@dimen/selectable_input_width"
+                android:layout_height="wrap_content"
+                android:text="@string/presentation_person_lock_together"
+                android:textColor="@color/main_color"
+                android:textSize="@dimen/common_text_size" />
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/rv_locker_together"
+                style="@style/CommonRecyclerView" />
+        </LinearLayout>
+
+        <com.grkj.iscs.widget.SelectableInput
+            android:id="@+id/si_person_safety"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            app:edittext_hint="@string/presentation_hint_safety"
+            app:mode="select"
+            app:name="@string/presentation_person_safety" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="7dp"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/start_time"
+                android:textColor="@color/main_color"
+                android:textSize="@dimen/common_text_size" />
+
+            <TextView
+                android:id="@+id/tv_start_time"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="2"
+                android:background="@drawable/selectable_input_text_bg"
+                android:textSize="@dimen/common_text_size" />
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/end_time"
+                android:textColor="@color/main_color"
+                android:textSize="@dimen/common_text_size" />
+
+            <TextView
+                android:id="@+id/tv_end_time"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="2"
+                android:background="@drawable/selectable_input_text_bg"
+                android:textSize="@dimen/common_text_size" />
+        </LinearLayout>
+
+        <Button
+            android:id="@+id/confirm"
+            android:layout_width="200dp"
+            android:layout_height="50dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_margin="5dp"
+            android:minWidth="0dp"
+            android:minHeight="0dp"
+            android:text="确定"
+            android:textSize="10sp" />
+    </LinearLayout>
+</androidx.core.widget.NestedScrollView>

+ 16 - 0
app/src/main/res/layout/activity_main.xml

@@ -111,4 +111,20 @@
             android:textSize="10sp"
             android:textSize="10sp"
             android:layout_margin="5dp"/>
             android:layout_margin="5dp"/>
     </LinearLayout>
     </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:gravity="center">
+        <Button
+            android:id="@+id/create_ticket"
+            android:layout_width="wrap_content"
+            android:layout_height="50dp"
+            android:minWidth="0dp"
+            android:minHeight="0dp"
+            android:text="Create Ticket"
+            android:textSize="10sp"
+            android:layout_margin="5dp"/>
+    </LinearLayout>
 </LinearLayout>
 </LinearLayout>