feat: 国际进港装机单添加航班级联查询和入库/修改库位功能
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,13 +6,18 @@ import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.databinding.ActivityIntImpLoadingListBinding
|
||||
import com.lukouguoji.gjj.dialog.IntImpInStorageDialogModel
|
||||
import com.lukouguoji.gjj.dialog.IntImpModifyStorageDialogModel
|
||||
import com.lukouguoji.gjj.viewModel.IntImpLoadingListViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.bean.GjjManifest
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
/**
|
||||
@@ -28,6 +33,7 @@ class IntImpLoadingListActivity :
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际进港装机单")
|
||||
binding.viewModel = viewModel
|
||||
binding.activity = this
|
||||
|
||||
// 观察全选状态,更新图标透明度
|
||||
viewModel.isAllChecked.observe(this) { isAllChecked ->
|
||||
@@ -45,10 +51,61 @@ class IntImpLoadingListActivity :
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
// 接收从进港舱单传递的参数
|
||||
intent.getStringExtra("fdate")?.let { if (it.isNotEmpty()) viewModel.flightDate.value = it }
|
||||
intent.getStringExtra("fno")?.let { if (it.isNotEmpty()) viewModel.flightNo.value = it }
|
||||
intent.getStringExtra("sendAddress")?.let { if (it.isNotEmpty()) viewModel.sendAddress.value = it }
|
||||
intent.getStringExtra("fdest")?.let { if (it.isNotEmpty()) viewModel.fdest.value = it }
|
||||
|
||||
// 如果收到了航班号和日期参数,触发航班查询来构建始发站下拉列表
|
||||
val fdate = intent.getStringExtra("fdate")
|
||||
val fno = intent.getStringExtra("fno")
|
||||
if (!fdate.isNullOrEmpty() && !fno.isNullOrEmpty()) {
|
||||
viewModel.onFlightNoInputComplete()
|
||||
}
|
||||
|
||||
// 初始加载数据
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示入库操作对话框
|
||||
*/
|
||||
fun showInStorageDialog() {
|
||||
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
|
||||
val selectedItems = list.filterIsInstance<GjjManifest>().filter { it.isSelected }
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请选择要入库的记录")
|
||||
return
|
||||
}
|
||||
|
||||
IntImpInStorageDialogModel { dialog ->
|
||||
val locationName = dialog.locationName
|
||||
val locationId = dialog.locationId
|
||||
viewModel.performInStorage(locationName, locationId, selectedItems)
|
||||
}.show(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示修改库位对话框
|
||||
*/
|
||||
fun showModifyStorageDialog() {
|
||||
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
|
||||
val selectedItems = list.filterIsInstance<GjjManifest>().filter { it.isSelected }
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请选择要修改库位的记录")
|
||||
return
|
||||
}
|
||||
|
||||
IntImpModifyStorageDialogModel { dialog ->
|
||||
val locationName = dialog.locationName
|
||||
val locationId = dialog.locationId
|
||||
viewModel.performModifyStorage(locationName, locationId, selectedItems)
|
||||
}.show(this)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) {
|
||||
|
||||
Reference in New Issue
Block a user