diff --git a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcCheckInRecord.kt b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcCheckInRecord.kt
index 796c730..8d2f3a3 100644
--- a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcCheckInRecord.kt
+++ b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjcCheckInRecord.kt
@@ -22,7 +22,9 @@ data class GjcCheckInRecord(
var weight: Double = 0.0, // 运抵重量
var volume: Double = 0.0, // 运抵体积
var whId: Long = 0, // GJC_WAREHOUSE.ID
- var carWeight: String = "" // 托盘自重
+ var carWeight: String = "", // 托盘车重
+ var trayNumber: Int = 0, // 托盘数量
+ var trayTotalWeight: Double = 0.0 // 托盘重量(托盘自重)
) : BaseObservable() {
// 数据变化回调
@@ -53,4 +55,28 @@ data class GjcCheckInRecord(
onDataChanged?.invoke()
}
}
+
+ // 托盘自重编辑过程中的原始输入串(保持回显与输入一致,避免光标跳位)
+ // 不作为构造参数,data class copy 备份/恢复时自动丢弃,回退到 trayTotalWeight 显示
+ // @Transient:仅界面内部状态,不参与 Gson 序列化提交
+ @Transient
+ private var trayTotalWeightInput: String? = null
+
+ // 托盘自重的字符串表示(用于双向绑定)
+ // 业务规则:重量包含托盘自重,托盘自重编辑后,重量同步增减相同差值
+ @get:Bindable
+ var trayTotalWeightStr: String
+ get() = trayTotalWeightInput
+ ?: if (trayTotalWeight == 0.0) "" else trayTotalWeight.toString()
+ set(value) {
+ trayTotalWeightInput = value
+ val newTrayWeight = value.toDoubleOrNull() ?: 0.0
+ if (trayTotalWeight != newTrayWeight) {
+ weight = Math.round((weight + newTrayWeight - trayTotalWeight) * 100) / 100.0
+ trayTotalWeight = newTrayWeight
+ notifyPropertyChanged(BR.trayTotalWeightStr)
+ notifyPropertyChanged(BR.weightStr)
+ onDataChanged?.invoke()
+ }
+ }
}
diff --git a/module_gjc/src/main/res/layout/item_gjc_check_in_record.xml b/module_gjc/src/main/res/layout/item_gjc_check_in_record.xml
index e1fcc60..c01dccf 100644
--- a/module_gjc/src/main/res/layout/item_gjc_check_in_record.xml
+++ b/module_gjc/src/main/res/layout/item_gjc_check_in_record.xml
@@ -67,17 +67,19 @@
type="@{DataLayoutType.INPUT}"
value="@={record.weightStr}" />
-
+
+ value="@={record.trayTotalWeightStr}" />