feat: 国际出港 出港组装 开始组装
This commit is contained in:
@@ -7,5 +7,6 @@ class AssembleWaybillBean {
|
||||
var waybillNo: String = "" // 运单号
|
||||
var pieces: String = "" // 件数
|
||||
var weight: String = "" // 重量
|
||||
var flight: String = "" // 配载航班
|
||||
var isMarked: Boolean = false // 是否标记(红色显示)
|
||||
}
|
||||
|
||||
@@ -568,6 +568,13 @@ interface Api {
|
||||
@GET("IntExpAssemble/pageQueryAssembler")
|
||||
suspend fun getIntExpAssemblerList(): BaseResultBean<List<String>>
|
||||
|
||||
/**
|
||||
* 国际出港组装 - 查询待组装运单列表
|
||||
* 接口路径: /IntExpAssemble/queryWaitingAssemble
|
||||
*/
|
||||
@POST("IntExpAssemble/queryWaitingAssemble")
|
||||
suspend fun queryWaitingAssemble(@Body data: RequestBody): BaseResultBean<MutableList<GjcWarehouse>>
|
||||
|
||||
/**
|
||||
* 国际出港出库交接-分页查询
|
||||
* 接口路径: /IntExpOutHandover/pageQuery
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.lukouguoji.module_base.ui.weight.search.layout
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
@@ -121,6 +123,11 @@ class PadSearchLayoutNew : LinearLayout {
|
||||
|
||||
var listRefreshCallBack: (() -> Unit)? = {}
|
||||
|
||||
/**
|
||||
* 搜索事件回调(回车键或搜索按钮触发)
|
||||
*/
|
||||
var searchCallBack: (() -> Unit)? = null
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 方法区
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -138,6 +145,20 @@ class PadSearchLayoutNew : LinearLayout {
|
||||
et.doOnTextChanged { text, _, _, _ ->
|
||||
value = text.toString()
|
||||
}
|
||||
|
||||
// 回车键监听 - 触发搜索
|
||||
et.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH ||
|
||||
actionId == EditorInfo.IME_ACTION_DONE ||
|
||||
(event?.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN)) {
|
||||
// 优先调用searchCallBack,如果没有则调用refreshCallBack
|
||||
searchCallBack?.invoke() ?: refreshCallBack?.invoke()
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
bindOnSelected(spinner, object : IOnSpinnerSelected {
|
||||
override fun onSelected(position: Int) {
|
||||
value = list.getOrNull(position)?.value ?: ""
|
||||
|
||||
@@ -140,6 +140,24 @@ fun setInputWaybill(layout: PadSearchLayout, isWaybill: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置搜索监听器(回车键或搜索按钮触发)
|
||||
*/
|
||||
@BindingAdapter("setOnSearchListener", requireAll = false)
|
||||
fun setSearchLayoutNewOnSearchListener(layout: PadSearchLayoutNew, listener: (() -> Unit)?) {
|
||||
layout.searchCallBack = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置搜索图标点击为搜索功能
|
||||
*/
|
||||
@BindingAdapter("setSearchIconClickListener", requireAll = false)
|
||||
fun setSearchLayoutNewSearchIconClickListener(layout: PadSearchLayoutNew, listener: (() -> Unit)?) {
|
||||
layout.iv.setOnClickListener {
|
||||
listener?.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// PadSearchLayoutNew 的绑定适配器
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 卸货按钮点击
|
||||
*/
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user