feat: 国际进港舱单新增页面优化及菜单调整
- 对调首页国际进港模块"原始舱单"和"进港舱单"菜单位置 - 航班日期默认为当天日期 - 运单号增加11位数字及mod7校验位验证 - 业务类型默认选中"普通货物运输" - 件数限制整数输入,重量允许小数输入 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -825,16 +825,16 @@ class HomeFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
list.add(
|
list.add(
|
||||||
RightMenu(
|
RightMenu(
|
||||||
Constant.AuthName.IntArrAirManifest,
|
Constant.AuthName.IntImpManifest,
|
||||||
R.mipmap.img_bwjx,
|
R.mipmap.img_bwjx,
|
||||||
"原始舱单"
|
"进港舱单"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
list.add(
|
list.add(
|
||||||
RightMenu(
|
RightMenu(
|
||||||
Constant.AuthName.IntImpManifest,
|
Constant.AuthName.IntArrAirManifest,
|
||||||
R.mipmap.img_bwjx,
|
R.mipmap.img_bwjx,
|
||||||
"进港舱单"
|
"原始舱单"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
list.add(
|
list.add(
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.lukouguoji.gjj.activity
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.InputType
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.databinding.ActivityGjjManifestAddBinding
|
import com.lukouguoji.gjj.databinding.ActivityGjjManifestAddBinding
|
||||||
import com.lukouguoji.gjj.viewModel.GjjManifestAddViewModel
|
import com.lukouguoji.gjj.viewModel.GjjManifestAddViewModel
|
||||||
@@ -23,6 +23,14 @@ class GjjManifestAddActivity :
|
|||||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
|
binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
|
||||||
|
|
||||||
|
// 件数只允许输入整数
|
||||||
|
binding.waybillNumInput.inputType = InputType.TYPE_CLASS_NUMBER
|
||||||
|
binding.actualNumInput.inputType = InputType.TYPE_CLASS_NUMBER
|
||||||
|
// 重量允许输入小数
|
||||||
|
binding.actualWeightInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||||
|
binding.billingWeightInput.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||||
|
|
||||||
viewModel.initOnCreated(intent)
|
viewModel.initOnCreated(intent)
|
||||||
|
|
||||||
// 动态设置标题(必须在 initOnCreated 之后,pageType 已从 Intent 解析)
|
// 动态设置标题(必须在 initOnCreated 之后,pageType 已从 Intent 解析)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.lukouguoji.module_base.common.DetailsPageType
|
|||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.ktx.finish
|
import com.lukouguoji.module_base.ktx.finish
|
||||||
|
import com.lukouguoji.module_base.ktx.formatDate
|
||||||
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.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
@@ -20,6 +21,7 @@ import com.lukouguoji.module_base.ktx.toRequestBody
|
|||||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
import com.lukouguoji.module_base.util.DictUtils
|
import com.lukouguoji.module_base.util.DictUtils
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
|
import dev.utils.common.DateUtils
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class GjjManifestAddViewModel : BaseViewModel() {
|
class GjjManifestAddViewModel : BaseViewModel() {
|
||||||
@@ -33,8 +35,8 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
// 航班ID
|
// 航班ID
|
||||||
var fid: String = ""
|
var fid: String = ""
|
||||||
|
|
||||||
// 航班日期
|
// 航班日期(新增模式默认今天)
|
||||||
val flightDate = MutableLiveData("")
|
val flightDate = MutableLiveData(DateUtils.getCurrentTime().formatDate())
|
||||||
|
|
||||||
// 航班号
|
// 航班号
|
||||||
val flightNo = MutableLiveData("")
|
val flightNo = MutableLiveData("")
|
||||||
@@ -173,6 +175,12 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
}
|
}
|
||||||
DictUtils.getBusinessTypeList(addAll = false) {
|
DictUtils.getBusinessTypeList(addAll = false) {
|
||||||
businessTypeList.postValue(it)
|
businessTypeList.postValue(it)
|
||||||
|
// 新增模式下默认选中"普通货物运输"
|
||||||
|
if (pageType.value == DetailsPageType.Add && businessType.value.isNullOrEmpty()) {
|
||||||
|
it.find { b -> b.key.contains("普通货物运输") }?.let { b ->
|
||||||
|
businessType.postValue(b.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DictUtils.getShouYunPackageTypeList {
|
DictUtils.getShouYunPackageTypeList {
|
||||||
packageTypeList.postValue(listOf(KeyValue("", "")) + it)
|
packageTypeList.postValue(listOf(KeyValue("", "")) + it)
|
||||||
@@ -273,11 +281,37 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
waybillType.value = manifest.awbType
|
waybillType.value = manifest.awbType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验运单号格式
|
||||||
|
* 规则:纯数字,固定11位,后8位中前7位 mod 7 == 最后一位
|
||||||
|
*/
|
||||||
|
private fun verifyWaybillNo(wbNo: String?): Boolean {
|
||||||
|
if (wbNo.isNullOrEmpty()) return false
|
||||||
|
if (wbNo.length != 11) {
|
||||||
|
showToast("运单号必须为11位数字")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (!wbNo.all { it.isDigit() }) {
|
||||||
|
showToast("运单号必须为纯数字")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 后8位:前7位 mod 7 == 最后一位
|
||||||
|
val last8 = wbNo.substring(3) // 后8位
|
||||||
|
val first7ofLast8 = last8.substring(0, 7).toLong()
|
||||||
|
val lastDigit = last8.last().toString().toInt()
|
||||||
|
if (first7ofLast8 % 7 != lastDigit.toLong()) {
|
||||||
|
showToast("运单号校验位不正确")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存点击
|
* 保存点击
|
||||||
*/
|
*/
|
||||||
fun onSaveClick(view: View) {
|
fun onSaveClick(view: View) {
|
||||||
if ((waybillNo.value.verifyNullOrEmpty("请输入运单号")
|
if ((waybillNo.value.verifyNullOrEmpty("请输入运单号")
|
||||||
|
|| verifyWaybillNo(waybillNo.value)
|
||||||
|| agent.value.verifyNullOrEmpty("请选择代理")
|
|| agent.value.verifyNullOrEmpty("请选择代理")
|
||||||
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
||||||
|| actualNum.value.verifyNullOrEmpty("请输入实到数量")
|
|| actualNum.value.verifyNullOrEmpty("请输入实到数量")
|
||||||
|
|||||||
@@ -193,6 +193,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
|
android:id="@+id/waybillNumInput"
|
||||||
hint='@{"请输入总件数"}'
|
hint='@{"请输入总件数"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"总 件 数"}'
|
title='@{"总 件 数"}'
|
||||||
@@ -204,6 +205,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
|
android:id="@+id/actualNumInput"
|
||||||
hint='@{"请输入实到件数"}'
|
hint='@{"请输入实到件数"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"实到件数"}'
|
title='@{"实到件数"}'
|
||||||
@@ -216,6 +218,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
|
android:id="@+id/actualWeightInput"
|
||||||
hint='@{"请输入实到重量"}'
|
hint='@{"请输入实到重量"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"实到重量"}'
|
title='@{"实到重量"}'
|
||||||
@@ -237,6 +240,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
|
android:id="@+id/billingWeightInput"
|
||||||
hint='@{"请输入计费重量"}'
|
hint='@{"请输入计费重量"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"计费重量"}'
|
title='@{"计费重量"}'
|
||||||
|
|||||||
Reference in New Issue
Block a user