fix(gjc): 开始计重手机端去掉地磅重量,平板车自重左对齐并自动带出

- 手机布局删除「地磅重量」;手机端不再按「地磅重量 − 托盘总重」自动计算运抵重量
  (地磅为 0 时会被写成 "0"),改为手输、默认空白;平板逻辑不变
- 「平板车自重」改用不可编辑的 INPUT 形态,与其他行一样左对齐
- 运单加载后若已带平板车号,直接回查自重(平板共用 ViewModel,一并生效)
- PhoneFormRow 的 INPUT 形态补上输入完成回调(失焦 / 键盘完成、下一项),
  原先从不触发,手输平板车号、运单号后不会回查

Refs: 禅道 Bug #621

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
YANG JIANKUAN
2026-10-14 20:20:57 -07:00
parent b22d55a380
commit 2c8fa689a5
3 changed files with 25 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.util.DeviceUtil
import com.lukouguoji.module_base.bean.GjcMaWb
import com.lukouguoji.module_base.bean.GjcWeighingBean
import com.lukouguoji.module_base.common.Constant
@@ -120,6 +121,8 @@ class GjcWeighingStartViewModel : BaseViewModel() {
* 自动计算运抵重量:地磅称重 - (托盘数量 × 托盘自重)
*/
private fun recalculateArriveWeight() {
// 手机端无地磅重量输入(Bug #621),运抵重量手输;否则会被 0 - 托盘总重 覆盖成 "0"
if (DeviceUtil.isPhone()) return
val gross = diBangWeight.value?.toDoubleOrNull() ?: 0.0
val trayTotal = getTrayTotalWeight()
val net = gross - trayTotal
@@ -198,6 +201,8 @@ class GjcWeighingStartViewModel : BaseViewModel() {
onSuccess = { result ->
maWbBean.value = result.data ?: GjcMaWb()
pageRemark.value = maWbBean.value?.remark
// 运单已带平板车号时直接回查自重(原先只在手输车号完成后查询,Bug #621)
onCarIdInputComplete()
// 更新航班日期字符串
flightDate.value = result.data?.fdate?.formatDate() ?: ""
}

View File

@@ -176,15 +176,7 @@
type="@{PhoneFormRowType.INPUT}"
value="@={viewModel.arrivePc}" />
<!-- 地磅重量(与平板右上角地磅称重一致):运抵重量 = 地磅重量 - 托盘数量 × 托盘自重,由 ViewModel 自动计算 -->
<com.lukouguoji.module_base.ui.weight.phone.PhoneFormRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
hint='@{"请输入地磅重量"}'
numeric="@{true}"
title='@{"地磅重量"}'
type="@{PhoneFormRowType.INPUT}"
value="@={viewModel.diBangWeight}" />
<!-- Bug #621:手机端去掉「地磅重量」,运抵重量手输(不再按地磅重量自动计算) -->
<com.lukouguoji.module_base.ui.weight.phone.PhoneFormRow
android:layout_width="match_parent"
@@ -267,12 +259,14 @@
type="@{PhoneFormRowType.INPUT}"
value="@={viewModel.maWbBean.carId}" />
<!-- 平板车自重:平板车号输入完成后回查,只读 -->
<!-- 平板车自重:平板车号输入完成 / 运单自带车号加载后回查,只读;
Bug #621:用不可编辑的 INPUT 形态,与其他行一样左对齐(TEXT 形态为右对齐) -->
<com.lukouguoji.module_base.ui.weight.phone.PhoneFormRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
enable="@{false}"
title='@{"平板车自重"}'
type="@{PhoneFormRowType.TEXT}"
type="@{PhoneFormRowType.INPUT}"
value="@{viewModel.carWeight}" />
<com.lukouguoji.module_base.ui.weight.phone.PhoneFormRow