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

@@ -1,5 +1,6 @@
package com.lukouguoji.module_base.bean package com.lukouguoji.module_base.bean
import androidx.databinding.ObservableBoolean
import java.io.Serializable import java.io.Serializable
/** /**
@@ -98,4 +99,12 @@ class GjcWeighingRecordBean : Serializable {
var haWbList: List<Any>? = null // 分单列表 var haWbList: List<Any>? = null // 分单列表
var storageUseList: List<Any>? = null // 库位使用列表 var storageUseList: List<Any>? = null // 库位使用列表
var attachList: List<Any>? = null // 附件列表 var attachList: List<Any>? = null // 附件列表
// ========== UI扩展字段 ==========
val checked: ObservableBoolean = ObservableBoolean(false) // 选中状态
// 兼容现有API的isSelected属性
var isSelected: Boolean
get() = checked.get()
set(value) = checked.set(value)
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" /> <corners android:radius="8dp" />
<solid android:color="#008000" /> <solid android:color="#E8F5E9" />
</shape> </shape>

View File

@@ -3,7 +3,9 @@ package com.lukouguoji.gjc.activity
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.lukouguoji.gjc.R import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ActivityIntExpArriveBinding import com.lukouguoji.gjc.databinding.ActivityIntExpArriveBinding
import com.lukouguoji.gjc.viewModel.IntExpArriveViewModel import com.lukouguoji.gjc.viewModel.IntExpArriveViewModel
@@ -22,13 +24,26 @@ import com.lukouguoji.module_base.router.ARouterConstants
class IntExpArriveActivity : class IntExpArriveActivity :
BaseBindingActivity<ActivityIntExpArriveBinding, IntExpArriveViewModel>() { BaseBindingActivity<ActivityIntExpArriveBinding, IntExpArriveViewModel>() {
@JvmField
@Autowired
var wbNoParam: String? = null
override fun layoutId() = R.layout.activity_int_exp_arrive override fun layoutId() = R.layout.activity_int_exp_arrive
override fun viewModelClass() = IntExpArriveViewModel::class.java override fun viewModelClass() = IntExpArriveViewModel::class.java
override fun initOnCreate(savedInstanceState: Bundle?) { override fun initOnCreate(savedInstanceState: Bundle?) {
// 注入 ARouter 参数
ARouter.getInstance().inject(this)
setBackArrow("出港运抵") setBackArrow("出港运抵")
binding.viewModel = viewModel binding.viewModel = viewModel
// 如果有传入运单号,自动填充并触发搜索
if (!wbNoParam.isNullOrEmpty()) {
viewModel.waybillNo.value = wbNoParam
viewModel.searchClick()
}
// 观察全选状态,更新图标透明度 // 观察全选状态,更新图标透明度
viewModel.isAllChecked.observe(this) { isAllChecked -> viewModel.isAllChecked.observe(this) { isAllChecked ->
binding.checkIcon.alpha = if (isAllChecked) 1.0f else 0.5f binding.checkIcon.alpha = if (isAllChecked) 1.0f else 0.5f
@@ -45,8 +60,10 @@ class IntExpArriveActivity :
viewModel.refresh() viewModel.refresh()
} }
// 初始加载数据 // 初始加载数据(如果没有传入运单号,才执行初始加载)
viewModel.refresh() if (wbNoParam.isNullOrEmpty()) {
viewModel.refresh()
}
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

View File

@@ -15,6 +15,16 @@ class GjcWeighingRecordViewHolder(view: View) :
override fun onBind(item: Any?, position: Int) { override fun onBind(item: Any?, position: Int) {
val bean = getItemBean(item)!! val bean = getItemBean(item)!!
binding.bean = bean binding.bean = bean
binding.executePendingBindings()
// 图标点击 - 切换选择状态
binding.ivIcon.setOnClickListener {
// 反转checked状态
bean.checked.set(!bean.checked.get())
// 立即更新UI (图片自动切换)
binding.executePendingBindings()
}
// 整行点击跳转到计重明细页 // 整行点击跳转到计重明细页
binding.ll.setOnClickListener { binding.ll.setOnClickListener {

View File

@@ -7,9 +7,12 @@ import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.holder.GjcWeighingRecordViewHolder import com.lukouguoji.gjc.holder.GjcWeighingRecordViewHolder
import com.lukouguoji.module_base.base.BasePageViewModel import com.lukouguoji.module_base.base.BasePageViewModel
import com.lukouguoji.module_base.common.Constant 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.http.net.NetApply
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.launchCollect import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.launchLoadingCollect 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.ktx.toRequestBody
import com.lukouguoji.module_base.model.ScanModel import com.lukouguoji.module_base.model.ScanModel
import com.lukouguoji.module_base.util.DictUtils import com.lukouguoji.module_base.util.DictUtils
@@ -92,10 +95,33 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
} }
/** /**
* 运抵申报按钮点击(暂未实现) * 运抵申报按钮点击
*/ */
fun declareClick() { 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 }, "fno" to flightNo.value!!.ifEmpty { null },
"agentCode" to agentCode.value!!.ifEmpty { null }, "agentCode" to agentCode.value!!.ifEmpty { null },
"spCode" to spCode.value!!.ifEmpty { null }, "spCode" to spCode.value!!.ifEmpty { null },
"likeNo" to waybillNo.value!!.ifEmpty { null }, "wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody() ).toRequestBody()
// 构建查询参数(统计接口 - 使用相同的搜索条件) // 构建查询参数(统计接口 - 使用相同的搜索条件)
@@ -119,7 +145,7 @@ class GjcWeighingRecordViewModel : BasePageViewModel() {
"fno" to flightNo.value!!.ifEmpty { null }, "fno" to flightNo.value!!.ifEmpty { null },
"agentCode" to agentCode.value!!.ifEmpty { null }, "agentCode" to agentCode.value!!.ifEmpty { null },
"spCode" to spCode.value!!.ifEmpty { null }, "spCode" to spCode.value!!.ifEmpty { null },
"likeNo" to waybillNo.value!!.ifEmpty { null }, "wbNo" to waybillNo.value!!.ifEmpty { null },
).toRequestBody() ).toRequestBody()
// 获取列表数据显示loading // 获取列表数据显示loading

View File

@@ -258,7 +258,17 @@ class GjcWeighingStartViewModel : BaseViewModel() {
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
if (channel.value.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 { bean.apply {
// 更新运抵数据(如果用户已编辑) // 更新运抵数据(如果用户已编辑)
arrivePc = this@GjcWeighingStartViewModel.arrivePc.value?.toLongOrNull() ?: arrivePc arrivePc = this@GjcWeighingStartViewModel.arrivePc.value?.toLongOrNull() ?: arrivePc
@@ -321,8 +331,17 @@ class GjcWeighingStartViewModel : BaseViewModel() {
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
if (channel.value.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 arriveWeightVal = arriveWeight.value?.toDoubleOrNull() ?: bean.arriveWeight
val arriveVolumeVal = arriveVolume.value?.toDoubleOrNull() ?: bean.arriveVolume val arriveVolumeVal = arriveVolume.value?.toDoubleOrNull() ?: bean.arriveVolume

View File

@@ -21,7 +21,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp" android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp" android:layout_marginVertical="5dp"
android:background="@drawable/bg_item" android:background="@{bean.checkIn.equals(`2`) ? @drawable/bg_item_green : @drawable/bg_item}"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="10dp"> android:padding="10dp">

View File

@@ -25,6 +25,7 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_gravity="center" android:layout_gravity="center"
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
android:src="@drawable/img_plane" /> android:src="@drawable/img_plane" />
<LinearLayout <LinearLayout