feat: 国际出港 出港计重 opt v
This commit is contained in:
@@ -3,7 +3,9 @@ package com.lukouguoji.gjc.activity
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
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.launcher.ARouter
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.ActivityIntExpArriveBinding
|
||||
import com.lukouguoji.gjc.viewModel.IntExpArriveViewModel
|
||||
@@ -22,13 +24,26 @@ import com.lukouguoji.module_base.router.ARouterConstants
|
||||
class IntExpArriveActivity :
|
||||
BaseBindingActivity<ActivityIntExpArriveBinding, IntExpArriveViewModel>() {
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var wbNoParam: String? = null
|
||||
|
||||
override fun layoutId() = R.layout.activity_int_exp_arrive
|
||||
override fun viewModelClass() = IntExpArriveViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
// 注入 ARouter 参数
|
||||
ARouter.getInstance().inject(this)
|
||||
|
||||
setBackArrow("出港运抵")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
// 如果有传入运单号,自动填充并触发搜索
|
||||
if (!wbNoParam.isNullOrEmpty()) {
|
||||
viewModel.waybillNo.value = wbNoParam
|
||||
viewModel.searchClick()
|
||||
}
|
||||
|
||||
// 观察全选状态,更新图标透明度
|
||||
viewModel.isAllChecked.observe(this) { isAllChecked ->
|
||||
binding.checkIcon.alpha = if (isAllChecked) 1.0f else 0.5f
|
||||
@@ -45,8 +60,10 @@ class IntExpArriveActivity :
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
// 初始加载数据
|
||||
viewModel.refresh()
|
||||
// 初始加载数据(如果没有传入运单号,才执行初始加载)
|
||||
if (wbNoParam.isNullOrEmpty()) {
|
||||
viewModel.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
|
||||
@@ -15,6 +15,16 @@ class GjcWeighingRecordViewHolder(view: View) :
|
||||
override fun onBind(item: Any?, position: Int) {
|
||||
val bean = getItemBean(item)!!
|
||||
binding.bean = bean
|
||||
binding.executePendingBindings()
|
||||
|
||||
// 图标点击 - 切换选择状态
|
||||
binding.ivIcon.setOnClickListener {
|
||||
// 反转checked状态
|
||||
bean.checked.set(!bean.checked.get())
|
||||
|
||||
// 立即更新UI (图片自动切换)
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
|
||||
// 整行点击跳转到计重明细页
|
||||
binding.ll.setOnClickListener {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
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:padding="10dp">
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
|
||||
android:src="@drawable/img_plane" />
|
||||
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user