feat(出港查询): 三格统计取服务端分项,筛选补日期类型,详情移除锁定状态/计费重量(问题清单 #21/#22)
- #21 已入库/已离港改取 pageQueryTotal 出参 storedNumber/departedNumber(全量口径),删除客户端计数 - #21「起始时间参数无意义」:内网实测 beginDate/endDate 仅在携带 dateState 时生效, 手机筛选新增「日期类型」(入库/离港,默认入库,与主干平板一致),有起止日期时才携带 dateState - #22 后端确认无需展示:运单信息移除「锁定状态」「计费重量」,件重区改两列对齐 - 内网实测:当日入库 2/2/0;切换离港 0/0/0,与直调一致 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import androidx.lifecycle.MutableLiveData
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.holder.GjcQueryViewHolder
|
||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||
import com.lukouguoji.module_base.bean.GjcMaWb
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.http.net.NetApply
|
||||
import com.lukouguoji.module_base.ktx.launchCollect
|
||||
@@ -81,14 +80,17 @@ class GjcQueryViewModel : BasePageViewModel() {
|
||||
// 特码下拉列表(设计稿筛选弹层为下拉;平板筛选为文本输入,不加载)
|
||||
val specialCodeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
// 三格统计:已入库 / 已离港(总票数复用 totalCount,为服务端全量口径)
|
||||
// 后端无分项统计出参,且文档定义的 isFclose 入参实测被 pageQuery/pageQueryTotal 静默忽略
|
||||
// (2026-07-31 内网 A/B 验证,见接口问题清单)——已入库/已离港暂为「已加载数据」客户端计数口径
|
||||
// 三格统计:总票数 / 已入库 / 已离港,均取 pageQueryTotal 出参(wbNumber / storedNumber / departedNumber),
|
||||
// 与列表同条件、服务端全量口径
|
||||
val storedCount = MutableLiveData("0")
|
||||
val departedCount = MutableLiveData("0")
|
||||
|
||||
// 日期类型(0:入库,1:离港),与主干平板端一致。后端 beginDate/endDate 仅在携带 dateState 时生效
|
||||
// (内网实测:不带 dateState 时起止日期被忽略)。平板布局(本分支)不绑定,phoneExtras 关闭时不进请求
|
||||
val dateState = MutableLiveData("0")
|
||||
val dateStateList = MutableLiveData(listOf(KeyValue("入库", "0"), KeyValue("离港", "1")))
|
||||
|
||||
private var phoneExtrasEnabled = false
|
||||
private var phoneLoadedList: List<GjcMaWb> = emptyList()
|
||||
|
||||
/**
|
||||
* 手机形态专属初始化(Activity 在 DeviceUtil.isPhone() 时调用)。
|
||||
@@ -186,10 +188,15 @@ class GjcQueryViewModel : BasePageViewModel() {
|
||||
* 核心方法:调用API获取数据并转换PageInfo为BaseListBean
|
||||
*/
|
||||
override fun getData() {
|
||||
// 手机版:日期类型,仅在有起止日期时携带(平板 phoneExtrasEnabled 恒 false → null 不进请求)
|
||||
val hasDate = !flightDateStart.value.isNullOrEmpty() || !flightDateEnd.value.isNullOrEmpty()
|
||||
val dateStateParam = if (phoneExtrasEnabled && hasDate) dateState.value?.toIntOrNull() else null
|
||||
|
||||
// 构建查询参数(列表接口)
|
||||
val listParams = mapOf(
|
||||
"pageNum" to pageModel.page,
|
||||
"pageSize" to pageModel.limit,
|
||||
"dateState" to dateStateParam,
|
||||
"beginDate" to flightDateStart.value!!.ifEmpty { null },
|
||||
"endDate" to flightDateEnd.value!!.ifEmpty { null },
|
||||
"agentCode" to agentId.value!!.ifEmpty { null },
|
||||
@@ -206,6 +213,7 @@ class GjcQueryViewModel : BasePageViewModel() {
|
||||
|
||||
// 构建查询参数(统计接口 - 使用相同的搜索条件)
|
||||
val totalParams = mapOf(
|
||||
"dateState" to dateStateParam,
|
||||
"beginDate" to flightDateStart.value!!.ifEmpty { null },
|
||||
"endDate" to flightDateEnd.value!!.ifEmpty { null },
|
||||
"agentCode" to agentId.value!!.ifEmpty { null },
|
||||
@@ -227,14 +235,6 @@ class GjcQueryViewModel : BasePageViewModel() {
|
||||
onSuccess = { pageInfo ->
|
||||
// ⚠️ 核心:使用toBaseListBean()转换PageInfo为BaseListBean
|
||||
pageModel.handleListBean(pageInfo.toBaseListBean())
|
||||
|
||||
// 手机三格统计:对已加载数据做客户端计数(平板不触发)
|
||||
if (phoneExtrasEnabled) {
|
||||
val pageItems = pageInfo.list ?: emptyList()
|
||||
phoneLoadedList =
|
||||
if (pageModel.page <= 1) pageItems else phoneLoadedList + pageItems
|
||||
updatePhoneCounts()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,20 +247,13 @@ class GjcQueryViewModel : BasePageViewModel() {
|
||||
totalCount.value = (data?.wbNumber ?: 0).toString()
|
||||
totalPc.value = (data?.totalPc ?: 0).toString()
|
||||
totalWeight.value = (data?.totalWeight ?: 0.0).toString()
|
||||
// 手机三格统计分项(平板布局不绑定,无影响)
|
||||
storedCount.value = (data?.storedNumber ?: 0).toString()
|
||||
departedCount.value = (data?.departedNumber ?: 0).toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机三格统计(已入库/已离港):与卡片状态标签同一判定口径(fclose / opDate),
|
||||
* 统计范围为已加载的列表数据。
|
||||
*/
|
||||
private fun updatePhoneCounts() {
|
||||
departedCount.value = phoneLoadedList.count { it.isQueryDeparted }.toString()
|
||||
storedCount.value =
|
||||
phoneLoadedList.count { !it.isQueryDeparted && it.isQueryStored }.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理扫码结果
|
||||
*/
|
||||
|
||||
@@ -239,21 +239,31 @@
|
||||
setOnResetClick="@{(v)-> viewModel.resetFilter()}"
|
||||
title='@{"筛选条件"}'>
|
||||
|
||||
<!-- 航班日期起(平板搜索行字段,手机移入弹层) -->
|
||||
<!-- 日期类型(dateState:入库/离港,与主干平板一致;后端起止日期仅在携带它时生效) -->
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneDataLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
hint='@{"请选择航班日期"}'
|
||||
title='@{"航班日期起"}'
|
||||
hint='@{"请选择日期类型"}'
|
||||
list="@{viewModel.dateStateList}"
|
||||
title='@{"日期类型"}'
|
||||
type="@{PhoneDataLayoutType.SPINNER}"
|
||||
value="@={viewModel.dateState}" />
|
||||
|
||||
<!-- 开始日期(平板搜索行字段,手机移入弹层) -->
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneDataLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
hint='@{"请选择开始日期"}'
|
||||
title='@{"开始日期"}'
|
||||
type="@{PhoneDataLayoutType.DATE}"
|
||||
value="@={viewModel.flightDateStart}" />
|
||||
|
||||
<!-- 航班日期止 -->
|
||||
<!-- 结束日期 -->
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneDataLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
hint='@{"请选择航班日期"}'
|
||||
title='@{"航班日期止"}'
|
||||
hint='@{"请选择结束日期"}'
|
||||
title='@{"结束日期"}'
|
||||
type="@{PhoneDataLayoutType.DATE}"
|
||||
value="@={viewModel.flightDateEnd}" />
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
数据全部来自既有 viewModel.maWbData(IntExpSearch/detail 的 maWb+maWbM 合并 Map),
|
||||
取值统一走 viewModel.str()/dec() 帮助方法(空值兜底 "-")。
|
||||
按设计稿新增展示的字段(承运人/始发站/中转站/目的站/UN编号/锁定状态/计费重量),
|
||||
其中锁定状态(lockStatus)与计费重量(cashWeight)在接口文档中无定义,实机核对后如缺失记入问题清单。
|
||||
按设计稿新增展示的字段(承运人/始发站/中转站/目的站/UN编号);
|
||||
锁定状态与计费重量后端确认无需展示,已移除(问题清单 #22)。
|
||||
入库件数/入库重量为 warehouseList 各批次求和(viewModel.inPcTotal/inWeightTotal)。
|
||||
-->
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
@@ -167,20 +167,13 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 锁定状态 | 包装类型 -->
|
||||
<!-- 包装类型(半宽) -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneKvItem
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
title='@{"锁定状态"}'
|
||||
value='@{viewModel.str(viewModel.maWbData, "lockStatus")}' />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneKvItem
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -188,6 +181,11 @@
|
||||
title='@{"包装类型"}'
|
||||
value='@{viewModel.str(viewModel.maWbData, "packageType")}' />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 业务类型 | 入库时间 -->
|
||||
@@ -286,7 +284,7 @@
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@color/phone_divider" />
|
||||
|
||||
<!-- 运单件数 | 运单重量 | 计费重量 -->
|
||||
<!-- 运单件数 | 运单重量 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -306,13 +304,6 @@
|
||||
title='@{"运单重量"}'
|
||||
value='@{viewModel.dec(viewModel.maWbData, "weight")}' />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.phone.PhoneKvItem
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
title='@{"计费重量"}'
|
||||
value='@{viewModel.dec(viewModel.maWbData, "cashWeight")}' />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 入库件数 | 入库重量 -->
|
||||
@@ -336,12 +327,6 @@
|
||||
title='@{"入库重量"}'
|
||||
value="@{viewModel.inWeightTotal}" />
|
||||
|
||||
<!-- 占位对齐第三列 -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user