feat: opt 出港组装
This commit is contained in:
@@ -65,6 +65,20 @@ class GjcUldUseBean : Serializable {
|
||||
|
||||
var loadArea: String = "" // 组装区
|
||||
var pc: Long = 0 // 组装件数
|
||||
var fillWeightFlag: String = "" // 回填状态:0-未回填,1-部分回填,2-已回填
|
||||
|
||||
// 回填状态文本
|
||||
val fillWeightFlagText: String
|
||||
get() = when (fillWeightFlag) {
|
||||
"0" -> "未回填"
|
||||
"1" -> "部分回填"
|
||||
"2" -> "已回填"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// 回填状态是否显示绿色(已回填时显示绿色)
|
||||
val isFillWeightGreen: Boolean
|
||||
get() = fillWeightFlag == "2"
|
||||
|
||||
// ========== 出港组装页面扩展字段 ==========
|
||||
var isExpanded: Boolean = false // 展开状态(旧版保留)
|
||||
|
||||
@@ -35,6 +35,7 @@ class IntExpAssembleStartActivity :
|
||||
companion object {
|
||||
private const val EXTRA_ULD_NO = "uld"
|
||||
private const val EXTRA_EDIT_MODE = "edit_mode"
|
||||
private const val EXTRA_LOAD_AREA = "load_area"
|
||||
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
@@ -45,12 +46,14 @@ class IntExpAssembleStartActivity :
|
||||
/**
|
||||
* 从列表页"修改"模式启动
|
||||
* @param uldNo ULD编号(将被锁定,整个页面生命周期内不可编辑)
|
||||
* @param loadArea 组装位置(用于自动选中对应的组装位置)
|
||||
*/
|
||||
@JvmStatic
|
||||
fun startForEdit(context: Context, uldNo: String) {
|
||||
fun startForEdit(context: Context, uldNo: String, loadArea: String) {
|
||||
val starter = Intent(context, IntExpAssembleStartActivity::class.java)
|
||||
.putExtra(EXTRA_ULD_NO, uldNo)
|
||||
.putExtra(EXTRA_EDIT_MODE, true)
|
||||
.putExtra(EXTRA_LOAD_AREA, loadArea)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
@@ -97,8 +100,9 @@ class IntExpAssembleStartActivity :
|
||||
val isEditMode = intent.getBooleanExtra(EXTRA_EDIT_MODE, false)
|
||||
if (isEditMode) {
|
||||
val uldNo = intent.getStringExtra(EXTRA_ULD_NO) ?: ""
|
||||
val loadArea = intent.getStringExtra(EXTRA_LOAD_AREA) ?: ""
|
||||
if (uldNo.isNotEmpty()) {
|
||||
viewModel.initFromEditMode(uldNo)
|
||||
viewModel.initFromEditMode(uldNo, loadArea)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
// ========== 标记位,避免重复查询 ==========
|
||||
private var lastQueriedUldNo = ""
|
||||
|
||||
// ========== 修改模式待匹配的组装位置 ==========
|
||||
private var pendingLoadArea: String = ""
|
||||
|
||||
/**
|
||||
* ULD编号锁定状态(页面内编辑模式)
|
||||
*/
|
||||
@@ -147,12 +150,30 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}
|
||||
}?.toMutableList() ?: mutableListOf()
|
||||
|
||||
assemblePositionList.value = list
|
||||
|
||||
// 保存默认选中的第一项
|
||||
if (list.isNotEmpty()) {
|
||||
// 检查是否有待匹配的组装位置(修改模式)
|
||||
if (pendingLoadArea.isNotEmpty() && list.isNotEmpty()) {
|
||||
// 取消所有选中状态
|
||||
list.forEach { it.isSelected = false }
|
||||
// 查找并选中匹配项
|
||||
val matchedItem = list.find { it.positionName == pendingLoadArea }
|
||||
if (matchedItem != null) {
|
||||
matchedItem.isSelected = true
|
||||
selectedPosition.value = matchedItem
|
||||
} else {
|
||||
// 未找到匹配项,选中第一项
|
||||
list[0].isSelected = true
|
||||
selectedPosition.value = list[0]
|
||||
}
|
||||
// 清空待匹配标记
|
||||
pendingLoadArea = ""
|
||||
// 触发组装信息列表查询
|
||||
loadAssembledList()
|
||||
} else if (list.isNotEmpty()) {
|
||||
// 非修改模式,选中第一项
|
||||
selectedPosition.value = list[0]
|
||||
}
|
||||
|
||||
assemblePositionList.value = list
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1013,13 +1034,19 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
/**
|
||||
* 从列表页"修改"模式初始化
|
||||
* @param uldNo ULD编号
|
||||
* @param loadArea 组装位置(用于自动选中对应的组装位置)
|
||||
*/
|
||||
fun initFromEditMode(uldNo: String) {
|
||||
fun initFromEditMode(uldNo: String, loadArea: String = "") {
|
||||
if (uldNo.isEmpty()) return
|
||||
|
||||
// 标记为修改模式(整个页面生命周期内 ULD 编号锁定)
|
||||
isFromEditMode.value = true
|
||||
|
||||
// 保存待匹配的组装位置(在组装位置列表加载完成后进行匹配选择)
|
||||
if (loadArea.isNotEmpty()) {
|
||||
pendingLoadArea = loadArea
|
||||
}
|
||||
|
||||
// 填充 ULD 编号
|
||||
uldInfo.value = uldInfo.value?.apply {
|
||||
this.uldNo = uldNo
|
||||
|
||||
@@ -176,12 +176,14 @@ class IntExpAssembleViewModel : BasePageViewModel() {
|
||||
/**
|
||||
* 修改单个列表项 - 跳转到开始组装页面(修改模式)
|
||||
* ULD 编号将被锁定,整个页面生命周期内不可编辑
|
||||
* 同时传递组装位置,用于自动选中对应项
|
||||
*/
|
||||
private fun onEditItem(position: Int) {
|
||||
val bean = pageModel.rv?.commonAdapter()?.getItem(position) as? GjcUldUseBean ?: return
|
||||
com.lukouguoji.gjc.page.assemble.IntExpAssembleStartActivity.startForEdit(
|
||||
getTopActivity(),
|
||||
bean.uld
|
||||
bean.uld,
|
||||
bean.loadArea
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
itemLayoutId="@{viewModel.itemLayoutId}"
|
||||
viewHolder="@{viewModel.itemViewHolder}"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_int_exp_assemble_uld" />
|
||||
tools:listitem="@layout/item_int_exp_assemble" />
|
||||
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
|
||||
@@ -92,31 +92,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 总重 -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
completeSpace="@{4}"
|
||||
android:text="总重:"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{String.valueOf((int)bean.totalWeight)}"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 货重 -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -171,7 +146,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -192,6 +167,31 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 回填状态 -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
completeSpace="@{5}"
|
||||
android:text="回填状态:"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.fillWeightFlagText}"
|
||||
android:textColor="@{bean.isFillWeightGreen ? @color/text_green : @color/text_normal}"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第二行:航班日期、航班号、组装人、组装区、组装时间 -->
|
||||
@@ -288,7 +288,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
completeSpace="@{4}"
|
||||
completeSpace="@{5}"
|
||||
android:text="组装区:"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
Reference in New Issue
Block a user