From 37ffc539c9cfe3a774d22780db196b992baf3ca7 Mon Sep 17 00:00:00 2001 From: YANGJIANKUAN Date: Mon, 8 Dec 2025 15:48:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E5=87=BA=E6=B8=AF=20?= =?UTF-8?q?=E5=87=BA=E6=B8=AF=E8=AE=A1=E9=87=8D=20=E5=88=86=E6=89=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lukouguoji/module_base/http/net/Api.kt | 7 +++ .../main/res/layout/layout_pad_data_new.xml | 4 +- .../viewModel/GjcWeighingStartViewModel.kt | 53 +++++++++++++++++-- .../layout/activity_gjc_weighing_start.xml | 4 +- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt index b9ab765..9462ab2 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt @@ -686,6 +686,13 @@ interface Api { @POST("IntExpCheckIn/completeCheckIn") suspend fun completeCheckIn(@Body data: RequestBody): BaseResultBean + /** + * 国际出港待计重-开始计重-分托计重 + * 接口路径: /IntExpCheckIn/splitCheckIn + */ + @POST("IntExpCheckIn/splitCheckIn") + suspend fun splitCheckIn(@Body data: RequestBody): BaseResultBean + /** * 国际出港计重明细-根据运单号查询所有计重记录 * 接口路径: /IntExpCheckIn/listRecordByWh diff --git a/module_base/src/main/res/layout/layout_pad_data_new.xml b/module_base/src/main/res/layout/layout_pad_data_new.xml index 10faf55..70579bc 100644 --- a/module_base/src/main/res/layout/layout_pad_data_new.xml +++ b/module_base/src/main/res/layout/layout_pad_data_new.xml @@ -3,8 +3,8 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/ll_container" android:layout_width="match_parent" - android:layout_height="42dp" - android:layout_margin="5dp" + android:layout_height="40dp" + android:layout_margin="4dp" android:focusableInTouchMode="false" android:focusable="false" android:clickable="false" diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingStartViewModel.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingStartViewModel.kt index 10f414d..7655b3a 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingStartViewModel.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingStartViewModel.kt @@ -230,11 +230,57 @@ class GjcWeighingStartViewModel : BaseViewModel() { } /** - * 分拣计重按钮点击 + * 分托计重按钮点击 */ fun sortingWeighingClick() { - showToast("分拣计重功能开发中") - // TODO: 实现分拣计重功能 + val bean = maWbBean.value ?: return + + // 1. 验证必填字段 + if (bean.no.verifyNullOrEmpty("请输入运单号")) return + if (bean.fno.verifyNullOrEmpty("请输入航班号")) return + if (channel.value.verifyNullOrEmpty("请选择通道号")) return + + // 2. 收集当前表单数据,更新到 bean + bean.apply { + // 更新运抵数据(如果用户已编辑) + arrivePc = this@GjcWeighingStartViewModel.arrivePc.value?.toLongOrNull() ?: arrivePc + arriveWeight = this@GjcWeighingStartViewModel.arriveWeight.value?.toDoubleOrNull() ?: arriveWeight + arriveVolume = this@GjcWeighingStartViewModel.arriveVolume.value?.toDoubleOrNull() ?: arriveVolume + } + + // 3. 构建请求数据(GjcMaWb转RequestBody) + val params = bean.toRequestBody(removeEmptyOrNull = true) + + // 4. 调用接口 + launchLoadingCollect({ + NetApply.api.splitCheckIn(params) + }) { + onSuccess = { result -> + if (result.verifySuccess()) { + showToast("分托计重成功") + + // 发送刷新事件 + viewModelScope.launch { + FlowBus.with(ConstantEvent.EVENT_REFRESH).emit("refresh") + } + + // 刷新实时计重数据(第5行的只读字段) + loadRealTimeRecord() + + // 清空表单字段,等待下一次计重 + arrivePc.value = "" + arriveWeight.value = "" + arriveVolume.value = "" + maWbBean.value = maWbBean.value?.apply { + carId = null + remark = null + } + carWeight.value = "0" + } else { + showToast(result.msg.noNull("分托计重失败")) + } + } + } } /** @@ -246,6 +292,7 @@ class GjcWeighingStartViewModel : BaseViewModel() { // 验证必填字段 if (bean.no.verifyNullOrEmpty("请输入运单号")) return if (bean.fno.verifyNullOrEmpty("请输入航班号")) return + if (channel.value.verifyNullOrEmpty("请选择通道号")) return // 从编辑字段获取数值 val pc = realTimePc.value?.toLongOrNull() ?: bean.pc diff --git a/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml b/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml index 815cbc7..58eef9e 100644 --- a/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml +++ b/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml @@ -36,7 +36,7 @@ android:layout_height="wrap_content" android:background="@drawable/bg_white_radius_8" android:orientation="vertical" - android:padding="15dp"> + android:padding="8dp">