diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a4e1f81..c752534 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -400,6 +400,13 @@ android:exported="false" android:screenOrientation="userLandscape" /> + + + diff --git a/app/src/main/java/com/lukouguoji/aerologic/ui/fragment/HomeFragment.kt b/app/src/main/java/com/lukouguoji/aerologic/ui/fragment/HomeFragment.kt index 7462dcc..6c2647c 100644 --- a/app/src/main/java/com/lukouguoji/aerologic/ui/fragment/HomeFragment.kt +++ b/app/src/main/java/com/lukouguoji/aerologic/ui/fragment/HomeFragment.kt @@ -442,6 +442,13 @@ class HomeFragment : Fragment() { ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_INT_IMP_MANIFEST) .navigation() } + + // 理货报告 + Constant.AuthName.IntImpTally -> { + ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_INT_IMP_TALLY) + .navigation() + } + /** * 航班查询 */ @@ -786,6 +793,13 @@ class HomeFragment : Fragment() { "进港舱单" ) ) + list.add( + RightMenu( + Constant.AuthName.IntImpTally, + R.mipmap.img_bwjx, + "理货报告" + ) + ) } Constant.AuthName.Flight -> { diff --git a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjImportTally.kt b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjImportTally.kt index 65f1589..cf9dcca 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjImportTally.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjImportTally.kt @@ -1,5 +1,8 @@ package com.lukouguoji.module_base.bean +import androidx.databinding.ObservableBoolean +import java.io.Serializable + /** * 国际进港理货数据 */ @@ -72,4 +75,17 @@ data class GjjImportTally( var volume: Double = 0.0, // 重量(kg) var weight: Double = 0.0 -) +) : Serializable { + // 选中状态(用于多选功能)- 不参与序列化 + @Transient + val checked: ObservableBoolean = ObservableBoolean(false) + + // 兼容现有API的isSelected属性 + var isSelected: Boolean + get() = checked.get() + set(value) = checked.set(value) + + // 获取完整运单号 + fun getWaybillNo() = "$prefix$no" +} + diff --git a/module_base/src/main/java/com/lukouguoji/module_base/common/Constant.kt b/module_base/src/main/java/com/lukouguoji/module_base/common/Constant.kt index bf004f2..85b98ec 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/common/Constant.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/common/Constant.kt @@ -268,6 +268,7 @@ interface Constant { const val IntImpMsgParseActivity = "AppIntImpMsgParse" //电报解析(电报生成) const val IntArrAirManifest = "AppIntArrAirManifest" //原始舱单 const val IntImpManifest = "AppIntImpManifest" //进港舱单 + const val IntImpTally = "AppIntImpTally" //理货报告 const val GjjManifestListActivity = "AppIntExpManifest" //舱单 const val GjjTallyListActivity = "AppIntExpTally" //理货 const val GjjGoodsListActivity = "AppIntExpGjjGoods" //货物交接 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 b2e1adc..d800c7a 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 @@ -48,6 +48,7 @@ import com.lukouguoji.module_base.bean.GjjGoodsBean import com.lukouguoji.module_base.bean.GjjGoodsDetailsBean import com.lukouguoji.module_base.bean.GjjGoodsTypeBean import com.lukouguoji.module_base.bean.GjjHandoverRecordBean +import com.lukouguoji.module_base.bean.GjjImportTally import com.lukouguoji.module_base.bean.GjjManifest import com.lukouguoji.module_base.bean.GjjManifestBean import com.lukouguoji.module_base.bean.GjjPackTypeBean @@ -1598,4 +1599,16 @@ interface Api { */ @POST("IntImpManifest/pageQueryAirTotal") suspend fun getIntImpLoadingTotal(@Body data: RequestBody): BaseResultBean + + /** + * 国际进港理货报告-分页查询 + */ + @POST("IntImpTally/pageQuery") + suspend fun getIntImpTallyList(@Body data: RequestBody): PageInfo + + /** + * 国际进港理货报告-分页合计 + */ + @POST("IntImpTally/pageQueryTotal") + suspend fun getIntImpTallyTotal(@Body data: RequestBody): BaseResultBean } \ No newline at end of file diff --git a/module_base/src/main/java/com/lukouguoji/module_base/router/ARouterConstants.kt b/module_base/src/main/java/com/lukouguoji/module_base/router/ARouterConstants.kt index 4a14498..e11891a 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/router/ARouterConstants.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/router/ARouterConstants.kt @@ -173,6 +173,7 @@ object ARouterConstants { const val ACTIVITY_URL_INT_ARR_SUPPLEMENT_INFO = "/gjj/IntArrSupplementInfoActivity" //国际进港 补充信息 const val ACTIVITY_URL_INT_IMP_MANIFEST = "/gjj/IntImpManifestActivity" //国际进港 进港舱单 const val ACTIVITY_URL_INT_IMP_LOADING_LIST = "/gjj/IntImpLoadingListActivity" //国际进港 装机单(分拣理货) + const val ACTIVITY_URL_INT_IMP_TALLY = "/gjj/IntImpTallyActivity" //国际进港 理货报告 ///////////////// 航班查询模块 /** diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpTallyActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpTallyActivity.kt new file mode 100644 index 0000000..f396431 --- /dev/null +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpTallyActivity.kt @@ -0,0 +1,67 @@ +package com.lukouguoji.gjj.activity + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import com.alibaba.android.arouter.facade.annotation.Route +import com.lukouguoji.gjj.R +import com.lukouguoji.gjj.databinding.ActivityIntImpTallyBinding +import com.lukouguoji.gjj.viewModel.IntImpTallyViewModel +import com.lukouguoji.module_base.base.BaseBindingActivity +import com.lukouguoji.module_base.common.Constant +import com.lukouguoji.module_base.common.ConstantEvent +import com.lukouguoji.module_base.impl.FlowBus +import com.lukouguoji.module_base.impl.observe +import com.lukouguoji.module_base.ktx.addOnItemClickListener +import com.lukouguoji.module_base.router.ARouterConstants + +/** + * 国际进港-理货报告页面 + */ +@Route(path = ARouterConstants.ACTIVITY_URL_INT_IMP_TALLY) +class IntImpTallyActivity : + BaseBindingActivity() { + + override fun layoutId() = R.layout.activity_int_imp_tally + override fun viewModelClass() = IntImpTallyViewModel::class.java + + override fun initOnCreate(savedInstanceState: Bundle?) { + setBackArrow("国际进港理货报告") + binding.viewModel = viewModel + + // 观察全选状态,更新图标透明度 + viewModel.isAllChecked.observe(this) { isAllChecked -> + binding.checkIcon.alpha = if (isAllChecked) 1.0f else 0.5f + } + + // 绑定分页 + viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this) + + // 设置item点击监听 + binding.rv.addOnItemClickListener(viewModel) + + // 监听刷新事件 + FlowBus.with(ConstantEvent.EVENT_REFRESH).observe(this) { + viewModel.refresh() + } + + // 初始加载数据 + viewModel.refresh() + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + + // 处理运单号扫码 + if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) { + viewModel.waybillNo.value = data?.getStringExtra(Constant.Result.CODED_CONTENT) + viewModel.searchClick() + } + + // 处理分单号扫码 + if (requestCode == Constant.RequestCode.HNO && resultCode == Activity.RESULT_OK) { + viewModel.hno.value = data?.getStringExtra(Constant.Result.CODED_CONTENT) + viewModel.searchClick() + } + } +} diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpTallyViewHolder.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpTallyViewHolder.kt new file mode 100644 index 0000000..daf9d78 --- /dev/null +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpTallyViewHolder.kt @@ -0,0 +1,26 @@ +package com.lukouguoji.gjj.holder + +import android.view.View +import com.lukouguoji.gjj.databinding.ItemIntImpTallyBinding +import com.lukouguoji.module_base.base.BaseViewHolder +import com.lukouguoji.module_base.bean.GjjImportTally + +/** + * 国际进港理货报告 ViewHolder + */ +class IntImpTallyViewHolder(view: View) : + BaseViewHolder(view) { + + override fun onBind(item: Any?, position: Int) { + val bean = getItemBean(item) ?: return + binding.bean = bean + binding.position = position + binding.executePendingBindings() + + // 选中图标点击 - 切换选择状态 + binding.ivIcon.setOnClickListener { + bean.checked.set(!bean.checked.get()) + binding.executePendingBindings() + } + } +} diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpTallyViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpTallyViewModel.kt new file mode 100644 index 0000000..9723ec0 --- /dev/null +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpTallyViewModel.kt @@ -0,0 +1,189 @@ +package com.lukouguoji.gjj.viewModel + +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.viewModelScope +import com.lukouguoji.gjj.R +import com.lukouguoji.gjj.holder.IntImpTallyViewHolder +import com.lukouguoji.module_base.base.BasePageViewModel +import com.lukouguoji.module_base.bean.GjjImportTally +import com.lukouguoji.module_base.common.Constant +import com.lukouguoji.module_base.common.ConstantEvent +import com.lukouguoji.module_base.http.net.NetApply +import com.lukouguoji.module_base.impl.FlowBus +import com.lukouguoji.module_base.ktx.commonAdapter +import com.lukouguoji.module_base.ktx.launchCollect +import com.lukouguoji.module_base.ktx.launchLoadingCollect +import com.lukouguoji.module_base.ktx.showToast +import com.lukouguoji.module_base.ktx.toRequestBody +import com.lukouguoji.module_base.model.ScanModel +import kotlinx.coroutines.launch + +/** + * 国际进港理货报告 ViewModel + */ +class IntImpTallyViewModel : BasePageViewModel() { + + // ========== 搜索条件 ========== + val flightDate = MutableLiveData("") // 航班日期 + val flightNo = MutableLiveData("") // 航班号 + val waybillNo = MutableLiveData("") // 运单号 + val hno = MutableLiveData("") // 分单号 + + // ========== 统计信息 ========== + val totalCount = MutableLiveData("0") // 合计票数 + val totalPc = MutableLiveData("0") // 总件数 + val totalWeight = MutableLiveData("0") // 总重量 + + // ========== 全选状态 ========== + val isAllChecked = MutableLiveData(false) + + init { + // 监听全选状态,自动更新所有列表项 + isAllChecked.observeForever { checked -> + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return@observeForever + list.forEach { it.checked.set(checked) } + pageModel.rv?.commonAdapter()?.notifyDataSetChanged() + } + } + + // ========== 适配器配置 ========== + val itemViewHolder = IntImpTallyViewHolder::class.java + val itemLayoutId = R.layout.item_int_imp_tally + + /** + * 搜索按钮点击 + */ + fun searchClick() { + refresh() + } + + /** + * 全选按钮点击(切换全选状态) + */ + fun checkAllClick() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return + + // 切换全选状态 + val shouldCheckAll = !isAllChecked.value!! + list.forEach { it.checked.set(shouldCheckAll) } + isAllChecked.value = shouldCheckAll + + pageModel.rv?.commonAdapter()?.notifyDataSetChanged() + } + + /** + * 扫码运单号 + */ + fun scanWaybill() { + ScanModel.startScan(getTopActivity(), Constant.RequestCode.WAYBILL) + } + + /** + * 扫码分单号 + */ + fun scanHno() { + ScanModel.startScan(getTopActivity(), Constant.RequestCode.HNO) + } + + /** + * 人工放行(暂不实现) + */ + fun manualReleaseClick() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return + val selectedItems = list.filter { it.isSelected } + + if (selectedItems.isEmpty()) { + showToast("请选择要放行的记录") + return + } + + showToast("人工放行功能开发中") + } + + /** + * 状态重置(暂不实现) + */ + fun statusResetClick() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return + val selectedItems = list.filter { it.isSelected } + + if (selectedItems.isEmpty()) { + showToast("请选择要重置的记录") + return + } + + showToast("状态重置功能开发中") + } + + /** + * 删除理货(暂不实现) + */ + fun deleteTallyClick() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return + val selectedItems = list.filter { it.isSelected } + + if (selectedItems.isEmpty()) { + showToast("请选择要删除的记录") + return + } + + showToast("删除理货功能开发中") + } + + /** + * 理货申报(暂不实现) + */ + fun tallyDeclareClick() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: return + val selectedItems = list.filter { it.isSelected } + + if (selectedItems.isEmpty()) { + showToast("请选择要申报的记录") + return + } + + showToast("理货申报功能开发中") + } + + /** + * 获取数据(重写BasePageViewModel) + */ + override fun getData() { + // 构建搜索条件 + val filterParams = mapOf( + "fdate" to flightDate.value?.ifEmpty { null }, + "fno" to flightNo.value?.ifEmpty { null }, + "wbNo" to waybillNo.value?.ifEmpty { null }, + "hno" to hno.value?.ifEmpty { null } + ) + + // 列表参数(含分页) + val listParams = (filterParams + mapOf( + "pageNum" to pageModel.page, + "pageSize" to pageModel.limit + )).toRequestBody() + + // 统计参数(无分页) + val totalParams = filterParams.toRequestBody() + + // 获取列表(带Loading) + launchLoadingCollect({ + NetApply.api.getIntImpTallyList(listParams) + }) { + onSuccess = { pageInfo -> + // ⚠️ 核心:使用toBaseListBean()转换PageInfo为BaseListBean + pageModel.handleListBean(pageInfo.toBaseListBean()) + } + } + + // 获取统计信息(后台请求,不阻塞列表) + launchCollect({ NetApply.api.getIntImpTallyTotal(totalParams) }) { + onSuccess = { result -> + val data = result.data + totalCount.value = (data?.wbNumber ?: 0).toString() + totalPc.value = (data?.totalPc ?: 0).toString() + totalWeight.value = (data?.totalWeight ?: 0.0).toString() + } + } + } +} diff --git a/module_gjj/src/main/res/layout/activity_int_imp_tally.xml b/module_gjj/src/main/res/layout/activity_int_imp_tally.xml new file mode 100644 index 0000000..2684d5d --- /dev/null +++ b/module_gjj/src/main/res/layout/activity_int_imp_tally.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/module_gjj/src/main/res/layout/item_int_imp_manifest.xml b/module_gjj/src/main/res/layout/item_int_imp_manifest.xml index 07ceec8..4155ba6 100644 --- a/module_gjj/src/main/res/layout/item_int_imp_manifest.xml +++ b/module_gjj/src/main/res/layout/item_int_imp_manifest.xml @@ -330,6 +330,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +