feat: 国际出港收运检查列表

This commit is contained in:
2025-11-17 17:05:37 +08:00
parent c6330a818f
commit af62041ef7
8 changed files with 180 additions and 49 deletions

View File

@@ -0,0 +1,12 @@
package com.lukouguoji.module_base.bean
/**
* 舱单统计数据DTO
* 用于国际出港收运审核统计接口返回
*/
data class ManifestTotalDto(
var wbNumber: Int = 0, // 运单票数/总票数
var totalPc: Long = 0, // 总件数
var totalWeight: Double = 0.0, // 总重量
var cargoWeight: Double = 0.0 // 总货重
)

View File

@@ -37,4 +37,7 @@ object ConstantEvent {
// 通用刷新事件
const val EVENT_REFRESH = "event_refresh"
// 复选框状态变化事件
const val EVENT_CHECK_CHANGED = "event_check_changed"
}

View File

@@ -43,6 +43,7 @@ import com.lukouguoji.module_base.bean.GncCunFangBean
import com.lukouguoji.module_base.bean.GncDistributionBean
import com.lukouguoji.module_base.bean.GncFuBangBean
import com.lukouguoji.module_base.bean.GjcInspectionBean
import com.lukouguoji.module_base.bean.ManifestTotalDto
import com.lukouguoji.module_base.bean.GncInspectionBean
import com.lukouguoji.module_base.bean.GncQueryBean
import com.lukouguoji.module_base.bean.GncQueryDetailsBean
@@ -187,6 +188,12 @@ interface Api {
@POST("typeCode/domExp/agentCode")
suspend fun getGncAgentList(): DictListBean
/**
* 获取代理人-国际出港-下拉框
*/
@POST("typeCode/intExp/agentCode")
suspend fun getIntExpAgentList(): DictListBean
/**
* 获取业务类型---CI:国内进港,CO:国内出港,II:国际进港,IO:国际出港 下拉框
*/
@@ -373,6 +380,13 @@ interface Api {
@POST("IntExpCheckInCheck/audit")
suspend fun auditGjcInspection(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
/**
* 条件查询-国际出港-收运审核-统计数据(总件数、总重量、运单总数)
* 接口路径: /IntExpCheckInCheck/pageQueryTotal
*/
@POST("IntExpCheckInCheck/pageQueryTotal")
suspend fun getGjcInspectionTotal(@Body data: RequestBody): BaseResultBean<ManifestTotalDto>
///////////////////////////////////////////////////////////////////////////
// 国际进-电报解析
///////////////////////////////////////////////////////////////////////////

View File

@@ -40,6 +40,18 @@ class GjcInspectionActivity :
viewModel.refresh()
}
// 监听checkbox状态变化事件
FlowBus.with<String>(ConstantEvent.EVENT_CHECK_CHANGED)
.observe(this) {
viewModel.onItemCheckChanged()
}
// 监听全选状态变化,更新图标
viewModel.isAllChecked.observe(this) { isAllChecked ->
// 通过alpha值表示全选状态全选时alpha=1.0未全选时alpha=0.5
binding.checkIcon.alpha = if (isAllChecked) 1.0f else 0.5f
}
// 初始化代理列表
viewModel.initAgentList()

View File

@@ -5,6 +5,11 @@ import android.view.View
import com.lukouguoji.gjc.databinding.ItemGjcInspectionBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjcInspectionBean
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.impl.FlowBus
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
/**
* 国际出港收运检查列表 ViewHolder
@@ -19,6 +24,10 @@ class GjcInspectionViewHolder(view: View) :
// 点击checkbox切换选中状态
binding.ivIcon.setOnClickListener {
bean.checked.set(!bean.checked.get())
// 发送checkbox状态变化事件
CoroutineScope(Dispatchers.Main).launch {
FlowBus.with<String>(ConstantEvent.EVENT_CHECK_CHANGED).emit("check_changed")
}
}
// 设置审核状态文本和颜色

View File

@@ -14,6 +14,7 @@ import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.formatDate
import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.noNull
@@ -24,6 +25,7 @@ import com.lukouguoji.module_base.model.ScanModel
import com.lukouguoji.module_base.util.CheckUtil
import dev.utils.app.info.KeyValue
import kotlinx.coroutines.launch
import java.util.Date
/**
* 国际出港收运检查 ViewModel
@@ -44,9 +46,8 @@ class GjcInspectionViewModel : BasePageViewModel() {
val auditStatusList = MutableLiveData(
listOf(
KeyValue("全部", ""),
KeyValue("已通过", "1"),
KeyValue("退回", "2"),
KeyValue("未审核", "0"),
KeyValue("通过", "1"),
)
)
@@ -59,6 +60,14 @@ class GjcInspectionViewModel : BasePageViewModel() {
val totalPc = MutableLiveData("0") // 总件数
val totalWeight = MutableLiveData("0") // 总重量
// 全选状态
val isAllChecked = MutableLiveData(false)
init {
// 设置航班日期默认值为当前日期
flightDate.value = Date().formatDate()
}
///////////////////////////////////////////////////////////////////////////
// 方法区
///////////////////////////////////////////////////////////////////////////
@@ -81,7 +90,8 @@ class GjcInspectionViewModel : BasePageViewModel() {
* 获取列表数据
*/
override fun getData() {
val body = mapOf(
// 构建查询参数(列表接口)
val listParams = mapOf(
"pageNum" to pageModel.page,
"pageSize" to pageModel.limit,
"fdate" to flightDate.value!!.ifEmpty { null },
@@ -91,15 +101,33 @@ class GjcInspectionViewModel : BasePageViewModel() {
"wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody()
// 构建查询参数(统计接口 - 使用相同的搜索条件)
val totalParams = mapOf(
"fdate" to flightDate.value!!.ifEmpty { null },
"fno" to flightNo.value!!.ifEmpty { null },
"agentCode" to agentId.value!!.ifEmpty { null },
"reviewStatus" to auditStatus.value!!.ifEmpty { null },
"wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody()
// 获取列表数据显示loading
launchLoadingCollect({
NetApply.api.getGjcInspectionList(body)
NetApply.api.getGjcInspectionList(listParams)
}) {
onSuccess = {
pageModel.handleListBean(it)
// 更新统计数据(包含在返回结果中)
totalCount.value = (it.total ?: 0).toString()
totalPc.value = (it.totalPc ?: 0).toString()
totalWeight.value = (it.totalWeight ?: 0.0).toString()
}
}
// 获取统计数据后台调用不显示loading
launchCollect({
NetApply.api.getGjcInspectionTotal(totalParams)
}) {
onSuccess = { result ->
val data = result.data
totalCount.value = (data?.wbNumber ?: 0).toString()
totalPc.value = (data?.totalPc ?: 0).toString()
totalWeight.value = (data?.totalWeight ?: 0.0).toString()
}
}
}
@@ -179,19 +207,42 @@ class GjcInspectionViewModel : BasePageViewModel() {
fun checkAllClick() {
val list = pageModel.rv!!.commonAdapter()!!.items as List<GjcInspectionBean>
CheckUtil.handleAllCheck(list)
updateCheckAllStatus()
}
/**
* 更新全选状态
*/
fun updateCheckAllStatus() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcInspectionBean>
if (list != null && list.isNotEmpty()) {
isAllChecked.value = list.all { it.checked.get() }
} else {
isAllChecked.value = false
}
}
/**
* 单个item点击事件用于更新全选状态
*/
fun onItemCheckChanged() {
updateCheckAllStatus()
}
/**
* 初始化代理下拉列表从API获取
*/
fun initAgentList() {
// TODO: 调用API获取代理列表
// 暂时使用模拟数据
agentList.value = listOf(
KeyValue("全部", ""),
KeyValue("SF", "SF"),
KeyValue("YTO", "YTO"),
KeyValue("ZTO", "ZTO"),
)
launchCollect({
NetApply.api.getIntExpAgentList()
}) {
onSuccess = { result ->
val list = mutableListOf(KeyValue("全部", ""))
result.data?.forEach {
list.add(KeyValue(it.name ?: "", it.code ?: ""))
}
agentList.value = list
}
}
}
}

View File

@@ -94,30 +94,6 @@
</LinearLayout>
<!-- 全选按钮 -->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:onClick="@{()->viewModel.checkAllClick()}"
android:text="全选" />
<ImageView
android:id="@+id/checkIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:onClick="@{()->viewModel.checkAllClick()}"
android:src="@drawable/img_check_all" />
</androidx.appcompat.widget.LinearLayoutCompat>
<!-- 列表 -->
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/srl"
@@ -144,16 +120,70 @@
android:gravity="center_vertical"
android:paddingHorizontal="15dp">
<TextView
<!-- 全选按钮区域 -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{()->viewModel.checkAllClick()}">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="全选"
android:textColor="@color/white"
android:textSize="16sp" />
<ImageView
android:id="@+id/checkIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="5dp"
android:src="@drawable/img_check_all" />
</LinearLayout>
<!-- 统计信息 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text='@{"合计:"+viewModel.totalCount+"票,总件数:"+viewModel.totalPc+",总重量:"+viewModel.totalWeight}'
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:text="合计1票总件数100总重量100" />
android:layout_marginLeft="20dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{"合计:"+viewModel.totalCount+"票"}'
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="合计11票" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text='@{"总件数:"+viewModel.totalPc}'
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="总件数100" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text='@{"总重量:"+viewModel.totalWeight}'
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="总重量100" />
</LinearLayout>
<!-- 操作按钮 -->
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()-> viewModel.auditRejectClick()}"

View File

@@ -201,7 +201,7 @@
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.8"
android:gravity="center_vertical">
<TextView
@@ -222,7 +222,7 @@
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.3"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView
@@ -270,7 +270,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@mipmap/right_icon"
android:src="@drawable/img_pda_right"
android:layout_marginLeft="10dp" />
</androidx.appcompat.widget.LinearLayoutCompat>