feat: 国际出港 fix bugs
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
// ========== 新增:展开按钮点击事件 ==========
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -48,8 +48,9 @@ class GjcInspectionViewModel : BasePageViewModel() {
|
||||
val auditStatusList = MutableLiveData(
|
||||
listOf(
|
||||
KeyValue("全部", ""),
|
||||
KeyValue("未审核", "0"),
|
||||
KeyValue("通过", "1"),
|
||||
KeyValue("未审核", "1"),
|
||||
KeyValue("已通过", "2"),
|
||||
KeyValue("退回", "3"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -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 -> {
|
||||
// 选择一个单据:跳转到出港运抵页面,携带运单号
|
||||
|
||||
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user