fix: 修复意外签注编辑页运单号校验及字段拼写错误

- 修正 GjjImportManifest 中 dgrContactMame 字段名拼写错误为 dgrContactName
- 同步修复 IntArrSupplementInfoViewModel 和布局中对应字段引用
- 意外签注编辑页运单号输入改为纯数字模式,并新增11位格式+校验位验证
- 修改航班日期/航班号输入完成时清空始发站和目的站,避免旧数据残留
- 保存前新增始发站/目的站非空校验
- 布局微调:图片上传区域边距和对齐优化

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 18:35:30 +08:00
parent 936af73ec0
commit 3e5f185721
6 changed files with 47 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package com.lukouguoji.gjj.activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.InputType
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ActivityIntImpAccidentVisaEditBinding
import com.lukouguoji.gjj.viewModel.IntImpAccidentVisaEditViewModel
@@ -26,8 +27,8 @@ class IntImpAccidentVisaEditActivity :
// 航班号:大写字母+数字
binding.fnoInput.et.setUpperCaseAlphanumericFilter()
// 运单号:大写字母+数字
binding.wbNoInput.et.setUpperCaseAlphanumericFilter()
// 运单号:纯数字11位
binding.wbNoInput.et.inputType = InputType.TYPE_CLASS_NUMBER
viewModel.rv = binding.rv
binding.rv.addOnItemClickListener(viewModel)

View File

@@ -129,7 +129,7 @@ class IntArrSupplementInfoViewModel : BaseViewModel() {
consignorPNum = formBean.consignorPNum,
consignorAddress = formBean.consignorAddress,
// 危险品信息
dgrContactMame = formBean.dgrContactMame,
dgrContactName = formBean.dgrContactName,
dgrContactNumber = formBean.dgrContactNumber,
unNumber = formBean.unNumber
)

View File

@@ -173,13 +173,23 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
fun onFlightDateInputComplete() {
lastQueriedFlight = ""
clearFlightInfo()
queryFlightIfReady()
}
fun onFlightNoInputComplete() {
lastQueriedFlight = ""
clearFlightInfo()
queryFlightIfReady()
}
private fun clearFlightInfo() {
val b = dataBean.value ?: GjAccidentVisaEditBean()
b.dep = ""
b.dest = ""
dataBean.value = b
}
private fun queryFlightIfReady() {
val bean = dataBean.value ?: return
val fdate = bean.fdate
@@ -228,11 +238,39 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
// 保存
///////////////////////////////////////////////////////////////////////////
/**
* 校验运单号格式
* 规则纯数字固定11位后8位中前7位 mod 7 == 最后一位
* 返回 true 表示校验失败(有错误)
*/
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
}
val last8 = wbNo.substring(3)
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() {
val bean = dataBean.value ?: return
if (bean.fdate.verifyNullOrEmpty("请输入航班日期")) return
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
if (bean.wbNo.verifyNullOrEmpty("请输入运单号")) return
if (verifyWaybillNo(bean.wbNo)) return
if (bean.dep.verifyNullOrEmpty("请先填写航班信息(始发站不能为空)")) return
if (bean.dest.verifyNullOrEmpty("请先填写航班信息(目的站不能为空)")) return
(rv?.commonAdapter()?.items ?: emptyList())
.asFlow()

View File

@@ -260,7 +260,7 @@
title='@{"名称"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.dataBean.dgrContactMame}' />
value='@={viewModel.dataBean.dgrContactName}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"

View File

@@ -323,6 +323,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="4dp"
android:orientation="horizontal">
<TextView
@@ -332,13 +333,14 @@
android:layout_gravity="center_vertical"
android:text='@{viewModel.isDetailMode ? "图片" : "上传图像"}'
android:textColor="@color/text_gray"
completeSpace="@{5}" />
completeSpace="@{6}" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:overScrollMode="never"
itemLayoutId="@{viewModel.itemLayoutId}"
viewHolder="@{viewModel.itemViewHolder}"