feat: 开始组装 opt
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.lukouguoji.module_base.bean
|
package com.lukouguoji.module_base.bean
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableBoolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运单列表Bean(右侧运单列表)
|
* 运单列表Bean(右侧运单列表)
|
||||||
*/
|
*/
|
||||||
@@ -15,4 +17,7 @@ class AssembleWaybillBean {
|
|||||||
val fLightInfo: String
|
val fLightInfo: String
|
||||||
get() = "$fno/${fdate.replace("-", "")}"
|
get() = "$fno/${fdate.replace("-", "")}"
|
||||||
|
|
||||||
|
// ========== UI扩展字段 ==========
|
||||||
|
val isSelected: ObservableBoolean = ObservableBoolean(false) // 选中状态
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class AssembleWaybillViewHolder(view: View) :
|
|||||||
binding.bean = bean
|
binding.bean = bean
|
||||||
binding.position = position
|
binding.position = position
|
||||||
|
|
||||||
// 点击运单
|
// 点击整行触发选择事件(单选模式,通过回调处理)
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
clickListener?.onItemClick(position, 0)
|
clickListener?.onItemClick(position, 1) // type=1表示运单列表点击
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ class IntExpAssembleStartActivity :
|
|||||||
)
|
)
|
||||||
binding.rvWaybillList.layoutManager = LinearLayoutManager(this)
|
binding.rvWaybillList.layoutManager = LinearLayoutManager(this)
|
||||||
binding.rvWaybillList.adapter = waybillAdapter
|
binding.rvWaybillList.adapter = waybillAdapter
|
||||||
|
// 添加点击监听器
|
||||||
|
binding.rvWaybillList.addOnItemClickListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,6 +119,7 @@ class IntExpAssembleStartActivity :
|
|||||||
override fun onItemClick(position: Int, type: Int) {
|
override fun onItemClick(position: Int, type: Int) {
|
||||||
when (type) {
|
when (type) {
|
||||||
0 -> viewModel.onPositionItemClick(position) // 组装位置点击
|
0 -> viewModel.onPositionItemClick(position) // 组装位置点击
|
||||||
|
1 -> viewModel.onWaybillItemClick(position) // 运单列表点击
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,36 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
|||||||
assemblePositionList.value = list
|
assemblePositionList.value = list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运单点击(单选切换)
|
||||||
|
*/
|
||||||
|
fun onWaybillItemClick(position: Int) {
|
||||||
|
val list = waybillList.value ?: return
|
||||||
|
|
||||||
|
// 取消所有运单的选中状态
|
||||||
|
list.forEach { it.isSelected.set(false) }
|
||||||
|
|
||||||
|
// 选中当前运单
|
||||||
|
if (position in list.indices) {
|
||||||
|
val selectedWaybill = list[position]
|
||||||
|
selectedWaybill.isSelected.set(true)
|
||||||
|
|
||||||
|
// 同步运单信息到表单
|
||||||
|
waybillInfo.value = WaybillInfoBean().apply {
|
||||||
|
waybillNo = selectedWaybill.waybillNo
|
||||||
|
waybillPieces = selectedWaybill.pieces
|
||||||
|
waybillWeight = selectedWaybill.weight
|
||||||
|
// 保留当前的组装件数、组装重量、组装人
|
||||||
|
assembleCount = waybillInfo.value?.assembleCount ?: ""
|
||||||
|
assembleWeight = waybillInfo.value?.assembleWeight ?: ""
|
||||||
|
operator = waybillInfo.value?.operator ?: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新列表
|
||||||
|
waybillList.value = list
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码运单
|
* 扫码运单
|
||||||
*/
|
*/
|
||||||
@@ -126,7 +156,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
|||||||
val warehouseList = result.data ?: mutableListOf()
|
val warehouseList = result.data ?: mutableListOf()
|
||||||
val waybillBeanList = warehouseList.map { warehouse ->
|
val waybillBeanList = warehouseList.map { warehouse ->
|
||||||
AssembleWaybillBean().apply {
|
AssembleWaybillBean().apply {
|
||||||
waybillNo = warehouse.no
|
waybillNo = warehouse.wbNo
|
||||||
pieces = warehouse.pc.toString()
|
pieces = warehouse.pc.toString()
|
||||||
weight = String.format("%.1f", warehouse.weight)
|
weight = String.format("%.1f", warehouse.weight)
|
||||||
flight = warehouse.flight
|
flight = warehouse.flight
|
||||||
|
|||||||
BIN
module_gjc/src/main/res/drawable/ic_red_checkbox.png
Normal file
BIN
module_gjc/src/main/res/drawable/ic_red_checkbox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -163,7 +163,7 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingHorizontal="8dp">
|
android:paddingHorizontal="8dp">
|
||||||
|
|
||||||
<!-- 序号 -->
|
<!-- 选择列占位 -->
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="64dp"
|
android:layout_width="64dp"
|
||||||
@@ -248,7 +248,6 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
enable="@{false}"
|
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"ULD编号:"}'
|
title='@{"ULD编号:"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
@@ -14,6 +15,11 @@
|
|||||||
type="Integer" />
|
type="Integer" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -23,14 +29,14 @@
|
|||||||
android:paddingHorizontal="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:paddingVertical="4dp">
|
android:paddingVertical="4dp">
|
||||||
|
|
||||||
<!-- 序号 -->
|
<!-- 选择标记 -->
|
||||||
<TextView
|
<ImageView
|
||||||
android:layout_width="64dp"
|
android:id="@+id/iv_select_icon"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="20dp"
|
||||||
android:gravity="center"
|
android:layout_height="20dp"
|
||||||
android:text="@{String.valueOf(position + 1)}"
|
android:layout_marginStart="22dp"
|
||||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
android:layout_marginEnd="22dp"
|
||||||
android:textSize="14sp" />
|
android:src="@{bean.isSelected.get() ? @drawable/ic_red_checkbox : @drawable/bg_circle_gray}" />
|
||||||
|
|
||||||
<!-- 运单号 -->
|
<!-- 运单号 -->
|
||||||
<TextView
|
<TextView
|
||||||
@@ -70,4 +76,12 @@
|
|||||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 分割线 -->
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/line" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user