fix: 开始组装卸货成功后重拉 useId 支持连续卸多票
卸货时 useId 来自 queryUldInfo,但同一 ULD 因 lastQueriedUldNo 防抖不会重新查询,useId 停留在卸首票前的陈旧值;装货修复的 useId==0 守卫又挡住卸货后的重拉,导致卸货成功后 useId 不刷新, 无法连续卸多票。改为按操作类型区分:装货保留 useId==0 守卫, 卸货成功后无条件重拉 getUld 回填最新 useId。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -702,7 +702,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}) {
|
||||
onSuccess = { result ->
|
||||
// 接口成功后才显示成功提示并刷新列表
|
||||
handleOperationSuccess(operationName, uldNo, operationFno, operationFdate)
|
||||
handleOperationSuccess(operationName, isLoad, uldNo, operationFno, operationFdate)
|
||||
}
|
||||
onFailed = { code, message ->
|
||||
showToast("${operationName}失败: $message")
|
||||
@@ -715,6 +715,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
*/
|
||||
private fun handleOperationSuccess(
|
||||
operationName: String,
|
||||
isLoad: Boolean,
|
||||
uldNo: String,
|
||||
operationFno: String,
|
||||
operationFdate: String
|
||||
@@ -729,14 +730,20 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
// 清空表单(在刷新数据前清空,避免刷新时的状态冲突)
|
||||
clearForm()
|
||||
|
||||
// 回填最新 useId(关键):以"新增"形式进入、对全新 ULD 首票装货时,
|
||||
// 服务端在首票成功后才生成该 ULD 的 use 记录,而装货/卸货接口返回值不含 useId。
|
||||
// 若不回填,后续票仍以 useId=null 提交,会被服务端当作新的 use 处理,
|
||||
// 导致无法继续往同一 ULD 组装多票。
|
||||
// 仅在本地 useId 尚未生成(为 0)时回填;"修改"模式及已过磅 ULD 本就带 useId,保持原逻辑不变。
|
||||
// 回填最新 useId(关键,用于后续装货/卸货提交到同一 ULD use 记录):
|
||||
// - 装货:以"新增"形式进入、对全新 ULD 首票装货时,服务端在首票成功后才生成
|
||||
// 该 ULD 的 use 记录,而接口返回值不含 useId,不回填则后续票以 useId=null 提交、
|
||||
// 被当作新 use 处理,无法继续多票。仅在本地 useId 尚未生成(为 0)时回填,
|
||||
// "修改"模式及已过磅 ULD 本就带 useId,保持原逻辑不变。
|
||||
// - 卸货:从组装信息列表选票卸货,同一 ULD 因 lastQueriedUldNo 防抖不会重新查询 ULD,
|
||||
// useId 会停留在卸首票前的陈旧值,故卸货成功后无条件重拉,保证可连续卸多票。
|
||||
if (isLoad) {
|
||||
if ((uldInfo.value?.useId ?: 0L) == 0L) {
|
||||
reloadUldUseId(uldNo)
|
||||
}
|
||||
} else {
|
||||
reloadUldUseId(uldNo)
|
||||
}
|
||||
|
||||
// 添加形式(全新 ULD)时航班可能未从 ULD 查询接口获取,导致组装信息列表查不出;
|
||||
// 仅在航班为空时用本次操作运单的航班信息兜底补全,ULD 已带航班时保持原值不变。
|
||||
|
||||
Reference in New Issue
Block a user