feat: 国际出港装载列表项加航程及始发站/目的站筛选

列表项改为5列并新增航程(range 为空时回退始发港-目的港拼接);
搜索区参考电报生成接口,填航班日期+号联动查询,始发站可下拉、
目的站自动填充只读,dep/dest 作为筛选传给列表接口。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 12:19:51 +08:00
parent 608f1af1f4
commit 3fedef27a7
5 changed files with 172 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.noNull
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.model.ScanModel
@@ -34,6 +35,77 @@ class IntExpLoadViewModel : BasePageViewModel() {
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期
val flightNo = MutableLiveData("") // 航班号
val waybillNo = MutableLiveData("") // 运单号
val depPort = MutableLiveData("") // 始发站(下拉选择)
val depPortList = MutableLiveData<List<KeyValue>>(emptyList()) // 始发站下拉列表(始发港 + 经停港)
val destPort = MutableLiveData("") // 目的站(航班查询自动填充,不可编辑)
// ========== 航班级联查询 ==========
private var lastQueriedFlight = "" // 避免重复查询
/**
* 航班日期输入完成回调
*/
fun onFlightDateInputComplete() {
lastQueriedFlight = ""
queryFlightIfReady()
}
/**
* 航班号输入完成回调
*/
fun onFlightNoInputComplete() {
queryFlightIfReady()
}
/**
* 航班日期 + 航班号 均有值时,查询航班并填充始发站/目的站
* 参考「电报生成」(/flt/intFlight):始发站下拉(始发港+经停港),目的站自动填充且只读
*/
private fun queryFlightIfReady() {
val fdate = flightDate.value
val fno = flightNo.value
if (fdate.isNullOrEmpty() || fno.isNullOrEmpty()) return
val key = "$fdate-$fno"
if (key == lastQueriedFlight) return
lastQueriedFlight = key
launchCollect({
NetApply.api.getGjFlightBean(
mapOf(
"fdate" to fdate,
"fno" to fno,
"ieFlag" to "E", // 出港
).toRequestBody()
)
}) {
onSuccess = {
if (it.verifySuccess() && it.data != null) {
val flight = it.data!!
// 目的站:航班查询返回,自动填充
destPort.value = flight.fdest.noNull()
// 始发站下拉:始发港 + 经停港(可逗号分隔多个)
val list = mutableListOf(KeyValue(flight.fdep.noNull(), flight.fdep.noNull()))
flight.jtz.split(",").forEach { stop ->
val s = stop.trim()
if (s.isNotEmpty()) list.add(KeyValue(s, s))
}
depPortList.value = list
depPort.value = flight.fdep.noNull()
} else {
depPortList.value = emptyList()
depPort.value = ""
destPort.value = ""
}
}
onFailed = { _, _ ->
depPortList.value = emptyList()
depPort.value = ""
destPort.value = ""
}
}
}
// ========== 统计信息 ==========
val totalCount = MutableLiveData("0") // 合计票数
@@ -199,6 +271,8 @@ class IntExpLoadViewModel : BasePageViewModel() {
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null },
dep = depPort.value?.ifEmpty { null },
dest = destPort.value?.ifEmpty { null },
pageNum = pageModel.page,
pageSize = pageModel.limit
)
@@ -210,7 +284,9 @@ class IntExpLoadViewModel : BasePageViewModel() {
val totalParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null }
wbNo = waybillNo.value?.ifEmpty { null },
dep = depPort.value?.ifEmpty { null },
dest = destPort.value?.ifEmpty { null }
).toRequestBody()
// 获取列表 (带Loading)

View File

@@ -37,6 +37,7 @@
android:layout_weight="1"
hint='@{"请选择航班日期"}'
icon="@{@drawable/img_date}"
setRefreshCallBack="@{viewModel::onFlightDateInputComplete}"
type="@{SearchLayoutType.DATE}"
value="@={viewModel.flightDate}" />
@@ -46,10 +47,31 @@
android:layout_height="wrap_content"
android:layout_weight="1"
hint='@{"请输入航班号"}'
setRefreshCallBack="@{viewModel::onFlightNoInputComplete}"
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.flightNo}"
setUpperCaseAlphanumeric="@{true}" />
<!-- 始发站(下拉选择:始发港 + 经停港) -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
hint='@{"始发站"}'
type="@{SearchLayoutType.SPINNER}"
list="@{viewModel.depPortList}"
value="@={viewModel.depPort}" />
<!-- 目的站(航班查询自动填充,不可编辑) -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
hint='@{"目的站"}'
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.destPort}" />
<!-- 运单号 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
@@ -71,10 +93,10 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.6"
android:gravity="center_vertical|start"
android:orientation="horizontal"
android:paddingHorizontal="24dp">
android:paddingHorizontal="12dp">
<ImageView
android:layout_width="36dp"

View File

@@ -42,7 +42,7 @@
android:layout_weight="1"
android:orientation="vertical">
<!-- 第一行:运单号、状态、件数、重量 -->
<!-- 第一行:运单号、状态、件数、重量、特码 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -53,7 +53,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -63,7 +63,7 @@
android:text="运单号:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{4}" />
completeSpace="@{5}" />
<TextView
android:layout_width="wrap_content"
@@ -79,7 +79,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.9"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -89,7 +89,7 @@
android:text="状态:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{5}" />
completeSpace="@{4}" />
<TextView
android:layout_width="wrap_content"
@@ -104,7 +104,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.9"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -114,7 +114,7 @@
android:text="件数:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{4}" />
completeSpace="@{3}" />
<TextView
android:layout_width="wrap_content"
@@ -129,7 +129,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -139,7 +139,7 @@
android:text="重量:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{5}" />
completeSpace="@{6}" />
<TextView
android:layout_width="wrap_content"
@@ -150,21 +150,11 @@
</LinearLayout>
</LinearLayout>
<!-- 第二行:特码、航班日期、航班号、品名(中) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- 特码 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.9"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -174,7 +164,7 @@
android:text="特码:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{4}" />
completeSpace="@{3}" />
<TextView
android:layout_width="wrap_content"
@@ -185,11 +175,21 @@
</LinearLayout>
</LinearLayout>
<!-- 第二行:航班日期、航班号、航程、品名(中) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- 航班日期 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -214,7 +214,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.9"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -235,11 +235,36 @@
</LinearLayout>
<!-- 航程 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="航程:"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{3}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.rangeText}"
android:textColor="@color/text_normal"
android:textSize="15sp" />
</LinearLayout>
<!-- 品名(中) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -249,7 +274,7 @@
android:text="品名(中)"
android:textColor="@color/text_normal"
android:textSize="15sp"
completeSpace="@{5}" />
completeSpace="@{6}" />
<TextView
android:layout_width="wrap_content"
@@ -262,6 +287,13 @@
</LinearLayout>
<!-- 占位 (与第一行特码列对齐) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:orientation="horizontal" />
</LinearLayout>
</LinearLayout>