diff --git a/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt b/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt index feac4e3..b713a41 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt @@ -102,6 +102,24 @@ object DictUtils { } } + /** + * 获取国际进港代理列表 + */ + fun getIntImpAgentList( + addAll: Boolean = true, + checkedValue: String? = null, + callBack: (List) -> Unit + ) { + launchCollect({ + NetApply.api + .getIntImpAgentList() + }) { + onSuccess = { + handleCallBack(it, checkedValue, addAll, callBack) + } + } + } + /** * 获取仓管列表 */ diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/GjjManifestAddViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/GjjManifestAddViewModel.kt index ce9163d..db5aa35 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/GjjManifestAddViewModel.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/GjjManifestAddViewModel.kt @@ -2,6 +2,7 @@ package com.lukouguoji.gjj.viewModel import android.content.Intent import android.view.View +import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.lukouguoji.module_base.base.BaseViewModel @@ -38,9 +39,6 @@ class GjjManifestAddViewModel : BaseViewModel() { // 航班号 val flightNo = MutableLiveData("") - // 航程 - val range = MutableLiveData("") - // 运单号 val waybillNo = MutableLiveData("") @@ -80,12 +78,10 @@ class GjjManifestAddViewModel : BaseViewModel() { 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("获取航班信息失败")) } } @@ -93,7 +89,6 @@ class GjjManifestAddViewModel : BaseViewModel() { fid = "" departure.value = "" destination.value = "" - range.value = "" } } } @@ -119,6 +114,17 @@ class GjjManifestAddViewModel : BaseViewModel() { // 目的港 val destination = MutableLiveData("") + // 航程(自动拼接:始发站-目的站) + val range = MediatorLiveData().apply { + val update = { + val dep = departure.value ?: "" + val dest = destination.value ?: "" + value = if (dep.isNotEmpty() || dest.isNotEmpty()) "$dep-$dest" else "" + } + addSource(departure) { update() } + addSource(destination) { update() } + } + // 品名(中) val goodsNameCn = MutableLiveData("") @@ -154,10 +160,10 @@ class GjjManifestAddViewModel : BaseViewModel() { val waybillType = MutableLiveData("") init { - DictUtils.getAgentList(addAll = false) { + DictUtils.getIntImpAgentList(addAll = false) { agentList.postValue(listOf(KeyValue("", "")) + it) } - DictUtils.getSpecialCodeList(addAll = false, flag = 1, ieFlag = "I") { + DictUtils.getSpecialCodeList(addAll = false, flag = 1, ieFlag = "") { val list = arrayListOf() it.find { b -> b.key.contains("普通货物") }?.let { b -> list.add(b) @@ -168,7 +174,7 @@ class GjjManifestAddViewModel : BaseViewModel() { DictUtils.getBusinessTypeList(addAll = false) { businessTypeList.postValue(it) } - DictUtils.getGjjPackageTypeList(addAll = false) { + DictUtils.getShouYunPackageTypeList { packageTypeList.postValue(listOf(KeyValue("", "")) + it) } DictUtils.getGjjGoodsTypeList(addAll = false) { diff --git a/module_gjj/src/main/res/layout/activity_gjj_manifest_add.xml b/module_gjj/src/main/res/layout/activity_gjj_manifest_add.xml index 9dedc1a..0fce01a 100644 --- a/module_gjj/src/main/res/layout/activity_gjj_manifest_add.xml +++ b/module_gjj/src/main/res/layout/activity_gjj_manifest_add.xml @@ -79,13 +79,13 @@ android:layout_weight="1" /> - + diff --git a/module_gjj/src/main/res/layout/fragment_int_imp_query_storage.xml b/module_gjj/src/main/res/layout/fragment_int_imp_query_storage.xml index 9b11e05..796230c 100644 --- a/module_gjj/src/main/res/layout/fragment_int_imp_query_storage.xml +++ b/module_gjj/src/main/res/layout/fragment_int_imp_query_storage.xml @@ -18,14 +18,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_white_radius_bottom_8" - android:orientation="vertical" - android:paddingEnd="8dp"> + android:orientation="vertical"> diff --git a/module_gjj/src/main/res/layout/fragment_int_imp_query_warehouse.xml b/module_gjj/src/main/res/layout/fragment_int_imp_query_warehouse.xml index 20869d1..686b4e6 100644 --- a/module_gjj/src/main/res/layout/fragment_int_imp_query_warehouse.xml +++ b/module_gjj/src/main/res/layout/fragment_int_imp_query_warehouse.xml @@ -18,14 +18,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_white_radius_bottom_8" - android:orientation="vertical" - android:paddingEnd="8dp"> + android:orientation="vertical">