Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc6d2f2c5 | ||
|
|
3dea103e27 | ||
|
|
5a4f136dba | ||
|
|
4973236469 | ||
|
|
c02a2ff08c | ||
|
|
8839320484 | ||
|
|
0a837a98b8 | ||
|
|
91271fbf8c | ||
|
|
bb09bc304f | ||
|
|
117c5fa3ad | ||
|
|
4ed44b5e4a | ||
|
|
79c0855976 | ||
|
|
71ca3a6081 | ||
|
|
d65f72e3c4 | ||
|
|
87da63bec7 | ||
|
|
58798fcbfb | ||
|
|
6e75007bd1 | ||
|
|
e712fa230a | ||
|
|
1ffae2737e | ||
|
|
f9f800bef3 | ||
|
|
6f2a47ad3f | ||
|
|
e34d925a83 | ||
|
|
b03a1bae8c | ||
|
|
201a0779bf | ||
|
|
be579ea7e4 | ||
|
|
fa2672d6d7 | ||
|
|
87278949d1 | ||
|
|
4867c14581 |
@@ -26,6 +26,8 @@ android {
|
|||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 设置输出APK文件名格式
|
||||||
|
setProperty("archivesBaseName", "煤矿数采终端v${versionName}")
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs{
|
signingConfigs{
|
||||||
@@ -76,7 +78,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||||
api rootProject.ext.androidxLibs
|
api rootProject.ext.androidxLibs
|
||||||
// ViewModel and LiveData
|
// ViewModel and LiveData
|
||||||
api rootProject.ext.jetpackLibs
|
api rootProject.ext.jetpackLibs
|
||||||
@@ -105,4 +107,12 @@ dependencies {
|
|||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
|
||||||
implementation 'com.google.code.gson:gson:2.10.1'
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
|
|
||||||
|
implementation("org.apache.poi:poi:5.2.3")
|
||||||
|
implementation("org.apache.poi:poi-ooxml:5.2.3")
|
||||||
|
|
||||||
|
implementation 'androidx.fragment:fragment-ktx:1.6.0'
|
||||||
|
|
||||||
|
// implementation 'com.zhihu.android:matisse:0.6.0'
|
||||||
|
implementation project(':matisse')
|
||||||
|
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,11 @@
|
|||||||
package="com.zmkg.coaloperation">
|
package="com.zmkg.coaloperation">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MyApplication"
|
android:name=".MyApplication"
|
||||||
@@ -13,8 +18,20 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.AppTheme"
|
android:theme="@style/Theme.AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"/>
|
||||||
|
</provider>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
@@ -30,15 +47,31 @@
|
|||||||
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
||||||
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
||||||
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
||||||
<activity android:name=".ui.home.activity.GeologicalActivity" />
|
<activity android:name=".ui.geologging.GeologicalActivity" />
|
||||||
|
<activity android:name=".ui.tunneling.activity.WorkingFaceStatisticsActivity" />
|
||||||
|
<activity android:name=".ui.tunneling.activity.WorkingFaceRecordActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingPointActivity" />
|
<activity android:name=".ui.tunneling.activity.AddWorkingFaceRecordActivity"
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetail2Activity" />
|
|
||||||
<activity android:name=".ui.tunneling.activity.AddWorkingPointActivity"
|
|
||||||
android:windowSoftInputMode="adjustPan"/>
|
android:windowSoftInputMode="adjustPan"/>
|
||||||
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkFaceActivity"
|
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity android:name=".ui.mining.activity.MiningActivity" />
|
||||||
|
<activity android:name=".ui.mining.activity.MiningFaceStatisticsActivity" />
|
||||||
|
<activity android:name=".ui.mining.activity.MiningFaceDetailActivity" />
|
||||||
|
<activity android:name=".ui.mining.activity.AddMiningFaceActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity android:name=".ui.mining.activity.MiningFaceRecordActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity android:name=".ui.user.activity.DataSyncActivity" />
|
||||||
|
<activity android:name=".ui.wateryield.WaterYieldObserveActivity" />
|
||||||
|
<activity android:name=".ui.wateryield.WaterYieldAddObservePointActivity"
|
||||||
|
android:windowSoftInputMode="adjustPan"/>
|
||||||
|
<activity android:name=".ui.wateryield.WaterYieldHomeActivity" />
|
||||||
|
<activity android:name=".ui.wateryield.WaterYieldObserveRecordActivity" />
|
||||||
|
<activity android:name=".ui.geologging.GeologicalPointActivity" />
|
||||||
|
<activity android:name=".ui.geologging.AddGeologicalPointActivity" />
|
||||||
|
<activity android:name=".ui.geologging.AddGeoLoggingFaceActivity" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zmkg.coaloperation
|
package com.zmkg.coaloperation
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@@ -10,7 +11,7 @@ import com.zmkg.coaloperation.bottomtab.HomeBottomTabLayout
|
|||||||
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
||||||
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
||||||
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
||||||
import com.zmkg.coaloperation.ui.report.fragment.ReportFragment
|
import com.zmkg.coaloperation.ui.report.fragment.Report2Fragment
|
||||||
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
||||||
|
|
||||||
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
||||||
@@ -56,7 +57,7 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
|||||||
}
|
}
|
||||||
|
|
||||||
TAG_REPORT -> {
|
TAG_REPORT -> {
|
||||||
return ReportFragment()
|
return Report2Fragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TAG_MESSAGE -> {
|
// TAG_MESSAGE -> {
|
||||||
@@ -77,4 +78,5 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
|||||||
override fun transparentStatusBar(): Boolean {
|
override fun transparentStatusBar(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,8 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun initLoginStatusListener() {
|
fun initLoginStatusListener() {
|
||||||
// TUILogin.addLoginListener(loginStatusListener)
|
// TUILogin.addLoginListener(loginStatusListener)
|
||||||
}
|
}
|
||||||
|
|||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemAddMiningFaceBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class AddMiningFaceAdapter(list: MutableList<AddMiningFaceItem>):
|
||||||
|
BaseQuickAdapter<AddMiningFaceItem, AddMiningFaceAdapter.VH>(R.layout.list_item_add_mining_face, list){
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemAddMiningFaceBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: AddMiningFaceItem
|
||||||
|
) {
|
||||||
|
holder.binding.let {
|
||||||
|
val index = holder.layoutPosition
|
||||||
|
it.imgExpand.run {
|
||||||
|
if (item.isShowArrowDown) visible() else gone()
|
||||||
|
}
|
||||||
|
it.tvFuncName.text = item.funcName
|
||||||
|
if (item.funcType == 0) {
|
||||||
|
it.etInputValue.run {
|
||||||
|
visible()
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.funcValue = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.funcValue)
|
||||||
|
}
|
||||||
|
it.tvSelectValue.gone()
|
||||||
|
} else {
|
||||||
|
it.etInputValue.gone()
|
||||||
|
it.tvSelectValue.run {
|
||||||
|
visible()
|
||||||
|
text = item.funcValue
|
||||||
|
tag = item.funcId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.divider.run {
|
||||||
|
if (index == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemAddMiningFaceBinding): BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.BuoyBottomItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemBuoyBottomBinding
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class BuoyBottomAdapter(list: MutableList<BuoyBottomItem>) :
|
||||||
|
BaseQuickAdapter<BuoyBottomItem, BuoyBottomAdapter.VH>(R.layout.list_item_buoy_bottom, list) {
|
||||||
|
inner class VH(var binding: ListItemBuoyBottomBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemBuoyBottomBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(holder: VH, item: BuoyBottomItem) {
|
||||||
|
holder.binding.let {
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
if (position > 0) {
|
||||||
|
item.name = "断面${position}到断面${position + 1}的水流时间(s)"
|
||||||
|
}
|
||||||
|
it.tvShowName.text = item.name
|
||||||
|
it.etShowValue.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.value = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.value.formatDecimalString())
|
||||||
|
}
|
||||||
|
it.divider.run {
|
||||||
|
if (position == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.BuoyTopItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemBuoyTopBinding
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class BuoyTopAdapter(list: MutableList<BuoyTopItem>) :
|
||||||
|
BaseQuickAdapter<BuoyTopItem, BuoyTopAdapter.VH>(R.layout.list_item_buoy_top, list) {
|
||||||
|
inner class VH(var binding: ListItemBuoyTopBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemBuoyTopBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(holder: VH, item: BuoyTopItem) {
|
||||||
|
holder.binding.let {
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
item.faceName = "断面${position + 1}"
|
||||||
|
it.tvFaceName.text = item.faceName
|
||||||
|
it.etDitchWidth.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.ditchWidth = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.ditchWidth.formatDecimalString())
|
||||||
|
}
|
||||||
|
it.etDitchDepth.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.ditchDepth = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.ditchDepth.formatDecimalString())
|
||||||
|
}
|
||||||
|
it.ivDeleteFace.run {
|
||||||
|
if (position > 0) visible() else gone()
|
||||||
|
}
|
||||||
|
it.divider.run {
|
||||||
|
if (position == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
it.btnAddFace.run {
|
||||||
|
if (position == data.size - 1) visible() else gone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemCommonImageBinding
|
||||||
|
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
import com.zmkg.coaloperation.utils.load
|
||||||
|
|
||||||
|
class CommonImageAdapter(var list: MutableList<CommonImageBean>, var imageSize: Int = 70.dp):
|
||||||
|
BaseQuickAdapter<CommonImageBean, CommonImageAdapter.VH>(
|
||||||
|
R.layout.list_item_common_image, list
|
||||||
|
){
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemCommonImageBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: CommonImageBean
|
||||||
|
) {
|
||||||
|
holder.binding.ivImage.let {
|
||||||
|
it.updateLayoutParams {
|
||||||
|
width = imageSize
|
||||||
|
height = imageSize
|
||||||
|
}
|
||||||
|
if (item.isAddFlag) {
|
||||||
|
it.load(R.drawable.ic_add_image)
|
||||||
|
} else {
|
||||||
|
it.loadRoundedImage(item.imagePath, 3F)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemCommonImageBinding): BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.DataSyncItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemDataSyncBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class DataSyncAdapter(list: MutableList<DataSyncItem>):
|
||||||
|
BaseQuickAdapter<DataSyncItem, DataSyncAdapter.VH>(R.layout.list_item_data_sync, list) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemDataSyncBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: DataSyncItem
|
||||||
|
) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.tvItemUnit.text = item.funcName
|
||||||
|
// it.divider.run {
|
||||||
|
// if (holder.layoutPosition == data.size - 1) gone() else visible()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemDataSyncBinding): BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.databinding.ItemGeologicalListBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.geologging.GeoLoggingFace
|
||||||
|
|
||||||
|
class GeoLoggingFaceAdapter(list: MutableList<GeoLoggingFace>):
|
||||||
|
BaseQuickAdapter<GeoLoggingFace, GeoLoggingFaceAdapter.VH>(
|
||||||
|
R.layout.item_geological_list, list
|
||||||
|
){
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ItemGeologicalListBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: GeoLoggingFace
|
||||||
|
) {
|
||||||
|
holder.binding.tvFaceName.text = item.surfaceName
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ItemGeologicalListBinding): BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ItemGeologicalPointBinding
|
||||||
|
import com.zmkg.coaloperation.ui.geologging.AddGeologicalPointActivity
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class GeoPointAdapter(list: MutableList<GeoPointItem>) :
|
||||||
|
BaseQuickAdapter<GeoPointItem, GeoPointAdapter.VH>(
|
||||||
|
R.layout.item_geological_point, list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ItemGeologicalPointBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: GeoPointItem
|
||||||
|
) {
|
||||||
|
val index = holder.layoutPosition
|
||||||
|
val binding = holder.binding
|
||||||
|
binding.tvNum.run {
|
||||||
|
text = "${index+1}"
|
||||||
|
setTextColor(
|
||||||
|
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
binding.tvName.run {
|
||||||
|
text = item.name
|
||||||
|
setTextColor(
|
||||||
|
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
binding.tvDistance.run {
|
||||||
|
text = item.distance
|
||||||
|
setTextColor(
|
||||||
|
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (item.isLogging) {
|
||||||
|
binding.ivState.setImageResource(
|
||||||
|
if (item.isChecked) R.drawable.ic_point_green_check
|
||||||
|
else R.drawable.ic_point_green
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
binding.ivState.setImageResource(R.drawable.ic_point_grey)
|
||||||
|
}
|
||||||
|
binding.horizontalDivider.run {
|
||||||
|
if (item.isLogging) {
|
||||||
|
if (index == data.size-1) gone() else visible()
|
||||||
|
} else {
|
||||||
|
visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.btnAddPoint.run {
|
||||||
|
if (!item.isLogging && index == data.size-1) visible() else gone()
|
||||||
|
setOnClickListener {
|
||||||
|
it.context.startActivity(Intent(it.context, AddGeologicalPointActivity::class.java))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
addChildClickViewIds(R.id.btnAddPoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ItemGeologicalPointBinding) : BaseViewHolder(binding.root)
|
||||||
|
}
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zhihu.matisse.Matisse
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseActivity
|
||||||
|
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemPointBaseHorizontalBinding
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemPointBaseVerticalBinding
|
||||||
|
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||||
|
BaseMultiItemQuickAdapter<GeoPointMultiItem, BaseViewHolder>(list) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
addItemType(GeoPointMultiItem.TYPE_BASE_INFO, R.layout.list_item_point_base_info)
|
||||||
|
addItemType(GeoPointMultiItem.TYPE_LOGGING_INFO, R.layout.list_item_point_logging_info)
|
||||||
|
addItemType(GeoPointMultiItem.TYPE_CALCULATE_INFO, R.layout.list_item_point_calculate_info)
|
||||||
|
addItemType(GeoPointMultiItem.TYPE_UPLOAD_IMAGE, R.layout.list_item_point_upload_image)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: BaseViewHolder,
|
||||||
|
item: GeoPointMultiItem
|
||||||
|
) {
|
||||||
|
when (holder.itemViewType) {
|
||||||
|
GeoPointMultiItem.TYPE_BASE_INFO -> {
|
||||||
|
loadBaseInfo(holder, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
GeoPointMultiItem.TYPE_LOGGING_INFO -> {
|
||||||
|
loadLoggingInfo(holder, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
GeoPointMultiItem.TYPE_CALCULATE_INFO -> {
|
||||||
|
loadCalculateInfo(holder, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
GeoPointMultiItem.TYPE_UPLOAD_IMAGE -> {
|
||||||
|
loadUploadImage(holder, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadUploadImage(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||||
|
val rvImageList = holder.itemView.findViewById<RecyclerView>(R.id.rvImageList)
|
||||||
|
if (item.images == null) {
|
||||||
|
item.images = mutableListOf()
|
||||||
|
}
|
||||||
|
val images = item.images!!
|
||||||
|
rvImageList.let { rv ->
|
||||||
|
rv.layoutManager = GridLayoutManager(rv.context, 4, GridLayoutManager.VERTICAL, false)
|
||||||
|
rv.adapter = CommonImageAdapter(images).also {
|
||||||
|
it.setOnItemClickListener { adapter, view, position ->
|
||||||
|
if (it.data[position].isAddFlag.not()) {
|
||||||
|
return@setOnItemClickListener
|
||||||
|
}
|
||||||
|
openGallery(context as BaseActivity, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadCalculateInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {}
|
||||||
|
|
||||||
|
private fun loadLoggingInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadBaseInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||||
|
val llBaseTop = holder.itemView.findViewById<LinearLayout>(R.id.llBaseTop)
|
||||||
|
llBaseTop.removeAllViews()
|
||||||
|
item.baseTopList?.forEach {
|
||||||
|
val itemBinding = ListItemPointBaseHorizontalBinding.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
llBaseTop,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
itemBinding.run {
|
||||||
|
tvItemName.text = it.name
|
||||||
|
etInputValue.setText(it.value)
|
||||||
|
}
|
||||||
|
llBaseTop.addView(itemBinding.root)
|
||||||
|
}
|
||||||
|
|
||||||
|
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
||||||
|
llBaseBottom.removeAllViews()
|
||||||
|
item.baseBottomList?.forEachIndexed { index, it ->
|
||||||
|
val itemBinding = ListItemPointBaseVerticalBinding.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
llBaseBottom,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
itemBinding.run {
|
||||||
|
tvItemName.text = it.name
|
||||||
|
etInputValue.setText(it.value)
|
||||||
|
dividerVertical.run {
|
||||||
|
if (index == item.baseBottomList!!.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemBinding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
width = 0
|
||||||
|
height = LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
weight = if (index == item.baseBottomList!!.size - 1) 1.24F else 1.0F
|
||||||
|
}
|
||||||
|
llBaseBottom.addView(itemBinding.root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||||
|
StorageUtils.requestPermission(activity) {
|
||||||
|
GalleryUtils.openGallery(activity) { data ->
|
||||||
|
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||||
|
paths?.forEach { path ->
|
||||||
|
val size = adapter.list.size
|
||||||
|
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointParent
|
||||||
|
import com.zmkg.coaloperation.databinding.ItemGeologicalHeaderBinding
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemGeologicalPointParentBinding
|
||||||
|
|
||||||
|
class GeoPointParentAdapter(list: MutableList<GeoPointParent>) :
|
||||||
|
BaseQuickAdapter<GeoPointParent, GeoPointParentAdapter.VH>(
|
||||||
|
R.layout.list_item_geological_point_parent, list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemGeologicalPointParentBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: GeoPointParent
|
||||||
|
) {
|
||||||
|
val binding = holder.binding
|
||||||
|
binding.tvPointFlag.run {
|
||||||
|
text = item.name
|
||||||
|
}
|
||||||
|
binding.rvPointList.let { rv ->
|
||||||
|
rv.layoutManager = LinearLayoutManager(context)
|
||||||
|
if (item.list == null) {
|
||||||
|
item.list = mutableListOf()
|
||||||
|
}
|
||||||
|
val geoPointAdapter = GeoPointAdapter(item.list!!)
|
||||||
|
rv.adapter = geoPointAdapter
|
||||||
|
// val headerBinding =
|
||||||
|
// ItemGeologicalHeaderBinding.inflate(LayoutInflater.from(context))
|
||||||
|
// geoPointAdapter.addHeaderView(headerBinding.root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemGeologicalPointParentBinding) : BaseViewHolder(binding.root)
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemMiningRecordBaseDataBinding
|
||||||
|
|
||||||
|
class MiningRecordBaseDataAdapter(list: MutableList<AddMiningFaceItem>) :
|
||||||
|
BaseQuickAdapter<AddMiningFaceItem, MiningRecordBaseDataAdapter.VH>(
|
||||||
|
R.layout.list_item_mining_record_base_data,
|
||||||
|
list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
): VH {
|
||||||
|
val binding = ListItemMiningRecordBaseDataBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: AddMiningFaceItem
|
||||||
|
) {
|
||||||
|
val binding = holder.binding
|
||||||
|
binding.tvItemName.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.funcName = text.toString().trim()
|
||||||
|
})
|
||||||
|
text = item.funcName
|
||||||
|
}
|
||||||
|
binding.etItemValue.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.funcValue = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.funcValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemMiningRecordBaseDataBinding) : BaseViewHolder(binding.root)
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.text.Html
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.CoalThicknessItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemMiningRecordCoalThicknessBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class MiningRecordCoalThicknessAdapter(list: MutableList<CoalThicknessItem>):
|
||||||
|
BaseQuickAdapter<CoalThicknessItem,MiningRecordCoalThicknessAdapter.VH>(R.layout.list_item_mining_record_coal_thickness,list){
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemMiningRecordCoalThicknessBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(holder: VH, item: CoalThicknessItem) {
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
val binding = holder.binding
|
||||||
|
binding.divider.run {
|
||||||
|
if (position == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
binding.btnAddPoint.run {
|
||||||
|
if (position == data.size - 1) visible() else gone()
|
||||||
|
}
|
||||||
|
binding.tvNameUnit.text = Html.fromHtml("<sup>#</sup>架", Html.FROM_HTML_MODE_LEGACY)
|
||||||
|
binding.etItemName.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.supportNo = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.supportNo)
|
||||||
|
}
|
||||||
|
binding.etItemValue.run {
|
||||||
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
item.thicknessValue = text.toString().trim()
|
||||||
|
})
|
||||||
|
setText(item.thicknessValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemMiningRecordCoalThicknessBinding): BaseViewHolder(binding.root)
|
||||||
|
}
|
||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.MiningFaceRecordActivity
|
||||||
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class MiningWorkingFaceAdapter(var list: MutableList<MiningWorkingFaceEntity>) :
|
||||||
|
BaseQuickAdapter<MiningWorkingFaceEntity, MiningWorkingFaceAdapter.VH>(
|
||||||
|
R.layout.list_item_tunnel_working_face, list
|
||||||
|
) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "TunnelWorkingFaceAdapter"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val binding = ListItemTunnelWorkingFaceBinding.inflate(inflater, parent, false)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: MiningWorkingFaceEntity
|
||||||
|
) {
|
||||||
|
holder.binding.let { binding ->
|
||||||
|
binding.includeHeader.root.isEnabled = false
|
||||||
|
binding.tvWorkingFaceName.text = item.surfaceName
|
||||||
|
binding.llFaceRecord.let {
|
||||||
|
if (item.isExpandRecord) it.visible() else it.gone()
|
||||||
|
}
|
||||||
|
binding.ivFlagEdit.let {
|
||||||
|
if (item.dataState == "1") it.visible() else it.gone()
|
||||||
|
}
|
||||||
|
binding.ivExpandRecord.setImageResource(
|
||||||
|
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
||||||
|
)
|
||||||
|
binding.ivExpandRecord.tag = item.isExpandRecord.toString()
|
||||||
|
binding.rvFaceRecord.let { rv ->
|
||||||
|
rv.layoutManager = LinearLayoutManager(context)
|
||||||
|
if (item.records == null) {
|
||||||
|
item.records = mutableListOf()
|
||||||
|
}
|
||||||
|
val size = item.records!!.size
|
||||||
|
binding.includeHeader.root.let { header ->
|
||||||
|
if (size > 0) header.visible()
|
||||||
|
else header.gone()
|
||||||
|
}
|
||||||
|
rv.updateLayoutParams {
|
||||||
|
height = if (size >= 3)
|
||||||
|
ScreenUtil.dp2px(150F)
|
||||||
|
else
|
||||||
|
RecyclerView.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
rv.isVerticalScrollBarEnabled = size >= 3
|
||||||
|
rv.isVerticalFadingEdgeEnabled = size < 3
|
||||||
|
rv.overScrollMode = if (size >= 3) View.OVER_SCROLL_IF_CONTENT_SCROLLS else View.OVER_SCROLL_NEVER
|
||||||
|
rv.adapter = MiningWorkingFaceRecordAdapter(item.records!!).apply {
|
||||||
|
setOnItemClickListener { adapter, view, recordPosition ->
|
||||||
|
// if (recordPosition == 0) {
|
||||||
|
// //0为头部表示,不需要点击操作
|
||||||
|
// return@setOnItemClickListener
|
||||||
|
// }
|
||||||
|
Log.d(TAG, "convert: ${item.records!![recordPosition].toJsonString()}")
|
||||||
|
context.let { ctx ->
|
||||||
|
if (ctx is MiningActivity) {
|
||||||
|
ctx.toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||||
|
putString(MiningFaceRecordActivity.WORK_RECORD_TYPE, MiningFaceRecordActivity.WorkRecordType.SEE.name)
|
||||||
|
putString(MiningFaceRecordActivity.FACE_NAME, item.surfaceName)
|
||||||
|
putParcelable(
|
||||||
|
MiningFaceRecordActivity.FACE_RECORD,
|
||||||
|
item.records!![recordPosition]
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemTunnelWorkingFaceBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
init {
|
||||||
|
addChildClickViewIds(
|
||||||
|
R.id.start_record,
|
||||||
|
R.id.ivExpandRecord,
|
||||||
|
R.id.llWorkingFace
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceRecordBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class MiningWorkingFaceRecordAdapter(var list: MutableList<MiningWorkingFaceRecordEntity>) :
|
||||||
|
BaseQuickAdapter<MiningWorkingFaceRecordEntity, MiningWorkingFaceRecordAdapter.VH>(
|
||||||
|
R.layout.list_item_tunnel_working_face_record, list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val binding = ListItemTunnelWorkingFaceRecordBinding.inflate(inflater, parent, false)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: MiningWorkingFaceRecordEntity
|
||||||
|
) {
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
holder.binding.let {
|
||||||
|
// if (position == 0) {
|
||||||
|
// it.time.setTextColor(Color.WHITE)
|
||||||
|
// it.time.textSize = 14f
|
||||||
|
// it.record.setTextColor(Color.WHITE)
|
||||||
|
// it.record.textSize = 14f
|
||||||
|
// it.operation.setTextColor(Color.WHITE)
|
||||||
|
// it.operation.textSize = 14f
|
||||||
|
// } else {
|
||||||
|
it.time.setTextColor("#FF6A6F87".toColorInt())
|
||||||
|
it.time.textSize = 12f
|
||||||
|
it.record.setTextColor("#FF6A6F87".toColorInt())
|
||||||
|
it.record.textSize = 12f
|
||||||
|
it.operation.setTextColor("#FFA3FEA6".toColorInt())
|
||||||
|
it.operation.textSize = 12f
|
||||||
|
// }
|
||||||
|
it.time.text = item.workingDate
|
||||||
|
it.record.text = item.recordPerson
|
||||||
|
it.operation.text = if (item.operationType == "1") "查看" else "操作"
|
||||||
|
it.divider.visibility =
|
||||||
|
if (position == list.size - 1) View.GONE else View.VISIBLE
|
||||||
|
|
||||||
|
|
||||||
|
it.ivFlagEdit.let {
|
||||||
|
if (item.dataState == "1") it.visible() else it.gone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemTunnelWorkingFaceRecordBinding) :
|
||||||
|
BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zhihu.matisse.Matisse
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseActivity
|
||||||
|
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||||
|
import com.zmkg.coaloperation.bean.ReportItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemReportBinding
|
||||||
|
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class ReportAdapter(list: MutableList<ReportItem>) :
|
||||||
|
BaseQuickAdapter<ReportItem, ReportAdapter.VH>(R.layout.list_item_report, list) {
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemReportBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemReportBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(holder: VH, item: ReportItem) {
|
||||||
|
val binding = holder.binding
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
binding.tvItemName.run {
|
||||||
|
text = item.name
|
||||||
|
gravity = Gravity.CENTER_VERTICAL
|
||||||
|
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
gravity = if (item.viewType == 4) Gravity.CENTER_VERTICAL else Gravity.TOP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.divider.run {
|
||||||
|
if (position == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
when (item.viewType) {
|
||||||
|
1 -> {
|
||||||
|
binding.tvItemValue.gone()
|
||||||
|
binding.rvReportImage.gone()
|
||||||
|
binding.etInputValue.let { et ->
|
||||||
|
et.visible()
|
||||||
|
et.setText(item.value)
|
||||||
|
et.hint = item.inputHint
|
||||||
|
et.isSingleLine = item.isSingleLine
|
||||||
|
if (item.isSingleLine) {
|
||||||
|
et.gravity = Gravity.CENTER_VERTICAL
|
||||||
|
et.setLines(1)
|
||||||
|
et.updateLayoutParams<LinearLayout.LayoutParams> { height = 50.dp }
|
||||||
|
} else {
|
||||||
|
et.gravity = Gravity.TOP
|
||||||
|
et.setLines(item.inputShowLines)
|
||||||
|
et.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
height = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
topMargin = 15.dp
|
||||||
|
bottomMargin = 15.dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
2 -> {
|
||||||
|
binding.rvReportImage.gone()
|
||||||
|
binding.etInputValue.gone()
|
||||||
|
binding.tvItemValue.let { tv ->
|
||||||
|
tv.visible()
|
||||||
|
tv.text = item.value
|
||||||
|
tv.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
R.drawable.ic_arrow_down_gray,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
width = LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
3 -> {
|
||||||
|
binding.rvReportImage.gone()
|
||||||
|
binding.etInputValue.gone()
|
||||||
|
binding.tvItemValue.let { tv ->
|
||||||
|
tv.visible()
|
||||||
|
tv.text = item.value
|
||||||
|
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_select_time, 0)
|
||||||
|
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
4 -> {
|
||||||
|
binding.tvItemValue.gone()
|
||||||
|
binding.etInputValue.gone()
|
||||||
|
if (item.images == null) {
|
||||||
|
item.images = mutableListOf()
|
||||||
|
}
|
||||||
|
binding.rvReportImage.let { rv ->
|
||||||
|
rv.visible()
|
||||||
|
rv.layoutManager = GridLayoutManager(rv.context, 2)
|
||||||
|
rv.adapter = CommonImageAdapter(item.images!!, 80.dp).also {
|
||||||
|
it.setOnItemClickListener { adapter, view, position ->
|
||||||
|
if (it.data[position].isAddFlag.not()) {
|
||||||
|
return@setOnItemClickListener
|
||||||
|
}
|
||||||
|
openGallery(context as BaseActivity, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||||
|
StorageUtils.requestPermission(activity) {
|
||||||
|
GalleryUtils.openGallery(activity) { data ->
|
||||||
|
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||||
|
paths?.forEach { path ->
|
||||||
|
val size = adapter.list.size
|
||||||
|
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
-3
@@ -7,7 +7,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter
|
|||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
|
||||||
class TunnelRoofLithologyAdapter(var list: MutableList<TunnelRoofLithologyEntity>) :
|
class TunnelRoofLithologyAdapter(var list: MutableList<TunnelRoofLithologyEntity>) :
|
||||||
BaseQuickAdapter<TunnelRoofLithologyEntity, TunnelRoofLithologyAdapter.VH>(
|
BaseQuickAdapter<TunnelRoofLithologyEntity, TunnelRoofLithologyAdapter.VH>(
|
||||||
@@ -34,13 +35,13 @@ class TunnelRoofLithologyAdapter(var list: MutableList<TunnelRoofLithologyEntity
|
|||||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
item.positionStart = text.toString().trim()
|
item.positionStart = text.toString().trim()
|
||||||
})
|
})
|
||||||
setText(item.positionStart)
|
setText(item.positionStart.formatDecimalString())
|
||||||
}
|
}
|
||||||
it.tvRockEndLen.run {
|
it.tvRockEndLen.run {
|
||||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
item.positionEnd = text.toString().trim()
|
item.positionEnd = text.toString().trim()
|
||||||
})
|
})
|
||||||
setText(item.positionEnd)
|
setText(item.positionEnd.formatDecimalString())
|
||||||
}
|
}
|
||||||
it.tvRockType.run {
|
it.tvRockType.run {
|
||||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||||
|
|||||||
+8
-5
@@ -13,9 +13,9 @@ import com.chad.library.adapter.base.BaseQuickAdapter
|
|||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceBinding
|
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.ui.tunneling.activity.TunnelingActivity
|
import com.zmkg.coaloperation.ui.tunneling.activity.TunnelingActivity
|
||||||
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingPointActivity
|
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceRecordActivity
|
||||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
import com.zmkg.coaloperation.utils.gone
|
import com.zmkg.coaloperation.utils.gone
|
||||||
import com.zmkg.coaloperation.utils.toJsonString
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
@@ -49,6 +49,9 @@ class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
|||||||
binding.llFaceRecord.let {
|
binding.llFaceRecord.let {
|
||||||
if (item.isExpandRecord) it.visible() else it.gone()
|
if (item.isExpandRecord) it.visible() else it.gone()
|
||||||
}
|
}
|
||||||
|
binding.ivFlagEdit.let {
|
||||||
|
if (item.dataState == "1") it.visible() else it.gone()
|
||||||
|
}
|
||||||
binding.ivExpandRecord.setImageResource(
|
binding.ivExpandRecord.setImageResource(
|
||||||
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
||||||
)
|
)
|
||||||
@@ -81,10 +84,10 @@ class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
|||||||
Log.d(TAG, "convert: ${item.records!![recordPosition].toJsonString()}")
|
Log.d(TAG, "convert: ${item.records!![recordPosition].toJsonString()}")
|
||||||
context.let { ctx ->
|
context.let { ctx ->
|
||||||
if (ctx is TunnelingActivity) {
|
if (ctx is TunnelingActivity) {
|
||||||
ctx.toActivity(WorkingPointActivity::class.java, Bundle().apply {
|
ctx.toActivity(WorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||||
putString(WorkingPointActivity.FACE_NAME, item.surfaceName)
|
putString(WorkingFaceRecordActivity.FACE_NAME, item.surfaceName)
|
||||||
putParcelable(
|
putParcelable(
|
||||||
WorkingPointActivity.FACE_RECORD,
|
WorkingFaceRecordActivity.FACE_RECORD,
|
||||||
item.records!![recordPosition]
|
item.records!![recordPosition]
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
+8
-2
@@ -1,15 +1,16 @@
|
|||||||
package com.zmkg.coaloperation.adapter
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceRecordBinding
|
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceRecordBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
class TunnelWorkingFaceRecordAdapter(var list: MutableList<TunnelWorkingFaceRecordEntity>) :
|
class TunnelWorkingFaceRecordAdapter(var list: MutableList<TunnelWorkingFaceRecordEntity>) :
|
||||||
BaseQuickAdapter<TunnelWorkingFaceRecordEntity, TunnelWorkingFaceRecordAdapter.VH>(
|
BaseQuickAdapter<TunnelWorkingFaceRecordEntity, TunnelWorkingFaceRecordAdapter.VH>(
|
||||||
@@ -50,6 +51,11 @@ class TunnelWorkingFaceRecordAdapter(var list: MutableList<TunnelWorkingFaceReco
|
|||||||
it.operation.text = if (item.operationType == "1") "查看" else "操作"
|
it.operation.text = if (item.operationType == "1") "查看" else "操作"
|
||||||
it.divider.visibility =
|
it.divider.visibility =
|
||||||
if (position == list.size - 1) View.GONE else View.VISIBLE
|
if (position == list.size - 1) View.GONE else View.VISIBLE
|
||||||
|
|
||||||
|
|
||||||
|
it.ivFlagEdit.let {
|
||||||
|
if (item.dataState == "1") it.visible() else it.gone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-21
@@ -9,21 +9,23 @@ import androidx.core.view.updateLayoutParams
|
|||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.bean.RockItem
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
import com.zmkg.coaloperation.bean.WorkingFaceItem
|
|
||||||
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
||||||
import com.zmkg.coaloperation.databinding.ListItemWorkingFaceBinding
|
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingItemBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
||||||
BaseQuickAdapter<WorkingFaceItem, WorkingItemAdapter.VH>(
|
BaseQuickAdapter<TunnelWorkingItem, TunnelWorkingItemAdapter.VH>(
|
||||||
R.layout.list_item_working_face,
|
R.layout.list_item_tunnel_working_item,
|
||||||
data
|
data
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
val binding = ListItemWorkingFaceBinding.inflate(
|
val binding = ListItemTunnelWorkingItemBinding.inflate(
|
||||||
LayoutInflater.from(parent.context),
|
LayoutInflater.from(parent.context),
|
||||||
parent,
|
parent,
|
||||||
false
|
false
|
||||||
@@ -35,24 +37,20 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
|||||||
|
|
||||||
override fun convert(
|
override fun convert(
|
||||||
holder: VH,
|
holder: VH,
|
||||||
item: WorkingFaceItem
|
item: TunnelWorkingItem
|
||||||
) {
|
) {
|
||||||
if (item.pageType == 0) {
|
if (item.pageType == 0) {
|
||||||
loadFaceData(holder.binding, item)
|
loadFaceData(holder.binding, item)
|
||||||
} else if (item.pageType == 1) {
|
} else if (item.pageType == 1) {
|
||||||
loadPointData(holder.binding, item)
|
loadRecordData(holder.binding, item)
|
||||||
}
|
}
|
||||||
val position = holder.layoutPosition
|
val position = holder.layoutPosition
|
||||||
holder.binding.divider.let {
|
holder.binding.divider.run {
|
||||||
if (position == data.size - 1) {
|
if (position == data.size - 1) gone() else visible()
|
||||||
it.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
it.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadPointData(binding: ListItemWorkingFaceBinding, item: WorkingFaceItem) {
|
private fun loadRecordData(binding: ListItemTunnelWorkingItemBinding, item: TunnelWorkingItem) {
|
||||||
binding.run {
|
binding.run {
|
||||||
tvItemName.text = item.name
|
tvItemName.text = item.name
|
||||||
if (item.items.isNullOrEmpty()) {
|
if (item.items.isNullOrEmpty()) {
|
||||||
@@ -73,7 +71,7 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private fun loadFaceData(binding: ListItemWorkingFaceBinding, item: WorkingFaceItem) {
|
private fun loadFaceData(binding: ListItemTunnelWorkingItemBinding, item: TunnelWorkingItem) {
|
||||||
binding.tvItemName.let {
|
binding.tvItemName.let {
|
||||||
it.updateLayoutParams { height = ScreenUtil.dp2px(50f) }
|
it.updateLayoutParams { height = ScreenUtil.dp2px(50f) }
|
||||||
it.text = item.name
|
it.text = item.name
|
||||||
@@ -96,12 +94,12 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
|||||||
tvRockStartLen.let {
|
tvRockStartLen.let {
|
||||||
it.focusable = EditText.NOT_FOCUSABLE
|
it.focusable = EditText.NOT_FOCUSABLE
|
||||||
it.setOnKeyListener(null)
|
it.setOnKeyListener(null)
|
||||||
it.setText(item.positionStart)
|
it.setText(item.positionStart.formatDecimalString())
|
||||||
}
|
}
|
||||||
tvRockEndLen.let {
|
tvRockEndLen.let {
|
||||||
it.focusable = EditText.NOT_FOCUSABLE
|
it.focusable = EditText.NOT_FOCUSABLE
|
||||||
it.setOnKeyListener(null)
|
it.setOnKeyListener(null)
|
||||||
it.setText(item.positionEnd)
|
it.setText(item.positionEnd.formatDecimalString())
|
||||||
}
|
}
|
||||||
tvRockType.let {
|
tvRockType.let {
|
||||||
it.focusable = EditText.NOT_FOCUSABLE
|
it.focusable = EditText.NOT_FOCUSABLE
|
||||||
@@ -114,5 +112,5 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inner class VH(var binding: ListItemWorkingFaceBinding) : BaseViewHolder(binding.root)
|
inner class VH(var binding: ListItemTunnelWorkingItemBinding) : BaseViewHolder(binding.root)
|
||||||
}
|
}
|
||||||
+5
-4
@@ -1,4 +1,4 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.adapter
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -6,7 +6,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter
|
|||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.databinding.ItemRockNatureBinding
|
import com.zmkg.coaloperation.databinding.ItemRockNatureBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,8 +30,8 @@ class TunnelingRockNatureAdapter(list: MutableList<TunnelRoofLithologyEntity>) :
|
|||||||
|
|
||||||
override fun convert(holder: VH, item: TunnelRoofLithologyEntity) {
|
override fun convert(holder: VH, item: TunnelRoofLithologyEntity) {
|
||||||
holder.binding.let {
|
holder.binding.let {
|
||||||
it.tvRock1Start.text = item.positionStart
|
it.tvRock1Start.text = item.positionStart.formatDecimalString()
|
||||||
it.tvRock1End.text = item.positionEnd
|
it.tvRock1End.text = item.positionEnd.formatDecimalString()
|
||||||
it.tvRock1Name.text = item.lithologyType
|
it.tvRock1Name.text = item.lithologyType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemUserMenuBinding
|
||||||
|
|
||||||
|
class UserMenuAdapter(list: MutableList<UserMenuBean>) :
|
||||||
|
BaseQuickAdapter<UserMenuBean, UserMenuAdapter.VH>(R.layout.list_item_user_menu, list) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemUserMenuBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: UserMenuBean
|
||||||
|
) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.ivUserMenu.run {
|
||||||
|
setImageResource(item.iconResId)
|
||||||
|
setBackgroundResource(item.iconBgResId)
|
||||||
|
}
|
||||||
|
it.tvUserMenu.text = item.menuName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemUserMenuBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemWaterYieldObserveBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.water.WaterYieldObserveEntity
|
||||||
|
import com.zmkg.coaloperation.utils.useShapeSetBackground
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
|
||||||
|
class WaterYieldObserveAdapter(list: MutableList<WaterYieldObserveEntity>):
|
||||||
|
BaseQuickAdapter<WaterYieldObserveEntity, WaterYieldObserveAdapter.VH>(R.layout.list_item_water_yield_observe, list) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemWaterYieldObserveBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: WaterYieldObserveEntity
|
||||||
|
) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.tvObservePoint.text = item.observePoint
|
||||||
|
it.tvObserveTime.text = item.observeTime
|
||||||
|
it.tvObserveState.run {
|
||||||
|
var stateColor = ""
|
||||||
|
if (item.observeState == "1") {
|
||||||
|
text = "已观测"
|
||||||
|
stateColor = "#3ECD88"
|
||||||
|
} else {
|
||||||
|
text = "未观测"
|
||||||
|
stateColor = "#803398"
|
||||||
|
}
|
||||||
|
useShapeSetBackground(
|
||||||
|
shape = GradientDrawable.RECTANGLE,
|
||||||
|
cornerRadius = 20F.dp,
|
||||||
|
solidColor = stateColor.toColorInt(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
it.root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||||
|
bottomMargin = if (holder.layoutPosition == data.size - 1) 80.dp else 3.dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemWaterYieldObserveBinding): BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
+129
@@ -0,0 +1,129 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.WaterYieldRecordItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemWaterYieldRecordBinding
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemWaterYieldRecordInnerBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
|
||||||
|
class WaterYieldRecordAdapter(data: MutableList<WaterYieldRecordItem>) :
|
||||||
|
BaseQuickAdapter<WaterYieldRecordItem, WaterYieldRecordAdapter.VH>(
|
||||||
|
R.layout.list_item_water_yield_record,
|
||||||
|
data
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemWaterYieldRecordBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: WaterYieldRecordItem
|
||||||
|
) {
|
||||||
|
loadRecordData(holder.binding, item)
|
||||||
|
val position = holder.layoutPosition
|
||||||
|
holder.binding.divider.run {
|
||||||
|
if (position == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadRecordData(
|
||||||
|
binding: ListItemWaterYieldRecordBinding,
|
||||||
|
item: WaterYieldRecordItem
|
||||||
|
) {
|
||||||
|
binding.run {
|
||||||
|
if (item.isHeader) {
|
||||||
|
tvItemName.let {
|
||||||
|
it.textSize = 16F
|
||||||
|
it.setTextColor(Color.WHITE)
|
||||||
|
it.gravity = Gravity.CENTER
|
||||||
|
it.updateLayoutParams {
|
||||||
|
width = ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
verticalDivider.gone()
|
||||||
|
tvItemValue.gone()
|
||||||
|
} else {
|
||||||
|
tvItemName.let {
|
||||||
|
it.textSize = 14F
|
||||||
|
it.setTextColor("#6A6F87".toColorInt())
|
||||||
|
it.gravity = Gravity.CENTER_VERTICAL
|
||||||
|
it.updateLayoutParams {
|
||||||
|
width = 80.dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
verticalDivider.visible()
|
||||||
|
tvItemValue.visible()
|
||||||
|
}
|
||||||
|
tvItemName.text = item.name
|
||||||
|
if (item.items.isNullOrEmpty()) {
|
||||||
|
// tvItemName.updateLayoutParams { height = ScreenUtil.dp2px(50f) }
|
||||||
|
tvItemValue.let {
|
||||||
|
it.visibility = View.VISIBLE
|
||||||
|
it.text = item.value
|
||||||
|
}
|
||||||
|
llContainer.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
// tvItemName.updateLayoutParams { height = ScreenUtil.dp2px(60f) }
|
||||||
|
tvItemValue.visibility = View.GONE
|
||||||
|
llContainer.let {
|
||||||
|
it.visibility = View.VISIBLE
|
||||||
|
it.removeAllViews()
|
||||||
|
addChildToContainer(it, item.items!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadItemData(
|
||||||
|
binding: ListItemWaterYieldRecordInnerBinding,
|
||||||
|
isLatest: Boolean,
|
||||||
|
item: WaterYieldRecordItem
|
||||||
|
) {
|
||||||
|
binding.tvItemName.text = "${item.name}:"
|
||||||
|
binding.tvItemValue.text = item.value
|
||||||
|
binding.divider.run {
|
||||||
|
if (isLatest) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addChildToContainer(
|
||||||
|
container: LinearLayout,
|
||||||
|
list: MutableList<WaterYieldRecordItem>
|
||||||
|
) {
|
||||||
|
list.forEachIndexed { index, item ->
|
||||||
|
val itemBinding = ListItemWaterYieldRecordInnerBinding.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
container,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
itemBinding.run {
|
||||||
|
loadItemData(itemBinding, index == list.size - 1, item)
|
||||||
|
container.addView(root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemWaterYieldRecordBinding) : BaseViewHolder(binding.root)
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.zmkg.coaloperation.adapter.common
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ListItemMiningDisasterWarningBinding
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
class DisasterAdapter(list: MutableList<TunnelWorkingItem>) :
|
||||||
|
BaseQuickAdapter<TunnelWorkingItem, DisasterAdapter.VH>(
|
||||||
|
R.layout.list_item_mining_disaster_warning,
|
||||||
|
list
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
val binding = ListItemMiningDisasterWarningBinding.inflate(
|
||||||
|
LayoutInflater.from(context), parent, false
|
||||||
|
)
|
||||||
|
return VH(binding)
|
||||||
|
}
|
||||||
|
override fun convert(
|
||||||
|
holder: VH,
|
||||||
|
item: TunnelWorkingItem
|
||||||
|
) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.tvDisasterName.text = item.name
|
||||||
|
it.tvDisasterValue.text = item.value
|
||||||
|
it.divider.run {
|
||||||
|
if (holder.layoutPosition == data.size - 1) gone() else visible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class VH(var binding: ListItemMiningDisasterWarningBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.zmkg.coaloperation.base;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.zmkg.coaloperation.bean.IActivityResult;
|
||||||
|
|
||||||
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
// public static final String COLOR_WHITE = "#FFFFFF";
|
||||||
|
//
|
||||||
|
// public void whiteStatusBar(boolean isFits) {
|
||||||
|
// whiteStatusBar(isFits, false);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void whiteStatusBar(boolean isFits, boolean keyboardEnable) {
|
||||||
|
// hasColorStatusBar(COLOR_WHITE, isFits, true, keyboardEnable);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void transparentStatusBar(boolean isFits, boolean isDarkFont) {
|
||||||
|
// ImmersionBar.with(this)
|
||||||
|
// .fitsSystemWindows(isFits)
|
||||||
|
// .statusBarDarkFont(isDarkFont)
|
||||||
|
// .transparentStatusBar()
|
||||||
|
// .navigationBarColor(R.color.white)
|
||||||
|
// .navigationBarDarkIcon(true)
|
||||||
|
// .init();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void hasColorStatusBar(String statusBarColor, boolean isFits, boolean isDarkFont) {
|
||||||
|
// hasColorStatusBar(statusBarColor, isFits, isDarkFont, false);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void hasColorStatusBar(String statusBarColor, boolean isFits, boolean isDarkFont, boolean keyboardEnable) {
|
||||||
|
// ImmersionBar.with(this)
|
||||||
|
// .fitsSystemWindows(isFits)
|
||||||
|
// .statusBarColor(statusBarColor)
|
||||||
|
// .statusBarDarkFont(isDarkFont)
|
||||||
|
// .keyboardEnable(keyboardEnable)
|
||||||
|
// .navigationBarColor(R.color.white)
|
||||||
|
// .navigationBarDarkIcon(true)
|
||||||
|
// .init();
|
||||||
|
// }
|
||||||
|
|
||||||
|
private final ActivityResultLauncher<Intent> activityLauncher =
|
||||||
|
registerForActivityResult(
|
||||||
|
new ActivityResultContracts.StartActivityForResult(),
|
||||||
|
result -> this.launchActivityCallback.callback(result)
|
||||||
|
);
|
||||||
|
private IActivityResult.LaunchActivityCallback launchActivityCallback;
|
||||||
|
|
||||||
|
public void launchActivityResult(Intent intent, IActivityResult.LaunchActivityCallback activityCallback) {
|
||||||
|
this.launchActivityCallback = activityCallback;
|
||||||
|
activityLauncher.launch(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IActivityResult.LaunchTackPictureCallback launchTackPictureCallback;
|
||||||
|
|
||||||
|
private final ActivityResultLauncher<Uri> tackPictureLauncher =
|
||||||
|
registerForActivityResult(
|
||||||
|
new ActivityResultContracts.TakePicture(),
|
||||||
|
result -> this.launchTackPictureCallback.callback(result)
|
||||||
|
);
|
||||||
|
|
||||||
|
public void launchTackPicture(Uri uri, IActivityResult.LaunchTackPictureCallback callback) {
|
||||||
|
this.launchTackPictureCallback = callback;
|
||||||
|
tackPictureLauncher.launch(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IActivityResult.RequestPermissionCallback launchPermissionCallback;
|
||||||
|
|
||||||
|
public void requestSinglePermissionResult(String permission, IActivityResult.RequestPermissionCallback permissionCallback) {
|
||||||
|
this.launchPermissionCallback = permissionCallback;
|
||||||
|
permissionLauncher.launch(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ActivityResultLauncher<String> permissionLauncher =
|
||||||
|
registerForActivityResult(
|
||||||
|
new ActivityResultContracts.RequestPermission(),
|
||||||
|
result -> this.launchPermissionCallback.callback(result)
|
||||||
|
);
|
||||||
|
|
||||||
|
private IActivityResult.RequestMultiplePermissionsCallback launchMultiplePermissionsCallback;
|
||||||
|
|
||||||
|
public void requestMultiplePermissionsResult(String[] permissions, IActivityResult.RequestMultiplePermissionsCallback permissionCallback) {
|
||||||
|
this.launchMultiplePermissionsCallback = permissionCallback;
|
||||||
|
multiplePermissionLauncher.launch(permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ActivityResultLauncher<String[]> multiplePermissionLauncher =
|
||||||
|
registerForActivityResult(
|
||||||
|
new ActivityResultContracts.RequestMultiplePermissions(),
|
||||||
|
result -> this.launchMultiplePermissionsCallback.callback(result)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,6 +34,8 @@ import com.zmkg.coaloperation.base.viewmodel.BaseViewModel.Companion.LOADING_STA
|
|||||||
import com.zmkg.coaloperation.superfuntion.hideLoading
|
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||||
import com.zmkg.coaloperation.superfuntion.showLoading
|
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||||
import com.zmkg.coaloperation.utils.StatusbarUtil
|
import com.zmkg.coaloperation.utils.StatusbarUtil
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||||
import com.zmkg.coaloperation.view.CustomToast
|
import com.zmkg.coaloperation.view.CustomToast
|
||||||
import com.zmkg.coaloperation.view.LoadingDialog
|
import com.zmkg.coaloperation.view.LoadingDialog
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -53,7 +55,7 @@ import java.sql.SQLException
|
|||||||
* 封装了ViewModel和DataBinding的Activity基类
|
* 封装了ViewModel和DataBinding的Activity基类
|
||||||
*/
|
*/
|
||||||
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
||||||
AppCompatActivity(), View.OnClickListener {
|
BaseActivity(), View.OnClickListener {
|
||||||
var mContext: Context? = null
|
var mContext: Context? = null
|
||||||
var mActivity: Activity? = null
|
var mActivity: Activity? = null
|
||||||
lateinit var mViewModel: VM
|
lateinit var mViewModel: VM
|
||||||
@@ -432,4 +434,18 @@ abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
configuration.fontScale = 1f
|
configuration.fontScale = 1f
|
||||||
return context.createConfigurationContext(configuration)
|
return context.createConfigurationContext(configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getShowNum2(num:String?):String {
|
||||||
|
return num?.formatDecimalString()?:""
|
||||||
|
}
|
||||||
|
fun getShowNum(num:String?):String {
|
||||||
|
if (num.isNullOrBlank()) return "0"
|
||||||
|
try {
|
||||||
|
val showNum = num.toDouble().roundedOneDecimalPlace()
|
||||||
|
return "$showNum"
|
||||||
|
} catch (e: Exception) {
|
||||||
|
return "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.bean
|
package com.zmkg.coaloperation.bean
|
||||||
|
|
||||||
data class DictBean(
|
data class DictBean(
|
||||||
var seam_list: Map<String, String>?,
|
var seam_list: Map<String, String>?,
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.zmkg.coaloperation.bean;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IActivityResult {
|
||||||
|
|
||||||
|
interface LaunchActivityCallback {
|
||||||
|
void callback(ActivityResult result);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LaunchTackPictureCallback {
|
||||||
|
void callback(boolean result);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RequestPermissionCallback {
|
||||||
|
void callback(boolean result);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RequestMultiplePermissionsCallback {
|
||||||
|
void callback(Map<String,Boolean> result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.zmkg.coaloperation.bean
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||||
|
|
||||||
|
data class UserMenuBean(
|
||||||
|
var menuName: String,
|
||||||
|
var iconResId: Int,
|
||||||
|
var iconBgResId: Int,
|
||||||
|
val click: () -> Unit
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AddMiningFaceItem(
|
||||||
|
//0-输入框,1-选择弹窗, 2-显示文本TextView
|
||||||
|
var funcType: Int = 0,
|
||||||
|
var funcName: String = "",
|
||||||
|
var funcValue: String = "",
|
||||||
|
var funcId: String = "",
|
||||||
|
var isShowArrowDown: Boolean = false,
|
||||||
|
var onClick: () -> Unit = {}
|
||||||
|
)
|
||||||
|
|
||||||
|
data class CoalThicknessItem(
|
||||||
|
var supportNo: String = "",
|
||||||
|
var thicknessValue: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DataSyncItem(
|
||||||
|
var funcName: String,
|
||||||
|
var onDataPull: () -> Unit = {},
|
||||||
|
var onDataPush: () -> Unit = {},
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BuoyTopItem(
|
||||||
|
var faceName: String = "",
|
||||||
|
var ditchWidth: String = "",
|
||||||
|
var ditchDepth: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BuoyBottomItem(
|
||||||
|
var name: String = "",
|
||||||
|
var value: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GeoPointItem(
|
||||||
|
var isChecked: Boolean = false,
|
||||||
|
var isLogging: Boolean = false,
|
||||||
|
var name: String = "",
|
||||||
|
var distance: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GeoPointParent(
|
||||||
|
var name: String = "",
|
||||||
|
var list: MutableList<GeoPointItem>? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BaseItem(
|
||||||
|
var name: String = "",
|
||||||
|
var value: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GeoPointMultiItem(
|
||||||
|
override val itemType: Int,
|
||||||
|
var pointName: String = "",
|
||||||
|
var pointDistance: String = "",
|
||||||
|
var totalDistance: String = "",
|
||||||
|
var baseTopList: MutableList<BaseItem>? = null,
|
||||||
|
var baseBottomList: MutableList<BaseItem>? = null,
|
||||||
|
var images: MutableList<CommonImageBean>? = null
|
||||||
|
) : MultiItemEntity {
|
||||||
|
companion object {
|
||||||
|
const val TYPE_BASE_INFO = 1
|
||||||
|
const val TYPE_LOGGING_INFO = 2
|
||||||
|
const val TYPE_CALCULATE_INFO = 3
|
||||||
|
const val TYPE_UPLOAD_IMAGE = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class CommonImageBean(
|
||||||
|
var imagePath: String = "",
|
||||||
|
var isAddFlag: Boolean = false
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ReportItem(
|
||||||
|
var name: String = "",
|
||||||
|
var value: String = "",
|
||||||
|
var id: String = "",
|
||||||
|
//1-输入框,2-文本选择弹窗,3-时间选择弹窗,4-上传图片
|
||||||
|
var viewType: Int = 0,
|
||||||
|
var inputHint: String = "",
|
||||||
|
var inputShowLines: Int = 0,
|
||||||
|
var isSingleLine: Boolean = true,
|
||||||
|
var images: MutableList<CommonImageBean>? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.zmkg.coaloperation.bean
|
||||||
|
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
|
|
||||||
|
data class TunnelWorkingItem(
|
||||||
|
var name: String? = "",
|
||||||
|
var value: String? = "",
|
||||||
|
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||||
|
var pageType: Int = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
data class RockItem(
|
||||||
|
var startLen: Int = 0,
|
||||||
|
var endLen: Int = 0,
|
||||||
|
val rockType: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class WorkOption(
|
||||||
|
var id: String,
|
||||||
|
var name: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Work3LevelOption(
|
||||||
|
var id: String = "",
|
||||||
|
var name: String = "",
|
||||||
|
|
||||||
|
var list: List<Work3LevelOption>? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class TunnelSubmitData(
|
||||||
|
var faceList: MutableList<TunnelWorkingFaceEntity>? = null,
|
||||||
|
var recordList: MutableList<TunnelWorkingFaceRecordEntity>? = null,
|
||||||
|
var lithologyList: MutableList<TunnelRoofLithologyEntity>? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class WaterYieldRecordItem(
|
||||||
|
var name: String? = "",
|
||||||
|
var value: String? = "",
|
||||||
|
var isHeader: Boolean = false,
|
||||||
|
var items: MutableList<WaterYieldRecordItem>? = null,
|
||||||
|
)
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
package com.zmkg.coaloperation.bean
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 掘进
|
||||||
|
*/
|
||||||
|
//data class TunnelingHomeBean(
|
||||||
|
// var contentList: MutableList<TunnelingHomeItemBean>?,
|
||||||
|
// val createBy: String?,
|
||||||
|
// val createTime: String?,
|
||||||
|
// val updateBy: String?,
|
||||||
|
// val updateTime: String?,
|
||||||
|
// val remark: String?,
|
||||||
|
// val surfaceId: String?,
|
||||||
|
// val totalFootage: String?,
|
||||||
|
// val seamId: String?,
|
||||||
|
// val areaId: String?,
|
||||||
|
// val seamName: String?,
|
||||||
|
// val surfaceName: String?,
|
||||||
|
// val areaName: String?,
|
||||||
|
// val surfaceAzimuth: String?,
|
||||||
|
// val surfaceHeight: String?,
|
||||||
|
// val surfaceWidth: String?,
|
||||||
|
// val tunnelNature: String?,
|
||||||
|
// val planStartDate: String?,
|
||||||
|
// val planEndDate: String?,
|
||||||
|
// val geologicalType: String?,
|
||||||
|
// val hydrogeologicalType: String?,
|
||||||
|
// val seamIgnition: String?,
|
||||||
|
// val seamGas: String?,
|
||||||
|
// val seamBumpPressure: String?,
|
||||||
|
// val surfaceSupportForm: String?
|
||||||
|
//)
|
||||||
|
//
|
||||||
|
//class TunnelingHomeItemBean {
|
||||||
|
// var createBy: String? = null
|
||||||
|
// var createTime: String? = null
|
||||||
|
// var updateBy: String? = null
|
||||||
|
// var updateTime: String? = null
|
||||||
|
// var remark: String? = null
|
||||||
|
// var recordId: String? = null
|
||||||
|
// var surfaceId: String? = null
|
||||||
|
// var workingDate: String? = null
|
||||||
|
// var teamShift: String? = null
|
||||||
|
// var teamId: String? = null
|
||||||
|
// var teamName: String? = null
|
||||||
|
// var teamLeader: String? = null
|
||||||
|
// var workingFootage: String? = null
|
||||||
|
// var seamDip: String? = null
|
||||||
|
// var seamHeight: String? = null
|
||||||
|
// var waterYield: String? = null
|
||||||
|
// var recordPerson: String? = null
|
||||||
|
// var mineWorkingLith: String? = null
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 新增工作面 给接口的数据
|
||||||
|
// */
|
||||||
|
//data class TunnelingFaceAddBean(
|
||||||
|
//
|
||||||
|
// val surfaceName: String? = null,
|
||||||
|
// val totalFootage: String? = null,
|
||||||
|
//
|
||||||
|
// val areaId: Int? = null,
|
||||||
|
// val areaName: String? = null,
|
||||||
|
// val createBy: String? = null,
|
||||||
|
// val createTime: String? = null,
|
||||||
|
// val geologicalType: String? = null,
|
||||||
|
// val hydrogeologicalType: String? = null,
|
||||||
|
// val params: Params? = null,
|
||||||
|
// val planEndDate: String? = null,
|
||||||
|
// val planStartDate: String? = null,
|
||||||
|
// val remark: String? = null,
|
||||||
|
// val seamBumpPressure: String? = null,
|
||||||
|
// val seamGas: String? = null,
|
||||||
|
// val seamId: Int? = null,
|
||||||
|
// val seamIgnition: String? = null,
|
||||||
|
// val seamName: String? = null,
|
||||||
|
// val surfaceAzimuth: String? = null,
|
||||||
|
// val surfaceHeight: String? = null,
|
||||||
|
// val surfaceId: Int? = null,
|
||||||
|
// val surfaceSupportForm: String? = null,
|
||||||
|
// val surfaceWidth: String? = null,
|
||||||
|
// val tunnelNature: String? = null,
|
||||||
|
// val updateBy: String? = null,
|
||||||
|
// val updateTime: String? = null
|
||||||
|
//)
|
||||||
|
|
||||||
|
data class Params(
|
||||||
|
val additionalProp1: String? = null,
|
||||||
|
val additionalProp2: String? = null,
|
||||||
|
val additionalProp3: String? = null
|
||||||
|
):Serializable
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面详情
|
||||||
|
*/
|
||||||
|
//data class FaceWorkDetailBean(
|
||||||
|
// val accumulativeFootage: Int,
|
||||||
|
// val areaId: Int,
|
||||||
|
// val areaName: String,
|
||||||
|
// val createBy: String,
|
||||||
|
// val createTime: String,
|
||||||
|
// val geologicalType: String,
|
||||||
|
// val hydrogeologicalType: String,
|
||||||
|
// val latestRecord: LatestRecord,
|
||||||
|
// val params: Params,
|
||||||
|
// val planEndDate: String,
|
||||||
|
// val planStartDate: String,
|
||||||
|
// val remainingFootage: Int,
|
||||||
|
// val remark: String,
|
||||||
|
// val seamBumpPressure: String,
|
||||||
|
// val seamGas: String,
|
||||||
|
// val seamId: Int,
|
||||||
|
// val seamIgnition: String,
|
||||||
|
// val seamName: String,
|
||||||
|
// val surfaceAzimuth: String,
|
||||||
|
// val surfaceHeight: String,
|
||||||
|
// val surfaceId: Int,
|
||||||
|
// val surfaceName: String,
|
||||||
|
// val surfaceSupportForm: String,
|
||||||
|
// val surfaceWidth: String,
|
||||||
|
// val totalFootage: Int,
|
||||||
|
// val tunnelNature: String,
|
||||||
|
// val updateBy: String,
|
||||||
|
// val updateTime: String,
|
||||||
|
// val yesterdayFootage: String,
|
||||||
|
// val monthFootage: String
|
||||||
|
//): Serializable
|
||||||
|
|
||||||
|
//data class LatestRecord(
|
||||||
|
// val createBy: String,
|
||||||
|
// val createTime: String,
|
||||||
|
// val mineWorkingLithologyList: MutableList<MineWorkingLithology>,
|
||||||
|
// val params: Params,
|
||||||
|
// val recordId: Int,
|
||||||
|
// val recordPerson: String,
|
||||||
|
// val remark: String,
|
||||||
|
// val seamDip: Int,
|
||||||
|
// val seamHeight: Int,
|
||||||
|
// val surfaceId: Int,
|
||||||
|
// val surfaceName: String,
|
||||||
|
// val teamId: Int,
|
||||||
|
// val teamLeader: String,
|
||||||
|
// val teamName: String,
|
||||||
|
// val teamShift: Int,
|
||||||
|
// val updateBy: String,
|
||||||
|
// val updateTime: String,
|
||||||
|
// val waterYield: Int,
|
||||||
|
// val workingDate: String,
|
||||||
|
// val workingFootage: Int
|
||||||
|
//):Serializable
|
||||||
|
|
||||||
|
//
|
||||||
|
//data class MineWorkingLithology(
|
||||||
|
// val createBy: String,
|
||||||
|
// val createTime: String,
|
||||||
|
// val lithologyId: Int,
|
||||||
|
// val lithologyType: String,
|
||||||
|
// val params: Params,
|
||||||
|
// val positionEnd: Int,
|
||||||
|
// val positionStart: Int,
|
||||||
|
// val recordId: Int,
|
||||||
|
// val remark: String,
|
||||||
|
// val updateBy: String,
|
||||||
|
// val updateTime: String
|
||||||
|
//):Serializable
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.zmkg.coaloperation.bean
|
|
||||||
|
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
|
||||||
|
|
||||||
data class WorkingFaceItem(
|
|
||||||
var name: String? = "",
|
|
||||||
var value: String? = "",
|
|
||||||
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
|
||||||
var pageType:Int = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
data class RockItem(
|
|
||||||
var startLen: Int = 0,
|
|
||||||
var endLen: Int = 0,
|
|
||||||
val rockType: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
data class WorkOption(
|
|
||||||
var id:String,
|
|
||||||
var name: String
|
|
||||||
)
|
|
||||||
@@ -1,18 +1,13 @@
|
|||||||
package com.zmkg.coaloperation.data.api
|
package com.zmkg.coaloperation.data.api
|
||||||
|
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.retorfit.UrlConfig
|
import com.zmkg.coaloperation.retorfit.UrlConfig
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
|
||||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
|
||||||
import okhttp3.RequestBody
|
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.Path
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
@@ -29,26 +24,26 @@ interface HomeApi {
|
|||||||
/**
|
/**
|
||||||
* 掘进-首页-工作面列表
|
* 掘进-首页-工作面列表
|
||||||
*/
|
*/
|
||||||
@GET("/api/mine/tunnelling/surface/list")
|
// @GET("/api/mine/tunnelling/surface/list")
|
||||||
suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>>
|
// suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>>
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 掘进-首页-工作面记录列表
|
// * 掘进-首页-工作面记录列表
|
||||||
*/
|
// */
|
||||||
@GET("/api/mine/tunnelling/surface/record/{recordId}")
|
// @GET("/api/mine/tunnelling/surface/record/{recordId}")
|
||||||
suspend fun getTunnelingHomeItemData(@Path("recordId") recordId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>>
|
// suspend fun getTunnelingHomeItemData(@Path("recordId") recordId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>>
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 掘进-工作面详情
|
// * 掘进-工作面详情
|
||||||
*/
|
// */
|
||||||
@GET("/api/mine/tunnelling/surface/detail/{surfaceId}")
|
// @GET("/api/mine/tunnelling/surface/detail/{surfaceId}")
|
||||||
suspend fun getTunnelingSurfaceDetail(@Path("surfaceId") surfaceId: String?): ApiResponse<FaceWorkDetailBean>
|
// suspend fun getTunnelingSurfaceDetail(@Path("surfaceId") surfaceId: String?): ApiResponse<FaceWorkDetailBean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 掘进-新增工作面
|
* 掘进-新增工作面
|
||||||
*/
|
*/
|
||||||
@POST("/api/mine/tunnelling/surface/add")
|
// @POST("/api/mine/tunnelling/surface/add")
|
||||||
suspend fun postTunnellingSurfaceAdd(@Body requestBody: RequestBody): ApiResponse<String>
|
// suspend fun postTunnellingSurfaceAdd(@Body requestBody: RequestBody): ApiResponse<String>
|
||||||
|
|
||||||
@GET("/api/mine/tunnelling/surface/detailList")
|
@GET("/api/mine/tunnelling/surface/detailList")
|
||||||
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?>
|
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?>
|
||||||
@@ -56,4 +51,7 @@ interface HomeApi {
|
|||||||
@GET("/api/mine/tunnelling/dictionaries")
|
@GET("/api/mine/tunnelling/dictionaries")
|
||||||
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
||||||
|
|
||||||
|
@POST("/api/mine/tunnelling/data/push")
|
||||||
|
suspend fun tunnelDataPush(@Body data: TunnelSubmitData): ApiResponse<Any?>
|
||||||
|
|
||||||
}
|
}
|
||||||
+45
-45
@@ -1,18 +1,12 @@
|
|||||||
package com.zmkg.coaloperation.data.repository
|
package com.zmkg.coaloperation.data.repository
|
||||||
|
|
||||||
import com.zmkg.coaloperation.base.repository.BaseRepository
|
import com.zmkg.coaloperation.base.repository.BaseRepository
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
import com.zmkg.coaloperation.data.api.HomeApi
|
import com.zmkg.coaloperation.data.api.HomeApi
|
||||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.retorfit.RetrofitManager
|
import com.zmkg.coaloperation.retorfit.RetrofitManager
|
||||||
import com.zmkg.coaloperation.retorfit.RetrofitManager.toRequestBody
|
|
||||||
import com.zmkg.coaloperation.superfuntion.toJson
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingFaceAddBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
|
||||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
|
||||||
|
|
||||||
|
|
||||||
object HomeRepository : BaseRepository() {
|
object HomeRepository : BaseRepository() {
|
||||||
@@ -30,44 +24,44 @@ object HomeRepository : BaseRepository(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 掘进-首页-工作面列表
|
// * 掘进-首页-工作面列表
|
||||||
*/
|
// */
|
||||||
suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>> {
|
// suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>> {
|
||||||
return apiCall {
|
// return apiCall {
|
||||||
val map = mutableMapOf<String, Any?>()
|
// val map = mutableMapOf<String, Any?>()
|
||||||
service.getTunnelingHomeData()
|
// service.getTunnelingHomeData()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
* 掘进-首页-工作面记录列表
|
|
||||||
*/
|
|
||||||
suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
|
||||||
return apiCall {
|
|
||||||
val map = mutableMapOf<String, Any?>()
|
|
||||||
service.getTunnelingHomeItemData(surfaceId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 掘进-工作面详情
|
|
||||||
*/
|
|
||||||
suspend fun getTunnelingSurfaceDetail(surfaceId: String?): ApiResponse<FaceWorkDetailBean> {
|
|
||||||
return apiCall {
|
|
||||||
val map = mutableMapOf<String, Any?>()
|
|
||||||
service.getTunnelingSurfaceDetail(surfaceId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 掘进-新增工作面
|
|
||||||
*/
|
|
||||||
suspend fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean): ApiResponse<String> {
|
|
||||||
return apiCall {
|
|
||||||
service.postTunnellingSurfaceAdd(tunnelingFaceAddBean.toJson().toRequestBody())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 掘进-首页-工作面记录列表
|
||||||
|
// */
|
||||||
|
// suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
||||||
|
// return apiCall {
|
||||||
|
// val map = mutableMapOf<String, Any?>()
|
||||||
|
// service.getTunnelingHomeItemData(surfaceId)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// /**
|
||||||
|
// * 掘进-工作面详情
|
||||||
|
// */
|
||||||
|
// suspend fun getTunnelingSurfaceDetail(surfaceId: String?): ApiResponse<FaceWorkDetailBean> {
|
||||||
|
// return apiCall {
|
||||||
|
// val map = mutableMapOf<String, Any?>()
|
||||||
|
// service.getTunnelingSurfaceDetail(surfaceId)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 掘进-新增工作面
|
||||||
|
// */
|
||||||
|
// suspend fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean): ApiResponse<String> {
|
||||||
|
// return apiCall {
|
||||||
|
// service.postTunnellingSurfaceAdd(tunnelingFaceAddBean.toJson().toRequestBody())
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
||||||
return apiCall {
|
return apiCall {
|
||||||
service.getTunnelHomeList()
|
service.getTunnelHomeList()
|
||||||
@@ -80,4 +74,10 @@ object HomeRepository : BaseRepository(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun tunnelDataPush(data: TunnelSubmitData): ApiResponse<Any?> {
|
||||||
|
return apiCall {
|
||||||
|
service.tunnelDataPush(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,18 +6,27 @@ import androidx.room.Room
|
|||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.migration.Migration
|
import androidx.room.migration.Migration
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningCoalHeightDao
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceDao
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceRecordDao
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
entities = [
|
entities = [
|
||||||
TunnelWorkingFaceEntity::class,
|
TunnelWorkingFaceEntity::class,
|
||||||
TunnelWorkingFaceRecordEntity::class,
|
TunnelWorkingFaceRecordEntity::class,
|
||||||
TunnelRoofLithologyEntity::class,
|
TunnelRoofLithologyEntity::class,
|
||||||
|
MiningWorkingFaceEntity::class,
|
||||||
|
MiningWorkingFaceRecordEntity::class,
|
||||||
|
MiningCoalHeightEntity::class,
|
||||||
],
|
],
|
||||||
version = 1,
|
version = 1,
|
||||||
exportSchema = true
|
exportSchema = true
|
||||||
@@ -26,6 +35,9 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
||||||
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
||||||
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
||||||
|
abstract fun miningWorkingFaceDao(): MiningWorkingFaceDao
|
||||||
|
abstract fun miningWorkingFaceRecordDao(): MiningWorkingFaceRecordDao
|
||||||
|
abstract fun miningCoalHeightDao(): MiningCoalHeightDao
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Volatile
|
@Volatile
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.zmkg.coaloperation.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import androidx.room.Update
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface MiningCoalHeightDao {
|
||||||
|
@Insert
|
||||||
|
fun insert(entity: MiningCoalHeightEntity): Long
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insertList(list: MutableList<MiningCoalHeightEntity>): Array<Long>
|
||||||
|
|
||||||
|
@Update
|
||||||
|
fun update(entity: MiningCoalHeightEntity)
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_coal_height WHERE recordId = :recordId ORDER BY createTime ASC")
|
||||||
|
fun getEntityList(recordId: Long): MutableList<MiningCoalHeightEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_coal_height WHERE dataState = :dataState ORDER BY createTime ASC")
|
||||||
|
fun getEntityListByState(dataState: String): MutableList<MiningCoalHeightEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_coal_height WHERE surfaceId = :surfaceId ORDER BY createTime ASC")
|
||||||
|
fun getEntityListByFaceId(surfaceId: Long): MutableList<MiningCoalHeightEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_coal_height WHERE surfaceId = :surfaceId AND recordId = :recordId ORDER BY createTime ASC")
|
||||||
|
fun getEntityListByRecordId(
|
||||||
|
surfaceId: Long,
|
||||||
|
recordId: Long
|
||||||
|
): MutableList<MiningCoalHeightEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_coal_height WHERE coalId = :lithologyId")
|
||||||
|
fun getEntityById(lithologyId: Long): MiningCoalHeightEntity?
|
||||||
|
|
||||||
|
@Query("DELETE FROM mining_coal_height")
|
||||||
|
fun deleteAll(): Int
|
||||||
|
|
||||||
|
@Query("DELETE FROM mining_coal_height WHERE recordId = :recordId")
|
||||||
|
fun deleteList(recordId: Long): Int
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.zmkg.coaloperation.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import androidx.room.RawQuery
|
||||||
|
import androidx.room.Update
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
|
||||||
|
//import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface MiningWorkingFaceDao {
|
||||||
|
@Insert
|
||||||
|
fun insert(entity: MiningWorkingFaceEntity): Long
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insertList(list: MutableList<MiningWorkingFaceEntity>): Array<Long>
|
||||||
|
|
||||||
|
@Update
|
||||||
|
fun update(entity: MiningWorkingFaceEntity)
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face ORDER BY createTime DESC")
|
||||||
|
fun getEntityList(): MutableList<MiningWorkingFaceEntity>?
|
||||||
|
|
||||||
|
@RawQuery
|
||||||
|
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<MiningWorkingFaceEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||||
|
fun getEntityListByState(dataState: String): MutableList<MiningWorkingFaceEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face WHERE surfaceId = :surfaceId")
|
||||||
|
fun getEntityById(surfaceId: Long): MiningWorkingFaceEntity?
|
||||||
|
|
||||||
|
@Query("DELETE FROM mining_working_face")
|
||||||
|
fun deleteAll(): Int
|
||||||
|
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.zmkg.coaloperation.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import androidx.room.Update
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface MiningWorkingFaceRecordDao {
|
||||||
|
@Insert
|
||||||
|
fun insert(entity: MiningWorkingFaceRecordEntity): Long
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>): Array<Long>
|
||||||
|
|
||||||
|
@Update
|
||||||
|
fun update(entity: MiningWorkingFaceRecordEntity)
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :surfaceId ORDER BY createTime DESC")
|
||||||
|
fun getEntityList(surfaceId: Long): MutableList<MiningWorkingFaceRecordEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face_record WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||||
|
fun getEntityListByState(dataState: String): MutableList<MiningWorkingFaceRecordEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :recordId")
|
||||||
|
fun getEntityById(recordId: Long): MiningWorkingFaceRecordEntity
|
||||||
|
|
||||||
|
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime DESC LIMIT 1")
|
||||||
|
fun getLastEntity(surfaceId: Long): MiningWorkingFaceRecordEntity?
|
||||||
|
|
||||||
|
@Query("DELETE FROM mining_working_face_record")
|
||||||
|
fun deleteAll(): Int
|
||||||
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import androidx.room.Insert
|
|||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface TunnelRoofLithologyDao {
|
interface TunnelRoofLithologyDao {
|
||||||
|
|||||||
+8
-3
@@ -4,8 +4,10 @@ import androidx.room.Dao
|
|||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
|
import androidx.room.RawQuery
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
|
||||||
//import kotlinx.coroutines.flow.Flow
|
//import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
@@ -20,10 +22,13 @@ interface TunnelWorkingFaceDao {
|
|||||||
@Update
|
@Update
|
||||||
fun update(entity: TunnelWorkingFaceEntity)
|
fun update(entity: TunnelWorkingFaceEntity)
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime ASC")
|
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime DESC")
|
||||||
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime ASC")
|
@RawQuery
|
||||||
|
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face WHERE surfaceId = :surfaceId")
|
@Query("SELECT * FROM tunnel_working_face WHERE surfaceId = :surfaceId")
|
||||||
|
|||||||
+4
-5
@@ -5,8 +5,7 @@ import androidx.room.Insert
|
|||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
|
||||||
|
|
||||||
//import kotlinx.coroutines.flow.Flow
|
//import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
@@ -21,16 +20,16 @@ interface TunnelWorkingFaceRecordDao {
|
|||||||
@Update
|
@Update
|
||||||
fun update(entity: TunnelWorkingFaceRecordEntity)
|
fun update(entity: TunnelWorkingFaceRecordEntity)
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId ORDER BY createTime ASC")
|
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId ORDER BY createTime DESC")
|
||||||
fun getEntityList(surfaceId: Long): MutableList<TunnelWorkingFaceRecordEntity>?
|
fun getEntityList(surfaceId: Long): MutableList<TunnelWorkingFaceRecordEntity>?
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face_record WHERE dataState = :dataState ORDER BY createTime ASC")
|
@Query("SELECT * FROM tunnel_working_face_record WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceRecordEntity>?
|
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceRecordEntity>?
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :recordId")
|
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :recordId")
|
||||||
fun getEntityById(recordId: Long): TunnelWorkingFaceRecordEntity
|
fun getEntityById(recordId: Long): TunnelWorkingFaceRecordEntity
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime ASC LIMIT 1")
|
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime DESC LIMIT 1")
|
||||||
fun getLastEntity(surfaceId: Long): TunnelWorkingFaceRecordEntity?
|
fun getLastEntity(surfaceId: Long): TunnelWorkingFaceRecordEntity?
|
||||||
|
|
||||||
@Query("DELETE FROM tunnel_working_face_record")
|
@Query("DELETE FROM tunnel_working_face_record")
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.zmkg.coaloperation.db.entiry
|
|
||||||
|
|
||||||
class OtherEntity {
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity
|
||||||
|
|
||||||
|
class OtherEntity {
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.geologging
|
||||||
|
|
||||||
|
data class GeoLoggingFace(
|
||||||
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
var userId: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面名称
|
||||||
|
*/
|
||||||
|
var surfaceName: String? = "",
|
||||||
|
)
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.mining
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回采工作面-煤层厚度数据表
|
||||||
|
*/
|
||||||
|
@Parcelize
|
||||||
|
@Entity(tableName = "mining_coal_height")
|
||||||
|
class MiningCoalHeightEntity (
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 煤层Id
|
||||||
|
*/
|
||||||
|
@PrimaryKey
|
||||||
|
var coalId: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支架号
|
||||||
|
*/
|
||||||
|
var supportNo: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 煤层厚度值
|
||||||
|
*/
|
||||||
|
var coalHeight: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面id
|
||||||
|
*/
|
||||||
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录id
|
||||||
|
*/
|
||||||
|
var recordId: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
var createTime: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||||
|
*/
|
||||||
|
var dataState: String = "0"
|
||||||
|
): Parcelable {
|
||||||
|
@Ignore
|
||||||
|
constructor():this(coalId = 0)
|
||||||
|
}
|
||||||
+150
@@ -0,0 +1,150 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.mining
|
||||||
|
|
||||||
|
//import androidx.room.ColumnInfo
|
||||||
|
import android.os.Parcelable
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回采工作面表对应字段
|
||||||
|
*/
|
||||||
|
@Parcelize
|
||||||
|
@Entity(tableName = "mining_working_face")
|
||||||
|
class MiningWorkingFaceEntity(
|
||||||
|
// @PrimaryKey(name = "faceId") val id: Int = 0
|
||||||
|
/**
|
||||||
|
* 工作面id,本地新增数据使用时间戳保证唯一性
|
||||||
|
*/
|
||||||
|
@PrimaryKey
|
||||||
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
var userId: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面名称
|
||||||
|
*/
|
||||||
|
var surfaceName: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总进尺
|
||||||
|
*/
|
||||||
|
var totalFootage: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计进尺
|
||||||
|
*/
|
||||||
|
var accumulativeFootage: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余进尺
|
||||||
|
*/
|
||||||
|
var remainingFootage: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属煤层编号
|
||||||
|
*/
|
||||||
|
var seamId: Long? = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属煤层名称
|
||||||
|
*/
|
||||||
|
var seamName: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属采区域编号
|
||||||
|
*/
|
||||||
|
var areaId: Long? = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属采区域
|
||||||
|
*/
|
||||||
|
var areaName: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面方位角
|
||||||
|
*/
|
||||||
|
var surfaceAzimuth: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面巷高
|
||||||
|
*/
|
||||||
|
var surfaceHeight: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面巷宽
|
||||||
|
*/
|
||||||
|
var surfaceWidth: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巷道性质
|
||||||
|
*/
|
||||||
|
var tunnelNature: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划工期开始日期
|
||||||
|
*/
|
||||||
|
var planStartDate: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划工期结束日期
|
||||||
|
*/
|
||||||
|
var planEndDate: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地质类型
|
||||||
|
*/
|
||||||
|
var geologicalType: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水文地质类型
|
||||||
|
*/
|
||||||
|
var hydrogeologicalType: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 煤层发火性
|
||||||
|
*/
|
||||||
|
var seamIgnition: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瓦斯含量
|
||||||
|
*/
|
||||||
|
var seamGas: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲击地压危险性
|
||||||
|
*/
|
||||||
|
var seamBumpPressure: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支护形式
|
||||||
|
*/
|
||||||
|
var surfaceSupportForm: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
var createTime: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||||
|
*/
|
||||||
|
var dataState: String = "0",
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var records: MutableList<MiningWorkingFaceRecordEntity>? = null,
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var latestRecord: MiningWorkingFaceRecordEntity? = null,
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var isExpandRecord: Boolean = false
|
||||||
|
): Parcelable
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.mining
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
@Entity(tableName = "mining_working_face_record")
|
||||||
|
data class MiningWorkingFaceRecordEntity (
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录id
|
||||||
|
*/
|
||||||
|
@PrimaryKey
|
||||||
|
var recordId: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面id
|
||||||
|
*/
|
||||||
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工日期
|
||||||
|
*/
|
||||||
|
var workingDate: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录人
|
||||||
|
*/
|
||||||
|
var recordPerson: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工班次
|
||||||
|
*/
|
||||||
|
var teamShift: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工队伍id
|
||||||
|
*/
|
||||||
|
var teamId: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工队伍名称
|
||||||
|
*/
|
||||||
|
var teamName: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带队班长
|
||||||
|
*/
|
||||||
|
var teamLeader: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本班进尺
|
||||||
|
*/
|
||||||
|
var workingFootage: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 煤层倾角
|
||||||
|
*/
|
||||||
|
var seamDip: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 煤层高度
|
||||||
|
*/
|
||||||
|
var seamHeight: String? = null,
|
||||||
|
/**
|
||||||
|
* 涌水量
|
||||||
|
*/
|
||||||
|
var waterYield: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
var createTime: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||||
|
*/
|
||||||
|
var dataState: String = "0",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面中昨日记录状态:0-默认值,非昨日记录,1-昨日记录
|
||||||
|
*/
|
||||||
|
var latestRecordState: String = "0",
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var coalHeightList: MutableList<MiningCoalHeightEntity>? = null,
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var operationType: String = "1"
|
||||||
|
): Parcelable
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.zmkg.coaloperation.db.entiry.tunnel
|
package com.zmkg.coaloperation.db.entity.tunnel
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.zmkg.coaloperation.db.entiry.tunnel
|
package com.zmkg.coaloperation.db.entity.tunnel
|
||||||
|
|
||||||
//import androidx.room.ColumnInfo
|
//import androidx.room.ColumnInfo
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
@@ -22,6 +22,8 @@ class TunnelWorkingFaceEntity(
|
|||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
var surfaceId: Long = 0,
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
var userId: String = "",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作面名称
|
* 工作面名称
|
||||||
*/
|
*/
|
||||||
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
package com.zmkg.coaloperation.db.entiry.tunnel
|
package com.zmkg.coaloperation.db.entity.tunnel
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.Ignore
|
import androidx.room.Ignore
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
|
||||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.water
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
@Entity(tableName = "water_yield_observe")
|
||||||
|
data class WaterYieldObserveEntity(
|
||||||
|
@PrimaryKey
|
||||||
|
var observeId: Long = 0,
|
||||||
|
var observePoint: String = "",
|
||||||
|
var observeTime: String = "",
|
||||||
|
var observeState:String = "0",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
var createTime: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||||
|
*/
|
||||||
|
var dataState: String = "0"
|
||||||
|
|
||||||
|
) : Parcelable {
|
||||||
|
@Ignore
|
||||||
|
constructor() : this(observeId = 0)
|
||||||
|
}
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningCoalHeightDao
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
class MiningCoalHeightRepository(private val dao: MiningCoalHeightDao) {
|
||||||
|
suspend fun getEntityList(recordId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityList(recordId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListByState(dataState)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insert(entity: MiningCoalHeightEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.insert(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insertList(list: MutableList<MiningCoalHeightEntity>) =
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
dao.insertList(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun update(entity: MiningCoalHeightEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.update(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListByFaceId(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListByFaceId(surfaceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListByRecordId(surfaceId: Long, recordId: Long) =
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListByRecordId(surfaceId, recordId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityById(lithologyId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityById(lithologyId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||||
|
dao.deleteAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteList(recordId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.deleteList(recordId)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceRecordDao
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
class MiningWorkingFaceRecordRepository(private val dao: MiningWorkingFaceRecordDao) {
|
||||||
|
suspend fun getEntityList(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityList(surfaceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListByState(dataState: String) =
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListByState(dataState)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insert(entity: MiningWorkingFaceRecordEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.insert(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>) =
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
dao.insertList(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun update(entity: MiningWorkingFaceRecordEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.update(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityById(faceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getLastEntity(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getLastEntity(surfaceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||||
|
dao.deleteAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
|
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceDao
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
class MiningWorkingFaceRepository(private val dao: MiningWorkingFaceDao) {
|
||||||
|
suspend fun getEntityList() = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityList()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListBySql(query: SupportSQLiteQuery) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListBySql(query)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListByState(dataState)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insert(entity: MiningWorkingFaceEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.insert(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insertList(list: MutableList<MiningWorkingFaceEntity>) = withContext(Dispatchers.IO) {
|
||||||
|
dao.insertList(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun update(entity: MiningWorkingFaceEntity) = withContext(Dispatchers.IO) {
|
||||||
|
dao.update(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityById(faceId)
|
||||||
|
}
|
||||||
|
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||||
|
dao.deleteAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package com.zmkg.coaloperation.db.repository
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package com.zmkg.coaloperation.db.repository
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -1,7 +1,8 @@
|
|||||||
package com.zmkg.coaloperation.db.repository
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
@@ -10,6 +11,10 @@ class TunnelWorkingFaceRepository(private val dao: TunnelWorkingFaceDao) {
|
|||||||
dao.getEntityList()
|
dao.getEntityList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListBySql(query: SupportSQLiteQuery) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListBySql(query)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||||
dao.getEntityListByState(dataState)
|
dao.getEntityListByState(dataState)
|
||||||
}
|
}
|
||||||
|
|||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
package com.zmkg.coaloperation.db.viewmodel
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import androidx.lifecycle.AndroidViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||||
|
import com.zmkg.coaloperation.db.repository.MiningCoalHeightRepository
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
class MiningCoalHeightViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
|
private val repository: MiningCoalHeightRepository
|
||||||
|
|
||||||
|
init {
|
||||||
|
val dao = AppDatabase.getDatabase(application).miningCoalHeightDao()
|
||||||
|
repository = MiningCoalHeightRepository(dao)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityList(recordId: Long, action: (MutableList<MiningCoalHeightEntity>?) -> Unit) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningCoalHeightEntity>? = repository.getEntityList(recordId)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListByState(
|
||||||
|
dataState: String,
|
||||||
|
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningCoalHeightEntity>? =
|
||||||
|
repository.getEntityListByState(dataState)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListByFaceId(
|
||||||
|
surfaceId: Long,
|
||||||
|
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||||
|
) = viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningCoalHeightEntity>? =
|
||||||
|
repository.getEntityListByFaceId(surfaceId)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListByRecordId(
|
||||||
|
surfaceId: Long,
|
||||||
|
recordId: Long,
|
||||||
|
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||||
|
) = viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningCoalHeightEntity>? =
|
||||||
|
repository.getEntityListByRecordId(surfaceId, recordId)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insertList(list: MutableList<MiningCoalHeightEntity>, action: () -> Unit = {}) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
repository.insertList(list)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insert(entity: MiningCoalHeightEntity, action: () -> Unit) = viewModelScope.launch {
|
||||||
|
repository.insert(entity)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun update(entity: MiningCoalHeightEntity, action: () -> Unit) = viewModelScope.launch {
|
||||||
|
repository.update(entity)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityById(faceId: Long, action: (MiningCoalHeightEntity) -> Unit) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val entity = repository.getEntityById(faceId)
|
||||||
|
entity?.let { action(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteList(recordId: Long, action: () -> Unit = {}) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
repository.deleteList(recordId)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteAll(action: () -> Unit = {}) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
repository.deleteAll()
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
package com.zmkg.coaloperation.db.viewmodel
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import androidx.lifecycle.AndroidViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
import com.zmkg.coaloperation.db.repository.MiningWorkingFaceRecordRepository
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
class MiningWorkingFaceRecordViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
|
private val repository: MiningWorkingFaceRecordRepository
|
||||||
|
|
||||||
|
init {
|
||||||
|
val dao = AppDatabase.getDatabase(application).miningWorkingFaceRecordDao()
|
||||||
|
repository = MiningWorkingFaceRecordRepository(dao)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityList(
|
||||||
|
surfaceId: Long,
|
||||||
|
action: (MutableList<MiningWorkingFaceRecordEntity>?) -> Unit
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningWorkingFaceRecordEntity>? =
|
||||||
|
repository.getEntityList(surfaceId)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListByState(
|
||||||
|
dataState: String,
|
||||||
|
action: (MutableList<MiningWorkingFaceRecordEntity>?) -> Unit
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningWorkingFaceRecordEntity>? =
|
||||||
|
repository.getEntityListByState(dataState)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insert(entity: MiningWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||||
|
repository.insert(entity)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>, action: () -> Unit = {}) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
repository.insertList(list)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun update(entity: MiningWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||||
|
repository.update(entity)
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityById(recordId: Long) = viewModelScope.launch {
|
||||||
|
repository.getEntityById(recordId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLastEntity(surfaceId: Long, action: (MiningWorkingFaceRecordEntity?) -> Unit) = viewModelScope.launch {
|
||||||
|
val record = repository.getLastEntity(surfaceId)
|
||||||
|
action(record)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteAll(action: () -> Unit={}) = viewModelScope.launch {
|
||||||
|
repository.deleteAll()
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+91
@@ -0,0 +1,91 @@
|
|||||||
|
package com.zmkg.coaloperation.db.viewmodel
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import androidx.lifecycle.AndroidViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import androidx.sqlite.db.SimpleSQLiteQuery
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.repository.MiningWorkingFaceRepository
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
class MiningWorkingFaceViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
|
private val repository: MiningWorkingFaceRepository
|
||||||
|
|
||||||
|
val faceList = MutableSharedFlow<MutableList<MiningWorkingFaceEntity>?>()
|
||||||
|
val faceListByState = MutableSharedFlow<MutableList<MiningWorkingFaceEntity>?>()
|
||||||
|
val insertOne = MutableSharedFlow<Long>()
|
||||||
|
val updateOne = MutableSharedFlow<Boolean>()
|
||||||
|
val insertArray = MutableSharedFlow<Array<Long>>()
|
||||||
|
val queryOne = MutableSharedFlow<MiningWorkingFaceEntity>()
|
||||||
|
val deleteFinish = MutableSharedFlow<Boolean>()
|
||||||
|
|
||||||
|
init {
|
||||||
|
val dao = AppDatabase.getDatabase(application).miningWorkingFaceDao()
|
||||||
|
repository = MiningWorkingFaceRepository(dao)
|
||||||
|
}
|
||||||
|
|
||||||
|
// fun getEntityList() = viewModelScope.launch {
|
||||||
|
// val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityList()
|
||||||
|
// faceList.emit(list)
|
||||||
|
// }
|
||||||
|
|
||||||
|
fun getEntityListByUserId(userId:String) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val sql = buildString {
|
||||||
|
append("SELECT * FROM mining_working_face WHERE 1=1 ")
|
||||||
|
if (userId.isNotBlank()) {
|
||||||
|
append(" AND userId = $userId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val query = SimpleSQLiteQuery(sql)
|
||||||
|
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||||
|
faceList.emit(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListBySql(
|
||||||
|
query: SupportSQLiteQuery,
|
||||||
|
action: (MutableList<MiningWorkingFaceEntity>?) -> Unit
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListByState(dataState: String) = viewModelScope.launch {
|
||||||
|
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListByState(dataState)
|
||||||
|
faceListByState.emit(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insert(entity: MiningWorkingFaceEntity) = viewModelScope.launch {
|
||||||
|
val faceId = repository.insert(entity)
|
||||||
|
insertOne.emit(faceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insertList(list: MutableList<MiningWorkingFaceEntity>) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val array = repository.insertList(list)
|
||||||
|
insertArray.emit(array)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun update(entity: MiningWorkingFaceEntity) = viewModelScope.launch {
|
||||||
|
repository.update(entity)
|
||||||
|
updateOne.emit(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityById(faceId: Long) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val entity = repository.getEntityById(faceId)
|
||||||
|
entity?.let {
|
||||||
|
queryOne.emit(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteAll() =
|
||||||
|
viewModelScope.launch {
|
||||||
|
repository.deleteAll()
|
||||||
|
deleteFinish.emit(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -4,7 +4,7 @@ import android.app.Application
|
|||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.zmkg.coaloperation.db.AppDatabase
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
import com.zmkg.coaloperation.db.repository.TunnelRoofLithologyRepository
|
import com.zmkg.coaloperation.db.repository.TunnelRoofLithologyRepository
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import android.app.Application
|
|||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.zmkg.coaloperation.db.AppDatabase
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRecordRepository
|
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRecordRepository
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|||||||
+25
-3
@@ -3,12 +3,12 @@ package com.zmkg.coaloperation.db.viewmodel
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import androidx.sqlite.db.SimpleSQLiteQuery
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import com.zmkg.coaloperation.db.AppDatabase
|
import com.zmkg.coaloperation.db.AppDatabase
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(application) {
|
class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
private val repository: TunnelWorkingFaceRepository
|
private val repository: TunnelWorkingFaceRepository
|
||||||
@@ -24,6 +24,28 @@ class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(ap
|
|||||||
action(list)
|
action(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getEntityListByUserId(userId:String, action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val sql = buildString {
|
||||||
|
append("SELECT * FROM tunnel_working_face WHERE 1=1 ")
|
||||||
|
if (userId.isNotBlank()) {
|
||||||
|
append(" AND userId = $userId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val query = SimpleSQLiteQuery(sql)
|
||||||
|
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getEntityListBySql(
|
||||||
|
query: SupportSQLiteQuery,
|
||||||
|
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||||
|
) =
|
||||||
|
viewModelScope.launch {
|
||||||
|
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||||
|
action(list)
|
||||||
|
}
|
||||||
|
|
||||||
fun getEntityListByState(
|
fun getEntityListByState(
|
||||||
dataState: String,
|
dataState: String,
|
||||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.zmkg.coaloperation.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.annotation.StyleRes
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
|
||||||
|
open class BaseDialog(context: Context, @StyleRes dialogTheme: Int) :
|
||||||
|
Dialog(context, dialogTheme) {
|
||||||
|
constructor(context: Context) : this(context, R.style.DialogTheme)
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
super.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.zmkg.coaloperation.dialog
|
||||||
|
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import com.allen.library.shape.ShapeButton
|
||||||
|
import com.zmkg.coaloperation.databinding.DialogCommonBinding
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
|
||||||
|
class CustomCenterDialog(
|
||||||
|
var activity: FragmentActivity,
|
||||||
|
var defaultWidth: Int = 300.dp
|
||||||
|
) : BaseDialog(activity) {
|
||||||
|
|
||||||
|
private lateinit var binding: DialogCommonBinding
|
||||||
|
|
||||||
|
var dialogCancelable = false
|
||||||
|
var dialogCanceledOnTouchOutside = false
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = DialogCommonBinding.inflate(LayoutInflater.from(activity))
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
setCancelable(dialogCancelable)
|
||||||
|
setCanceledOnTouchOutside(dialogCanceledOnTouchOutside)
|
||||||
|
window?.apply {
|
||||||
|
setLayout(defaultWidth, WindowManager.LayoutParams.WRAP_CONTENT)
|
||||||
|
setBackgroundDrawable(ColorDrawable())
|
||||||
|
setGravity(Gravity.CENTER)
|
||||||
|
}
|
||||||
|
binding.btnCancel.setOnClickListener { onLeftClick?.invoke(this) }
|
||||||
|
binding.btnConfirm.setOnClickListener { onRightClick?.invoke(this) }
|
||||||
|
}
|
||||||
|
|
||||||
|
private var dialogTitle: String = ""
|
||||||
|
fun setDialogTitle(title: String) {
|
||||||
|
this.dialogTitle = title
|
||||||
|
}
|
||||||
|
|
||||||
|
private var dialogContent: String = ""
|
||||||
|
fun setDialogContent(content: String) {
|
||||||
|
this.dialogContent = content
|
||||||
|
}
|
||||||
|
|
||||||
|
private var spannableBuilder: SpannableStringBuilder? = null
|
||||||
|
fun setDialogContent(spannableBuilder: SpannableStringBuilder) {
|
||||||
|
this.spannableBuilder = spannableBuilder
|
||||||
|
}
|
||||||
|
|
||||||
|
private var dialogLeftBtnText = ""
|
||||||
|
private var onLeftClick: ((CustomCenterDialog) -> Unit)? = null
|
||||||
|
fun setCancelButton(
|
||||||
|
text: String,
|
||||||
|
onClick: (CustomCenterDialog) -> Unit
|
||||||
|
) {
|
||||||
|
this.dialogLeftBtnText = text
|
||||||
|
this.onLeftClick = onClick
|
||||||
|
}
|
||||||
|
|
||||||
|
private var dialogRightBtnText = ""
|
||||||
|
private var onRightClick: ((CustomCenterDialog) -> Unit)? = null
|
||||||
|
fun setConfirmButton(
|
||||||
|
text: String,
|
||||||
|
onClick: (CustomCenterDialog) -> Unit
|
||||||
|
) {
|
||||||
|
this.dialogRightBtnText = text
|
||||||
|
this.onRightClick = onClick
|
||||||
|
}
|
||||||
|
|
||||||
|
private var showSingleButton = false
|
||||||
|
fun setShowSingleButton(show: Boolean) {
|
||||||
|
this.showSingleButton = show
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var bgLayoutSetting: ((View) -> Unit)? = null
|
||||||
|
var titleSetting: ((TextView) -> Unit)? = null
|
||||||
|
var contentSetting: ((TextView) -> Unit)? = null
|
||||||
|
var leftBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||||
|
var rightBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
super.show()
|
||||||
|
|
||||||
|
binding.tvDialogTitle.apply {
|
||||||
|
text = dialogTitle
|
||||||
|
}
|
||||||
|
binding.tvDialogContent.apply {
|
||||||
|
text = dialogContent
|
||||||
|
}
|
||||||
|
|
||||||
|
bgLayoutSetting?.invoke(binding.root)
|
||||||
|
titleSetting?.invoke(binding.tvDialogTitle)
|
||||||
|
contentSetting?.invoke(binding.tvDialogContent)
|
||||||
|
leftBtnSetting?.invoke(binding.btnCancel)
|
||||||
|
rightBtnSetting?.invoke(binding.btnConfirm)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -207,7 +207,7 @@ fun ImageView.loadCircle(@DrawableRes resourceId: Int) {
|
|||||||
* @param imageView View
|
* @param imageView View
|
||||||
* @param placeholder 占位图
|
* @param placeholder 占位图
|
||||||
*/
|
*/
|
||||||
fun ImageView.loadRoundedImage(
|
fun ImageView.loadRoundedImage2(
|
||||||
url: String?,
|
url: String?,
|
||||||
roundingRadius: Float,
|
roundingRadius: Float,
|
||||||
@DrawableRes defaultResId: Int = 0,
|
@DrawableRes defaultResId: Int = 0,
|
||||||
@@ -239,6 +239,32 @@ fun ImageView.loadRoundedImage(
|
|||||||
.into(this)
|
.into(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ImageView.loadRoundedImage(
|
||||||
|
any: Any,
|
||||||
|
roundingRadius: Float,
|
||||||
|
@DrawableRes defaultResId: Int = 0,
|
||||||
|
isCenterCrop:Boolean = true
|
||||||
|
) {
|
||||||
|
//设置图片圆角角度
|
||||||
|
val roundedCorners = RoundedCorners(dp2px(roundingRadius))
|
||||||
|
val multiTransformation: MultiTransformation<Bitmap> = MultiTransformation(
|
||||||
|
if (isCenterCrop) CenterCrop() else FitCenter(), roundedCorners
|
||||||
|
)
|
||||||
|
val options = RequestOptions
|
||||||
|
.bitmapTransform(multiTransformation)
|
||||||
|
if (defaultResId == 0) {
|
||||||
|
options.placeholder(R.drawable.ic_default)
|
||||||
|
.error(R.drawable.ic_default)
|
||||||
|
} else {
|
||||||
|
options.placeholder(defaultResId)
|
||||||
|
.error(defaultResId)
|
||||||
|
}
|
||||||
|
Glide.with(context)
|
||||||
|
.load(any)
|
||||||
|
.apply(options)
|
||||||
|
.into(this)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载图片到ImageView
|
* 加载图片到ImageView
|
||||||
* @param imageUrl 图片地址
|
* @param imageUrl 图片地址
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.geologging
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityAddGeoLoggingFaceBinding
|
||||||
|
|
||||||
|
class AddGeoLoggingFaceActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityAddGeoLoggingFaceBinding>(
|
||||||
|
R.layout.activity_add_geo_logging_face
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "新增工作面"
|
||||||
|
mBinding.btnAddFace.setOnClickListener {
|
||||||
|
val faceName = mBinding.etWorkfaceName.text.toString().trim()
|
||||||
|
if (faceName.isBlank()) {
|
||||||
|
showToast("请输入工作面名称")
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+137
@@ -0,0 +1,137 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.geologging
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.core.view.marginLeft
|
||||||
|
import androidx.core.view.marginStart
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.commit
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityAddGeologicalPointBinding
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
import com.zmkg.coaloperation.utils.useShapeSetBackground
|
||||||
|
import net.lucode.hackware.magicindicator.FragmentContainerHelper
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地质编录点新增
|
||||||
|
*/
|
||||||
|
class AddGeologicalPointActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityAddGeologicalPointBinding>(
|
||||||
|
R.layout.activity_add_geological_point
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "编录点"
|
||||||
|
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
|
|
||||||
|
initFragments()
|
||||||
|
initMagicIndicator()
|
||||||
|
showFragment(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private val fragments = mutableListOf<AddGeologicalPointFragment>()
|
||||||
|
private fun initFragments() {
|
||||||
|
titles.forEachIndexed { index, string ->
|
||||||
|
val fragment = AddGeologicalPointFragment()
|
||||||
|
fragments.add(fragment)
|
||||||
|
supportFragmentManager.commit {
|
||||||
|
add(R.id.frgContainerView, fragment, "frg_${index}").hide(fragment)
|
||||||
|
// replace(R.id.frgContainerView, fragments[0], "point01")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
fragments[showFrgIndex].onActivityResult(requestCode, resultCode, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val titles = listOf("1#", "2#", "3#", "4#", "5#", "6#")
|
||||||
|
private fun initMagicIndicator() {
|
||||||
|
val commonNavigator = CommonNavigator(this).apply {
|
||||||
|
adapter = object : CommonNavigatorAdapter() {
|
||||||
|
override fun getCount() = titles.size
|
||||||
|
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
||||||
|
return ColorTransitionPagerTitleView(context).apply {
|
||||||
|
// setPadding(10.dp, 5.dp,10.dp, 5.dp)
|
||||||
|
width = 65.dp
|
||||||
|
text = titles[index]
|
||||||
|
textSize = 20f
|
||||||
|
normalColor = Color.WHITE
|
||||||
|
selectedColor = "#30E0A1".toColorInt()
|
||||||
|
useShapeSetBackground(
|
||||||
|
cornerRadius = 12.dp.toFloat(),
|
||||||
|
solidColor = "#1430E0A1".toColorInt(),
|
||||||
|
strokeColor = "#0C0D0E".toColorInt(),
|
||||||
|
strokeWidth = 8.dp
|
||||||
|
)
|
||||||
|
setOnClickListener { showFragment(index) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getIndicator(context: Context?) = LinePagerIndicator(context).apply {
|
||||||
|
// mode = LinePagerIndicator.MODE_WRAP_CONTENT
|
||||||
|
// setColors("#30E0A1".toColorInt())
|
||||||
|
// lineHeight = 1.dp.toFloat()
|
||||||
|
//lineWidth = 10.dp.toFloat()
|
||||||
|
// background = GradientDrawable().also {
|
||||||
|
// it.shape = GradientDrawable.RECTANGLE
|
||||||
|
// it.cornerRadius = 5.dp.toFloat()
|
||||||
|
// it.setColor("#30E0A1".toColorInt())
|
||||||
|
//// it.setStroke(strokeWidth, strokeColor)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBinding.magicIndicator.let {
|
||||||
|
fragmentContainerHelper = FragmentContainerHelper(it)
|
||||||
|
it.navigator = commonNavigator
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var fragmentContainerHelper:FragmentContainerHelper
|
||||||
|
|
||||||
|
private var showFrgIndex = 0
|
||||||
|
private fun showFragment(position: Int) {
|
||||||
|
showFrgIndex = position
|
||||||
|
// supportFragmentManager.beginTransaction()
|
||||||
|
// .replace(R.id.frgContainerView, fragments[position])
|
||||||
|
// .commit()
|
||||||
|
fragmentContainerHelper.handlePageSelected(position)
|
||||||
|
supportFragmentManager.commit {
|
||||||
|
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||||
|
fragments.forEachIndexed { index, fragment ->
|
||||||
|
if (index == position) show(fragment) else hide(fragment)
|
||||||
|
}
|
||||||
|
setReorderingAllowed(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.geologging
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.GeoPointMultiAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.BaseItem
|
||||||
|
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||||
|
import com.zmkg.coaloperation.databinding.FragmentAddGeologicalPointBinding
|
||||||
|
|
||||||
|
class AddGeologicalPointFragment :
|
||||||
|
BaseVMBFragment<TestViewModel, FragmentAddGeologicalPointBinding>(R.layout.fragment_add_geological_point) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val IMAGE_REQUEST_CODE = 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
private val geoPointList: MutableList<GeoPointMultiItem> = mutableListOf()
|
||||||
|
private val geoPointAdapter by lazy {
|
||||||
|
GeoPointMultiAdapter(geoPointList)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
|
geoPointList.clear()
|
||||||
|
val topList = mutableListOf(
|
||||||
|
BaseItem(name = "点号", value = ""),
|
||||||
|
BaseItem(name = "点距", value = ""),
|
||||||
|
BaseItem(name = "累距", value = ""),
|
||||||
|
)
|
||||||
|
val bottomList = mutableListOf(
|
||||||
|
BaseItem(name = "巷高", value = ""),
|
||||||
|
BaseItem(name = "顶板", value = ""),
|
||||||
|
BaseItem(name = "底板", value = ""),
|
||||||
|
BaseItem(name = "巷顶煤厚", value = ""),
|
||||||
|
)
|
||||||
|
val imageList = mutableListOf<CommonImageBean>()
|
||||||
|
imageList.add(CommonImageBean(isAddFlag = true))
|
||||||
|
geoPointList.run {
|
||||||
|
add(
|
||||||
|
GeoPointMultiItem(
|
||||||
|
itemType = GeoPointMultiItem.TYPE_BASE_INFO,
|
||||||
|
baseTopList = topList,
|
||||||
|
baseBottomList = bottomList
|
||||||
|
)
|
||||||
|
)
|
||||||
|
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_LOGGING_INFO))
|
||||||
|
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_CALCULATE_INFO))
|
||||||
|
add(
|
||||||
|
GeoPointMultiItem(
|
||||||
|
itemType = GeoPointMultiItem.TYPE_UPLOAD_IMAGE,
|
||||||
|
images = imageList
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
mBinding.rvPointList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(it.context)
|
||||||
|
it.adapter = geoPointAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.geologging
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.GeoLoggingFaceAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityGeologicalBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.geologging.GeoLoggingFace
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地质编录
|
||||||
|
*/
|
||||||
|
class GeologicalActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityGeologicalBinding>(R.layout.activity_geological) {
|
||||||
|
|
||||||
|
val faceList: MutableList<GeoLoggingFace> = mutableListOf()
|
||||||
|
val faceAdapter by lazy {
|
||||||
|
GeoLoggingFaceAdapter(faceList).apply {
|
||||||
|
setOnItemClickListener { adapter, view, position ->
|
||||||
|
toActivity(GeologicalPointActivity::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "编录位置选择"
|
||||||
|
mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(AddGeoLoggingFaceActivity::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
faceList.run {
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20304回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20305回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20306回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20307回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20308回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20309回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20310回风工作面"))
|
||||||
|
add(GeoLoggingFace(surfaceName = "5-20311回风工作面"))
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.rvGeoLogging.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = faceAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.geologging
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.GeoPointParentAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||||
|
import com.zmkg.coaloperation.bean.GeoPointParent
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityGeologicalPointBinding
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地质编录
|
||||||
|
*/
|
||||||
|
class GeologicalPointActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityGeologicalPointBinding>(R.layout.activity_geological_point) {
|
||||||
|
|
||||||
|
private val parentList: MutableList<GeoPointParent> = mutableListOf(
|
||||||
|
GeoPointParent(name = "已编录点"),
|
||||||
|
GeoPointParent(name = "未编录点")
|
||||||
|
)
|
||||||
|
private val parentAdapter by lazy {
|
||||||
|
GeoPointParentAdapter(parentList)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "编录点"
|
||||||
|
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
|
|
||||||
|
val subList = mutableListOf(
|
||||||
|
GeoPointItem(isLogging = true, name = "1#", distance = "0", isChecked = true),
|
||||||
|
GeoPointItem(isLogging = true, name = "2#", distance = "24.252"),
|
||||||
|
GeoPointItem(isLogging = true, name = "3#", distance = "37.859"),
|
||||||
|
GeoPointItem(isLogging = true, name = "4#", distance = "43.123"),
|
||||||
|
GeoPointItem(isLogging = true, name = "5#", distance = "50.567"),
|
||||||
|
GeoPointItem(isLogging = true, name = "6#", distance = "60.567"),
|
||||||
|
GeoPointItem(isLogging = true, name = "7#", distance = "70.567")
|
||||||
|
)
|
||||||
|
val subList2 = mutableListOf(
|
||||||
|
GeoPointItem(name = "1#", distance = "0"),
|
||||||
|
GeoPointItem(name = "2#", distance = "24.252"),
|
||||||
|
GeoPointItem(name = "3#", distance = "37.859"),
|
||||||
|
GeoPointItem(name = "4#", distance = "56.859"),
|
||||||
|
GeoPointItem(name = "5#", distance = "89.859")
|
||||||
|
)
|
||||||
|
parentList[0].list = subList
|
||||||
|
parentList[1].list = subList2
|
||||||
|
mBinding.rvPointParent.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = parentAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
-27
@@ -1,27 +0,0 @@
|
|||||||
package com.zmkg.coaloperation.ui.home.activity
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import com.zmkg.coaloperation.R
|
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
|
||||||
import com.zmkg.coaloperation.databinding.ActivityGeologicalBinding
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 地质编录
|
|
||||||
*/
|
|
||||||
class GeologicalActivity : BaseVMBActivity<TestViewModel, ActivityGeologicalBinding>(R.layout.activity_geological) {
|
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun processClick(v: View?) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
@@ -1,5 +1,6 @@
|
|||||||
package com.zmkg.coaloperation.ui.home.adapter
|
package com.zmkg.coaloperation.ui.home.adapter
|
||||||
|
|
||||||
|
import android.widget.Toast
|
||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
@@ -30,5 +31,8 @@ class HomeMenuAdapter :
|
|||||||
R.id.img,
|
R.id.img,
|
||||||
getMenuTabImg(item.index!!, holder.itemViewType)
|
getMenuTabImg(item.index!!, holder.itemViewType)
|
||||||
)
|
)
|
||||||
|
holder.itemView.setOnClickListener {
|
||||||
|
item.onClick()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,13 @@ package com.zmkg.coaloperation.ui.home.bean
|
|||||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||||
|
|
||||||
|
|
||||||
class HomeMenuBean : MultiItemEntity {
|
data class HomeMenuBean(
|
||||||
var name: String? = null
|
var name: String? = null,
|
||||||
var index: Int? = null
|
var index: Int? = null,
|
||||||
var type: Int? = null // 0: 前4个(左右布局),1: 后4个(上下布局)
|
var type: Int? = null, // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||||
|
var onClick:()->Unit = {}
|
||||||
|
) : MultiItemEntity {
|
||||||
override val itemType: Int
|
override val itemType: Int
|
||||||
get() = type!!
|
get() = type!!
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-43
@@ -1,39 +1,33 @@
|
|||||||
package com.zmkg.coaloperation.ui.home.fragment
|
package com.zmkg.coaloperation.ui.home.fragment
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.reflect.TypeToken
|
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
||||||
import com.zmkg.coaloperation.local.DataStoreManager
|
|
||||||
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
||||||
import com.zmkg.coaloperation.superfuntion.init
|
import com.zmkg.coaloperation.superfuntion.init
|
||||||
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
||||||
import com.zmkg.coaloperation.superfuntion.toJson
|
import com.zmkg.coaloperation.ui.geologging.GeologicalActivity
|
||||||
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
||||||
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
||||||
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import com.zmkg.coaloperation.ui.wateryield.WaterYieldHomeActivity
|
||||||
import kotlinx.coroutines.launch
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
|
||||||
|
|
||||||
class HomeFragment :
|
class HomeFragment :
|
||||||
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
||||||
OnItemClickListener {
|
OnItemClickListener {
|
||||||
|
|
||||||
private val homeMenuAdapter: HomeMenuAdapter by lazy { HomeMenuAdapter() }
|
private val homeMenuAdapter: HomeMenuAdapter by lazy {
|
||||||
|
HomeMenuAdapter()
|
||||||
|
}
|
||||||
|
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
mBinding.apply {
|
mBinding.apply {
|
||||||
@@ -47,7 +41,7 @@ class HomeFragment :
|
|||||||
rvList.adapter = homeMenuAdapter
|
rvList.adapter = homeMenuAdapter
|
||||||
rvList.addItemTouchCallback {
|
rvList.addItemTouchCallback {
|
||||||
resetItemTypes(homeMenuAdapter.data)
|
resetItemTypes(homeMenuAdapter.data)
|
||||||
DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
// DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||||
homeMenuAdapter.notifyDataSetChanged()
|
homeMenuAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,41 +74,32 @@ class HomeFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
|
DictUtils.initData()
|
||||||
// mViewModel.getWaterLedgerData()
|
// mViewModel.getWaterLedgerData()
|
||||||
|
|
||||||
val titleNameList = mutableListOf(
|
val menuList = mutableListOf(
|
||||||
"涌水量观测",
|
HomeMenuBean(index = 1, name = "涌水量观测", type = 0, onClick = {
|
||||||
"导线测量",
|
toActivity(WaterYieldHomeActivity::class.java)
|
||||||
"瓦斯巡检",
|
}),
|
||||||
"防灭火检查",
|
HomeMenuBean(index = 2, name = "导线测量", type = 0),
|
||||||
"通风巡检",
|
HomeMenuBean(index = 3, name = "瓦斯巡检", type = 0),
|
||||||
"地质编录",
|
HomeMenuBean(index = 4, name = "防灭火检查", type = 0),
|
||||||
"水文地质编录",
|
HomeMenuBean(index = 5, name = "通风巡检", type = 1),
|
||||||
"隐蔽致灾",
|
HomeMenuBean(index = 6, name = "地质编录", type = 1, onClick = {
|
||||||
"地物查询"
|
toActivity(GeologicalActivity::class.java)
|
||||||
|
}),
|
||||||
|
HomeMenuBean(index = 7, name = "水文地质编录", type = 1),
|
||||||
|
HomeMenuBean(index = 8, name = "隐蔽致灾", type = 1),
|
||||||
|
HomeMenuBean(index = 9, name = "地物查询", type = 1)
|
||||||
)
|
)
|
||||||
var mutableListOf = mutableListOf<HomeMenuBean>()
|
|
||||||
|
|
||||||
val homeData = DataStoreManager.getHomeData()
|
// val homeData = DataStoreManager.getHomeData()
|
||||||
if (TextUtils.isEmpty(homeData)) {
|
// if (!TextUtils.isEmpty(homeData)) {
|
||||||
|
// val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.type
|
||||||
|
// mutableListOf = Gson().fromJson(homeData, listType)
|
||||||
|
// }
|
||||||
|
|
||||||
titleNameList.forEachIndexed { index, s ->
|
homeMenuAdapter.setNewInstance(menuList)
|
||||||
val homeMenuBean = HomeMenuBean()
|
|
||||||
homeMenuBean.name = s
|
|
||||||
homeMenuBean.index = index + 1
|
|
||||||
if (index < 4) {
|
|
||||||
homeMenuBean.type = 0
|
|
||||||
} else {
|
|
||||||
homeMenuBean.type = 1
|
|
||||||
}
|
|
||||||
mutableListOf.add(homeMenuBean)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.getType()
|
|
||||||
mutableListOf = Gson().fromJson(homeData, listType)
|
|
||||||
}
|
|
||||||
|
|
||||||
homeMenuAdapter.setNewInstance(mutableListOf)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,6 +6,7 @@ import com.zmkg.coaloperation.R
|
|||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||||
|
|
||||||
class PagerLeftFragment :
|
class PagerLeftFragment :
|
||||||
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
||||||
@@ -24,8 +25,7 @@ class PagerLeftFragment :
|
|||||||
mBinding.rootView.setOnClickListener {
|
mBinding.rootView.setOnClickListener {
|
||||||
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
||||||
// pagerViewClickDialog.show()
|
// pagerViewClickDialog.show()
|
||||||
|
toActivity(MiningActivity::class.java)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-7
@@ -10,8 +10,10 @@ import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
|||||||
import com.zmkg.coaloperation.databinding.ActivityLoginBinding
|
import com.zmkg.coaloperation.databinding.ActivityLoginBinding
|
||||||
import com.zmkg.coaloperation.local.DataStoreManager
|
import com.zmkg.coaloperation.local.DataStoreManager
|
||||||
import com.zmkg.coaloperation.superfuntion.loginIm
|
import com.zmkg.coaloperation.superfuntion.loginIm
|
||||||
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
|
|
||||||
class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layout.activity_login) {
|
class LoginActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityLoginBinding>(R.layout.activity_login) {
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||||
@@ -33,8 +35,8 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
|||||||
override fun processClick(v: View?) {
|
override fun processClick(v: View?) {
|
||||||
when (v?.id) {
|
when (v?.id) {
|
||||||
R.id.submit -> {
|
R.id.submit -> {
|
||||||
val userId = mBinding.loginEtUserName.text.toString()
|
val userName = mBinding.loginEtUserName.text.toString()
|
||||||
if (TextUtils.isEmpty(userId)) {
|
if (TextUtils.isEmpty(userName)) {
|
||||||
showToast("请输入用户名")
|
showToast("请输入用户名")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -44,12 +46,14 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
loginIm(userId) {}
|
loginIm(userName) {}
|
||||||
DataStoreManager.setUserName(userId)
|
DataStoreManager.setUserName(userName)
|
||||||
|
|
||||||
|
// TODO: 保存临时生成的用户id
|
||||||
|
SpTool.put(SpTool.USER_ID, "1758266158000")
|
||||||
|
|
||||||
toActivity(MainActivity::class.java)
|
toActivity(MainActivity::class.java)
|
||||||
finish()
|
finish()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining
|
||||||
|
|
||||||
|
class MiningViewModel {
|
||||||
|
}
|
||||||
+276
@@ -0,0 +1,276 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.AddMiningFaceAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||||
|
import com.zmkg.coaloperation.bean.WorkOption
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityAddMiningFaceBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceViewModel
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.activity.AddWorkingFaceActivity
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceDetailActivity
|
||||||
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
import com.zmkg.coaloperation.utils.PickerUtil
|
||||||
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面
|
||||||
|
*/
|
||||||
|
class AddMiningFaceActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityAddMiningFaceBinding>(R.layout.activity_add_mining_face) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "AddMiningFaceActivity"
|
||||||
|
const val WORK_FACE_TYPE = "WorkFaceType"
|
||||||
|
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class WorkFaceType {
|
||||||
|
ADD,//新增
|
||||||
|
|
||||||
|
EDIT,//修改
|
||||||
|
|
||||||
|
SEE//查看
|
||||||
|
}
|
||||||
|
|
||||||
|
private var currentFaceType = WorkFaceType.ADD
|
||||||
|
|
||||||
|
// private val workingFaceViewModel: TunnelWorkingFaceViewModel by lazy {
|
||||||
|
// ViewModelProvider(this)[TunnelWorkingFaceViewModel::class.java]
|
||||||
|
// }
|
||||||
|
private var faceDetail: MiningWorkingFaceEntity? = null
|
||||||
|
|
||||||
|
private val miningList = mutableListOf<AddMiningFaceItem>()
|
||||||
|
private val workingFaceViewModel: MiningWorkingFaceViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[MiningWorkingFaceViewModel::class.java]
|
||||||
|
}
|
||||||
|
private val addFaceAdapter by lazy {
|
||||||
|
AddMiningFaceAdapter(miningList).apply {
|
||||||
|
addChildClickViewIds(R.id.tvSelectValue, R.id.imgExpand)
|
||||||
|
setOnItemChildClickListener { adapter, view, position ->
|
||||||
|
if (view.id == R.id.tvSelectValue) {
|
||||||
|
miningList[position].onClick()
|
||||||
|
return@setOnItemChildClickListener
|
||||||
|
}
|
||||||
|
if (view.id == R.id.imgExpand) {
|
||||||
|
miningList.clear()
|
||||||
|
initMiningList(false)
|
||||||
|
notifyDataSetChanged()
|
||||||
|
return@setOnItemChildClickListener
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
val stringExtra = intent.getStringExtra(WORK_FACE_TYPE)
|
||||||
|
if (TextUtils.isEmpty(stringExtra)) {
|
||||||
|
stringExtra == WorkFaceType.ADD.name
|
||||||
|
}
|
||||||
|
when (stringExtra) {
|
||||||
|
WorkFaceType.ADD.name -> {
|
||||||
|
currentFaceType = WorkFaceType.ADD
|
||||||
|
mBinding.btnConfirm.text = "确认新增"
|
||||||
|
mBinding.toolbarLay.title = "新增工作面"
|
||||||
|
initMiningList(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkFaceType.EDIT.name -> {
|
||||||
|
currentFaceType = WorkFaceType.EDIT
|
||||||
|
mBinding.btnConfirm.text = "确认修改"
|
||||||
|
mBinding.toolbarLay.title = "修改工作面"
|
||||||
|
faceDetail =
|
||||||
|
intent.getParcelableExtra(WorkingFaceDetailActivity.Companion.FACE_WORK_DETAIL_DATA) as MiningWorkingFaceEntity?
|
||||||
|
if (faceDetail == null) {
|
||||||
|
showToast("未查询到工作面数据")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
faceDetail?.let {
|
||||||
|
loadDetail(it)
|
||||||
|
}
|
||||||
|
initMiningList(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkFaceType.SEE.name -> {
|
||||||
|
currentFaceType = WorkFaceType.SEE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBinding.rvFaceList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = addFaceAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
// mBinding.tvSeamName.setOnClickListener { v ->
|
||||||
|
|
||||||
|
// }
|
||||||
|
// mBinding.tvAreaName.setOnClickListener { v ->
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private var seamAreaList: MutableList<WorkOption> = mutableListOf()
|
||||||
|
|
||||||
|
private fun numToString(num: Int): String {
|
||||||
|
return if (num < 10) "0${num}" else num.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.btnConfirm.setOnClickListener {
|
||||||
|
if (currentFaceType == WorkFaceType.ADD) {
|
||||||
|
addNewFace()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
if (currentFaceType == WorkFaceType.EDIT) {
|
||||||
|
editFace()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private var workingFaceEntity: MiningWorkingFaceEntity?=null
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
launch {
|
||||||
|
workingFaceViewModel.insertOne.collectLatest{
|
||||||
|
showToast("工作面新增完成")
|
||||||
|
workingFaceEntity?.let {
|
||||||
|
EventBus.getDefault().post(workingFaceEntity!!)
|
||||||
|
}
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
when (v?.id) {
|
||||||
|
// R.id.imgExpand -> {
|
||||||
|
// if (mBinding.expandLayout.isGone) {
|
||||||
|
// mBinding.expandLayout.visible()
|
||||||
|
// mBinding.imgExpand.setImageResource(R.drawable.ic_arrow_up_white2)
|
||||||
|
// } else {
|
||||||
|
// mBinding.expandLayout.gone()
|
||||||
|
// mBinding.imgExpand.setImageResource(R.drawable.ic_arrow_down_white2)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadDetail(it: MiningWorkingFaceEntity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addNewFace() {
|
||||||
|
workingFaceEntity = MiningWorkingFaceEntity().also {
|
||||||
|
it.surfaceId = System.currentTimeMillis()
|
||||||
|
it.surfaceName = miningList[0].funcValue
|
||||||
|
it.userId = SpTool.getString(SpTool.USER_ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
workingFaceViewModel.insert(workingFaceEntity!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun editFace() {
|
||||||
|
// workingFaceViewModel.update(workingFaceEntity) {
|
||||||
|
// showToast("工作面修改完成")
|
||||||
|
// EventBus.getDefault().post(workingFaceEntity)
|
||||||
|
// finish()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun string2num(text: String?): Long {
|
||||||
|
return if (text.isNullOrBlank()) 0 else text.toLong()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initMiningList(isFirst: Boolean) {
|
||||||
|
miningList.run {
|
||||||
|
if (isFirst) {
|
||||||
|
add(AddMiningFaceItem(funcName = "工作面名称", isShowArrowDown = true))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
add(AddMiningFaceItem(funcName = "工作面名称", isShowArrowDown = false))
|
||||||
|
add(AddMiningFaceItem(funcName = "水平", funcType = 1, onClick = { selectHorizontalPlane() }))
|
||||||
|
add(AddMiningFaceItem(funcName = "煤层", funcType = 1, onClick = { selectSeam() }))
|
||||||
|
add(AddMiningFaceItem(funcName = "采区", funcType = 1, onClick = { selectArea() }))
|
||||||
|
add(AddMiningFaceItem(funcName = "储量"))
|
||||||
|
add(AddMiningFaceItem(funcName = "胶运巷安全出口宽度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "回风巷安全出口宽度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "走向长度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "倾向长度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "胶带巷长度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "回风巷长度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "切眼长度"))
|
||||||
|
add(AddMiningFaceItem(funcName = "平均煤厚"))
|
||||||
|
add(AddMiningFaceItem(funcName = "容积"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun selectArea() {
|
||||||
|
if (seamAreaList.isEmpty()) {
|
||||||
|
showToast("请先选择所属煤层")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
PickerUtil.showOptionPicker(this, "请选择所属采区域", seamAreaList) { option ->
|
||||||
|
miningList[3].let {
|
||||||
|
it.funcValue = option.name
|
||||||
|
it.funcId = option.id
|
||||||
|
}
|
||||||
|
addFaceAdapter.notifyItemChanged(3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun selectSeam() {
|
||||||
|
PickerUtil.showOptionPicker(this, "请选择所属煤层", DictUtils.seamList) { option ->
|
||||||
|
miningList[2].let {
|
||||||
|
it.funcValue = option.name
|
||||||
|
it.funcId = option.id
|
||||||
|
}
|
||||||
|
addFaceAdapter.notifyItemChanged(2)
|
||||||
|
seamAreaList = DictUtils.areaMap[option.id] ?: mutableListOf()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun selectHorizontalPlane() {
|
||||||
|
val list = mutableListOf<WorkOption>()
|
||||||
|
list.add(WorkOption("1","A"))
|
||||||
|
list.add(WorkOption("2","B"))
|
||||||
|
list.add(WorkOption("3","C"))
|
||||||
|
list.add(WorkOption("4","D"))
|
||||||
|
list.add(WorkOption("5","E"))
|
||||||
|
PickerUtil.showOptionPicker(this, "请选择水平", list) { option ->
|
||||||
|
miningList[1].let {
|
||||||
|
it.funcValue = option.name
|
||||||
|
it.funcId = option.id
|
||||||
|
}
|
||||||
|
addFaceAdapter.notifyItemChanged(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+251
@@ -0,0 +1,251 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining.activity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.MiningWorkingFaceAdapter
|
||||||
|
import com.zmkg.coaloperation.adapter.MiningWorkingFaceRecordAdapter
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceAdapter
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceRecordAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityMiningBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceRecordViewModel
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceViewModel
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.AddMiningFaceActivity.Companion.WORK_FACE_TYPE
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.AddMiningFaceActivity.WorkFaceType
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.activity.AddWorkingFaceRecordActivity
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceStatisticsActivity
|
||||||
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回采首页列表
|
||||||
|
*/
|
||||||
|
class MiningActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityMiningBinding>(R.layout.activity_mining) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "MiningActivity"
|
||||||
|
}
|
||||||
|
|
||||||
|
private val workingFaceViewModel: MiningWorkingFaceViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[MiningWorkingFaceViewModel::class.java]
|
||||||
|
}
|
||||||
|
private val workingFaceRecordViewModel: MiningWorkingFaceRecordViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[MiningWorkingFaceRecordViewModel::class.java]
|
||||||
|
}
|
||||||
|
private val workingFaceList = mutableListOf<MiningWorkingFaceEntity>()
|
||||||
|
|
||||||
|
private val workingFaceAdapter: MiningWorkingFaceAdapter by lazy {
|
||||||
|
MiningWorkingFaceAdapter(workingFaceList).apply {
|
||||||
|
setOnItemChildClickListener { _, view, position ->
|
||||||
|
if (view.id == R.id.llWorkingFace) {
|
||||||
|
toActivity(MiningFaceStatisticsActivity::class.java, Bundle().apply {
|
||||||
|
putParcelable(
|
||||||
|
WorkingFaceStatisticsActivity.FACE_DETAIL,
|
||||||
|
workingFaceList[position]
|
||||||
|
)
|
||||||
|
})
|
||||||
|
return@setOnItemChildClickListener
|
||||||
|
}
|
||||||
|
if (view.id == R.id.ivExpandRecord) {
|
||||||
|
val expandState = view.tag.toString().toBooleanStrictOrNull() ?: false
|
||||||
|
workingFaceList[position].isExpandRecord = expandState.not()
|
||||||
|
if (workingFaceList[position].isExpandRecord) {
|
||||||
|
getFaceRecord(position)
|
||||||
|
} else {
|
||||||
|
notifyItemChanged(position)
|
||||||
|
}
|
||||||
|
return@setOnItemChildClickListener
|
||||||
|
}
|
||||||
|
if (view.id == R.id.start_record) {
|
||||||
|
toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||||
|
putString(
|
||||||
|
MiningFaceRecordActivity.WORK_RECORD_TYPE,
|
||||||
|
MiningFaceRecordActivity.WorkRecordType.ADD.name
|
||||||
|
)
|
||||||
|
putLong(
|
||||||
|
MiningFaceRecordActivity.FACE_ID,
|
||||||
|
workingFaceList[position].surfaceId
|
||||||
|
)
|
||||||
|
putString(
|
||||||
|
MiningFaceRecordActivity.FACE_NAME,
|
||||||
|
workingFaceList[position].surfaceName
|
||||||
|
)
|
||||||
|
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "回采上报"
|
||||||
|
mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
|
mBinding.rvMiningList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = workingFaceAdapter
|
||||||
|
}
|
||||||
|
val surfaceId01 = System.currentTimeMillis()
|
||||||
|
val surfaceId02 = System.currentTimeMillis()
|
||||||
|
val surfaceId03 = System.currentTimeMillis()
|
||||||
|
val recordList = mutableListOf<MiningWorkingFaceRecordEntity>()
|
||||||
|
recordList.add(
|
||||||
|
MiningWorkingFaceRecordEntity(
|
||||||
|
recordId = System.currentTimeMillis(),
|
||||||
|
surfaceId = surfaceId01,
|
||||||
|
recordPerson = "张三",
|
||||||
|
workingDate = "2025-09-19 10:50:15"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
recordList.add(
|
||||||
|
MiningWorkingFaceRecordEntity(
|
||||||
|
recordId = System.currentTimeMillis(),
|
||||||
|
surfaceId = surfaceId01,
|
||||||
|
recordPerson = "李四",
|
||||||
|
workingDate = "2025-09-19 15:10:39"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
workingFaceList.add(
|
||||||
|
MiningWorkingFaceEntity(
|
||||||
|
surfaceId = surfaceId01,
|
||||||
|
surfaceName = "250919回采工作面",
|
||||||
|
totalFootage = "256",
|
||||||
|
createTime = "2025-09-19 10:27:43",
|
||||||
|
records = recordList
|
||||||
|
)
|
||||||
|
)
|
||||||
|
workingFaceList.add(
|
||||||
|
MiningWorkingFaceEntity(
|
||||||
|
surfaceId = surfaceId02,
|
||||||
|
surfaceName = "250901回采工作面",
|
||||||
|
totalFootage = "256",
|
||||||
|
createTime = "2025-09-01 08:20:43"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
workingFaceList.add(
|
||||||
|
MiningWorkingFaceEntity(
|
||||||
|
surfaceId = surfaceId03,
|
||||||
|
surfaceName = "250810回采工作面",
|
||||||
|
totalFootage = "256",
|
||||||
|
createTime = "2025-09-19 09:09:03"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
workingFaceAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
val userId = SpTool.getString(SpTool.USER_ID)
|
||||||
|
workingFaceViewModel.getEntityListByUserId(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(AddMiningFaceActivity::class.java, Bundle().apply {
|
||||||
|
putString(WORK_FACE_TYPE, WorkFaceType.ADD.name)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun getFaceRecord(position: Int) {
|
||||||
|
workingFaceAdapter.notifyItemChanged(position)
|
||||||
|
// val surfaceId = workingFaceList[position].surfaceId
|
||||||
|
// workingFaceRecordViewModel.getEntityList(surfaceId) { recordEntities ->
|
||||||
|
// if (recordEntities.isNullOrEmpty()) {
|
||||||
|
// workingFaceAdapter.notifyItemChanged(position)
|
||||||
|
// return@getEntityList
|
||||||
|
// }
|
||||||
|
// val recordAdapter = getRecordAdapter(position)
|
||||||
|
// recordAdapter.apply {
|
||||||
|
// list.clear()
|
||||||
|
//// list.add(FACE_RECORD_HEADER)
|
||||||
|
// list.addAll(recordEntities)
|
||||||
|
// notifyDataSetChanged()
|
||||||
|
// }
|
||||||
|
// workingFaceAdapter.notifyItemChanged(position)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||||
|
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||||
|
if (index == -1) {
|
||||||
|
//新增工作面
|
||||||
|
val insertIndex = 0
|
||||||
|
workingFaceList.add(0, event)
|
||||||
|
workingFaceAdapter.notifyItemInserted(insertIndex)
|
||||||
|
workingFaceAdapter.notifyItemRangeChanged(insertIndex, insertIndex + 1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//修改工作面
|
||||||
|
// workingFaceViewModel.getEntityById(event.surfaceId) { entity ->
|
||||||
|
// workingFaceList[index] = entity
|
||||||
|
// workingFaceAdapter.notifyItemChanged(index)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onFaceRecordEvent(event: MiningWorkingFaceRecordEntity) {
|
||||||
|
val position = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||||
|
val faceEntity = workingFaceList[position]
|
||||||
|
if (faceEntity.isExpandRecord.not()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
faceEntity.records?.let { records ->
|
||||||
|
val index = records.indexOfFirst { it.recordId == event.recordId }
|
||||||
|
if (index == -1) {
|
||||||
|
records.add(0, event)
|
||||||
|
} else {
|
||||||
|
records[index] = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val recordAdapter = getRecordAdapter(position)
|
||||||
|
recordAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
workingFaceAdapter.notifyItemChanged(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SuspiciousIndentation")
|
||||||
|
private fun getRecordAdapter(position: Int): MiningWorkingFaceRecordAdapter {
|
||||||
|
val viewHolder =
|
||||||
|
mBinding.rvMiningList.findViewHolderForLayoutPosition(position) as MiningWorkingFaceAdapter.VH
|
||||||
|
return viewHolder.binding.rvFaceRecord.adapter as MiningWorkingFaceRecordAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
launch {
|
||||||
|
workingFaceViewModel.faceList.collectLatest {
|
||||||
|
Log.d(TAG, "createObserve: ${it.toJsonString()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining.activity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityMiningFaceDetailBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面详情
|
||||||
|
*/
|
||||||
|
class MiningFaceDetailActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityMiningFaceDetailBinding>(R.layout.activity_mining_face_detail) {
|
||||||
|
companion object {
|
||||||
|
const val FACE_WORK_DETAIL_DATA = "MiningFaceDetailActivity"
|
||||||
|
}
|
||||||
|
|
||||||
|
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||||
|
|
||||||
|
// private var detail:FaceWorkDetailBean?=null
|
||||||
|
private var detail: MiningWorkingFaceEntity? = null
|
||||||
|
private val adapter by lazy {
|
||||||
|
TunnelWorkingItemAdapter(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||||
|
mBinding.toolbarLay.rightText = "修改"
|
||||||
|
|
||||||
|
mBinding.rvFaceList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||||
|
it.adapter = adapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
detail = intent.getParcelableExtra(FACE_WORK_DETAIL_DATA)
|
||||||
|
detail?.let {
|
||||||
|
loadFaceDetail(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(AddMiningFaceActivity::class.java, Bundle().apply {
|
||||||
|
putString(AddMiningFaceActivity.WORK_FACE_TYPE, AddMiningFaceActivity.WorkFaceType.EDIT.name)
|
||||||
|
putParcelable(AddMiningFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun loadFaceDetail(it: MiningWorkingFaceEntity) {
|
||||||
|
mBinding.toolbarLay.title = it.surfaceName
|
||||||
|
list.clear()
|
||||||
|
list.add(TunnelWorkingItem(name = "工作面名称", value = it.surfaceName))
|
||||||
|
list.add(TunnelWorkingItem(name = "水平", value = "水平"))
|
||||||
|
list.add(TunnelWorkingItem(name = "煤层", value = "煤层"))
|
||||||
|
list.add(TunnelWorkingItem(name = "采区", value = "采区"))
|
||||||
|
list.add(TunnelWorkingItem(name = "储量", value = "储量"))
|
||||||
|
list.add(TunnelWorkingItem(name = "胶带巷安全出口宽度", value = "宽度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "回风巷安全出口宽度", value = "宽度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "走向长度", value = "长度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "倾向长度", value = "长度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "胶带巷长度", value = "长度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "回风巷长度", value = "长度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "切眼长度", value = "长度"))
|
||||||
|
list.add(TunnelWorkingItem(name = "平均煤厚", value = "煤厚"))
|
||||||
|
list.add(TunnelWorkingItem(name = "平均煤厚", value = "容积"))
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||||
|
detail = event
|
||||||
|
detail?.let {
|
||||||
|
loadFaceDetail(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining.activity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.MiningRecordBaseDataAdapter
|
||||||
|
import com.zmkg.coaloperation.adapter.MiningRecordCoalThicknessAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||||
|
import com.zmkg.coaloperation.bean.CoalThicknessItem
|
||||||
|
import com.zmkg.coaloperation.bean.WorkOption
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityMiningFaceRecordBinding
|
||||||
|
import com.zmkg.coaloperation.utils.PickerUtil
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
class MiningFaceRecordActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityMiningFaceRecordBinding>(R.layout.activity_mining_face_record) {
|
||||||
|
companion object {
|
||||||
|
const val TAG = "MiningFaceRecordActivity"
|
||||||
|
const val SHOW_TYPE = "showType"
|
||||||
|
const val WORK_RECORD_TYPE = "workRecordType"
|
||||||
|
const val FACE_NAME = "faceName"
|
||||||
|
const val FACE_ID = "faceId"
|
||||||
|
const val FACE_RECORD = "faceRecord"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class WorkRecordType {
|
||||||
|
ADD,//新增
|
||||||
|
|
||||||
|
EDIT,//修改
|
||||||
|
|
||||||
|
SEE//查看
|
||||||
|
}
|
||||||
|
|
||||||
|
private var currentRecordType = WorkRecordType.ADD
|
||||||
|
private val baseDataList: MutableList<AddMiningFaceItem> = mutableListOf()
|
||||||
|
private val coalThicknessList: MutableList<CoalThicknessItem> = mutableListOf()
|
||||||
|
|
||||||
|
private val baseDataAdapter by lazy {
|
||||||
|
MiningRecordBaseDataAdapter(baseDataList)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val coalThicknessAdapter by lazy {
|
||||||
|
MiningRecordCoalThicknessAdapter(coalThicknessList).apply {
|
||||||
|
addChildClickViewIds(R.id.btnAddPoint)
|
||||||
|
setOnItemChildClickListener { adapter, view, position ->
|
||||||
|
if (view.id == R.id.btnAddPoint) {
|
||||||
|
coalThicknessList.add(CoalThicknessItem())
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.rvBaseData.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = baseDataAdapter
|
||||||
|
}
|
||||||
|
mBinding.rvCoalThickness.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = coalThicknessAdapter
|
||||||
|
}
|
||||||
|
val stringExtra = intent.getStringExtra(WORK_RECORD_TYPE)
|
||||||
|
if (TextUtils.isEmpty(stringExtra)) {
|
||||||
|
stringExtra == AddMiningFaceActivity.WorkFaceType.ADD.name
|
||||||
|
}
|
||||||
|
when (stringExtra) {
|
||||||
|
WorkRecordType.ADD.name -> {
|
||||||
|
currentRecordType = WorkRecordType.ADD
|
||||||
|
mBinding.toolbarLay.title = "开始记录"
|
||||||
|
mBinding.btnSaveRecord.text = "保存"
|
||||||
|
mBinding.btnSaveRecord.visible()
|
||||||
|
initAddRecord()
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkRecordType.EDIT.name -> {
|
||||||
|
currentRecordType = WorkRecordType.EDIT
|
||||||
|
mBinding.toolbarLay.title = "修改记录"
|
||||||
|
mBinding.btnSaveRecord.text = "修改"
|
||||||
|
mBinding.btnSaveRecord.visible()
|
||||||
|
// detail =
|
||||||
|
// intent.getParcelableExtra(WorkingFaceDetailActivity.Companion.FACE_WORK_DETAIL_DATA) as MiningWorkingFaceEntity?
|
||||||
|
// if (faceDetail == null) {
|
||||||
|
// showToast("未查询到记录数据")
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
initEditRecord()
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkRecordType.SEE.name -> {
|
||||||
|
currentRecordType = WorkRecordType.SEE
|
||||||
|
mBinding.toolbarLay.title = "查看详情"
|
||||||
|
mBinding.toolbarLay.rightText = "修改"
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||||
|
putString(WORK_RECORD_TYPE, WorkRecordType.EDIT.name)
|
||||||
|
// putParcelable(FACE_RECORD, faceRecord)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
mBinding.btnSaveRecord.gone()
|
||||||
|
initRecordDetail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
val waterOutflowList: MutableList<WorkOption> = mutableListOf()
|
||||||
|
waterOutflowList.add(WorkOption(id = "0", name = "是"))
|
||||||
|
waterOutflowList.add(WorkOption(id = "1", name = "否"))
|
||||||
|
val tvWaterOutflow = mBinding.tvWaterOutflow
|
||||||
|
tvWaterOutflow.setOnClickListener { v ->
|
||||||
|
PickerUtil.showOptionPicker(this, "请选择是否出水", waterOutflowList) { option ->
|
||||||
|
tvWaterOutflow.text = option.name
|
||||||
|
tvWaterOutflow.tag = option.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initAddRecord() {
|
||||||
|
baseDataList.run {
|
||||||
|
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||||
|
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||||
|
}
|
||||||
|
baseDataAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
coalThicknessList.run {
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
}
|
||||||
|
coalThicknessAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initEditRecord() {
|
||||||
|
baseDataList.run {
|
||||||
|
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||||
|
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||||
|
}
|
||||||
|
baseDataAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
coalThicknessList.run {
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
}
|
||||||
|
coalThicknessAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initRecordDetail() {
|
||||||
|
baseDataList.run {
|
||||||
|
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||||
|
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||||
|
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||||
|
}
|
||||||
|
baseDataAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
coalThicknessList.run {
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
add(CoalThicknessItem())
|
||||||
|
}
|
||||||
|
coalThicknessAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
+225
@@ -0,0 +1,225 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||||
|
import com.zmkg.coaloperation.adapter.common.DisasterAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityMiningFaceStatisticsBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面详情
|
||||||
|
*/
|
||||||
|
class MiningFaceStatisticsActivity :
|
||||||
|
BaseVMBActivity<TestViewModel, ActivityMiningFaceStatisticsBinding>(R.layout.activity_mining_face_statistics) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TAG = "MiningFaceStatisticsActivity"
|
||||||
|
const val FACE_DETAIL = "faceDetail"
|
||||||
|
}
|
||||||
|
|
||||||
|
// private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||||
|
// ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||||
|
// ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||||
|
// }
|
||||||
|
// private val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy {
|
||||||
|
// TunnelingRockNatureAdapter(lithologyList)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private val lithologyList:MutableList<TunnelRoofLithologyEntity> = mutableListOf()
|
||||||
|
|
||||||
|
private var faceDetail: MiningWorkingFaceEntity? = null
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.rightText = "查看详情"
|
||||||
|
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||||
|
// mBinding.rvRockNature.adapter = tunnelingRockNatureAdapter
|
||||||
|
|
||||||
|
mBinding.arcViewGreen.let {
|
||||||
|
it.arcColor = "#30E0A1".toColorInt()
|
||||||
|
it.startAngle = 0f
|
||||||
|
it.sweepAngle = 360f
|
||||||
|
it.strokeWidth = 12f
|
||||||
|
it.radius = ScreenUtil.dp2px(122f - 12f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.arcViewRed.let {
|
||||||
|
it.arcColor = "#FA2256".toColorInt()
|
||||||
|
it.startAngle = -90f
|
||||||
|
it.strokeWidth = 10f
|
||||||
|
it.sweepAngle = 0f
|
||||||
|
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.arcViewBlue.let {
|
||||||
|
it.arcColor = "#246CF9".toColorInt()
|
||||||
|
it.startAngle = -90f
|
||||||
|
it.strokeWidth = 10f
|
||||||
|
it.sweepAngle = 0f
|
||||||
|
it.radius = ScreenUtil.dp2px(80f - 10f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// val surfaceId = intent.getStringExtra("surfaceId")
|
||||||
|
// if (TextUtils.isEmpty(surfaceId)) {
|
||||||
|
// finish()
|
||||||
|
// } else {
|
||||||
|
// mViewModel.getTunnelingSurfaceDetail(surfaceId)
|
||||||
|
// }
|
||||||
|
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
||||||
|
|
||||||
|
faceDetail?.let { detail ->
|
||||||
|
loadFaceDetail()
|
||||||
|
// workingFaceRecordViewModel.getLastEntity(detail.surfaceId) { record ->
|
||||||
|
// record?.let {
|
||||||
|
// mBinding.tvYesterdayLen.text = "${it.workingFootage?.formatDecimalString()}m"
|
||||||
|
// mBinding.tvWorkingFaceAngle.text = "${it.seamDip?.formatDecimalString()}°"
|
||||||
|
//// mBinding.tvMonthAccumulateLen.text = "${it.monthFootage}m"
|
||||||
|
// mBinding.tvWorkingFaceWater.text = "${it.waterYield?.formatDecimalString()}"
|
||||||
|
//
|
||||||
|
// roofLithologyViewModel.getEntityList(it.recordId) { list ->
|
||||||
|
// list?.let {
|
||||||
|
// lithologyList.addAll(it)
|
||||||
|
// tunnelingRockNatureAdapter.notifyDataSetChanged()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(MiningFaceDetailActivity::class.java, Bundle().apply {
|
||||||
|
putParcelable(MiningFaceDetailActivity.FACE_WORK_DETAIL_DATA, faceDetail)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun stringToDouble(numText: String?): Double {
|
||||||
|
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
||||||
|
return numText.toDouble()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadFaceDetail() {
|
||||||
|
val bean = faceDetail!!
|
||||||
|
mBinding.apply {
|
||||||
|
toolbarLay.title = bean.surfaceName
|
||||||
|
bean.totalFootage = "6000"
|
||||||
|
bean.accumulativeFootage = "1400.3"
|
||||||
|
|
||||||
|
val total = stringToDouble(bean.totalFootage)
|
||||||
|
val accumulative = stringToDouble(bean.accumulativeFootage)
|
||||||
|
val remaining = total - accumulative
|
||||||
|
// val remaining = stringToDouble(bean.remainingFootage)
|
||||||
|
bean.remainingFootage = "${remaining.roundedOneDecimalPlace()}"
|
||||||
|
|
||||||
|
tvLenTotal.text = "总进尺:${bean.totalFootage?.formatDecimalString()}/吨"
|
||||||
|
tvLenAccumulate.text = "累计进尺:${bean.accumulativeFootage?.formatDecimalString()}/吨"
|
||||||
|
tvLenRemain.text = "剩余进尺:${bean.remainingFootage?.formatDecimalString()}/吨"
|
||||||
|
|
||||||
|
//累计进尺占比
|
||||||
|
var radio = 0
|
||||||
|
|
||||||
|
//累计进尺圆圈占比
|
||||||
|
var arcViewRadio: Float
|
||||||
|
|
||||||
|
if (accumulative >= total) {
|
||||||
|
radio = 100
|
||||||
|
arcViewRadio = 360F
|
||||||
|
} else if (accumulative <= 0) {
|
||||||
|
radio = 0
|
||||||
|
arcViewRadio = 0F
|
||||||
|
} else {
|
||||||
|
arcViewRadio = (accumulative * 100F / total).toFloat()
|
||||||
|
radio = arcViewRadio.roundToInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
arcViewRed.let {
|
||||||
|
it.sweepAngle = arcViewRadio
|
||||||
|
}
|
||||||
|
|
||||||
|
arcViewBlue.let {
|
||||||
|
it.sweepAngle = (360F - arcViewRadio)
|
||||||
|
//* -1F
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mBinding.tvCompleteRate.text = "$radio%"
|
||||||
|
|
||||||
|
// tvYesterdayLen.text = "${bean?.yesterdayFootage}m"
|
||||||
|
// tvWorkingFaceAngle.text = "${bean?.latestRecord?.seamDip.orEmptyDefaultInt()}"
|
||||||
|
// tvMonthAccumulateLen.text = "${bean?.monthFootage}m"
|
||||||
|
// tvWorkingFaceWater.text = "${bean?.latestRecord?.waterYield.orEmptyDefaultInt()}m"
|
||||||
|
|
||||||
|
// val list = bean?.latestRecord?.mineWorkingLithologyList
|
||||||
|
// if (list.isNullOrEmpty()) {
|
||||||
|
// tvYesterdayRockType.visibility = View.GONE
|
||||||
|
// } else {
|
||||||
|
// tvYesterdayRockType.visibility = View.VISIBLE
|
||||||
|
// tunnelingRockNatureAdapter.setNewInstance(list)
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
val workingItemList = mutableListOf<TunnelWorkingItem>()
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "昨日进尺", value = "123"))
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "出煤量", value = "12"))
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "胶运巷回采位置", value = "3"))
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "胶运巷安全出口宽度", value = "23"))
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "回风巷回采位置", value = "5"))
|
||||||
|
workingItemList.add(TunnelWorkingItem(name = "回风巷安全出口宽度", value = "56"))
|
||||||
|
mBinding.rvBaseList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = TunnelWorkingItemAdapter(workingItemList)
|
||||||
|
}
|
||||||
|
|
||||||
|
val disasterList = mutableListOf<TunnelWorkingItem>()
|
||||||
|
disasterList.add(TunnelWorkingItem(name = "AAA", value = "80"))
|
||||||
|
disasterList.add(TunnelWorkingItem(name = "BBB", value = "50"))
|
||||||
|
disasterList.add(TunnelWorkingItem(name = "CCC", value = "135"))
|
||||||
|
mBinding.rvDisasterList.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
|
it.adapter = DisasterAdapter(disasterList)
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.included.let {
|
||||||
|
it.tvItemName.text="回采工作面涌水量"
|
||||||
|
it.tvItemValue.text="3.6m³/h"
|
||||||
|
it.divider.gone()
|
||||||
|
it.root.setBackgroundResource(R.drawable.bg_stroke_gray)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||||
|
faceDetail = event
|
||||||
|
loadFaceDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+123
-123
@@ -1,123 +1,123 @@
|
|||||||
package com.zmkg.coaloperation.ui.report.adapter
|
//package com.zmkg.coaloperation.ui.report.adapter
|
||||||
|
//
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
//import com.chad.library.adapter.base.module.LoadMoreModule
|
||||||
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
//import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||||
import com.zmkg.coaloperation.R
|
//import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
//import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||||
import com.zmkg.coaloperation.bean.ImageBean
|
//import com.zmkg.coaloperation.bean.ImageBean
|
||||||
import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
//import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
//import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||||
import java.io.File
|
//import java.io.File
|
||||||
|
//
|
||||||
class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
//class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||||
R.layout.item_recycle_image
|
// R.layout.item_recycle_image
|
||||||
), LoadMoreModule {
|
//), LoadMoreModule {
|
||||||
private var isEditModel = false
|
// private var isEditModel = false
|
||||||
private var editImageShow = false
|
// private var editImageShow = false
|
||||||
override fun bindViewClickListener(
|
// override fun bindViewClickListener(
|
||||||
viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
// viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||||
viewType: Int
|
// viewType: Int
|
||||||
) {
|
// ) {
|
||||||
addChildClickViewIds(R.id.btn_delete)
|
// addChildClickViewIds(R.id.btn_delete)
|
||||||
super.bindViewClickListener(viewHolder, viewType)
|
// super.bindViewClickListener(viewHolder, viewType)
|
||||||
}
|
// }
|
||||||
override fun convert(
|
// override fun convert(
|
||||||
holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
// holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||||
item: ImageBean
|
// item: ImageBean
|
||||||
) {
|
// ) {
|
||||||
val mBinding = holder.dataBinding
|
// val mBinding = holder.dataBinding
|
||||||
mBinding?.let {
|
// mBinding?.let {
|
||||||
if(item.isAddButton){
|
// if(item.isAddButton){
|
||||||
mBinding.ivImage.setImageResource(R.mipmap.upload)
|
// mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||||
mBinding.btnDelete.visibility = View.GONE
|
// mBinding.btnDelete.visibility = View.GONE
|
||||||
}else{
|
// }else{
|
||||||
if(item.isFilePath){
|
// if(item.isFilePath){
|
||||||
mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
// mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||||
}else{
|
// }else{
|
||||||
mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
// mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||||
}
|
// }
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
mBinding.btnDelete.visibility = View.VISIBLE
|
// mBinding.btnDelete.visibility = View.VISIBLE
|
||||||
}else{
|
// }else{
|
||||||
mBinding.btnDelete.visibility = View.GONE
|
// mBinding.btnDelete.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fun isEditModel(isEdit: Boolean){
|
// fun isEditModel(isEdit: Boolean){
|
||||||
isEditModel = isEdit
|
// isEditModel = isEdit
|
||||||
notifyDataSetChanged()
|
// notifyDataSetChanged()
|
||||||
if(isEditModel && !editImageShow){
|
// if(isEditModel && !editImageShow){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun setList(list: Collection<ImageBean>?) {
|
// override fun setList(list: Collection<ImageBean>?) {
|
||||||
super.setList(list)
|
// super.setList(list)
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
override fun setNewInstance(list: MutableList<ImageBean>?) {
|
// override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||||
super.setNewInstance(list)
|
// super.setNewInstance(list)
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun addData(newData: Collection<ImageBean>) {
|
// override fun addData(newData: Collection<ImageBean>) {
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
if(editImageShow){
|
// if(editImageShow){
|
||||||
var lastPosition = data.size - 1
|
// var lastPosition = data.size - 1
|
||||||
if(lastPosition < 0){
|
// if(lastPosition < 0){
|
||||||
lastPosition = 0
|
// lastPosition = 0
|
||||||
}
|
// }
|
||||||
addData(lastPosition, newData)
|
// addData(lastPosition, newData)
|
||||||
}else{
|
// }else{
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
if(data.size > maxNum){
|
// if(data.size > maxNum){
|
||||||
showAddButton(false)
|
// showAddButton(false)
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
super.addData(newData)
|
// super.addData(newData)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun removeAt(position: Int) {
|
// override fun removeAt(position: Int) {
|
||||||
super.removeAt(position)
|
// super.removeAt(position)
|
||||||
if(isEditModel && !editImageShow){
|
// if(isEditModel && !editImageShow){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fun getImageList(): MutableList<ImageBean>{
|
// fun getImageList(): MutableList<ImageBean>{
|
||||||
var list = mutableListOf<ImageBean>()
|
// var list = mutableListOf<ImageBean>()
|
||||||
data.forEach { imageBean ->
|
// data.forEach { imageBean ->
|
||||||
if(!imageBean.isAddButton){
|
// if(!imageBean.isAddButton){
|
||||||
list.add(imageBean)
|
// list.add(imageBean)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return list
|
// return list
|
||||||
}
|
// }
|
||||||
fun getImageSize(): Int {
|
// fun getImageSize(): Int {
|
||||||
if(isEditModel && editImageShow){
|
// if(isEditModel && editImageShow){
|
||||||
return getDefItemCount() - 1
|
// return getDefItemCount() - 1
|
||||||
}
|
// }
|
||||||
return getDefItemCount()
|
// return getDefItemCount()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 显示添加图片按钮
|
// * 显示添加图片按钮
|
||||||
* @param isShow true为显示 false为隐藏
|
// * @param isShow true为显示 false为隐藏
|
||||||
*/
|
// */
|
||||||
private fun showAddButton(isShow: Boolean){
|
// private fun showAddButton(isShow: Boolean){
|
||||||
editImageShow = if(isShow){
|
// editImageShow = if(isShow){
|
||||||
addData(ImageBean(isAddButton = true))
|
// addData(ImageBean(isAddButton = true))
|
||||||
true
|
// true
|
||||||
}else{
|
// }else{
|
||||||
removeAt(data.size-1)
|
// removeAt(data.size-1)
|
||||||
false
|
// false
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.report.fragment
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.ReportAdapter
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
|
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||||
|
import com.zmkg.coaloperation.bean.ReportItem
|
||||||
|
import com.zmkg.coaloperation.databinding.FragmentReport2Binding
|
||||||
|
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||||
|
import com.zmkg.coaloperation.utils.dp
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
|
||||||
|
class Report2Fragment :
|
||||||
|
BaseVMBFragment<ReportViewModel, FragmentReport2Binding>(R.layout.fragment_report2) {
|
||||||
|
|
||||||
|
lateinit var pageStatus: PageStatus
|
||||||
|
|
||||||
|
enum class PageStatus(val status: Int) {
|
||||||
|
ADD(1),
|
||||||
|
EDIT(2),
|
||||||
|
SEE(3),
|
||||||
|
NO_EDIT(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val reportItemList = mutableListOf(
|
||||||
|
ReportItem(viewType = 2, name = "上报类型"),
|
||||||
|
ReportItem(viewType = 2, name = "上报区域"),
|
||||||
|
ReportItem(viewType = 1, name = "上报地点", isSingleLine = true, inputHint = "请输入"),
|
||||||
|
ReportItem(viewType = 1, name = "上报描述", isSingleLine = true, inputHint = "请输入"),
|
||||||
|
ReportItem(viewType = 3, name = "上报时间"),
|
||||||
|
ReportItem(viewType = 2, name = "处理状态"),
|
||||||
|
ReportItem(viewType = 2, name = "上报人"),
|
||||||
|
ReportItem(viewType = 2, name = "处理人"),
|
||||||
|
ReportItem(viewType = 1, name = "处理策略", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||||
|
ReportItem(viewType = 1, name = "处理结果", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||||
|
ReportItem(viewType = 3, name = "处理时间"),
|
||||||
|
ReportItem(viewType = 4, name = "上传图片", images = mutableListOf(
|
||||||
|
CommonImageBean(isAddFlag = true)
|
||||||
|
)),
|
||||||
|
ReportItem(viewType = 1, name = "备注", isSingleLine = false, inputShowLines = 6 ,inputHint = "请输入备注信息,120字以内"),
|
||||||
|
)
|
||||||
|
private val reportAdapter by lazy {
|
||||||
|
ReportAdapter(reportItemList)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.title = "新增临时上报"
|
||||||
|
mBinding.toolbarLay.rightText = "查看记录"
|
||||||
|
mBinding.toolbarLay.titleIvBack.gone()
|
||||||
|
mBinding.toolbarLay.titleTvName.updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||||
|
leftMargin = 20.dp
|
||||||
|
}
|
||||||
|
mBinding.rvReport.let {
|
||||||
|
it.layoutManager = LinearLayoutManager(it.context)
|
||||||
|
it.adapter = reportAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun transparentStatusBar(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+203
-199
@@ -1,200 +1,204 @@
|
|||||||
package com.zmkg.coaloperation.ui.report.fragment
|
//package com.zmkg.coaloperation.ui.report.fragment
|
||||||
|
//
|
||||||
import android.os.Bundle
|
//import android.os.Bundle
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import androidx.core.view.ViewCompat
|
//import androidx.core.view.ViewCompat
|
||||||
import androidx.lifecycle.Lifecycle
|
//import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
//import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
//import androidx.lifecycle.repeatOnLifecycle
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
//import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
//import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
//import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
//import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
//import com.luck.picture.lib.basic.PictureSelectionModel
|
||||||
import com.luck.picture.lib.basic.PictureSelector
|
//import com.luck.picture.lib.basic.PictureSelector
|
||||||
import com.luck.picture.lib.config.SelectMimeType
|
//import com.luck.picture.lib.config.SelectMimeType
|
||||||
import com.luck.picture.lib.config.SelectModeConfig
|
//import com.luck.picture.lib.config.SelectModeConfig
|
||||||
import com.luck.picture.lib.entity.LocalMedia
|
//import com.luck.picture.lib.entity.LocalMedia
|
||||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
//import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||||
import com.luck.picture.lib.utils.SandboxTransformUtils
|
//import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||||
import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
//import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||||
import com.zmkg.coaloperation.R
|
//import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
//import com.zmkg.coaloperation.base.BaseActivity
|
||||||
import com.zmkg.coaloperation.bean.ImageBean
|
//import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
//import com.zmkg.coaloperation.bean.ImageBean
|
||||||
import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
//import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
//import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||||
import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
//import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
//import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||||
import kotlinx.coroutines.launch
|
//import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||||
|
//import kotlinx.coroutines.flow.collectLatest
|
||||||
class ReportFragment :
|
//import kotlinx.coroutines.launch
|
||||||
BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
//
|
||||||
OnItemClickListener, OnItemChildClickListener {
|
//class ReportFragment :
|
||||||
|
// BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||||
private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
// OnItemClickListener, OnItemChildClickListener {
|
||||||
lateinit var pageStatus: PageStatus
|
//
|
||||||
|
// private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||||
companion object {
|
// lateinit var pageStatus: PageStatus
|
||||||
const val maxImageNum = 5
|
//
|
||||||
}
|
// companion object {
|
||||||
|
// const val maxImageNum = 5
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
// }
|
||||||
|
//
|
||||||
mBinding.apply {
|
// override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
val gridLayoutManager = GridLayoutManager(context, 3)
|
//
|
||||||
layInspectionReport.rvList.layoutManager = gridLayoutManager
|
// mBinding.apply {
|
||||||
imageAdapter.setOnItemClickListener(this@ReportFragment)
|
// val gridLayoutManager = GridLayoutManager(context, 3)
|
||||||
imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
// layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||||
mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
// imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
// imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||||
}
|
// mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||||
|
// ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||||
setPageModel(PageStatus.ADD)
|
// }
|
||||||
|
//
|
||||||
}
|
// setPageModel(PageStatus.ADD)
|
||||||
|
//
|
||||||
enum class PageStatus(val status: Int) {
|
// }
|
||||||
ADD(1),
|
//
|
||||||
EDIT(2),
|
// enum class PageStatus(val status: Int) {
|
||||||
SEE(3),
|
// ADD(1),
|
||||||
NO_EDIT(4)
|
// EDIT(2),
|
||||||
}
|
// SEE(3),
|
||||||
|
// NO_EDIT(4)
|
||||||
private fun setPageModel(status: PageStatus) {
|
// }
|
||||||
this.pageStatus = status
|
//
|
||||||
mBinding?.apply {
|
// private fun setPageModel(status: PageStatus) {
|
||||||
when (status) {
|
// this.pageStatus = status
|
||||||
PageStatus.ADD -> {
|
// mBinding?.apply {
|
||||||
lifecycleScope.launch {
|
// when (status) {
|
||||||
mViewModel.noEdit.emit(false)
|
// PageStatus.ADD -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(false)
|
||||||
|
// }
|
||||||
PageStatus.EDIT -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(false)
|
// PageStatus.EDIT -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
|
// mViewModel.noEdit.emit(false)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
PageStatus.SEE -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(true)
|
// PageStatus.SEE -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(true)
|
||||||
|
// }
|
||||||
PageStatus.NO_EDIT -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(true)
|
// PageStatus.NO_EDIT -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
override fun bindEvent() {
|
//
|
||||||
}
|
//
|
||||||
|
// override fun bindEvent() {
|
||||||
override fun onClick(v: View?) {
|
// }
|
||||||
}
|
//
|
||||||
|
// override fun onClick(v: View?) {
|
||||||
override fun transparentStatusBar(): Boolean {
|
// }
|
||||||
return true
|
//
|
||||||
}
|
// override fun transparentStatusBar(): Boolean {
|
||||||
|
// return true
|
||||||
override fun createObserve() {
|
// }
|
||||||
super.createObserve()
|
//
|
||||||
lifecycleScope.launch {
|
// override fun createObserve() {
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
// super.createObserve()
|
||||||
mViewModel.noEdit.collectLatest { noEdit ->
|
// lifecycleScope.launch {
|
||||||
mBinding.apply {
|
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
imageAdapter.isEditModel(!noEdit)
|
// mViewModel.noEdit.collectLatest { noEdit ->
|
||||||
}
|
// mBinding.apply {
|
||||||
}
|
// imageAdapter.isEditModel(!noEdit)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
// }
|
||||||
val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
//
|
||||||
imageBean?.let { it ->
|
// override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||||
if (it.isAddButton) {
|
// val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||||
initPictureSelectorModel()
|
// imageBean?.let { it ->
|
||||||
.forResult(object : OnResultCallbackListener<LocalMedia?> {
|
// if (it.isAddButton) {
|
||||||
override fun onResult(result: ArrayList<LocalMedia?>?) {
|
// StorageUtils.requestPermission(context as BaseActivity) {
|
||||||
result?.let { list ->
|
// initPictureSelectorModel()
|
||||||
var resultList = localMediaToImageList(list)
|
// .forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||||
imageAdapter.addData(resultList)
|
// override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||||
setImageNum(imageAdapter.getImageSize())
|
// result?.let { list ->
|
||||||
}
|
// var resultList = localMediaToImageList(list)
|
||||||
}
|
// imageAdapter.addData(resultList)
|
||||||
|
// setImageNum(imageAdapter.getImageSize())
|
||||||
override fun onCancel() {}
|
// }
|
||||||
})
|
// }
|
||||||
} else {
|
//
|
||||||
// startFullScreenImageActivity(
|
// override fun onCancel() {}
|
||||||
// it.isFilePath,
|
// })
|
||||||
// it.imageUrl
|
// }
|
||||||
|
// } else {
|
||||||
|
//// startFullScreenImageActivity(
|
||||||
|
//// it.isFilePath,
|
||||||
|
//// it.imageUrl
|
||||||
|
//// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fun setImageNum(size: Int) {
|
||||||
|
// mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||||
|
// R.string.image_list_num,
|
||||||
|
// size,
|
||||||
|
// maxImageNum
|
||||||
// )
|
// )
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
}
|
// private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||||
|
// return PictureSelector.create(this)
|
||||||
fun setImageNum(size: Int) {
|
// .openGallery(SelectMimeType.TYPE_IMAGE)
|
||||||
mBinding.layInspectionReport.tvImageNum.text = getString(
|
// .setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||||
R.string.image_list_num,
|
// .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||||
size,
|
// .setCompressEngine(ImageFileCompressEngine())
|
||||||
maxImageNum
|
// .setImageEngine(GlideEngine.createGlideEngine())
|
||||||
)
|
// .setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||||
}
|
// if (call != null) {
|
||||||
|
// var sandboxPath =
|
||||||
private fun initPictureSelectorModel(): PictureSelectionModel {
|
// SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||||
return PictureSelector.create(this)
|
// call.onCallback(srcPath, sandboxPath)
|
||||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
// }
|
||||||
.setSelectionMode(SelectModeConfig.MULTIPLE)
|
// }
|
||||||
.setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
// }
|
||||||
.setCompressEngine(ImageFileCompressEngine())
|
//
|
||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
//
|
||||||
.setSandboxFileEngine { context, srcPath, mineType, call ->
|
//
|
||||||
if (call != null) {
|
//
|
||||||
var sandboxPath =
|
// override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||||
SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
// adapter.removeAt(position)
|
||||||
call.onCallback(srcPath, sandboxPath)
|
// }
|
||||||
}
|
//
|
||||||
}
|
// fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||||
}
|
// var imageList = mutableListOf<ImageBean>()
|
||||||
|
// var imageBean: ImageBean
|
||||||
|
// result.forEach {
|
||||||
|
// it?.let {
|
||||||
|
// imageBean = ImageBean(getImagePath(it), true)
|
||||||
override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
// imageList.add(imageBean)
|
||||||
adapter.removeAt(position)
|
// }
|
||||||
}
|
// }
|
||||||
|
// return imageList
|
||||||
fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
// }
|
||||||
var imageList = mutableListOf<ImageBean>()
|
//
|
||||||
var imageBean: ImageBean
|
// private fun getImagePath(localMedia: LocalMedia): String {
|
||||||
result.forEach {
|
// if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||||
it?.let {
|
// return localMedia.cutPath
|
||||||
imageBean = ImageBean(getImagePath(it), true)
|
// }
|
||||||
imageList.add(imageBean)
|
// if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||||
}
|
// return localMedia.compressPath
|
||||||
}
|
// }
|
||||||
return imageList
|
// if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||||
}
|
// return localMedia.sandboxPath
|
||||||
|
// }
|
||||||
private fun getImagePath(localMedia: LocalMedia): String {
|
// return localMedia.path
|
||||||
if (!localMedia.cutPath.isNullOrEmpty()) {
|
// }
|
||||||
return localMedia.cutPath
|
//}
|
||||||
}
|
|
||||||
if (!localMedia.compressPath.isNullOrEmpty()) {
|
|
||||||
return localMedia.compressPath
|
|
||||||
}
|
|
||||||
if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
|
||||||
return localMedia.sandboxPath
|
|
||||||
}
|
|
||||||
return localMedia.path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+9
-26
@@ -4,28 +4,21 @@ import android.os.Bundle
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.core.view.isGone
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import com.zmkg.coaloperation.databinding.ActivityWorkFaceBinding
|
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
|
||||||
import com.zmkg.coaloperation.event.TunnelingWorkFaceRefreshEvent
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
|
||||||
import androidx.core.view.isGone
|
|
||||||
import com.zmkg.coaloperation.bean.WorkOption
|
import com.zmkg.coaloperation.bean.WorkOption
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityAddWorkingFaceBinding
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
import com.zmkg.coaloperation.utils.PickerUtil
|
import com.zmkg.coaloperation.utils.PickerUtil
|
||||||
import com.zmkg.coaloperation.utils.gone
|
import com.zmkg.coaloperation.utils.gone
|
||||||
import com.zmkg.coaloperation.utils.visible
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
@@ -33,8 +26,8 @@ import java.time.LocalDateTime
|
|||||||
/**
|
/**
|
||||||
* 工作面
|
* 工作面
|
||||||
*/
|
*/
|
||||||
class WorkFaceActivity :
|
class AddWorkingFaceActivity :
|
||||||
BaseVMBActivity<TunnelingViewModel, ActivityWorkFaceBinding>(R.layout.activity_work_face) {
|
BaseVMBActivity<TunnelingViewModel, ActivityAddWorkingFaceBinding>(R.layout.activity_add_working_face) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "WorkFaceActivity"
|
private const val TAG = "WorkFaceActivity"
|
||||||
@@ -79,7 +72,7 @@ class WorkFaceActivity :
|
|||||||
mBinding.expandLayout.visible()
|
mBinding.expandLayout.visible()
|
||||||
mBinding.imgExpand.gone()
|
mBinding.imgExpand.gone()
|
||||||
faceDetail =
|
faceDetail =
|
||||||
intent.getParcelableExtra(WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA) as TunnelWorkingFaceEntity?
|
intent.getParcelableExtra(WorkingFaceDetailActivity.FACE_WORK_DETAIL_DATA) as TunnelWorkingFaceEntity?
|
||||||
if (faceDetail == null) {
|
if (faceDetail == null) {
|
||||||
showToast("未查询到工作面数据")
|
showToast("未查询到工作面数据")
|
||||||
return
|
return
|
||||||
@@ -170,16 +163,6 @@ class WorkFaceActivity :
|
|||||||
|
|
||||||
override fun createObserve() {
|
override fun createObserve() {
|
||||||
super.createObserve()
|
super.createObserve()
|
||||||
lifecycleScope.launch {
|
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
|
||||||
mViewModel.tunnelingWorkFaceAdd.collectLatest {
|
|
||||||
showToast("新增成功")
|
|
||||||
EventBus.getDefault().post(TunnelingWorkFaceRefreshEvent())
|
|
||||||
delay(200)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processClick(v: View?) {
|
override fun processClick(v: View?) {
|
||||||
+124
-57
@@ -10,17 +10,23 @@ import com.zmkg.coaloperation.R
|
|||||||
import com.zmkg.coaloperation.adapter.TunnelRoofLithologyAdapter
|
import com.zmkg.coaloperation.adapter.TunnelRoofLithologyAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
import com.zmkg.coaloperation.databinding.ActivityAddWorkingPointBinding
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.databinding.ActivityAddWorkingFaceRecordBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
|
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||||
|
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||||
import com.zmkg.coaloperation.superfuntion.toJson
|
import com.zmkg.coaloperation.superfuntion.toJson
|
||||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
import com.zmkg.coaloperation.utils.ExcelExportUtils
|
||||||
|
import com.zmkg.coaloperation.utils.FileUtils
|
||||||
import com.zmkg.coaloperation.utils.KeyboardUtil
|
import com.zmkg.coaloperation.utils.KeyboardUtil
|
||||||
import com.zmkg.coaloperation.utils.PickerUtil
|
import com.zmkg.coaloperation.utils.PickerUtil
|
||||||
import com.zmkg.coaloperation.utils.clickWithDebounce
|
import com.zmkg.coaloperation.utils.clickWithDebounce
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
@@ -29,8 +35,8 @@ import java.time.LocalDateTime
|
|||||||
/**
|
/**
|
||||||
* 开始记录
|
* 开始记录
|
||||||
*/
|
*/
|
||||||
class AddWorkingPointActivity :
|
class AddWorkingFaceRecordActivity :
|
||||||
BaseVMBActivity<TestViewModel, ActivityAddWorkingPointBinding>(R.layout.activity_add_working_point) {
|
BaseVMBActivity<TestViewModel, ActivityAddWorkingFaceRecordBinding>(R.layout.activity_add_working_face_record) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "AddWorkingPointActivity"
|
const val TAG = "AddWorkingPointActivity"
|
||||||
@@ -115,13 +121,19 @@ class AddWorkingPointActivity :
|
|||||||
|
|
||||||
mBinding.btnSave.clickWithDebounce {
|
mBinding.btnSave.clickWithDebounce {
|
||||||
if (showType == 0) {
|
if (showType == 0) {
|
||||||
|
judgeInputParam {
|
||||||
saveFaceRecord()
|
saveFaceRecord()
|
||||||
|
}
|
||||||
return@clickWithDebounce
|
return@clickWithDebounce
|
||||||
}
|
}
|
||||||
|
judgeInputParam {
|
||||||
updateFaceRecord()
|
updateFaceRecord()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mBinding.btnExport.clickWithDebounce {
|
mBinding.btnExport.clickWithDebounce {
|
||||||
showToast("开发中……")
|
judgeInputParam {
|
||||||
|
exportExcelFile()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mBinding.rvLithology.let {
|
mBinding.rvLithology.let {
|
||||||
@@ -169,46 +181,6 @@ class AddWorkingPointActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun saveFaceRecord() {
|
private fun saveFaceRecord() {
|
||||||
if (mBinding.tvWorkingDate.text.isBlank()) {
|
|
||||||
showToast("请选择施工日期")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.tvTeamShift.text.isBlank()) {
|
|
||||||
showToast("请选择施工班次")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.tvWorkTeam.text.isBlank()) {
|
|
||||||
showToast("请选择施工队伍")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.etTeamLeader.text.isBlank()) {
|
|
||||||
showToast("请输入带班队长")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.etWorkingFootage.text.isBlank()) {
|
|
||||||
showToast("请输入本班进尺")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.etSeamDip.text.isBlank()) {
|
|
||||||
showToast("请输入煤层倾角")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.etSeamHeight.text.isBlank()) {
|
|
||||||
showToast("请输入煤层高")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (mBinding.etRecordPerson.text.isBlank()) {
|
|
||||||
showToast("请输入填写人")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val emptyDataList = roofLithologyList.filter {
|
|
||||||
it.positionStart.isBlank() || it.positionEnd.isBlank() || it.lithologyType.isBlank()
|
|
||||||
}
|
|
||||||
if (emptyDataList.isNotEmpty()) {
|
|
||||||
showToast("顶板岩性中存在部分编录点数据为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val faceRecord = TunnelWorkingFaceRecordEntity().also {
|
val faceRecord = TunnelWorkingFaceRecordEntity().also {
|
||||||
it.recordId = recordId
|
it.recordId = recordId
|
||||||
it.surfaceId = surfaceId
|
it.surfaceId = surfaceId
|
||||||
@@ -218,9 +190,10 @@ class AddWorkingPointActivity :
|
|||||||
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
||||||
|
|
||||||
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim()
|
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||||
it.seamDip = mBinding.etSeamDip.text.toString().trim()
|
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim()
|
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||||
|
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
|
|
||||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||||
@@ -230,8 +203,8 @@ class AddWorkingPointActivity :
|
|||||||
Log.d(TAG, "saveFaceRecord: ${roofLithologyList.toJson()}")
|
Log.d(TAG, "saveFaceRecord: ${roofLithologyList.toJson()}")
|
||||||
|
|
||||||
workingFaceRecordViewModel.insert(faceRecord) {
|
workingFaceRecordViewModel.insert(faceRecord) {
|
||||||
EventBus.getDefault().post(faceRecord)
|
|
||||||
roofLithologyViewModel.insertList(roofLithologyList) {
|
roofLithologyViewModel.insertList(roofLithologyList) {
|
||||||
|
EventBus.getDefault().post(faceRecord)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,9 +219,10 @@ class AddWorkingPointActivity :
|
|||||||
mBinding.tvWorkTeam.tag = it.teamId
|
mBinding.tvWorkTeam.tag = it.teamId
|
||||||
|
|
||||||
mBinding.etTeamLeader.setText(it.teamLeader)
|
mBinding.etTeamLeader.setText(it.teamLeader)
|
||||||
mBinding.etWorkingFootage.setText(it.workingFootage)
|
mBinding.etWorkingFootage.setText(getShowNum2(it.workingFootage))
|
||||||
mBinding.etSeamDip.setText(it.seamDip)
|
mBinding.etSeamDip.setText(getShowNum2(it.seamDip))
|
||||||
mBinding.etSeamHeight.setText(it.seamHeight)
|
mBinding.etSeamHeight.setText(getShowNum2(it.seamHeight))
|
||||||
|
mBinding.etWaterYield.setText(getShowNum2(it.waterYield))
|
||||||
mBinding.etRecordPerson.setText(it.recordPerson)
|
mBinding.etRecordPerson.setText(it.recordPerson)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,18 +237,19 @@ class AddWorkingPointActivity :
|
|||||||
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
||||||
|
|
||||||
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim()
|
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||||
it.seamDip = mBinding.etSeamDip.text.toString().trim()
|
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim()
|
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||||
|
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
|
|
||||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||||
it.dataState = "1"
|
it.dataState = "1"
|
||||||
}
|
}
|
||||||
workingFaceRecordViewModel.update(faceRecord) {
|
workingFaceRecordViewModel.update(faceRecord) {
|
||||||
EventBus.getDefault().post(faceRecord)
|
|
||||||
roofLithologyViewModel.deleteList(recordId) {
|
roofLithologyViewModel.deleteList(recordId) {
|
||||||
roofLithologyViewModel.insertList(roofLithologyList) {
|
roofLithologyViewModel.insertList(roofLithologyList) {
|
||||||
|
EventBus.getDefault().post(faceRecord)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,4 +261,96 @@ class AddWorkingPointActivity :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun judgeInputParam(acton:()-> Unit) {
|
||||||
|
list.clear()
|
||||||
|
list.add(TunnelWorkingItem(name = "工作面名称", value = faceName))
|
||||||
|
|
||||||
|
val workingDate = mBinding.tvWorkingDate.text.toString().trim()
|
||||||
|
if (workingDate.isBlank()) {
|
||||||
|
showToast("请选择施工日期")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "施工日期", value = workingDate))
|
||||||
|
|
||||||
|
val teamShift = mBinding.tvTeamShift.text.toString().trim()
|
||||||
|
if (teamShift.isBlank()) {
|
||||||
|
showToast("请选择施工班次")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "施工班次", value = teamShift))
|
||||||
|
|
||||||
|
val workTeam = mBinding.tvWorkTeam.text.toString().trim()
|
||||||
|
if (workTeam.isBlank()) {
|
||||||
|
showToast("请选择施工队伍")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "施工队伍", value = workTeam))
|
||||||
|
|
||||||
|
val teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||||
|
if (teamLeader.isBlank()) {
|
||||||
|
showToast("请输入带班队长")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "带班队长", value = teamLeader))
|
||||||
|
|
||||||
|
val workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||||
|
if (workingFootage.isBlank()) {
|
||||||
|
showToast("请输入本班进尺")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "本班进尺", value = workingFootage))
|
||||||
|
|
||||||
|
val seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||||
|
if (seamDip.isBlank()) {
|
||||||
|
showToast("请输入煤层倾角")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "煤层倾角", value = seamDip))
|
||||||
|
|
||||||
|
val seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||||
|
if (seamHeight.isBlank()) {
|
||||||
|
showToast("请输入煤层高")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "煤层高", value = seamHeight))
|
||||||
|
|
||||||
|
val waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||||
|
if (waterYield.isBlank()) {
|
||||||
|
showToast("请输入涌水量")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "涌水量", value = waterYield))
|
||||||
|
|
||||||
|
val recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
|
if (recordPerson.isBlank()) {
|
||||||
|
showToast("请输入填写人")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "记录人", value = recordPerson))
|
||||||
|
|
||||||
|
val emptyDataList = roofLithologyList.filter {
|
||||||
|
it.positionStart.isBlank() || it.positionEnd.isBlank() || it.lithologyType.isBlank()
|
||||||
|
}
|
||||||
|
if (emptyDataList.isNotEmpty()) {
|
||||||
|
showToast("顶板岩性中存在部分编录点数据为空")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list.add(TunnelWorkingItem(name = "顶板岩性", value = "", items = roofLithologyList))
|
||||||
|
|
||||||
|
acton()
|
||||||
|
}
|
||||||
|
|
||||||
|
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||||
|
private fun exportExcelFile() {
|
||||||
|
showLoading()
|
||||||
|
val fileName = "${faceName}_${mBinding.tvWorkingDate.text}_${System.currentTimeMillis()}.xlsx"
|
||||||
|
val filePath = FileUtils.getFilePath(fileName)
|
||||||
|
ExcelExportUtils.exportToExcel(list, filePath) {
|
||||||
|
window.decorView.postDelayed({
|
||||||
|
hideLoading()
|
||||||
|
showToast("Excel导出完成")
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+22
-19
@@ -10,12 +10,13 @@ import com.zmkg.coaloperation.adapter.TunnelWorkingFaceAdapter
|
|||||||
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceRecordAdapter
|
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceRecordAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import com.zmkg.coaloperation.databinding.ActivityTunnelingBinding
|
import com.zmkg.coaloperation.databinding.ActivityTunnelingBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ class TunnelingActivity :
|
|||||||
TunnelWorkingFaceAdapter(workingFaceList).apply {
|
TunnelWorkingFaceAdapter(workingFaceList).apply {
|
||||||
setOnItemChildClickListener { _, view, position ->
|
setOnItemChildClickListener { _, view, position ->
|
||||||
if (view.id == R.id.llWorkingFace) {
|
if (view.id == R.id.llWorkingFace) {
|
||||||
toActivity(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
toActivity(WorkingFaceStatisticsActivity::class.java, Bundle().apply {
|
||||||
putParcelable(WorkingFaceDetailActivity.FACE_DETAIL, workingFaceList[position])
|
putParcelable(WorkingFaceStatisticsActivity.FACE_DETAIL, workingFaceList[position])
|
||||||
})
|
})
|
||||||
return@setOnItemChildClickListener
|
return@setOnItemChildClickListener
|
||||||
}
|
}
|
||||||
@@ -59,16 +60,16 @@ class TunnelingActivity :
|
|||||||
return@setOnItemChildClickListener
|
return@setOnItemChildClickListener
|
||||||
}
|
}
|
||||||
if (view.id == R.id.start_record) {
|
if (view.id == R.id.start_record) {
|
||||||
toActivity(AddWorkingPointActivity::class.java, Bundle().apply {
|
toActivity(AddWorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||||
putLong(
|
putLong(
|
||||||
AddWorkingPointActivity.FACE_ID,
|
AddWorkingFaceRecordActivity.FACE_ID,
|
||||||
workingFaceList[position].surfaceId
|
workingFaceList[position].surfaceId
|
||||||
)
|
)
|
||||||
putString(
|
putString(
|
||||||
AddWorkingPointActivity.FACE_NAME,
|
AddWorkingFaceRecordActivity.FACE_NAME,
|
||||||
workingFaceList[position].surfaceName
|
workingFaceList[position].surfaceName
|
||||||
)
|
)
|
||||||
putInt(AddWorkingPointActivity.SHOW_TYPE, 0)
|
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
mBinding.toolbarLay.rightText = "新增工作面"
|
mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
mBinding.rvList.let {
|
mBinding.rvTunnelingList.let {
|
||||||
it.layoutManager = LinearLayoutManager(this)
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
it.adapter = workingFaceAdapter
|
it.adapter = workingFaceAdapter
|
||||||
}
|
}
|
||||||
@@ -85,10 +86,10 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
DictUtils.initData()
|
val userId = SpTool.getString(SpTool.USER_ID)
|
||||||
workingFaceViewModel.getEntityList { it ->
|
workingFaceViewModel.getEntityListByUserId(userId) { it ->
|
||||||
if (it.isNullOrEmpty()) {
|
if (it.isNullOrEmpty()) {
|
||||||
return@getEntityList
|
return@getEntityListByUserId
|
||||||
}
|
}
|
||||||
workingFaceList.clear()
|
workingFaceList.clear()
|
||||||
workingFaceList.addAll(it)
|
workingFaceList.addAll(it)
|
||||||
@@ -99,14 +100,13 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
override fun createObserve() {
|
override fun createObserve() {
|
||||||
super.createObserve()
|
super.createObserve()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
toActivity(WorkFaceActivity::class.java, Bundle().apply {
|
toActivity(AddWorkingFaceActivity::class.java, Bundle().apply {
|
||||||
putString(WorkFaceActivity.WORK_FACE_TYPE, WorkFaceActivity.WorkFaceType.ADD.name)
|
putString(AddWorkingFaceActivity.WORK_FACE_TYPE, AddWorkingFaceActivity.WorkFaceType.ADD.name)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,8 +143,8 @@ class TunnelingActivity :
|
|||||||
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
//新增工作面
|
//新增工作面
|
||||||
val insertIndex = workingFaceList.size
|
val insertIndex = 0
|
||||||
workingFaceList.add(event)
|
workingFaceList.add(0,event)
|
||||||
workingFaceAdapter.notifyItemInserted(insertIndex)
|
workingFaceAdapter.notifyItemInserted(insertIndex)
|
||||||
workingFaceAdapter.notifyItemRangeChanged(insertIndex, insertIndex+1)
|
workingFaceAdapter.notifyItemRangeChanged(insertIndex, insertIndex+1)
|
||||||
return
|
return
|
||||||
@@ -166,18 +166,21 @@ class TunnelingActivity :
|
|||||||
faceEntity.records?.let { records ->
|
faceEntity.records?.let { records ->
|
||||||
val index = records.indexOfFirst { it.recordId == event.recordId }
|
val index = records.indexOfFirst { it.recordId == event.recordId }
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
records.add(event)
|
records.add(0,event)
|
||||||
} else {
|
} else {
|
||||||
records[index] = event
|
records[index] = event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val recordAdapter = getRecordAdapter(position)
|
val recordAdapter = getRecordAdapter(position)
|
||||||
recordAdapter.notifyDataSetChanged()
|
recordAdapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
workingFaceAdapter.notifyItemChanged(position)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SuspiciousIndentation")
|
||||||
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
||||||
val viewHolder =
|
val viewHolder =
|
||||||
mBinding.rvList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
mBinding.rvTunnelingList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||||
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-112
@@ -1,112 +0,0 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import com.zmkg.coaloperation.R
|
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.zmkg.coaloperation.adapter.WorkingItemAdapter
|
|
||||||
import com.zmkg.coaloperation.bean.WorkingFaceItem
|
|
||||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetail2Binding
|
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工作面详情2
|
|
||||||
*/
|
|
||||||
class WorkingFaceDetail2Activity :
|
|
||||||
BaseVMBActivity<TestViewModel, ActivityWorkingFaceDetail2Binding>(R.layout.activity_working_face_detail2) {
|
|
||||||
companion object {
|
|
||||||
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
|
||||||
}
|
|
||||||
|
|
||||||
private val list: MutableList<WorkingFaceItem> = mutableListOf()
|
|
||||||
|
|
||||||
// private var detail:FaceWorkDetailBean?=null
|
|
||||||
private var detail: TunnelWorkingFaceEntity? = null
|
|
||||||
private val adapter by lazy {
|
|
||||||
WorkingItemAdapter(list)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
|
||||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
|
||||||
mBinding.toolbarLay.rightText = "修改"
|
|
||||||
|
|
||||||
mBinding.rvFaceList.let {
|
|
||||||
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
|
||||||
it.adapter = adapter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initData() {
|
|
||||||
detail = intent.getParcelableExtra(FACE_WORK_DETAIL_DATA)
|
|
||||||
detail?.let {
|
|
||||||
loadFaceDetail(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
|
||||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
|
||||||
toActivity(WorkFaceActivity::class.java, Bundle().apply {
|
|
||||||
putString(WorkFaceActivity.WORK_FACE_TYPE, WorkFaceActivity.WorkFaceType.EDIT.name)
|
|
||||||
// putSerializable(WorkFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
|
||||||
putParcelable(WorkFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun processClick(v: View?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
private fun loadFaceDetail(it: TunnelWorkingFaceEntity) {
|
|
||||||
mBinding.toolbarLay.title = it.surfaceName
|
|
||||||
list.clear()
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面名称", value = it.surfaceName))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "所属煤层", value = it.seamName))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "所属采区域", value = it.areaName))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面方位角", value = it.surfaceAzimuth))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面巷高", value = it.surfaceHeight))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面巷宽", value = it.surfaceWidth))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "巷道性质", value = it.tunnelNature))
|
|
||||||
list.add(
|
|
||||||
WorkingFaceItem(
|
|
||||||
pageType = 0,
|
|
||||||
name = "计划工期",
|
|
||||||
value = "${it.planStartDate} ~ ${it.planEndDate}"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "地质类型", value = it.geologicalType))
|
|
||||||
list.add(
|
|
||||||
WorkingFaceItem(
|
|
||||||
pageType = 0,
|
|
||||||
name = "水文地质类型",
|
|
||||||
value = it.hydrogeologicalType
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "煤层发火性", value = it.seamIgnition))
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "瓦斯含量", value = it.seamGas))
|
|
||||||
list.add(
|
|
||||||
WorkingFaceItem(
|
|
||||||
pageType = 0,
|
|
||||||
name = "冲击地压危险性",
|
|
||||||
value = it.seamBumpPressure
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(WorkingFaceItem(pageType = 0, name = "支护形式", value = it.surfaceSupportForm))
|
|
||||||
|
|
||||||
adapter.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
|
||||||
detail = event
|
|
||||||
detail?.let {
|
|
||||||
loadFaceDetail(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+68
-164
@@ -1,208 +1,112 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import androidx.core.graphics.toColorInt
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetailBinding
|
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetailBinding
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingRockNatureAdapter
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
|
||||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import kotlin.apply
|
|
||||||
import kotlin.math.roundToInt
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作面详情
|
* 工作面详情2
|
||||||
*/
|
*/
|
||||||
class WorkingFaceDetailActivity :
|
class WorkingFaceDetailActivity :
|
||||||
BaseVMBActivity<TunnelingViewModel, ActivityWorkingFaceDetailBinding>(R.layout.activity_working_face_detail) {
|
BaseVMBActivity<TestViewModel, ActivityWorkingFaceDetailBinding>(R.layout.activity_working_face_detail) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val FACE_DETAIL = "faceDetail"
|
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||||
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
|
||||||
}
|
|
||||||
|
|
||||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
// private var detail:FaceWorkDetailBean?=null
|
||||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
private var detail: TunnelWorkingFaceEntity? = null
|
||||||
|
private val adapter by lazy {
|
||||||
|
TunnelWorkingItemAdapter(list)
|
||||||
}
|
}
|
||||||
private val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy {
|
|
||||||
TunnelingRockNatureAdapter(lithologyList)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val lithologyList:MutableList<TunnelRoofLithologyEntity> = mutableListOf()
|
|
||||||
|
|
||||||
private var faceDetail: TunnelWorkingFaceEntity? = null
|
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
mBinding.toolbarLay.rightText = "查看详情"
|
|
||||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||||
mBinding.rvRockNature.adapter = tunnelingRockNatureAdapter
|
mBinding.toolbarLay.rightText = "修改"
|
||||||
|
|
||||||
mBinding.arcViewGreen.let {
|
mBinding.rvFaceList.let {
|
||||||
it.arcColor = "#30E0A1".toColorInt()
|
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||||
it.startAngle = 0f
|
it.adapter = adapter
|
||||||
it.sweepAngle = 360f
|
|
||||||
it.strokeWidth = 12f
|
|
||||||
it.radius = ScreenUtil.dp2px(122f - 12f) / 2f
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mBinding.arcViewRed.let {
|
|
||||||
it.arcColor = "#FA2256".toColorInt()
|
|
||||||
it.startAngle = -90f
|
|
||||||
it.strokeWidth = 10f
|
|
||||||
it.sweepAngle = 0f
|
|
||||||
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
|
||||||
}
|
|
||||||
|
|
||||||
mBinding.arcViewBlue.let {
|
|
||||||
it.arcColor = "#246CF9".toColorInt()
|
|
||||||
it.startAngle = -90f
|
|
||||||
it.strokeWidth = 10f
|
|
||||||
it.sweepAngle = 0f
|
|
||||||
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
// val surfaceId = intent.getStringExtra("surfaceId")
|
detail = intent.getParcelableExtra(FACE_WORK_DETAIL_DATA)
|
||||||
// if (TextUtils.isEmpty(surfaceId)) {
|
detail?.let {
|
||||||
// finish()
|
loadFaceDetail(it)
|
||||||
// } else {
|
|
||||||
// mViewModel.getTunnelingSurfaceDetail(surfaceId)
|
|
||||||
// }
|
|
||||||
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
|
||||||
|
|
||||||
faceDetail?.let { detail ->
|
|
||||||
loadFaceDetail()
|
|
||||||
workingFaceRecordViewModel.getLastEntity(detail.surfaceId) { record ->
|
|
||||||
record?.let {
|
|
||||||
mBinding.tvYesterdayLen.text = "${it.workingFootage}m"
|
|
||||||
mBinding.tvWorkingFaceAngle.text = "${it.seamDip}"
|
|
||||||
// mBinding.tvMonthAccumulateLen.text = "${it.monthFootage}m"
|
|
||||||
mBinding.tvWorkingFaceWater.text = "${it.waterYield}"
|
|
||||||
|
|
||||||
roofLithologyViewModel.getEntityList(it.recordId) { list ->
|
|
||||||
list?.let {
|
|
||||||
lithologyList.addAll(it)
|
|
||||||
tunnelingRockNatureAdapter.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
toActivity(WorkingFaceDetail2Activity::class.java, Bundle().apply {
|
toActivity(AddWorkingFaceActivity::class.java, Bundle().apply {
|
||||||
// putSerializable(
|
putString(AddWorkingFaceActivity.WORK_FACE_TYPE, AddWorkingFaceActivity.WorkFaceType.EDIT.name)
|
||||||
// WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA,
|
// putSerializable(WorkFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||||
// mViewModel.faceWorkDetailData.value as Serializable
|
putParcelable(AddWorkingFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||||
// )
|
|
||||||
putParcelable(WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA, faceDetail)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processClick(v: View?) {
|
override fun processClick(v: View?) {
|
||||||
}
|
|
||||||
|
|
||||||
override fun createObserve() {
|
|
||||||
super.createObserve()
|
|
||||||
// lifecycleScope.launch {
|
|
||||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
|
||||||
// mViewModel.faceWorkDetailData.collectLatest {
|
|
||||||
// if (it != null) {
|
|
||||||
// setDataView(it)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setDataView(bean: FaceWorkDetailBean?) {
|
|
||||||
bean ?: return
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun stringToDouble(numText: String?): Double {
|
|
||||||
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
|
||||||
return numText.toDouble()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadFaceDetail() {
|
|
||||||
val bean = faceDetail!!
|
|
||||||
mBinding.apply {
|
|
||||||
toolbarLay.title = bean.surfaceName
|
|
||||||
|
|
||||||
val total = stringToDouble(bean.totalFootage)
|
|
||||||
val accumulative = stringToDouble(bean.accumulativeFootage)
|
|
||||||
val remaining = stringToDouble(bean.remainingFootage)
|
|
||||||
|
|
||||||
tvLenTotal.text = "总进尺:${total}m"
|
|
||||||
tvLenAccumulate.text = "累计进尺:${accumulative}m"
|
|
||||||
tvLenRemain.text = "剩余进尺:${remaining}m"
|
|
||||||
|
|
||||||
//累计进尺占比
|
|
||||||
var radio = 0
|
|
||||||
|
|
||||||
//累计进尺圆圈占比
|
|
||||||
var arcViewRadio: Float
|
|
||||||
|
|
||||||
if (accumulative >= total) {
|
|
||||||
radio = 100
|
|
||||||
arcViewRadio = 360F
|
|
||||||
} else if (accumulative <= 0) {
|
|
||||||
radio = 0
|
|
||||||
arcViewRadio = 0F
|
|
||||||
} else {
|
|
||||||
arcViewRadio = (accumulative * 100F / total).toFloat()
|
|
||||||
radio = arcViewRadio.roundToInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
arcViewRed.let {
|
|
||||||
it.sweepAngle = arcViewRadio
|
|
||||||
}
|
|
||||||
|
|
||||||
arcViewBlue.let {
|
|
||||||
it.sweepAngle = (360F - arcViewRadio) * -1F
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
mBinding.tvCompleteRate.text = "$radio%"
|
|
||||||
|
|
||||||
// tvYesterdayLen.text = "${bean?.yesterdayFootage}m"
|
|
||||||
// tvWorkingFaceAngle.text = "${bean?.latestRecord?.seamDip.orEmptyDefaultInt()}"
|
|
||||||
// tvMonthAccumulateLen.text = "${bean?.monthFootage}m"
|
|
||||||
// tvWorkingFaceWater.text = "${bean?.latestRecord?.waterYield.orEmptyDefaultInt()}m"
|
|
||||||
|
|
||||||
// val list = bean?.latestRecord?.mineWorkingLithologyList
|
|
||||||
// if (list.isNullOrEmpty()) {
|
|
||||||
// tvYesterdayRockType.visibility = View.GONE
|
|
||||||
// } else {
|
|
||||||
// tvYesterdayRockType.visibility = View.VISIBLE
|
|
||||||
// tunnelingRockNatureAdapter.setNewInstance(list)
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun loadFaceDetail(it: TunnelWorkingFaceEntity) {
|
||||||
|
mBinding.toolbarLay.title = it.surfaceName
|
||||||
|
list.clear()
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "工作面名称", value = it.surfaceName))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "所属煤层", value = it.seamName))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "所属采区域", value = it.areaName))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "工作面方位角", value = it.surfaceAzimuth))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "工作面巷高", value = it.surfaceHeight))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "工作面巷宽", value = it.surfaceWidth))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "巷道性质", value = it.tunnelNature))
|
||||||
|
list.add(
|
||||||
|
TunnelWorkingItem(
|
||||||
|
pageType = 0,
|
||||||
|
name = "计划工期",
|
||||||
|
value = "${it.planStartDate} ~ ${it.planEndDate}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "地质类型", value = it.geologicalType))
|
||||||
|
list.add(
|
||||||
|
TunnelWorkingItem(
|
||||||
|
pageType = 0,
|
||||||
|
name = "水文地质类型",
|
||||||
|
value = it.hydrogeologicalType
|
||||||
|
)
|
||||||
|
)
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "煤层发火性", value = it.seamIgnition))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "瓦斯含量", value = it.seamGas))
|
||||||
|
list.add(
|
||||||
|
TunnelWorkingItem(
|
||||||
|
pageType = 0,
|
||||||
|
name = "冲击地压危险性",
|
||||||
|
value = it.seamBumpPressure
|
||||||
|
)
|
||||||
|
)
|
||||||
|
list.add(TunnelWorkingItem(pageType = 0, name = "支护形式", value = it.surfaceSupportForm))
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||||
faceDetail = event
|
detail = event
|
||||||
loadFaceDetail()
|
detail?.let {
|
||||||
|
loadFaceDetail(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+32
-28
@@ -7,16 +7,16 @@ import android.view.View
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.adapter.WorkingItemAdapter
|
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
import com.zmkg.coaloperation.bean.RockItem
|
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||||
import com.zmkg.coaloperation.bean.WorkingFaceItem
|
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceRecordBinding
|
||||||
import com.zmkg.coaloperation.databinding.ActivityWorkingPointBinding
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceRecordEntity
|
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||||
import com.zmkg.coaloperation.utils.toJsonString
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
@@ -24,8 +24,8 @@ import org.greenrobot.eventbus.ThreadMode
|
|||||||
/**
|
/**
|
||||||
* 查看(棋盘井)
|
* 查看(棋盘井)
|
||||||
*/
|
*/
|
||||||
class WorkingPointActivity :
|
class WorkingFaceRecordActivity :
|
||||||
BaseVMBActivity<TestViewModel, ActivityWorkingPointBinding>(R.layout.activity_working_point) {
|
BaseVMBActivity<TestViewModel, ActivityWorkingFaceRecordBinding>(R.layout.activity_working_face_record) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "WorkingPointActivity"
|
const val TAG = "WorkingPointActivity"
|
||||||
@@ -35,13 +35,13 @@ class WorkingPointActivity :
|
|||||||
|
|
||||||
private var faceName: String? = null
|
private var faceName: String? = null
|
||||||
private var faceRecord: TunnelWorkingFaceRecordEntity? = null
|
private var faceRecord: TunnelWorkingFaceRecordEntity? = null
|
||||||
private val list: MutableList<WorkingFaceItem> = mutableListOf()
|
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||||
|
|
||||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||||
}
|
}
|
||||||
private val adapter by lazy {
|
private val adapter by lazy {
|
||||||
WorkingItemAdapter(list)
|
TunnelWorkingItemAdapter(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
@@ -49,10 +49,10 @@ class WorkingPointActivity :
|
|||||||
mBinding.toolbarLay.title = "查看详情"
|
mBinding.toolbarLay.title = "查看详情"
|
||||||
mBinding.toolbarLay.rightText = "修改"
|
mBinding.toolbarLay.rightText = "修改"
|
||||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
toActivity(AddWorkingPointActivity::class.java, Bundle().apply {
|
toActivity(AddWorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||||
putInt(AddWorkingPointActivity.SHOW_TYPE, 1)
|
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 1)
|
||||||
putString(AddWorkingPointActivity.FACE_NAME, faceName)
|
putString(AddWorkingFaceRecordActivity.FACE_NAME, faceName)
|
||||||
putParcelable(AddWorkingPointActivity.FACE_RECORD, faceRecord)
|
putParcelable(AddWorkingFaceRecordActivity.FACE_RECORD, faceRecord)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
mBinding.rvPointList.let {
|
mBinding.rvPointList.let {
|
||||||
@@ -67,39 +67,43 @@ class WorkingPointActivity :
|
|||||||
Log.d(TAG, "loadFaceRecord: ${faceRecord.toJsonString()}")
|
Log.d(TAG, "loadFaceRecord: ${faceRecord.toJsonString()}")
|
||||||
faceRecord?.let {
|
faceRecord?.let {
|
||||||
loadFaceRecord(it)
|
loadFaceRecord(it)
|
||||||
roofLithologyViewModel.getEntityList(it.recordId) { lithologyEntities ->
|
|
||||||
list[6].items = lithologyEntities
|
|
||||||
adapter.notifyItemChanged(6)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun loadFaceRecord(it: TunnelWorkingFaceRecordEntity) {
|
private fun loadFaceRecord(it: TunnelWorkingFaceRecordEntity) {
|
||||||
list.clear()
|
list.clear()
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "工作面名称", value = faceName))
|
list.add(TunnelWorkingItem(pageType = 1, name = "工作面名称", value = faceName))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "施工日期", value = it.workingDate))
|
list.add(TunnelWorkingItem(pageType = 1, name = "施工日期", value = it.workingDate))
|
||||||
list.add(
|
list.add(
|
||||||
WorkingFaceItem(
|
TunnelWorkingItem(
|
||||||
pageType = 1,
|
pageType = 1,
|
||||||
name = "施工班次",
|
name = "施工班次",
|
||||||
value = DictUtils.getTeamShift(it.teamShift)
|
value = DictUtils.getTeamShift(it.teamShift)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "施工队伍", value = it.teamName))
|
list.add(TunnelWorkingItem(pageType = 1, name = "施工队伍", value = it.teamName))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "带班队长", value = it.teamLeader))
|
list.add(TunnelWorkingItem(pageType = 1, name = "带班队长", value = it.teamLeader))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "本班进尺", value = it.workingFootage))
|
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${getShowNum2(it.workingFootage)}m"))
|
||||||
|
|
||||||
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
||||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
||||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "砂"))
|
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "砂"))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "顶板岩性", value = "", items = null))
|
list.add(TunnelWorkingItem(pageType = 1, name = "顶板岩性", value = "", items = null))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "煤层倾角", value = it.seamDip))
|
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${getShowNum2(it.seamDip)}°"))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "煤层高", value = it.seamHeight))
|
list.add(TunnelWorkingItem(pageType = 1, name = "煤层高", value = "${getShowNum2(it.seamHeight)}m"))
|
||||||
list.add(WorkingFaceItem(pageType = 1, name = "记录人", value = it.recordPerson))
|
list.add(TunnelWorkingItem(pageType = 1, name = "涌水量", value = "${getShowNum2(it.waterYield)}m³/h"))
|
||||||
|
list.add(TunnelWorkingItem(pageType = 1, name = "记录人", value = it.recordPerson))
|
||||||
|
|
||||||
adapter.notifyDataSetChanged()
|
adapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
|
||||||
|
roofLithologyViewModel.getEntityList(it.recordId) { lithologyEntities ->
|
||||||
|
list[6].items = lithologyEntities
|
||||||
|
adapter.notifyItemChanged(6)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
}
|
}
|
||||||
+208
@@ -0,0 +1,208 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
|
import com.zmkg.coaloperation.adapter.TunnelingRockNatureAdapter
|
||||||
|
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceStatisticsBinding
|
||||||
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import kotlin.apply
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面详情
|
||||||
|
*/
|
||||||
|
class WorkingFaceStatisticsActivity :
|
||||||
|
BaseVMBActivity<TunnelingViewModel, ActivityWorkingFaceStatisticsBinding>(R.layout.activity_working_face_statistics) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val FACE_DETAIL = "faceDetail"
|
||||||
|
}
|
||||||
|
|
||||||
|
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||||
|
}
|
||||||
|
|
||||||
|
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||||
|
}
|
||||||
|
private val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy {
|
||||||
|
TunnelingRockNatureAdapter(lithologyList)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val lithologyList:MutableList<TunnelRoofLithologyEntity> = mutableListOf()
|
||||||
|
|
||||||
|
private var faceDetail: TunnelWorkingFaceEntity? = null
|
||||||
|
|
||||||
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
mBinding.toolbarLay.rightText = "查看详情"
|
||||||
|
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||||
|
mBinding.rvRockNature.adapter = tunnelingRockNatureAdapter
|
||||||
|
|
||||||
|
mBinding.arcViewGreen.let {
|
||||||
|
it.arcColor = "#30E0A1".toColorInt()
|
||||||
|
it.startAngle = 0f
|
||||||
|
it.sweepAngle = 360f
|
||||||
|
it.strokeWidth = 12f
|
||||||
|
it.radius = ScreenUtil.dp2px(122f - 12f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.arcViewRed.let {
|
||||||
|
it.arcColor = "#FA2256".toColorInt()
|
||||||
|
it.startAngle = -90f
|
||||||
|
it.strokeWidth = 10f
|
||||||
|
it.sweepAngle = 0f
|
||||||
|
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.arcViewBlue.let {
|
||||||
|
it.arcColor = "#246CF9".toColorInt()
|
||||||
|
it.startAngle = -90f
|
||||||
|
it.strokeWidth = 10f
|
||||||
|
it.sweepAngle = 0f
|
||||||
|
it.radius = ScreenUtil.dp2px(80f - 10f) / 2f
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// val surfaceId = intent.getStringExtra("surfaceId")
|
||||||
|
// if (TextUtils.isEmpty(surfaceId)) {
|
||||||
|
// finish()
|
||||||
|
// } else {
|
||||||
|
// mViewModel.getTunnelingSurfaceDetail(surfaceId)
|
||||||
|
// }
|
||||||
|
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
||||||
|
|
||||||
|
faceDetail?.let { detail ->
|
||||||
|
loadFaceDetail()
|
||||||
|
workingFaceRecordViewModel.getLastEntity(detail.surfaceId) { record ->
|
||||||
|
record?.let {
|
||||||
|
mBinding.tvYesterdayLen.text = "${it.workingFootage?.formatDecimalString()}m"
|
||||||
|
mBinding.tvWorkingFaceAngle.text = "${it.seamDip?.formatDecimalString()}°"
|
||||||
|
// mBinding.tvMonthAccumulateLen.text = "${it.monthFootage}m"
|
||||||
|
mBinding.tvWorkingFaceWater.text = "${it.waterYield?.formatDecimalString()}"
|
||||||
|
|
||||||
|
roofLithologyViewModel.getEntityList(it.recordId) { list ->
|
||||||
|
list?.let {
|
||||||
|
lithologyList.addAll(it)
|
||||||
|
tunnelingRockNatureAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindEvent() {
|
||||||
|
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||||
|
toActivity(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
||||||
|
// putSerializable(
|
||||||
|
// WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA,
|
||||||
|
// mViewModel.faceWorkDetailData.value as Serializable
|
||||||
|
// )
|
||||||
|
putParcelable(WorkingFaceDetailActivity.FACE_WORK_DETAIL_DATA, faceDetail)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processClick(v: View?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createObserve() {
|
||||||
|
super.createObserve()
|
||||||
|
// lifecycleScope.launch {
|
||||||
|
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
// mViewModel.faceWorkDetailData.collectLatest {
|
||||||
|
// if (it != null) {
|
||||||
|
// setDataView(it)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// private fun setDataView(bean: FaceWorkDetailBean?) {
|
||||||
|
// bean ?: return
|
||||||
|
// }
|
||||||
|
|
||||||
|
private fun stringToDouble(numText: String?): Double {
|
||||||
|
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
||||||
|
return numText.toDouble()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadFaceDetail() {
|
||||||
|
val bean = faceDetail!!
|
||||||
|
mBinding.apply {
|
||||||
|
toolbarLay.title = bean.surfaceName
|
||||||
|
|
||||||
|
val total = stringToDouble(bean.totalFootage)
|
||||||
|
val accumulative = stringToDouble(bean.accumulativeFootage)
|
||||||
|
val remaining = stringToDouble(bean.remainingFootage)
|
||||||
|
|
||||||
|
tvLenTotal.text = "总进尺:${bean.totalFootage?.formatDecimalString()}m"
|
||||||
|
tvLenAccumulate.text = "累计进尺:${bean.accumulativeFootage?.formatDecimalString()}m"
|
||||||
|
tvLenRemain.text = "剩余进尺:${bean.remainingFootage?.formatDecimalString()}m"
|
||||||
|
|
||||||
|
//累计进尺占比
|
||||||
|
var radio = 0
|
||||||
|
|
||||||
|
//累计进尺圆圈占比
|
||||||
|
var arcViewRadio: Float
|
||||||
|
|
||||||
|
if (accumulative >= total) {
|
||||||
|
radio = 100
|
||||||
|
arcViewRadio = 360F
|
||||||
|
} else if (accumulative <= 0) {
|
||||||
|
radio = 0
|
||||||
|
arcViewRadio = 0F
|
||||||
|
} else {
|
||||||
|
arcViewRadio = (accumulative * 100F / total).toFloat()
|
||||||
|
radio = arcViewRadio.roundToInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
arcViewRed.let {
|
||||||
|
it.sweepAngle = arcViewRadio
|
||||||
|
}
|
||||||
|
|
||||||
|
arcViewBlue.let {
|
||||||
|
it.sweepAngle = (360F - arcViewRadio) * -1F
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mBinding.tvCompleteRate.text = "$radio%"
|
||||||
|
|
||||||
|
// tvYesterdayLen.text = "${bean?.yesterdayFootage}m"
|
||||||
|
// tvWorkingFaceAngle.text = "${bean?.latestRecord?.seamDip.orEmptyDefaultInt()}"
|
||||||
|
// tvMonthAccumulateLen.text = "${bean?.monthFootage}m"
|
||||||
|
// tvWorkingFaceWater.text = "${bean?.latestRecord?.waterYield.orEmptyDefaultInt()}m"
|
||||||
|
|
||||||
|
// val list = bean?.latestRecord?.mineWorkingLithologyList
|
||||||
|
// if (list.isNullOrEmpty()) {
|
||||||
|
// tvYesterdayRockType.visibility = View.GONE
|
||||||
|
// } else {
|
||||||
|
// tvYesterdayRockType.visibility = View.VISIBLE
|
||||||
|
// tunnelingRockNatureAdapter.setNewInstance(list)
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||||
|
faceDetail = event
|
||||||
|
loadFaceDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
-64
@@ -1,64 +0,0 @@
|
|||||||
//package com.zmkg.coaloperation.ui.tunneling.adapter
|
|
||||||
//
|
|
||||||
//import android.content.Intent
|
|
||||||
//import android.view.View
|
|
||||||
//import android.widget.ImageView
|
|
||||||
//import android.widget.LinearLayout
|
|
||||||
//import androidx.recyclerview.widget.RecyclerView
|
|
||||||
//import com.chad.library.adapter.base.BaseQuickAdapter
|
|
||||||
//import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
|
||||||
//import com.zmkg.coaloperation.R
|
|
||||||
//import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
|
||||||
//import com.zmkg.coaloperation.ui.tunneling.activity.WorkingPointActivity
|
|
||||||
//
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 掘进首页列表
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//class TunnelingHomeAdapter(var listener: (Int,String?)->Unit) : BaseQuickAdapter<TunnelingHomeBean, BaseViewHolder>(
|
|
||||||
// R.layout.item_geological_list
|
|
||||||
//) {
|
|
||||||
//
|
|
||||||
// override fun convert(holder: BaseViewHolder, item: TunnelingHomeBean) {
|
|
||||||
// val tunnelingHomeListAdapter: TunnelingHomeListAdapter by lazy { TunnelingHomeListAdapter().apply {
|
|
||||||
// setOnItemClickListener { adapter, view, position ->
|
|
||||||
// context.startActivity(Intent(context, WorkingPointActivity::class.java))
|
|
||||||
// }
|
|
||||||
// } }
|
|
||||||
//
|
|
||||||
// val rvList = holder.getView<RecyclerView>(R.id.rv_content)
|
|
||||||
// val expand = holder.getView<ImageView>(R.id.expand)
|
|
||||||
// val recordLayout = holder.getView<LinearLayout>(R.id.record_layout)
|
|
||||||
//
|
|
||||||
// holder.apply {
|
|
||||||
// setText(R.id.title, item.surfaceName)
|
|
||||||
// rvList.adapter = tunnelingHomeListAdapter
|
|
||||||
// tunnelingHomeListAdapter.setNewInstance(item.contentList?:mutableListOf())
|
|
||||||
// }
|
|
||||||
// expand.setOnClickListener {
|
|
||||||
// val imageView = it as ImageView
|
|
||||||
// if (imageView.tag.equals("0")) {//收起状态
|
|
||||||
// imageView.setImageResource(R.drawable.ic_arrow_down_white)
|
|
||||||
// recordLayout.visibility = View.VISIBLE
|
|
||||||
// imageView.tag = "1"
|
|
||||||
//
|
|
||||||
// if (data[holder.absoluteAdapterPosition].contentList.isNullOrEmpty()) {
|
|
||||||
//// if (context is TunnelingActivity) {
|
|
||||||
//// (context as TunnelingActivity).getRecordList(holder.layoutPosition) {
|
|
||||||
//// tunnelingHomeListAdapter.notifyDataSetChanged()
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// listener.invoke(holder.absoluteAdapterPosition,data[holder.absoluteAdapterPosition].surfaceId)
|
|
||||||
// }
|
|
||||||
// } else {//展开状态
|
|
||||||
// imageView.setImageResource(R.drawable.ic_arrow_right_gray)
|
|
||||||
// recordLayout.visibility = View.GONE
|
|
||||||
// imageView.tag = "0"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// init {
|
|
||||||
// addChildClickViewIds(R.id.start_record)
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
-27
@@ -1,27 +0,0 @@
|
|||||||
//package com.zmkg.coaloperation.ui.tunneling.adapter
|
|
||||||
//
|
|
||||||
//import com.chad.library.adapter.base.BaseQuickAdapter
|
|
||||||
//import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
|
||||||
//import com.zmkg.coaloperation.R
|
|
||||||
//import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
|
||||||
//
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 掘进首页点击出现的列表
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//class TunnelingHomeListAdapter :
|
|
||||||
// BaseQuickAdapter<TunnelingHomeItemBean, BaseViewHolder>(R.layout.item_geological_list_content) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// override fun convert(holder: BaseViewHolder, item: TunnelingHomeItemBean) {
|
|
||||||
// if (holder.absoluteAdapterPosition != 0) {
|
|
||||||
// holder.setGone(R.id.head, true)
|
|
||||||
// }
|
|
||||||
// holder.setText(R.id.time, item.workingDate)
|
|
||||||
// .setText(R.id.record, item.recordPerson)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
-170
@@ -1,170 +0,0 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.bean
|
|
||||||
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 掘进
|
|
||||||
*/
|
|
||||||
data class TunnelingHomeBean(
|
|
||||||
var contentList: MutableList<TunnelingHomeItemBean>?,
|
|
||||||
val createBy: String?,
|
|
||||||
val createTime: String?,
|
|
||||||
val updateBy: String?,
|
|
||||||
val updateTime: String?,
|
|
||||||
val remark: String?,
|
|
||||||
val surfaceId: String?,
|
|
||||||
val totalFootage: String?,
|
|
||||||
val seamId: String?,
|
|
||||||
val areaId: String?,
|
|
||||||
val seamName: String?,
|
|
||||||
val surfaceName: String?,
|
|
||||||
val areaName: String?,
|
|
||||||
val surfaceAzimuth: String?,
|
|
||||||
val surfaceHeight: String?,
|
|
||||||
val surfaceWidth: String?,
|
|
||||||
val tunnelNature: String?,
|
|
||||||
val planStartDate: String?,
|
|
||||||
val planEndDate: String?,
|
|
||||||
val geologicalType: String?,
|
|
||||||
val hydrogeologicalType: String?,
|
|
||||||
val seamIgnition: String?,
|
|
||||||
val seamGas: String?,
|
|
||||||
val seamBumpPressure: String?,
|
|
||||||
val surfaceSupportForm: String?
|
|
||||||
)
|
|
||||||
|
|
||||||
class TunnelingHomeItemBean {
|
|
||||||
var createBy: String? = null
|
|
||||||
var createTime: String? = null
|
|
||||||
var updateBy: String? = null
|
|
||||||
var updateTime: String? = null
|
|
||||||
var remark: String? = null
|
|
||||||
var recordId: String? = null
|
|
||||||
var surfaceId: String? = null
|
|
||||||
var workingDate: String? = null
|
|
||||||
var teamShift: String? = null
|
|
||||||
var teamId: String? = null
|
|
||||||
var teamName: String? = null
|
|
||||||
var teamLeader: String? = null
|
|
||||||
var workingFootage: String? = null
|
|
||||||
var seamDip: String? = null
|
|
||||||
var seamHeight: String? = null
|
|
||||||
var waterYield: String? = null
|
|
||||||
var recordPerson: String? = null
|
|
||||||
var mineWorkingLith: String? = null
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增工作面 给接口的数据
|
|
||||||
*/
|
|
||||||
data class TunnelingFaceAddBean(
|
|
||||||
|
|
||||||
val surfaceName: String? = null,
|
|
||||||
val totalFootage: String? = null,
|
|
||||||
|
|
||||||
val areaId: Int? = null,
|
|
||||||
val areaName: String? = null,
|
|
||||||
val createBy: String? = null,
|
|
||||||
val createTime: String? = null,
|
|
||||||
val geologicalType: String? = null,
|
|
||||||
val hydrogeologicalType: String? = null,
|
|
||||||
val params: Params? = null,
|
|
||||||
val planEndDate: String? = null,
|
|
||||||
val planStartDate: String? = null,
|
|
||||||
val remark: String? = null,
|
|
||||||
val seamBumpPressure: String? = null,
|
|
||||||
val seamGas: String? = null,
|
|
||||||
val seamId: Int? = null,
|
|
||||||
val seamIgnition: String? = null,
|
|
||||||
val seamName: String? = null,
|
|
||||||
val surfaceAzimuth: String? = null,
|
|
||||||
val surfaceHeight: String? = null,
|
|
||||||
val surfaceId: Int? = null,
|
|
||||||
val surfaceSupportForm: String? = null,
|
|
||||||
val surfaceWidth: String? = null,
|
|
||||||
val tunnelNature: String? = null,
|
|
||||||
val updateBy: String? = null,
|
|
||||||
val updateTime: String? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
data class Params(
|
|
||||||
val additionalProp1: String? = null,
|
|
||||||
val additionalProp2: String? = null,
|
|
||||||
val additionalProp3: String? = null
|
|
||||||
):Serializable
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工作面详情
|
|
||||||
*/
|
|
||||||
data class FaceWorkDetailBean(
|
|
||||||
val accumulativeFootage: Int,
|
|
||||||
val areaId: Int,
|
|
||||||
val areaName: String,
|
|
||||||
val createBy: String,
|
|
||||||
val createTime: String,
|
|
||||||
val geologicalType: String,
|
|
||||||
val hydrogeologicalType: String,
|
|
||||||
val latestRecord: LatestRecord,
|
|
||||||
val params: Params,
|
|
||||||
val planEndDate: String,
|
|
||||||
val planStartDate: String,
|
|
||||||
val remainingFootage: Int,
|
|
||||||
val remark: String,
|
|
||||||
val seamBumpPressure: String,
|
|
||||||
val seamGas: String,
|
|
||||||
val seamId: Int,
|
|
||||||
val seamIgnition: String,
|
|
||||||
val seamName: String,
|
|
||||||
val surfaceAzimuth: String,
|
|
||||||
val surfaceHeight: String,
|
|
||||||
val surfaceId: Int,
|
|
||||||
val surfaceName: String,
|
|
||||||
val surfaceSupportForm: String,
|
|
||||||
val surfaceWidth: String,
|
|
||||||
val totalFootage: Int,
|
|
||||||
val tunnelNature: String,
|
|
||||||
val updateBy: String,
|
|
||||||
val updateTime: String,
|
|
||||||
val yesterdayFootage: String,
|
|
||||||
val monthFootage: String
|
|
||||||
): Serializable
|
|
||||||
|
|
||||||
data class LatestRecord(
|
|
||||||
val createBy: String,
|
|
||||||
val createTime: String,
|
|
||||||
val mineWorkingLithologyList: MutableList<MineWorkingLithology>,
|
|
||||||
val params: Params,
|
|
||||||
val recordId: Int,
|
|
||||||
val recordPerson: String,
|
|
||||||
val remark: String,
|
|
||||||
val seamDip: Int,
|
|
||||||
val seamHeight: Int,
|
|
||||||
val surfaceId: Int,
|
|
||||||
val surfaceName: String,
|
|
||||||
val teamId: Int,
|
|
||||||
val teamLeader: String,
|
|
||||||
val teamName: String,
|
|
||||||
val teamShift: Int,
|
|
||||||
val updateBy: String,
|
|
||||||
val updateTime: String,
|
|
||||||
val waterYield: Int,
|
|
||||||
val workingDate: String,
|
|
||||||
val workingFootage: Int
|
|
||||||
):Serializable
|
|
||||||
|
|
||||||
|
|
||||||
data class MineWorkingLithology(
|
|
||||||
val createBy: String,
|
|
||||||
val createTime: String,
|
|
||||||
val lithologyId: Int,
|
|
||||||
val lithologyType: String,
|
|
||||||
val params: Params,
|
|
||||||
val positionEnd: Int,
|
|
||||||
val positionStart: Int,
|
|
||||||
val recordId: Int,
|
|
||||||
val remark: String,
|
|
||||||
val updateBy: String,
|
|
||||||
val updateTime: String
|
|
||||||
):Serializable
|
|
||||||
+58
-47
@@ -1,15 +1,12 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.viewmodel
|
package com.zmkg.coaloperation.ui.tunneling.viewmodel
|
||||||
|
|
||||||
import com.zmkg.coaloperation.base.viewmodel.BaseViewModel
|
import com.zmkg.coaloperation.base.viewmodel.BaseViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
import com.zmkg.coaloperation.data.repository.HomeRepository
|
import com.zmkg.coaloperation.data.repository.HomeRepository
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.superfuntion.handleRequest
|
import com.zmkg.coaloperation.superfuntion.handleRequest
|
||||||
import com.zmkg.coaloperation.superfuntion.launch
|
import com.zmkg.coaloperation.superfuntion.launch
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingFaceAddBean
|
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,11 +16,11 @@ class TunnelingViewModel : BaseViewModel() {
|
|||||||
|
|
||||||
|
|
||||||
// var tunnelingHomeList = MutableSharedFlow<MutableList<TunnelingHomeBean>?>()
|
// var tunnelingHomeList = MutableSharedFlow<MutableList<TunnelingHomeBean>?>()
|
||||||
var tunnelingHomeItemList = MutableSharedFlow<MutableList<TunnelingHomeItemBean>?>()
|
// var tunnelingHomeItemList = MutableSharedFlow<MutableList<TunnelingHomeItemBean>?>()
|
||||||
var tunnelingWorkFaceAdd = MutableSharedFlow<Boolean>()//新增面
|
// var tunnelingWorkFaceAdd = MutableSharedFlow<Boolean>()//新增面
|
||||||
var faceWorkDetailData = MutableStateFlow<FaceWorkDetailBean?>(null)//面详情
|
// var faceWorkDetailData = MutableStateFlow<FaceWorkDetailBean?>(null)//面详情
|
||||||
|
//
|
||||||
var itemIndex = MutableStateFlow(0)//item的下标
|
// var itemIndex = MutableStateFlow(0)//item的下标
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
}
|
}
|
||||||
@@ -42,44 +39,44 @@ class TunnelingViewModel : BaseViewModel() {
|
|||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
fun getTunnelingHomeItemData(index: Int,surfaceId: String?) {
|
// fun getTunnelingHomeItemData(index: Int,surfaceId: String?) {
|
||||||
launch(
|
// launch(
|
||||||
{
|
// {
|
||||||
itemIndex.emit(index)
|
// itemIndex.emit(index)
|
||||||
handleRequest(
|
// handleRequest(
|
||||||
HomeRepository.getTunnelingHomeItemData(surfaceId),
|
// HomeRepository.getTunnelingHomeItemData(surfaceId),
|
||||||
successBlock = {
|
// successBlock = {
|
||||||
tunnelingHomeItemList.emit(it.data)
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getTunnelingSurfaceDetail(surfaceId: String?) {
|
|
||||||
launch(
|
|
||||||
{
|
|
||||||
handleRequest(
|
|
||||||
HomeRepository.getTunnelingSurfaceDetail(surfaceId),
|
|
||||||
successBlock = {
|
|
||||||
// tunnelingHomeItemList.emit(it.data)
|
// tunnelingHomeItemList.emit(it.data)
|
||||||
faceWorkDetailData.emit(it.data)
|
//
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean) {
|
// fun getTunnelingSurfaceDetail(surfaceId: String?) {
|
||||||
launch(
|
// launch(
|
||||||
{
|
// {
|
||||||
handleRequest(
|
// handleRequest(
|
||||||
HomeRepository.postTunnellingSurfaceAdd(tunnelingFaceAddBean),
|
// HomeRepository.getTunnelingSurfaceDetail(surfaceId),
|
||||||
successBlock = {
|
// successBlock = {
|
||||||
tunnelingWorkFaceAdd.emit(true)
|
//// tunnelingHomeItemList.emit(it.data)
|
||||||
})
|
// faceWorkDetailData.emit(it.data)
|
||||||
}
|
// })
|
||||||
)
|
// }
|
||||||
}
|
// )
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean) {
|
||||||
|
// launch(
|
||||||
|
// {
|
||||||
|
// handleRequest(
|
||||||
|
// HomeRepository.postTunnellingSurfaceAdd(tunnelingFaceAddBean),
|
||||||
|
// successBlock = {
|
||||||
|
// tunnelingWorkFaceAdd.emit(true)
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
|
||||||
var tunnelFaceAndRecordList = MutableSharedFlow<MutableList<TunnelWorkingFaceEntity>?>()
|
var tunnelFaceAndRecordList = MutableSharedFlow<MutableList<TunnelWorkingFaceEntity>?>()
|
||||||
|
|
||||||
@@ -108,4 +105,18 @@ class TunnelingViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tunnelDataPush = MutableSharedFlow<Any?>()
|
||||||
|
|
||||||
|
fun tunnelDataPush(data:TunnelSubmitData) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.tunnelDataPush(data),
|
||||||
|
successBlock = {
|
||||||
|
tunnelDataPush.emit(it.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user