feat: 国际出港 出港组装 开始组装

This commit is contained in:
2025-12-09 17:58:25 +08:00
parent 2871cbf784
commit 7d39cbf70f
8 changed files with 200 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
package com.lukouguoji.gjc.page.assemble
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
@@ -10,6 +11,7 @@ import com.lukouguoji.gjc.databinding.ActivityIntExpAssembleStartBinding
import com.lukouguoji.gjc.viewModel.IntExpAssembleStartViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.router.ARouterConstants
@@ -115,4 +117,22 @@ class IntExpAssembleStartActivity :
else -> {}
}
}
/**
* 处理扫码结果
*/
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) {
// 获取扫码结果
val codedContent = data?.getStringExtra(Constant.Result.CODED_CONTENT)
// 更新搜索框内容
viewModel.searchText.value = codedContent
// 自动触发查询
viewModel.loadWaitingAssembleWaybills()
}
}
}

View File

@@ -7,9 +7,12 @@ import com.lukouguoji.gjc.holder.AssemblePositionViewHolder
import com.lukouguoji.gjc.holder.AssembleWaybillViewHolder
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.bean.*
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.model.ScanModel
/**
* 国际出港-开始组装ViewModel静态数据
@@ -193,9 +196,57 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
* 扫码运单
*/
fun scanWaybill() {
showToast("扫码功能(静态页面暂不实现)")
ScanModel.startScan(getTopActivity(), Constant.RequestCode.WAYBILL)
}
/**
* 加载待组装运单列表
*/
fun loadWaitingAssembleWaybills() {
val wbNo = searchText.value?.trim() ?: ""
// 验证运单号不能为空
if (wbNo.isEmpty()) {
showToast("请输入运单号")
return
}
// 构建请求参数
val params = mapOf("wbNo" to wbNo).toRequestBody()
// 发起网络请求
launchLoadingCollect({ NetApply.api.queryWaitingAssemble(params) }) {
onSuccess = { result ->
// 数据转换: GjcWarehouse -> AssembleWaybillBean
val warehouseList = result.data ?: mutableListOf()
val waybillBeanList = warehouseList.map { warehouse ->
AssembleWaybillBean().apply {
waybillNo = warehouse.no
pieces = warehouse.pc.toString()
weight = String.format("%.1f", warehouse.weight)
flight = warehouse.flight
isMarked = false
}
}.toMutableList()
// 更新列表
waybillList.value = waybillBeanList
// 结果反馈
if (waybillBeanList.isEmpty()) {
showToast("未找到待组装运单")
} else {
showToast("查询成功,共${waybillBeanList.size}条记录")
}
}
onFailed = { code, message ->
showToast("查询失败: $message")
waybillList.value = mutableListOf()
}
}
}
/**
* 卸货按钮点击
*/

View File

@@ -74,7 +74,7 @@
android:id="@+id/rv_assemble_info"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_weight="0.6"
android:layout_marginBottom="16dp" />
<!-- 组装位置标题 -->
@@ -93,11 +93,12 @@
android:layout_marginBottom="8dp"
app:dividerColor="@color/line" />
<!-- 组装位置列表 -->
<!-- 组装位置列表 - 固定高度2/5支持滚动 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_assemble_position"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="0dp"
android:layout_weight="0.4" />
</LinearLayout>
</LinearLayout>
@@ -122,12 +123,16 @@
<!-- 搜索框 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayoutNew
android:id="@+id/tvWbSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
hint='@{"请输入搜索内容"}'
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.searchText}" />
value="@={viewModel.searchText}"
icon="@{@drawable/img_search}"
setSearchIconClickListener="@{viewModel::loadWaitingAssembleWaybills}"
setOnSearchListener="@{viewModel::loadWaitingAssembleWaybills}" />
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
@@ -135,6 +140,68 @@
android:layout_marginBottom="8dp"
app:dividerColor="@color/line" />
<!-- 运单列表表头 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:background="@color/color_f2"
android:gravity="center_vertical"
android:paddingHorizontal="8dp">
<!-- 序号 -->
<TextView
android:layout_width="40dp"
android:layout_height="wrap_content"
android:text="序号"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold"
android:gravity="center" />
<!-- 运单号 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="运单号"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold" />
<!-- 件数 -->
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:text="件数"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold"
android:gravity="center" />
<!-- 重量 -->
<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="重量"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold"
android:gravity="end" />
<!-- 配载航班 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:text="配载航班"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold"
android:gravity="center" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_waybill_list"
android:layout_width="match_parent"

View File

@@ -55,5 +55,15 @@
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
android:textSize="14sp"
android:gravity="end" />
<!-- 配载航班 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:text="@{bean.flight}"
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
android:textSize="14sp"
android:gravity="center" />
</LinearLayout>
</layout>