feat: 国际出港 出港计重 opt v

This commit is contained in:
2026-01-17 20:40:09 +08:00
parent 80a0983459
commit d6be019c3a
8 changed files with 97 additions and 15 deletions

View File

@@ -7,15 +7,18 @@ import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.holder.GjcWeighingRecordViewHolder
import com.lukouguoji.module_base.base.BasePageViewModel
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.bean.GjcWeighingRecordBean
import com.lukouguoji.module_base.http.net.NetApply
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.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.model.ScanModel
import com.lukouguoji.module_base.util.DictUtils
import dev.utils.app.info.KeyValue
import dev.utils.common.DateUtils
import com.lukouguoji.module_base.ktx.formatDate
import com.lukouguoji.module_base.ktx.formatDate
/**
* 国际出港计重记录 ViewModel
@@ -92,10 +95,33 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
}
/**
* 运抵申报按钮点击(暂未实现)
* 运抵申报按钮点击
*/
fun declareClick() {
// TODO: 跳转到运抵申报页面(待实现)
// 获取列表数据
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcWeighingRecordBean> ?: return
// 过滤选中项
val selectedItems = list.filter { it.isSelected }
when (selectedItems.size) {
0 -> {
// 没有选择单据Toast 提示
showToast("请选择要申报的单据")
}
1 -> {
// 选择一个单据:跳转到出港运抵页面,携带运单号
val waybillNo = selectedItems[0].wbNo
com.alibaba.android.arouter.launcher.ARouter.getInstance()
.build(com.lukouguoji.module_base.router.ARouterConstants.ACTIVITY_URL_INT_EXP_ARRIVE)
.withString("wbNoParam", waybillNo)
.navigation()
}
else -> {
// 选择多个单据Toast 提示
showToast("只能选择一个单据")
}
}
}
/**
@@ -110,7 +136,7 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
"fno" to flightNo.value!!.ifEmpty { null },
"agentCode" to agentCode.value!!.ifEmpty { null },
"spCode" to spCode.value!!.ifEmpty { null },
"likeNo" to waybillNo.value!!.ifEmpty { null },
"wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody()
// 构建查询参数(统计接口 - 使用相同的搜索条件)
@@ -119,7 +145,7 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
"fno" to flightNo.value!!.ifEmpty { null },
"agentCode" to agentCode.value!!.ifEmpty { null },
"spCode" to spCode.value!!.ifEmpty { null },
"likeNo" to waybillNo.value!!.ifEmpty { null },
"wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody()
// 获取列表数据显示loading

View File

@@ -258,7 +258,17 @@ class GjcWeighingStartViewModel : BaseViewModel() {
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
if (channel.value.verifyNullOrEmpty("请选择通道号")) return
// 2. 收集当前表单数据,更新到 bean
// 2. 校验件数: 运抵件数 + 实时件数 不能大于 预配件数
val realTimePcVal = realTimePc.value?.toLongOrNull() ?: 0L
val arrivePcVal = arrivePc.value?.toLongOrNull() ?: bean.arrivePc ?: 0L
val preallocatedPc = bean.pc ?: 0L
if (arrivePcVal + realTimePcVal > preallocatedPc) {
showToast("运抵件数 + 实时件数不能大于预配件数")
return
}
// 3. 收集当前表单数据,更新到 bean
bean.apply {
// 更新运抵数据(如果用户已编辑)
arrivePc = this@GjcWeighingStartViewModel.arrivePc.value?.toLongOrNull() ?: arrivePc
@@ -321,8 +331,17 @@ class GjcWeighingStartViewModel : BaseViewModel() {
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
if (channel.value.verifyNullOrEmpty("请选择通道号")) return
// 校验件数: 运抵件数 + 实时件数 不能大于 预配件数
val realTimePcVal = realTimePc.value?.toLongOrNull() ?: 0L
val arrivePcVal = arrivePc.value?.toLongOrNull() ?: bean.arrivePc ?: 0L
val preallocatedPc = bean.pc ?: 0L
if (arrivePcVal + realTimePcVal > preallocatedPc) {
showToast("运抵件数 + 实时件数不能大于预配件数")
return
}
// 从编辑字段获取数值
val arrivePcVal = arrivePc.value?.toLongOrNull() ?: bean.arrivePc
val arriveWeightVal = arriveWeight.value?.toDoubleOrNull() ?: bean.arriveWeight
val arriveVolumeVal = arriveVolume.value?.toDoubleOrNull() ?: bean.arriveVolume