feat: 国际出港查询新增日期类型与航班航次统计

- 合计栏在总重量后追加航班航次(取统计接口 flightNumber)
- 日期范围前新增日期类型下拉(入库/离港),对应接口 dateState 参数
- 航班号从筛选弹框移至列表上方,出库状态移入筛选弹框
- dateState、outState 按接口文档改为整型传参

原航班号查询无效的原因并非参数名有误(fno 与文档一致),
而是缺少 dateState 导致后端按默认日期口径过滤,补齐后已实测生效。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-28 14:49:46 +08:00
parent 2f3ae2a814
commit ded57554fa
4 changed files with 73 additions and 49 deletions

View File

@@ -54,7 +54,7 @@ class GjcQueryActivity :
}
// 航班号:大写字母+数字
binding.filterPanel.filterFlightNo.et.setUpperCaseAlphanumericFilter()
binding.flightNoSearch.et.setUpperCaseAlphanumericFilter()
// 目的港:仅大写字母
binding.filterPanel.filterDest.et.setUpperCaseLetterFilter()

View File

@@ -25,13 +25,22 @@ import com.lukouguoji.module_base.ktx.formatDate
class GjcQueryViewModel : BasePageViewModel() {
// ==================== 搜索条件 ====================
val dateState = MutableLiveData("0") // 日期类型0入库1离港
val flightDateStart = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期起
val flightDateEnd = MutableLiveData("") // 航班日期止
val agentId = MutableLiveData("") // 代理ID
val outStatus = MutableLiveData("") // 出库状态
val flightNo = MutableLiveData("") // 航班号
val waybillNo = MutableLiveData("") // 运单号
// ==================== 下拉列表 ====================
// 日期类型下拉列表(对应接口 dateState
val dateStateList = MutableLiveData(
listOf(
KeyValue("入库", "0"),
KeyValue("离港", "1")
)
)
// 代理下拉列表从API获取
val agentList = MutableLiveData(listOf(KeyValue("全部", "")))
@@ -52,6 +61,7 @@ class GjcQueryViewModel : BasePageViewModel() {
val totalCount = MutableLiveData("0") // 合计票数
val totalPc = MutableLiveData("0") // 总件数
val totalWeight = MutableLiveData("0") // 总重量
val totalFlightNumber = MutableLiveData("0") // 航班航次
// ==================== 筛选面板 ====================
val filterVisible = MutableLiveData(false)
@@ -70,7 +80,7 @@ class GjcQueryViewModel : BasePageViewModel() {
// ==================== 筛选条件 ====================
val spCode = MutableLiveData("") // 特码
val flightNo = MutableLiveData("") // 航班号
val outStatus = MutableLiveData("") // 出库状态
val dest = MutableLiveData("") // 目的港
val awbType = MutableLiveData("") // 运单类型
val businessType = MutableLiveData("") // 业务类型
@@ -79,11 +89,11 @@ class GjcQueryViewModel : BasePageViewModel() {
// 是否有筛选条件(任意一个非空则为 true用于筛选按钮红点
val hasFilter: MediatorLiveData<Boolean> = MediatorLiveData<Boolean>().apply {
val update = { _: Any? ->
value = listOf(spCode, flightNo, dest, awbType, businessType, goodsCn)
value = listOf(spCode, outStatus, dest, awbType, businessType, goodsCn)
.any { !it.value.isNullOrEmpty() }
}
addSource(spCode, update)
addSource(flightNo, update)
addSource(outStatus, update)
addSource(dest, update)
addSource(awbType, update)
addSource(businessType, update)
@@ -127,7 +137,7 @@ class GjcQueryViewModel : BasePageViewModel() {
*/
fun resetFilter() {
spCode.value = ""
flightNo.value = ""
outStatus.value = ""
dest.value = ""
awbType.value = ""
businessType.value = ""
@@ -160,39 +170,32 @@ class GjcQueryViewModel : BasePageViewModel() {
* 核心方法调用API获取数据并转换PageInfo为BaseListBean
*/
override fun getData() {
// 公共查询条件(列表与统计接口共用)
val commonParams = mapOf(
// 日期类型0入库1离港+ 日期范围
"dateState" to dateState.value?.ifEmpty { null }?.toIntOrNull(),
"beginDate" to flightDateStart.value?.ifEmpty { null },
"endDate" to flightDateEnd.value?.ifEmpty { null },
"agentCode" to agentId.value?.ifEmpty { null },
"fno" to flightNo.value?.ifEmpty { null },
"wbNo" to waybillNo.value?.ifEmpty { null },
// 筛选面板条件
"spCode" to spCode.value?.ifEmpty { null },
"outState" to outStatus.value?.ifEmpty { null }?.toIntOrNull(),
"dest" to dest.value?.ifEmpty { null },
"awbType" to awbType.value?.ifEmpty { null },
"businessType" to businessType.value?.ifEmpty { null },
"goodsCn" to goodsCn.value?.ifEmpty { null }
)
// 构建查询参数(列表接口)
val listParams = mapOf(
val listParams = (commonParams + mapOf(
"pageNum" to pageModel.page,
"pageSize" to pageModel.limit,
"beginDate" to flightDateStart.value!!.ifEmpty { null },
"endDate" to flightDateEnd.value!!.ifEmpty { null },
"agentCode" to agentId.value!!.ifEmpty { null },
"outState" to outStatus.value!!.ifEmpty { null },
"wbNo" to waybillNo.value!!.ifEmpty { null },
// 筛选条件(暂未使用)
"spCode" to spCode.value!!.ifEmpty { null },
"fno" to flightNo.value!!.ifEmpty { null },
"dest" to dest.value!!.ifEmpty { null },
"awbType" to awbType.value!!.ifEmpty { null },
"businessType" to businessType.value!!.ifEmpty { null },
"goodsCn" to goodsCn.value!!.ifEmpty { null }
).toRequestBody()
"pageSize" to pageModel.limit
)).toRequestBody()
// 构建查询参数(统计接口 - 使用相同的搜索条件)
val totalParams = mapOf(
"beginDate" to flightDateStart.value!!.ifEmpty { null },
"endDate" to flightDateEnd.value!!.ifEmpty { null },
"agentCode" to agentId.value!!.ifEmpty { null },
"outState" to outStatus.value!!.ifEmpty { null },
"wbNo" to waybillNo.value!!.ifEmpty { null },
// 筛选条件
"spCode" to spCode.value!!.ifEmpty { null },
"fno" to flightNo.value!!.ifEmpty { null },
"dest" to dest.value!!.ifEmpty { null },
"awbType" to awbType.value!!.ifEmpty { null },
"businessType" to businessType.value!!.ifEmpty { null },
"goodsCn" to goodsCn.value!!.ifEmpty { null }
).toRequestBody()
val totalParams = commonParams.toRequestBody()
// 获取列表数据显示loading
launchLoadingCollect({
@@ -213,6 +216,7 @@ class GjcQueryViewModel : BasePageViewModel() {
totalCount.value = (data?.wbNumber ?: 0).toString()
totalPc.value = (data?.totalPc ?: 0).toString()
totalWeight.value = (data?.totalWeight ?: 0.0).toString()
totalFlightNumber.value = (data?.flightNumber ?: 0).toString()
}
}
}

View File

@@ -42,6 +42,16 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- 日期类型(入库/离港) -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
hint='@{"请选择日期类型"}'
list="@{viewModel.dateStateList}"
type="@{SearchLayoutType.SPINNER}"
value="@={viewModel.dateState}" />
<!-- 航班日期起 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
@@ -72,15 +82,15 @@
type="@{SearchLayoutType.SPINNER}"
value="@={viewModel.agentId}" />
<!-- 出库状态 -->
<!-- 航班号 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:id="@+id/flight_no_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
hint='@{"请选择出库状态"}'
list="@{viewModel.outStatusList}"
type="@{SearchLayoutType.SPINNER}"
value="@={viewModel.outStatus}" />
hint='@{"请输入航班号"}'
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.flightNo}" />
<!-- 运单号 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
@@ -204,6 +214,16 @@
android:textStyle="bold"
tools:text="总重量100" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text='@{`航班航次:` + viewModel.totalFlightNumber}'
android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="16sp"
android:textStyle="bold"
tools:text="航班航次2" />
</LinearLayout>
</LinearLayout>

View File

@@ -67,17 +67,17 @@
type="@{DataLayoutType.INPUT}"
value='@={viewModel.spCode}' />
<!-- 航班号 -->
<!-- 出库状态 -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:id="@+id/filter_flight_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
hint='@{"请输入航班号"}'
title='@{"航班号"}'
hint='@{"请选择出库状态"}'
list="@{viewModel.outStatusList}"
title='@{"出库状态"}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.flightNo}' />
type="@{DataLayoutType.SPINNER}"
value='@={viewModel.outStatus}' />
<!-- 目的港 -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew