feat: opt 出港计重 计重明细 update

This commit is contained in:
2025-12-16 09:36:36 +08:00
parent d1ed050c76
commit b4238a04d0
5 changed files with 60 additions and 26 deletions

View File

@@ -1,5 +1,9 @@
package com.lukouguoji.module_base.bean
import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import androidx.databinding.library.baseAdapters.BR
/**
* 国际出港计重记录明细Bean
* 用于:加载运单的所有计重记录 + 批量更新
@@ -18,18 +22,34 @@ data class GjcCheckInRecord(
var weight: Double = 0.0, // 运抵重量
var volume: Double = 0.0, // 运抵体积
var whId: Long = 0 // GJC_WAREHOUSE.ID
) {
) : BaseObservable() {
// 数据变化回调
var onDataChanged: (() -> Unit)? = null
// 件数的字符串表示(用于双向绑定)
@get:Bindable
var pcStr: String
get() = if (pc == 0L) "" else pc.toString()
set(value) {
pc = value.toLongOrNull() ?: 0L
val newPc = value.toLongOrNull() ?: 0L
if (pc != newPc) {
pc = newPc
notifyPropertyChanged(BR.pcStr)
onDataChanged?.invoke()
}
}
// 重量的字符串表示(用于双向绑定)
@get:Bindable
var weightStr: String
get() = if (weight == 0.0) "" else weight.toString()
set(value) {
weight = value.toDoubleOrNull() ?: 0.0
val newWeight = value.toDoubleOrNull() ?: 0.0
if (weight != newWeight) {
weight = newWeight
notifyPropertyChanged(BR.weightStr)
onDataChanged?.invoke()
}
}
}