feat: 国际出港 fix bugs

This commit is contained in:
2026-01-20 18:34:45 +08:00
parent 9a034c1653
commit b0b109de9a
18 changed files with 223 additions and 191 deletions

View File

@@ -24,10 +24,11 @@ class GjcBoxWeighingAddActivity :
binding.viewModel = viewModel
viewModel.initOnCreated(this)
// 为架子车号、ULD编码、IMP代码添加大写字母和数字的输入限制
// 为架子车号、ULD编码、IMP代码、航班号添加大写字母和数字的输入限制
binding.carIdInput.et.setUpperCaseAlphanumericFilter()
binding.uldNoInput.et.setUpperCaseAlphanumericFilter()
binding.impCodeInput.et.setUpperCaseAlphanumericFilter()
binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
}
companion object {

View File

@@ -20,20 +20,13 @@ class IntExpTallyViewHolder(view: View) :
binding.position = position
binding.executePendingBindings()
// 图标点击切换选择状态(单向同步到子列表
// 图标点击切换选择状态(主单和分单独立,互不干扰
binding.ivIcon.setOnClickListener {
// 切换主列表项的选择状态
val newCheckedState = !bean.checked.get()
bean.checked.set(newCheckedState)
// 单向同步:主列表选择状态同步到所有子列表项
bean.haWbList?.forEach { haWb ->
haWb.checked.set(newCheckedState)
}
// 切换主单自己的选择状态,不同步到分单
bean.checked.set(!bean.checked.get())
// 刷新UI
binding.executePendingBindings()
binding.rvSub.adapter?.notifyDataSetChanged()
}
// ========== 新增:展开按钮点击事件 ==========

View File

@@ -314,10 +314,12 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
bean.uld = uldNo.value ?: ""
bean.fno = flightNo.value ?: ""
bean.fdate = flightDate.value ?: ""
bean.passageway = channel.value ?: ""
// 验证必填字段
if (bean.carId.verifyNullOrEmpty("请输入架子车号")) return
if (bean.uld.verifyNullOrEmpty("请输入ULD编号")) return
if (bean.passageway.verifyNullOrEmpty("请选择通道号")) return
// 验证是否已组装(复磅场景必须有 useId
if (usingUldData == null || usingUldData?.useId == 0L) {

View File

@@ -48,8 +48,9 @@ class GjcInspectionViewModel : BasePageViewModel() {
val auditStatusList = MutableLiveData(
listOf(
KeyValue("全部", ""),
KeyValue("未审核", "0"),
KeyValue("通过", "1"),
KeyValue("未审核", "1"),
KeyValue("通过", "2"),
KeyValue("退回", "3"),
)
)

View File

@@ -99,15 +99,17 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
*/
fun declareClick() {
// 获取列表数据
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcWeighingRecordBean> ?: return
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcWeighingRecordBean> ?: emptyList()
// 过滤选中项
val selectedItems = list.filter { it.isSelected }
when (selectedItems.size) {
0 -> {
// 没有选择单据:Toast 提示
showToast("请选择要申报的单据")
// 没有选择单据:直接跳转(不带参数)
com.alibaba.android.arouter.launcher.ARouter.getInstance()
.build(com.lukouguoji.module_base.router.ARouterConstants.ACTIVITY_URL_INT_EXP_ARRIVE)
.navigation()
}
1 -> {
// 选择一个单据:跳转到出港运抵页面,携带运单号

View File

@@ -44,6 +44,7 @@ class GjcWeighingStartViewModel : BaseViewModel() {
// 用于防止重复查询的标记
private var lastQueriedWbNo: String = ""
private var lastQueriedCarId: String = ""
// 航班日期格式化为字符串用于DataBinding
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate())
@@ -286,6 +287,30 @@ class GjcWeighingStartViewModel : BaseViewModel() {
ScanModel.startScan(getTopActivity(), Constant.RequestCode.CAR)
}
/**
* 托盘车号输入完成时调用
* 当用户输入完整托盘车号后,自动查询平板车信息并填充自重
*/
fun onCarIdInputComplete() {
val carId = maWbBean.value?.carId ?: ""
// 验证托盘车号是否为空
if (carId.isEmpty()) {
return
}
// 防止重复查询
if (carId == lastQueriedCarId) {
return
}
// 更新查询标记
lastQueriedCarId = carId
// 调用接口查询平板车信息
queryCarWeight(carId)
}
/**
* 托盘车号输入后查询自重
*/
@@ -295,18 +320,26 @@ class GjcWeighingStartViewModel : BaseViewModel() {
return
}
val params = mapOf(
"carId" to carId
).toRequestBody()
launchCollect({
// 查询托盘车自重接口(待确认具体接口)
// 暂时使用模拟数据
// NetApply.api.queryCarWeight(params)
carWeight.value = "0" // 模拟返回
NetApply.api.getFlatcarInfo(carId)
}) {
onSuccess = {
// carWeight.value = it.data?.weight?.toString() ?: "0"
onSuccess = { result ->
val data = result.data
if (data != null) {
// 填充托盘车自重
carWeight.value = data.carWeight.ifEmpty { "0" }
} else {
showToast("未找到该平板车信息")
carWeight.value = "0"
// 清空查询标记,允许重新查询
lastQueriedCarId = ""
}
}
onFailed = { code, msg ->
showToast("查询平板车失败: $msg")
carWeight.value = "0"
// 清空查询标记,允许重新查询
lastQueriedCarId = ""
}
}
}

View File

@@ -189,7 +189,7 @@ class IntExpLoadViewModel : BasePageViewModel() {
val pageParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
whNo = waybillNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null },
pageNum = pageModel.page,
pageSize = pageModel.limit
)
@@ -201,7 +201,7 @@ class IntExpLoadViewModel : BasePageViewModel() {
val totalParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
whNo = waybillNo.value?.ifEmpty { null }
wbNo = waybillNo.value?.ifEmpty { null }
).toRequestBody()
// 获取列表 (带Loading)

View File

@@ -73,23 +73,14 @@ class IntExpTallyViewModel : BasePageViewModel() {
}
/**
* 全选按钮点击 (切换全选状态,单向同步到子列表)
* 全选按钮点击 (切换主单的全选状态,分单选择独立)
*/
fun checkAllClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
// 切换全选状态
// 切换全选状态(只针对主单)
val shouldCheckAll = !isAllChecked.value!!
// 单向同步:主列表和子列表都设置为相同的选择状态
list.forEach { maWb ->
maWb.checked.set(shouldCheckAll)
// 同步到所有子列表项
maWb.haWbList?.forEach { haWb ->
haWb.checked.set(shouldCheckAll)
}
}
list.forEach { it.checked.set(shouldCheckAll) }
isAllChecked.value = shouldCheckAll
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
@@ -191,18 +182,40 @@ class IntExpTallyViewModel : BasePageViewModel() {
}
/**
* 理货申报 (批量操作)
* 理货申报 (批量操作,主单和分单分开)
*/
fun declareTally() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
val selectedItems = list.filter { it.isSelected }
if (selectedItems.isEmpty()) {
// 收集选中的主单
val selectedMaWbList = list.filter { it.isSelected }
// 收集选中的分单
val selectedHaWbList = mutableListOf<GjcHaWb>()
list.forEach { maWb ->
maWb.haWbList?.forEach { haWb ->
if (haWb.isSelected) {
selectedHaWbList.add(haWb)
}
}
}
// 检查是否有选中项
if (selectedMaWbList.isEmpty() && selectedHaWbList.isEmpty()) {
showToast("请选择要理货的记录")
return
}
val requestData = selectedItems.toRequestBody()
// 构建请求参数(区分主单和分单)
val params = mutableMapOf<String, Any?>()
if (selectedMaWbList.isNotEmpty()) {
params["maWbList"] = selectedMaWbList
}
if (selectedHaWbList.isNotEmpty()) {
params["haWbList"] = selectedHaWbList
}
val requestData = params.toRequestBody()
launchLoadingCollect({ NetApply.api.declareTally(requestData) }) {
onSuccess = {
@@ -269,7 +282,7 @@ class IntExpTallyViewModel : BasePageViewModel() {
val pageParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
whNo = waybillNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null },
hno = houseWaybillNo.value?.ifEmpty { null },
pageNum = pageModel.page,
pageSize = pageModel.limit
@@ -282,7 +295,7 @@ class IntExpTallyViewModel : BasePageViewModel() {
val totalParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
whNo = waybillNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null },
hno = houseWaybillNo.value?.ifEmpty { null }
).toRequestBody()

View File

@@ -363,6 +363,7 @@
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
hint='@{"请输入托盘车号"}'
setRefreshCallBack="@{viewModel::onCarIdInputComplete}"
title='@{"托盘车号"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"

View File

@@ -77,7 +77,7 @@
title="@{`托盘自重`}"
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value="@{`100`}" />
value="@{record.carWeight}" />
<!-- 计重时间字段(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew

View File

@@ -38,7 +38,7 @@
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:gravity="center"
android:text="@{bean.storageCode ?? `--`}"
android:text="@{bean.no ?? `--`}"
android:textColor="@android:color/black"
android:textSize="14sp" />
@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@{bean.inId ?? `--`}"
android:text="@{bean.inOpId ?? `--`}"
android:textColor="@android:color/black"
android:textSize="14sp" />
@@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@{bean.outId ?? `--`}"
android:text="@{bean.outOpId ?? `--`}"
android:textColor="@android:color/black"
android:textSize="14sp" />

View File

@@ -190,7 +190,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{(bean.dep.isEmpty() ? "" : bean.dep + "—") + (bean.dest1.isEmpty() ? "" : bean.dest1 + "—") + (bean.dest2.isEmpty() ? "" : bean.dest2 + "—") + bean.dest}'
android:text='@{bean.range}'
android:lines="1"
android:maxLines="1"
android:ellipsize="end" />

View File

@@ -41,18 +41,18 @@
android:layout_weight="1"
android:orientation="vertical">
<!-- 第一行ULD编、架子车号、总重、装机重量、货重 -->
<!-- 第一行ULD编、架子车号、总重、货重、航班信息 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- ULD编 -->
<!-- ULD编 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:layout_weight="1.1"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -60,17 +60,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="ULD编"
android:textColor="@color/text_normal"
android:text="ULD编"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.uld}"
android:textColor="@color/colorPrimary"
android:textSize="16sp"
android:textStyle="bold" />
android:textSize="16sp"/>
</LinearLayout>
@@ -87,14 +84,12 @@
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="架子车号:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf(bean.carId)}"
android:textColor="@color/text_normal"
android:text="@{bean.carId}"
android:textSize="16sp" />
</LinearLayout>
@@ -110,131 +105,19 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
completeSpace="@{5}"
android:text="总重:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf((int)bean.totalWeight)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 装机重量 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="装机重量:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf((int)bean.netWeight)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 货重 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="货重:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf((int)bean.cargoWeight)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</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.2"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="航班日期:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.fdateFormatted}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 航班号 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="航班号:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.fno}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 目的港 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -246,20 +129,74 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="货重:"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf((int)bean.cargoWeight)}"
android:textSize="16sp" />
</LinearLayout>
<!-- 航班信息 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="航班信息:"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.flight}"
android:textSize="16sp" />
</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.1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="目的港:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.fdest}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 交接人 -->
<!-- 库位号 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -271,15 +208,60 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="库位号:"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.transArea}"
android:textSize="16sp" />
</LinearLayout>
<!-- 复磅状态 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="复磅状态:"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.wtDate != null &amp;&amp; !bean.wtDate.isEmpty() ? `已复磅` : `未复磅`}"
android:textColor="@{bean.wtDate != null &amp;&amp; !bean.wtDate.isEmpty() ? @color/text_green : @color/text_normal}"
android:textSize="16sp" />
</LinearLayout>
<!-- 交接人 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="交接人:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.hoUserName}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
@@ -288,7 +270,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:layout_weight="1.2"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -297,14 +279,12 @@
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="交接时间:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.hoDate}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>