feat: 国际进港舱单增删改查接口对齐及交互优化
- 新增/编辑接口切换至新路径,删除统一使用批量删除接口 - 新增模式下航班日期、航班号等字段可编辑,支持航班级联查询自动填充 - 编辑模式下从列表页传入航班日期和航班号进行回显 - 修复编辑模式标题显示错误、航班号大写限制、DATE类型hint不显示等问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1254,21 +1254,21 @@ interface Api {
|
|||||||
suspend fun getGjjManifestDetail(@Query("id") id: String): BaseResultBean<GjjManifestBean>
|
suspend fun getGjjManifestDetail(@Query("id") id: String): BaseResultBean<GjjManifestBean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除-国际进-舱单-列表
|
* 批量删除-国际进港舱单(请求体为 mfId 数组,如 [1,2,3])
|
||||||
*/
|
*/
|
||||||
@POST("IntImpManiFest/deleteFestList")
|
@POST("IntImpManiFest/deleteFestList")
|
||||||
suspend fun gjjManifestDelete(@Body data: RequestBody): BaseResultBean<Any>
|
suspend fun gjjManifestDeleteBatch(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增-国际进-舱单
|
* 新增-国际进港舱单
|
||||||
*/
|
*/
|
||||||
@POST("IntImpManiFest/saveFest")
|
@POST("IntImpManifest/addManifest")
|
||||||
suspend fun gjjManifestInsert(@Body data: RequestBody): BaseResultBean<Any>
|
suspend fun gjjManifestInsert(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新-国际进-舱单
|
* 修改-国际进港舱单
|
||||||
*/
|
*/
|
||||||
@POST("IntImpManiFest/updateFest")
|
@POST("IntImpManifest/modifyManifest")
|
||||||
suspend fun gjjManifestUpdate(@Body data: RequestBody): BaseResultBean<Any>
|
suspend fun gjjManifestUpdate(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class PadDataLayoutNew : FrameLayout {
|
|||||||
field = value
|
field = value
|
||||||
|
|
||||||
et.hint = value
|
et.hint = value
|
||||||
|
tv.hint = value
|
||||||
bindAdapter(spinner, list, hint)
|
bindAdapter(spinner, list, hint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.lukouguoji.module_base.base.BaseBindingActivity
|
|||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.common.DetailsPageType
|
import com.lukouguoji.module_base.common.DetailsPageType
|
||||||
import com.lukouguoji.module_base.ktx.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
|
import com.lukouguoji.module_base.ktx.setUpperCaseAlphanumericFilter
|
||||||
|
|
||||||
class GjjManifestAddActivity :
|
class GjjManifestAddActivity :
|
||||||
BaseBindingActivity<ActivityGjjManifestAddBinding, GjjManifestAddViewModel>() {
|
BaseBindingActivity<ActivityGjjManifestAddBinding, GjjManifestAddViewModel>() {
|
||||||
@@ -20,15 +21,16 @@ class GjjManifestAddActivity :
|
|||||||
override fun viewModelClass() = GjjManifestAddViewModel::class.java
|
override fun viewModelClass() = GjjManifestAddViewModel::class.java
|
||||||
|
|
||||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||||
// 动态设置标题
|
binding.viewModel = viewModel
|
||||||
val title = when {
|
binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
|
||||||
viewModel.pageType.value == DetailsPageType.Modify -> "国际进港舱单编辑"
|
viewModel.initOnCreated(intent)
|
||||||
|
|
||||||
|
// 动态设置标题(必须在 initOnCreated 之后,pageType 已从 Intent 解析)
|
||||||
|
val title = when (viewModel.pageType.value) {
|
||||||
|
DetailsPageType.Modify -> "国际进港舱单编辑"
|
||||||
else -> "国际进港舱单新增"
|
else -> "国际进港舱单新增"
|
||||||
}
|
}
|
||||||
setBackArrow(title)
|
setBackArrow(title)
|
||||||
|
|
||||||
binding.viewModel = viewModel
|
|
||||||
viewModel.initOnCreated(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -49,10 +51,17 @@ class GjjManifestAddActivity :
|
|||||||
* 编辑舱单(通过Bean对象)
|
* 编辑舱单(通过Bean对象)
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun startForEdit(context: Context, bean: com.lukouguoji.module_base.bean.GjjManifest) {
|
fun startForEdit(
|
||||||
|
context: Context,
|
||||||
|
bean: com.lukouguoji.module_base.bean.GjjManifest,
|
||||||
|
flightDate: String = "",
|
||||||
|
flightNo: String = ""
|
||||||
|
) {
|
||||||
val starter = Intent(context, GjjManifestAddActivity::class.java)
|
val starter = Intent(context, GjjManifestAddActivity::class.java)
|
||||||
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Modify.name)
|
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Modify.name)
|
||||||
.putExtra(Constant.Key.BEAN, bean)
|
.putExtra(Constant.Key.BEAN, bean)
|
||||||
|
.putExtra("flightDate", flightDate)
|
||||||
|
.putExtra("flightNo", flightNo)
|
||||||
context.startActivity(starter)
|
context.startActivity(starter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,60 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
// 运单号
|
// 运单号
|
||||||
val waybillNo = MutableLiveData("")
|
val waybillNo = MutableLiveData("")
|
||||||
|
|
||||||
|
// ========== 航班级联查询 ==========
|
||||||
|
private var lastQueriedFlight = ""
|
||||||
|
|
||||||
|
fun onFlightDateInputComplete() {
|
||||||
|
lastQueriedFlight = ""
|
||||||
|
queryFlightIfReady()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onFlightNoInputComplete() {
|
||||||
|
queryFlightIfReady()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun queryFlightIfReady() {
|
||||||
|
val fdate = flightDate.value
|
||||||
|
val fno = flightNo.value
|
||||||
|
if (fdate.isNullOrEmpty() || fno.isNullOrEmpty()) return
|
||||||
|
|
||||||
|
val key = "$fdate-$fno"
|
||||||
|
if (key == lastQueriedFlight) return
|
||||||
|
lastQueriedFlight = key
|
||||||
|
|
||||||
|
launchCollect({
|
||||||
|
NetApply.api.getGjFlightBean(
|
||||||
|
mapOf(
|
||||||
|
"fdate" to fdate,
|
||||||
|
"fno" to fno,
|
||||||
|
"ieFlag" to "I",
|
||||||
|
).toRequestBody()
|
||||||
|
)
|
||||||
|
}) {
|
||||||
|
onSuccess = {
|
||||||
|
if (it.verifySuccess() && it.data != null) {
|
||||||
|
val flight = it.data!!
|
||||||
|
fid = flight.fid.noNull()
|
||||||
|
departure.value = flight.fdep.noNull()
|
||||||
|
destination.value = flight.fdest.noNull()
|
||||||
|
range.value = flight.range.noNull()
|
||||||
|
} else {
|
||||||
|
fid = ""
|
||||||
|
departure.value = ""
|
||||||
|
destination.value = ""
|
||||||
|
range.value = ""
|
||||||
|
showToast(it.msg.noNull("获取航班信息失败"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onFailed = { _, _ ->
|
||||||
|
fid = ""
|
||||||
|
departure.value = ""
|
||||||
|
destination.value = ""
|
||||||
|
range.value = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// UN编号
|
// UN编号
|
||||||
val unNumber = MutableLiveData("")
|
val unNumber = MutableLiveData("")
|
||||||
|
|
||||||
@@ -146,6 +200,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
|
|
||||||
// 编辑模式:从Bean对象加载数据
|
// 编辑模式:从Bean对象加载数据
|
||||||
if (pageType.value == DetailsPageType.Modify) {
|
if (pageType.value == DetailsPageType.Modify) {
|
||||||
|
// 回填航班日期和航班号(Bean中不包含,从列表页传入)
|
||||||
|
flightDate.value = intent.getStringExtra("flightDate").noNull()
|
||||||
|
flightNo.value = intent.getStringExtra("flightNo").noNull()
|
||||||
|
|
||||||
val bean = intent.getSerializableExtra(Constant.Key.BEAN)
|
val bean = intent.getSerializableExtra(Constant.Key.BEAN)
|
||||||
if (bean is com.lukouguoji.module_base.bean.GjjManifest) {
|
if (bean is com.lukouguoji.module_base.bean.GjjManifest) {
|
||||||
loadManifestFromBean(bean)
|
loadManifestFromBean(bean)
|
||||||
@@ -229,15 +287,14 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
"mfId" to if (pageType.value == DetailsPageType.Modify) mfId else null,
|
"mfId" to if (pageType.value == DetailsPageType.Modify) mfId else null,
|
||||||
"fid" to fid,
|
"fid" to fid,
|
||||||
"wbNo" to waybillNo.value,
|
"wbNo" to waybillNo.value,
|
||||||
"agent" to agent.value,
|
"agentCode" to agent.value,
|
||||||
"spCode" to specialCode.value,
|
"spCode" to specialCode.value,
|
||||||
"businessType" to businessType.value,
|
"businessType" to businessType.value,
|
||||||
"awbpc" to waybillNum.value,
|
"totalPc" to waybillNum.value,
|
||||||
"pc" to actualNum.value,
|
"pc" to actualNum.value,
|
||||||
"weight" to actualWeight.value,
|
"weight" to actualWeight.value,
|
||||||
"planweight" to billingWeight.value,
|
"cashWeight" to billingWeight.value,
|
||||||
"packagecode" to packageType.value,
|
"packageType" to packageType.value,
|
||||||
"dep" to departure.value,
|
|
||||||
"origin" to departure.value,
|
"origin" to departure.value,
|
||||||
"dest" to destination.value,
|
"dest" to destination.value,
|
||||||
"goods" to goodsNameEn.value,
|
"goods" to goodsNameEn.value,
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class GjjManifestListViewModel : BasePageViewModel(), IOnItemClickListener {
|
|||||||
private fun onDelete(list: List<GjjManifestBean>) {
|
private fun onDelete(list: List<GjjManifestBean>) {
|
||||||
showLoading()
|
showLoading()
|
||||||
launchCollect({
|
launchCollect({
|
||||||
NetApply.api.gjjManifestDelete(
|
NetApply.api.gjjManifestDeleteBatch(
|
||||||
list.map { it.mfId }.toRequestBody()
|
list.map { it.mfId }.toRequestBody()
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -264,8 +264,12 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
101 -> {
|
101 -> {
|
||||||
// 编辑(传递整个Bean对象)
|
// 编辑(传递整个Bean对象 + 当前筛选的航班日期和航班号)
|
||||||
GjjManifestAddActivity.startForEdit(getTopActivity(), bean)
|
GjjManifestAddActivity.startForEdit(
|
||||||
|
getTopActivity(), bean,
|
||||||
|
flightDate = flightDate.value ?: "",
|
||||||
|
flightNo = flightNo.value ?: ""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
102 -> {
|
102 -> {
|
||||||
// 删除
|
// 删除
|
||||||
@@ -279,28 +283,14 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除单个舱单
|
* 删除单个舱单(通过批量删除接口,传单元素数组)
|
||||||
*/
|
*/
|
||||||
private fun deleteManifest(bean: GjjManifest) {
|
private fun deleteManifest(bean: GjjManifest) {
|
||||||
ConfirmDialogModel(
|
ConfirmDialogModel(
|
||||||
message = "确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?",
|
message = "确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?",
|
||||||
title = "提示"
|
title = "提示"
|
||||||
) {
|
) {
|
||||||
val params = mapOf("mfId" to bean.mfId).toRequestBody()
|
doDeleteByIds(listOf(bean.mfId))
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.gjjManifestDelete(params) }) {
|
|
||||||
onSuccess = {
|
|
||||||
if (it.verifySuccess()) {
|
|
||||||
showToast("删除成功")
|
|
||||||
viewModelScope.launch {
|
|
||||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
|
||||||
}
|
|
||||||
refresh()
|
|
||||||
} else {
|
|
||||||
showToast(it.msg.noNull("删除失败"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +306,32 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showToast("删除功能开发中")
|
ConfirmDialogModel(
|
||||||
|
message = "确定要删除选中的 ${selectedItems.size} 条舱单吗?",
|
||||||
|
title = "批量删除确认"
|
||||||
|
) {
|
||||||
|
doDeleteByIds(selectedItems.map { it.mfId })
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行批量删除(统一接口,请求体为 mfId 数组)
|
||||||
|
*/
|
||||||
|
private fun doDeleteByIds(mfIds: List<Long>) {
|
||||||
|
launchLoadingCollect({ NetApply.api.gjjManifestDeleteBatch(mfIds.toRequestBody()) }) {
|
||||||
|
onSuccess = {
|
||||||
|
if (it.verifySuccess()) {
|
||||||
|
showToast("删除成功")
|
||||||
|
isAllChecked.value = false
|
||||||
|
viewModelScope.launch {
|
||||||
|
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||||
|
}
|
||||||
|
refresh()
|
||||||
|
} else {
|
||||||
|
showToast(it.msg.noNull("删除失败"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,16 +44,17 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<!-- 第1行:航班日期、航班号、航程(全部禁止编辑) -->
|
<!-- 第1行:航班日期、航班号、航程(新增可编辑,编辑禁止) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
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}"
|
enable="@{viewModel.pageType == DetailsPageType.Add}"
|
||||||
hint='@{"请选择航班日期"}'
|
hint='@{"请选择航班日期"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
|
setRefreshCallBack="@{viewModel::onFlightDateInputComplete}"
|
||||||
title='@{"航班日期"}'
|
title='@{"航班日期"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.DATE}"
|
type="@{DataLayoutType.DATE}"
|
||||||
@@ -63,9 +64,11 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
enable="@{false}"
|
android:id="@+id/flightNoInput"
|
||||||
|
enable="@{viewModel.pageType == DetailsPageType.Add}"
|
||||||
hint='@{"请输入航班号"}'
|
hint='@{"请输入航班号"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
|
setRefreshCallBack="@{viewModel::onFlightNoInputComplete}"
|
||||||
title='@{"航 班 号"}'
|
title='@{"航 班 号"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -76,7 +79,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
enable="@{false}"
|
enable="@{viewModel.pageType == DetailsPageType.Add}"
|
||||||
hint='@{"请输入航程"}'
|
hint='@{"请输入航程"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"航 程"}'
|
title='@{"航 程"}'
|
||||||
@@ -90,7 +93,7 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 第2行:运单号(禁止编辑)、代理、特码 -->
|
<!-- 第2行:运单号(新增可编辑,编辑禁止)、代理、特码 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -98,7 +101,7 @@
|
|||||||
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}"
|
enable="@{viewModel.pageType == DetailsPageType.Add}"
|
||||||
hint='@{"请输入运单号"}'
|
hint='@{"请输入运单号"}'
|
||||||
required="@{false}"
|
required="@{false}"
|
||||||
title='@{"运 单 号"}'
|
title='@{"运 单 号"}'
|
||||||
|
|||||||
Reference in New Issue
Block a user