feat: 出港组装 回填重量

This commit is contained in:
2026-01-26 12:34:01 +08:00
parent d3ea88db08
commit 5f31cf5274
12 changed files with 654 additions and 55 deletions

View File

@@ -109,6 +109,12 @@
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:exported="false" android:exported="false"
android:screenOrientation="userLandscape" /> android:screenOrientation="userLandscape" />
<!-- 国际出港修改组装重量 -->
<activity
android:name="com.lukouguoji.gjc.activity.GjcAssembleWeightEditActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<!-- 国际出港出库交接 --> <!-- 国际出港出库交接 -->
<activity <activity
android:name="com.lukouguoji.gjc.activity.IntExpOutHandoverActivity" android:name="com.lukouguoji.gjc.activity.IntExpOutHandoverActivity"

View File

@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit
class MyApplication : Application() { class MyApplication : Application() {
//ARouter debug开关true-open;false-close //ARouter debug开关true-open;false-close
private val isDebugARouter = true private val isDebugARouter = false
companion object { companion object {
lateinit var context: Context lateinit var context: Context

View File

@@ -1,12 +1,13 @@
package com.lukouguoji.module_base.bean package com.lukouguoji.module_base.bean
import androidx.databinding.ObservableBoolean import androidx.databinding.ObservableBoolean
import java.io.Serializable
/** /**
* 国际出港板箱过磅-ULD使用记录Bean * 国际出港板箱过磅-ULD使用记录Bean
* 对应API: IntExpWeighting/pageQuery * 对应API: IntExpWeighting/pageQuery
*/ */
class GjcUldUseBean { class GjcUldUseBean : Serializable {
var useId: Long = 0 // 使用id var useId: Long = 0 // 使用id
var uld: String = "" // uld编号 var uld: String = "" // uld编号
var carId: String = "" // 板车号 var carId: String = "" // 板车号

View File

@@ -11,6 +11,10 @@ class GjcWarehouse {
var wbNo: String = "" // 主运单编号 var wbNo: String = "" // 主运单编号
var pc: Long = 0 // 件数 var pc: Long = 0 // 件数
var weight: Double = 0.0 // 重量 var weight: Double = 0.0 // 重量
set(value) {
field = value
onDataChanged?.invoke()
}
var volume: Double = 0.0 // 体积 var volume: Double = 0.0 // 体积
var agentCode: String = "" // 代理code var agentCode: String = "" // 代理code
var agentName: String = "" // 代理名称 var agentName: String = "" // 代理名称
@@ -34,4 +38,21 @@ class GjcWarehouse {
var checkInPc: Long = 0 // 入库件数 var checkInPc: Long = 0 // 入库件数
var checkInWeight: Double = 0.0 // 入库重量 var checkInWeight: Double = 0.0 // 入库重量
var assembleCount: Int = 0 // 已经组装的数量 var assembleCount: Int = 0 // 已经组装的数量
// ========== UI扩展字段 ==========
/**
* 重量字符串用于双向绑定EditText
*/
var weightStr: String
get() = if (weight == 0.0) "" else weight.toString()
set(value) {
weight = value.toDoubleOrNull() ?: 0.0
}
/**
* 数据变化回调(用于实时计算统计)
*/
@Transient
var onDataChanged: (() -> Unit)? = null
} }

View File

@@ -661,6 +661,14 @@ interface Api {
@POST("IntExpAssemble/queryAssembledByUld") @POST("IntExpAssemble/queryAssembledByUld")
suspend fun getAssembledWaybillsByUld(@Body data: RequestBody): BaseResultBean<List<GjcWarehouse>> suspend fun getAssembledWaybillsByUld(@Body data: RequestBody): BaseResultBean<List<GjcWarehouse>>
/**
* 国际出港组装 - 修改列表(批量更新运单重量)
* 接口路径: /IntExpAssemble/update
* @param data GjcWarehouse数组
*/
@POST("IntExpAssemble/update")
suspend fun updateIntExpAssemble(@Body data: RequestBody): BaseResultBean<Boolean>
/** /**
* 国际出港出库交接-分页查询 * 国际出港出库交接-分页查询
* 接口路径: /IntExpOutHandover/pageQuery * 接口路径: /IntExpOutHandover/pageQuery

View File

@@ -147,6 +147,7 @@ object ARouterConstants {
const val ACTIVITY_URL_INT_EXP_TALLY = "/gjc/IntExpTallyActivity" //国际出港 出港理货 const val ACTIVITY_URL_INT_EXP_TALLY = "/gjc/IntExpTallyActivity" //国际出港 出港理货
const val ACTIVITY_URL_INT_EXP_ARRIVE = "/gjc/IntExpArriveActivity" //国际出港 出港运抵 const val ACTIVITY_URL_INT_EXP_ARRIVE = "/gjc/IntExpArriveActivity" //国际出港 出港运抵
const val ACTIVITY_URL_INT_EXP_STORAGE_USE = "/gjc/IntExpStorageUseActivity" //国际出港 仓库 const val ACTIVITY_URL_INT_EXP_STORAGE_USE = "/gjc/IntExpStorageUseActivity" //国际出港 仓库
const val ACTIVITY_URL_GJC_ASSEMBLE_WEIGHT_EDIT = "/gjc/GjcAssembleWeightEditActivity" //国际出港 修改组装重量
///////////////// 国际进港模块 ///////////////// 国际进港模块
/** /**

View File

@@ -0,0 +1,69 @@
package com.lukouguoji.gjc.activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ActivityGjcAssembleWeightEditBinding
import com.lukouguoji.gjc.holder.GjcAssembleWeightEditViewHolder
import com.lukouguoji.gjc.viewModel.GjcAssembleWeightEditViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.bean.GjcUldUseBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.router.ARouterConstants
/**
* 国际出港-修改组装重量页面
*/
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_ASSEMBLE_WEIGHT_EDIT)
class GjcAssembleWeightEditActivity :
BaseBindingActivity<ActivityGjcAssembleWeightEditBinding, GjcAssembleWeightEditViewModel>() {
private lateinit var adapter: CommonAdapter
override fun layoutId() = R.layout.activity_gjc_assemble_weight_edit
override fun viewModelClass() = GjcAssembleWeightEditViewModel::class.java
override fun initOnCreate(savedInstanceState: Bundle?) {
setBackArrow("修改组装重量")
binding.viewModel = viewModel
// 初始化RecyclerView
val layoutManager = LinearLayoutManager(this)
binding.recyclerView.layoutManager = layoutManager
// 添加分割线
val divider = DividerItemDecoration(this, DividerItemDecoration.VERTICAL)
binding.recyclerView.addItemDecoration(divider)
adapter = CommonAdapter(
this,
R.layout.item_gjc_assemble_weight_edit,
GjcAssembleWeightEditViewHolder::class.java
)
binding.recyclerView.adapter = adapter
// 监听数据变化更新RecyclerView
viewModel.waybillList.observe(this) { records ->
adapter.refresh(records)
}
// 初始化数据
viewModel.initOnCreated(intent)
}
companion object {
@JvmStatic
fun start(context: Context, bean: GjcUldUseBean) {
val starter = Intent(context, GjcAssembleWeightEditActivity::class.java)
.putExtra(Constant.Key.BEAN, bean)
context.startActivity(starter)
}
}
}

View File

@@ -0,0 +1,21 @@
package com.lukouguoji.gjc.holder
import android.view.View
import com.lukouguoji.gjc.databinding.ItemGjcAssembleWeightEditBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjcWarehouse
/**
* 国际出港-修改组装重量列表 ViewHolder
*/
class GjcAssembleWeightEditViewHolder(view: View) :
BaseViewHolder<GjcWarehouse, ItemGjcAssembleWeightEditBinding>(view) {
override fun onBind(item: Any?, position: Int) {
val warehouse = getItemBean(item) ?: return
binding.bean = warehouse
binding.position = position
binding.executePendingBindings()
}
}

View File

@@ -0,0 +1,218 @@
package com.lukouguoji.gjc.viewModel
import android.content.Intent
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.bean.GjcUldUseBean
import com.lukouguoji.module_base.bean.GjcWarehouse
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import kotlinx.coroutines.launch
/**
* 国际出港-修改组装重量 ViewModel
*/
class GjcAssembleWeightEditViewModel : BaseViewModel() {
///////////////////////////////////////////////////////////////////////////
// 数据字段
///////////////////////////////////////////////////////////////////////////
// ULD信息Bean从列表页传入
val uldBean = MutableLiveData<GjcUldUseBean>()
// 运单列表
val waybillList = MutableLiveData<List<GjcWarehouse>>(emptyList())
///////////////////////////////////////////////////////////////////////////
// ULD信息显示字段
///////////////////////////////////////////////////////////////////////////
val uldNo = MutableLiveData("") // ULD编号
val totalPc = MutableLiveData("") // 总件数
val totalWeight = MutableLiveData("") // 总重量
val cargoWeight = MutableLiveData("") // 货重
///////////////////////////////////////////////////////////////////////////
// 底部统计字段
///////////////////////////////////////////////////////////////////////////
val sumCargoWeight = MutableLiveData("0") // 总货重
val weightError = MutableLiveData("0%") // 重量误差百分比
// 传递参数用于API调用
private var useId: Long = 0
private var uld: String = ""
private var fdate: String = ""
private var fno: String = ""
init {
// 监听 waybillList 变化,自动触发统计计算
waybillList.observeForever {
calculateStatistics()
}
}
///////////////////////////////////////////////////////////////////////////
// 初始化
///////////////////////////////////////////////////////////////////////////
fun initOnCreated(intent: Intent) {
// 接收传入的完整 Bean 对象
val bean = intent.getSerializableExtra(Constant.Key.BEAN) as? GjcUldUseBean
bean?.let {
uldBean.value = it
// 提取ULD信息字段
uldNo.value = it.uld
totalPc.value = it.pc.toString()
totalWeight.value = it.totalWeight.toString()
cargoWeight.value = it.cargoWeight.toString()
// 保存参数用于API调用
useId = it.useId
uld = it.uld
fdate = it.fdate
fno = it.fno
// 加载运单数据
loadData()
} ?: run {
showToast("参数错误")
}
}
///////////////////////////////////////////////////////////////////////////
// 数据加载
///////////////////////////////////////////////////////////////////////////
private fun loadData() {
val params = mapOf(
"useId" to useId,
"uld" to uld,
"fdate" to fdate,
"fno" to fno
).toRequestBody()
launchLoadingCollect({ NetApply.api.getAssembledWaybillsByUld(params) }) {
onSuccess = { result ->
val list = result.data ?: emptyList()
// 为每个运单设置数据变化回调
list.forEach { warehouse ->
warehouse.onDataChanged = {
// 数据变化时重新计算统计
calculateStatistics()
}
}
waybillList.value = list
if (list.isEmpty()) {
showToast("暂无运单数据")
}
}
onFailed = { code, msg ->
showToast("加载失败:$msg")
}
}
}
/**
* 计算统计数据:总货重、重量误差
*/
private fun calculateStatistics() {
val records = waybillList.value ?: emptyList()
// 计算总货重所有运单weight之和
val sumWeight = records.sumOf { it.weight }
sumCargoWeight.value = String.format("%.2f", sumWeight)
// 计算重量误差百分比相对于ULD的货重
val uldCargoWeight = cargoWeight.value?.toDoubleOrNull() ?: 0.0
val error = if (sumWeight > 0 && uldCargoWeight > 0) {
((sumWeight - uldCargoWeight) / uldCargoWeight * 100)
} else {
0.0
}
weightError.value = String.format("%.1f%%", error)
}
///////////////////////////////////////////////////////////////////////////
// 按钮事件
///////////////////////////////////////////////////////////////////////////
/**
* 点击"取消"按钮
*/
fun onCancelClick() {
getTopActivity().finish()
}
/**
* 点击"保存"按钮
*/
fun onSaveClick() {
val records = waybillList.value ?: return
if (records.isEmpty()) {
showToast("没有可保存的数据")
return
}
// 验证数据
if (!validateRecords(records)) return
// 调用批量更新接口
saveRecords(records)
}
///////////////////////////////////////////////////////////////////////////
// 业务逻辑
///////////////////////////////////////////////////////////////////////////
/**
* 验证数据
*/
private fun validateRecords(records: List<GjcWarehouse>): Boolean {
records.forEachIndexed { index, record ->
if (record.weight < 0) {
showToast("${index + 1}条记录的重量不能为负数")
return false
}
}
return true
}
/**
* 批量保存运单重量
*/
private fun saveRecords(records: List<GjcWarehouse>) {
launchLoadingCollect({
NetApply.api.updateIntExpAssemble(records.toRequestBody())
}) {
onSuccess = { result ->
if (result.data == true) {
showToast("保存成功")
// 发送刷新事件通知列表页
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
// 关闭页面
getTopActivity().finish()
} else {
showToast("保存失败")
}
}
onFailed = { code, msg ->
showToast("保存失败:$msg")
}
}
}
}

View File

@@ -1,10 +1,6 @@
package com.lukouguoji.gjc.viewModel package com.lukouguoji.gjc.viewModel
import android.text.InputType
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.lukouguoji.gjc.R import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.holder.IntExpAssembleItemViewHolder import com.lukouguoji.gjc.holder.IntExpAssembleItemViewHolder
@@ -12,17 +8,15 @@ import com.lukouguoji.module_base.base.BasePageViewModel
import com.lukouguoji.module_base.bean.GjcUldUseBean import com.lukouguoji.module_base.bean.GjcUldUseBean
import com.lukouguoji.module_base.http.net.NetApply import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.ktx.commonAdapter import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.formatDate
import com.lukouguoji.module_base.ktx.launchCollect import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.launchLoadingCollect import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.showConfirmDialog import com.lukouguoji.module_base.ktx.showConfirmDialog
import com.lukouguoji.module_base.ktx.showToast import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import com.lukouguoji.module_base.router.ARouterConstants import com.lukouguoji.module_base.router.ARouterConstants
import dev.utils.app.info.KeyValue import dev.utils.app.info.KeyValue
import dev.utils.common.DateUtils import dev.utils.common.DateUtils
import com.lukouguoji.module_base.ktx.formatDate
import kotlinx.coroutines.launch
/** /**
* 国际出港-出港组装ViewModel * 国际出港-出港组装ViewModel
@@ -264,7 +258,7 @@ class IntExpAssembleViewModel : BasePageViewModel() {
} }
/** /**
* 回填重量按钮点击 * 回填重量按钮点击 - 跳转到修改组装重量页面
*/ */
fun onBackfillWeightClick() { fun onBackfillWeightClick() {
// 获取选中的数据 // 获取选中的数据
@@ -275,55 +269,17 @@ class IntExpAssembleViewModel : BasePageViewModel() {
.filter { it.isSelected } .filter { it.isSelected }
if (selectedItems.isEmpty()) { if (selectedItems.isEmpty()) {
showToast("请选择要回填重量的记录") showToast("请选择要修改重量的ULD")
return return
} }
// 显示输入对话框 if (selectedItems.size > 1) {
showBackfillWeightDialog(selectedItems) showToast("每次只能选择一个ULD进行重量修改")
return
} }
/** // 跳转到修改组装重量页面
* 显示回填重量对话框 val bean = selectedItems.first()
*/ com.lukouguoji.gjc.activity.GjcAssembleWeightEditActivity.start(getTopActivity(), bean)
private fun showBackfillWeightDialog(items: List<GjcUldUseBean>) {
val activity = getTopActivity()
// 创建输入框
val input = EditText(activity).apply {
hint = "请输入重量(KG)"
inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
setPadding(40, 40, 40, 40)
}
AlertDialog.Builder(activity)
.setTitle("回填重量")
.setMessage("共选中 ${items.size} 条记录")
.setView(input)
.setPositiveButton("确定") { _, _ ->
val weight = input.text.toString()
if (weight.verifyNullOrEmpty("请输入重量")) return@setPositiveButton
backfillWeight(items, weight)
}
.setNegativeButton("取消", null)
.show()
}
/**
* 回填重量API调用
*/
private fun backfillWeight(items: List<GjcUldUseBean>, weight: String) {
val ids = items.mapNotNull { it.useId }.joinToString(",")
val params = mapOf(
"ids" to ids,
"weight" to weight
).toRequestBody()
launchLoadingCollect({ NetApply.api.backfillIntExpAssembleWeight(params) }) {
onSuccess = {
showToast("回填重量成功")
refresh()
}
}
} }
} }

View File

@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="com.lukouguoji.gjc.viewModel.GjcAssembleWeightEditViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f2"
android:orientation="vertical">
<include layout="@layout/title_tool_bar" />
<!-- ULD信息区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/bg_white_radius_8"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="8dp"
android:text="ULD信息"
android:textColor="@color/color_33"
android:textSize="17sp"
android:textStyle="bold" />
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="15dp">
<!-- ULD编号 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ULD编号"
android:textColor="@color/text_gray"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.uldNo}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 总件数 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="总件数:"
android:textColor="@color/text_gray"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.totalPc}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 总重量 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="总重量:"
android:textColor="@color/text_gray"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.totalWeight}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 货重 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="货重:"
android:textColor="@color/text_gray"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.cargoWeight}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- 运单信息区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="15dp"
android:layout_marginBottom="15dp"
android:layout_weight="1"
android:background="@drawable/bg_white_radius_8"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="8dp"
android:text="运单信息"
android:textColor="@color/color_33"
android:textSize="17sp"
android:textStyle="bold" />
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e7e7e7" />
<!-- 运单列表 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/item_gjc_assemble_weight_edit" />
</LinearLayout>
<!-- 取消+保存按钮组(居中) -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="15dp"
android:layout_marginBottom="15dp"
android:orientation="horizontal">
<!-- 取消按钮 -->
<TextView
android:id="@+id/btnCancel"
style="@style/tv_bottom_btn"
android:layout_marginEnd="10dp"
android:onClick="@{() -> viewModel.onCancelClick()}"
android:text="取消" />
<!-- 保存按钮 -->
<TextView
android:id="@+id/btnSave"
style="@style/tv_bottom_btn"
android:onClick="@{() -> viewModel.onSaveClick()}"
android:text="保存" />
</LinearLayout>
<!-- 底部统计区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="15dp">
<!-- 总货重 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{`总货重:` + viewModel.sumCargoWeight}"
android:textColor="@color/text_gray"
android:textSize="16sp" />
<!-- 重量误差(红色) -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="@{`重量误差:` + viewModel.weightError}"
android:textColor="@color/text_red"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View" />
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
<variable
name="bean"
type="com.lukouguoji.module_base.bean.GjcWarehouse" />
<variable
name="position"
type="Integer" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_white_radius_8"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="15dp"
android:paddingVertical="8dp">
<!-- 运单号(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
enable="@{false}"
title="@{`运单号`}"
titleLength="@{3}"
type="@{DataLayoutType.INPUT}"
value="@{bean.wbNo}" />
<!-- 件数(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
title="@{`件数`}"
titleLength="@{2}"
type="@{DataLayoutType.INPUT}"
value="@{String.valueOf(bean.pc)}" />
<!-- 重量(可编辑) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{true}"
hint="@{`请输入重量`}"
inputType="@{android.text.InputType.TYPE_CLASS_NUMBER | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL}"
title="@{`重量`}"
titleLength="@{2}"
type="@{DataLayoutType.INPUT}"
value="@={bean.weightStr}" />
</LinearLayout>
</layout>