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 d7e07b9..90c0f80 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 @@ -446,7 +446,7 @@ interface Api { * 参数: maWbId (Long) */ @POST("IntExpSearch/detail") - suspend fun getGjcQueryDetails(@Body data: RequestBody): BaseResultBean> + suspend fun getGjcQueryDetails(@Query("maWbId") maWbId: Long): BaseResultBean> /** * 国际出港板箱过磅-分页搜索 diff --git a/module_base/src/main/res/drawable/bg_white_radius_bottom_8.xml b/module_base/src/main/res/drawable/bg_white_radius_bottom_8.xml new file mode 100644 index 0000000..84d3883 --- /dev/null +++ b/module_base/src/main/res/drawable/bg_white_radius_bottom_8.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/module_base/src/main/res/drawable/bg_white_radius_top_8.xml b/module_base/src/main/res/drawable/bg_white_radius_top_8.xml new file mode 100644 index 0000000..8304365 --- /dev/null +++ b/module_base/src/main/res/drawable/bg_white_radius_top_8.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcQueryDetailsViewModel.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcQueryDetailsViewModel.kt index 6c86bcd..577fced 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcQueryDetailsViewModel.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcQueryDetailsViewModel.kt @@ -10,7 +10,6 @@ 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 /** * 国际出港查询详情-ViewModel @@ -26,6 +25,15 @@ class GjcQueryDetailsViewModel : BaseViewModel() { // ==================== 详情数据 ==================== val detailData = MutableLiveData>(emptyMap()) + // 运单信息 (maWb) + val maWbData = MutableLiveData>(emptyMap()) + + // 仓库列表 (warehouseList) + val warehouseList = MutableLiveData>>(emptyList()) + + // 库位列表 (storageUseList) + val storageUseList = MutableLiveData>>(emptyList()) + // ==================== Fragment列表 ==================== val fragmentList by lazy { listOf( @@ -60,11 +68,53 @@ class GjcQueryDetailsViewModel : BaseViewModel() { return } - val params = mapOf("maWbId" to maWbId.toLongOrNull()).toRequestBody() + val maWbIdValue = maWbId.toLongOrNull() + if (maWbIdValue == null) { + showToast("运单ID格式错误") + return + } - launchLoadingCollect({ NetApply.api.getGjcQueryDetails(params) }) { + launchLoadingCollect({ NetApply.api.getGjcQueryDetails(maWbIdValue) }) { onSuccess = { result -> - detailData.value = result.data ?: emptyMap() + val data = result.data ?: emptyMap() + detailData.value = data + + // 解析 maWb 对象 + @Suppress("UNCHECKED_CAST") + val maWb = data["maWb"] as? Map ?: emptyMap() + + // 解析 maWbM 对象 (包含海关报文等信息) + @Suppress("UNCHECKED_CAST") + val maWbM = data["maWbM"] as? Map ?: emptyMap() + + // 合并 maWb 和 maWbM 的数据,并添加组合字段 + val mergedData = mutableMapOf() + mergedData.putAll(maWb) + mergedData.putAll(maWbM) + + // 添加组合字段: wbNo = prefix + no + val prefix = maWb["prefix"] as? String ?: "" + val no = maWb["no"] as? String ?: "" + if (prefix.isNotEmpty() || no.isNotEmpty()) { + mergedData["wbNo"] = "$prefix-$no" + } + + // 字段映射: cmdStatus -> customsCommand + maWbM["cmdStatus"]?.let { + mergedData["customsCommand"] = it + } + + maWbData.value = mergedData + + // 解析 warehouseList 列表 + @Suppress("UNCHECKED_CAST") + val whList = data["warehouseList"] as? List> ?: emptyList() + warehouseList.value = whList + + // 解析 storageUseList 列表 + @Suppress("UNCHECKED_CAST") + val suList = data["storageUseList"] as? List> ?: emptyList() + storageUseList.value = suList } } } diff --git a/module_gjc/src/main/res/layout/activity_gjc_query_details.xml b/module_gjc/src/main/res/layout/activity_gjc_query_details.xml index ac67d9f..72b94d0 100644 --- a/module_gjc/src/main/res/layout/activity_gjc_query_details.xml +++ b/module_gjc/src/main/res/layout/activity_gjc_query_details.xml @@ -3,7 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + + @@ -22,14 +24,15 @@ @@ -40,6 +43,7 @@ android:layout_weight="1" android:gravity="center" android:text="运单信息" + android:textStyle="bold" android:textColor="@{viewModel.currentTab == 0 ? @color/colorPrimary : @color/text_gray}" android:textSize="16sp" /> @@ -53,9 +57,8 @@ @@ -65,6 +68,7 @@ android:layout_height="0dp" android:layout_weight="1" android:gravity="center" + android:textStyle="bold" android:text="仓库信息" android:textColor="@{viewModel.currentTab == 1 ? @color/colorPrimary : @color/text_gray}" android:textSize="16sp" /> @@ -78,9 +82,8 @@ @@ -90,6 +93,7 @@ android:layout_height="0dp" android:layout_weight="1" android:gravity="center" + android:textStyle="bold" android:text="库位信息" android:textColor="@{viewModel.currentTab == 2 ? @color/colorPrimary : @color/text_gray}" android:textSize="16sp" /> @@ -103,6 +107,12 @@ + + + android:paddingHorizontal="15dp" + android:paddingBottom="15dp"> @@ -43,7 +44,7 @@ title='@{"运单号"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("wbNo")}' /> + value='@{(String)viewModel.maWbData.get("wbNo")}' /> + value='@{(String)viewModel.maWbData.get("agentName")}' /> + value='@{(String)viewModel.maWbData.get("spCode")}' /> @@ -82,7 +83,7 @@ title='@{"运单件数"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{String.valueOf(viewModel.detailData.get("pc"))}' /> + value='@{String.valueOf(viewModel.maWbData.get("pc"))}' /> + value='@{String.valueOf(viewModel.maWbData.get("weight"))}' /> + value='@{String.valueOf(viewModel.maWbData.get("volume"))}' /> @@ -121,7 +122,7 @@ title='@{"包装类型"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("packageType")}' /> + value='@{(String)viewModel.maWbData.get("packageType")}' /> + value='@{(String)viewModel.maWbData.get("awbName")}' /> + value='@{(String)viewModel.maWbData.get("businessName")}' /> @@ -159,7 +160,7 @@ title='@{"品名(英)"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("goods")}' /> + value='@{(String)viewModel.maWbData.get("goods")}' /> @@ -177,7 +178,7 @@ title='@{"品名(中)"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("goodsCn")}' /> + value='@{(String)viewModel.maWbData.get("goodsCn")}' /> @@ -196,7 +197,7 @@ title='@{"海关指令"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("customsCommand")}' /> + value='@{(String)viewModel.maWbData.get("customsCommand")}' /> + value='@{(String)viewModel.maWbData.get("mftStatus")}' /> + value='@{(String)viewModel.maWbData.get("arrivalStatus")}' /> @@ -235,7 +236,7 @@ title='@{"装载舱单"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("loadStatus")}' /> + value='@{(String)viewModel.maWbData.get("loadStatus")}' /> + value='@{(String)viewModel.maWbData.get("tallyStatus")}' /> + value='@{(String)viewModel.maWbData.get("opDate")}' /> @@ -274,7 +275,7 @@ title='@{"省直辖市"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("proName")}' /> + value='@{(String)viewModel.maWbData.get("proName")}' /> + value='@{(String)viewModel.maWbData.get("cityName")}' /> + value='@{(String)viewModel.maWbData.get("areaName")}' /> @@ -308,7 +309,7 @@ title='@{"备注"}' titleLength="@{5}" type="@{DataLayoutType.INPUT}" - value='@{(String)viewModel.detailData.get("remark")}' /> + value='@{(String)viewModel.maWbData.get("remark")}' />