feat: 国际出港 出港运抵
This commit is contained in:
@@ -8,6 +8,7 @@ import com.lukouguoji.gjc.dialog.IntExpArriveResetDialogModel
|
|||||||
import com.lukouguoji.gjc.holder.IntExpArriveViewHolder
|
import com.lukouguoji.gjc.holder.IntExpArriveViewHolder
|
||||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
import com.lukouguoji.module_base.bean.GjcDeclareParam
|
import com.lukouguoji.module_base.bean.GjcDeclareParam
|
||||||
|
import com.lukouguoji.module_base.bean.GjcHaWb
|
||||||
import com.lukouguoji.module_base.bean.GjcMaWb
|
import com.lukouguoji.module_base.bean.GjcMaWb
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.common.ConstantEvent
|
import com.lukouguoji.module_base.common.ConstantEvent
|
||||||
@@ -211,14 +212,36 @@ class IntExpArriveViewModel : BasePageViewModel() {
|
|||||||
*/
|
*/
|
||||||
fun arriveReportClick() {
|
fun arriveReportClick() {
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||||
val selectedItems = list.filter { it.isSelected }
|
|
||||||
|
|
||||||
if (selectedItems.isEmpty()) {
|
// 收集选中的主单
|
||||||
|
val selectedMaWbList = list.filter { it.isSelected }
|
||||||
|
|
||||||
|
// 收集选中的分单
|
||||||
|
val selectedHaWbList = mutableListOf<GjcHaWb>()
|
||||||
|
list.forEach { maWb ->
|
||||||
|
maWb.haWbList?.forEach { haWb ->
|
||||||
|
if (haWb.isSelected) {
|
||||||
|
selectedHaWbList.add(haWb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有选中项
|
||||||
|
if (selectedMaWbList.isEmpty() && selectedHaWbList.isEmpty()) {
|
||||||
showToast("请选择要申报的运单")
|
showToast("请选择要申报的运单")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val requestData = mapOf("maWbList" to selectedItems).toRequestBody()
|
// 构建请求参数(区分主单和分单)
|
||||||
|
val params = mutableMapOf<String, Any?>()
|
||||||
|
if (selectedMaWbList.isNotEmpty()) {
|
||||||
|
params["maWbList"] = selectedMaWbList
|
||||||
|
}
|
||||||
|
if (selectedHaWbList.isNotEmpty()) {
|
||||||
|
params["haWbList"] = selectedHaWbList
|
||||||
|
}
|
||||||
|
|
||||||
|
val requestData = params.toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.arriveDeclare(requestData) }) {
|
launchLoadingCollect({ NetApply.api.arriveDeclare(requestData) }) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
|
|||||||
Reference in New Issue
Block a user