feat: 国际进港 报文解析
This commit is contained in:
@@ -351,6 +351,13 @@
|
|||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:screenOrientation="userLandscape"/>
|
android:screenOrientation="userLandscape"/>
|
||||||
|
|
||||||
|
<!-- 国际进港-电报解析 -->
|
||||||
|
<activity
|
||||||
|
android:name="com.lukouguoji.gjj.activity.IntImpMsgParseActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="userLandscape" />
|
||||||
|
|
||||||
<service android:name="com.huitao.printer.service.PrinterService" />
|
<service android:name="com.huitao.printer.service.PrinterService" />
|
||||||
<service android:name="com.lukouguoji.gnc.bluetooth.service.AncillaryService" />
|
<service android:name="com.lukouguoji.gnc.bluetooth.service.AncillaryService" />
|
||||||
<service android:name="com.lukouguoji.gnc.bluetooth.service.MyService" />
|
<service android:name="com.lukouguoji.gnc.bluetooth.service.MyService" />
|
||||||
|
|||||||
@@ -427,44 +427,9 @@ class HomeFragment : Fragment() {
|
|||||||
/**
|
/**
|
||||||
* 国际进港
|
* 国际进港
|
||||||
*/
|
*/
|
||||||
//舱单
|
// 电报解析(电报生成)
|
||||||
Constant.AuthName.GjjCangDanListActivity -> {
|
Constant.AuthName.IntImpMsgParseActivity -> {
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_CANG_DAN_LIST)
|
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_INT_IMP_MSG_PARSE)
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
//仓库
|
|
||||||
Constant.AuthName.GjjWareHouseActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_WARE_HOUSE)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
//出库
|
|
||||||
Constant.AuthName.GjjChuKuListActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_CHU_KU_LIST)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
//查询
|
|
||||||
Constant.AuthName.GjjQueryListActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_QUERY_LIST)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
// 报文解析
|
|
||||||
Constant.AuthName.GjjPacketParseActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_PACKET_PARSE)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
// 舱单
|
|
||||||
Constant.AuthName.GjjManifestListActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_MANIFEST)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
// 理货
|
|
||||||
Constant.AuthName.GjjTallyListActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_Tally)
|
|
||||||
.navigation()
|
|
||||||
}
|
|
||||||
// 货物交接
|
|
||||||
Constant.AuthName.GjjGoodsListActivity -> {
|
|
||||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GJJ_GOODS)
|
|
||||||
.navigation()
|
.navigation()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -789,53 +754,12 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Constant.AuthName.IntImp -> {
|
Constant.AuthName.IntImp -> {
|
||||||
|
// 国际进港菜单 - 新版
|
||||||
list.add(
|
list.add(
|
||||||
RightMenu(
|
RightMenu(
|
||||||
Constant.AuthName.GjjChuKuListActivity,
|
Constant.AuthName.IntImpMsgParseActivity,
|
||||||
R.mipmap.gjj_chu_ku_icon,
|
|
||||||
"提取出库"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjWareHouseActivity,
|
|
||||||
R.mipmap.gjj_cang_ku_icon,
|
|
||||||
"仓库管理"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjQueryListActivity,
|
|
||||||
R.mipmap.gjj_query_icon,
|
|
||||||
"进港查询"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjPacketParseActivity,
|
|
||||||
R.mipmap.img_bwjx,
|
R.mipmap.img_bwjx,
|
||||||
"报文解析"
|
"电报解析"
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjManifestListActivity,
|
|
||||||
R.mipmap.gjc_query_icon,
|
|
||||||
"进港舱单"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjTallyListActivity,
|
|
||||||
R.mipmap.img_jglh,
|
|
||||||
"进港理货"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
list.add(
|
|
||||||
RightMenu(
|
|
||||||
Constant.AuthName.GjjGoodsListActivity,
|
|
||||||
R.mipmap.img_hwjj,
|
|
||||||
"货物交接"
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.lukouguoji.module_base.bean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电报分页查询请求参数
|
||||||
|
*/
|
||||||
|
class MsgPoolPage(
|
||||||
|
var pageNum: Int = 1, // 页号
|
||||||
|
var pageSize: Int = 10, // 每页显示条数
|
||||||
|
var fdate: String = "", // 航班日期
|
||||||
|
var fno: String = "", // 航班号
|
||||||
|
var fid: Long? = null, // 航班id
|
||||||
|
var msgType: String = "", // 报文类型
|
||||||
|
var sendAddress: String = "", // 发送地址(发站)
|
||||||
|
var flow: String = "", // 流向:接收0、发送1
|
||||||
|
var teleContent: String = "", // 报文内容
|
||||||
|
var startTime: String = "", // 时间起
|
||||||
|
var endTime: String = "", // 时间止
|
||||||
|
var startIndex: Int? = null,
|
||||||
|
var endIndex: Int? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.lukouguoji.module_base.bean
|
||||||
|
|
||||||
|
import androidx.databinding.BaseObservable
|
||||||
|
import androidx.databinding.ObservableBoolean
|
||||||
|
import com.lukouguoji.module_base.interfaces.ICheck
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际进港电报接收池Bean
|
||||||
|
*/
|
||||||
|
class MsgReceivePool(
|
||||||
|
var id: Long? = null,
|
||||||
|
var msgType: String = "", // 报文类型
|
||||||
|
var receiveTime: String = "", // 接收时间
|
||||||
|
var teleContent: String = "", // 报文内容
|
||||||
|
var anaStatus: String = "", // 生成(解析)状态:0-未生成;1-已生成
|
||||||
|
var wbNo: String = "", // 主单号
|
||||||
|
var hno: String = "", // 分单号
|
||||||
|
var sendAddress: String = "", // 发报地址
|
||||||
|
var receiveAddress: String = "", // 接收地址
|
||||||
|
var status: String = "", // 报文状态
|
||||||
|
var errorMsg: String = "", // 报文识别异常原因
|
||||||
|
var key: String = "", // 关键字
|
||||||
|
var interfaceType: String = "" // 接口类型
|
||||||
|
) : BaseObservable(), ICheck {
|
||||||
|
|
||||||
|
// 选中状态
|
||||||
|
val checked = ObservableBoolean(false)
|
||||||
|
|
||||||
|
override fun getCheckObservable() = checked
|
||||||
|
|
||||||
|
// 兼容现有API的isSelected属性
|
||||||
|
var isSelected: Boolean
|
||||||
|
get() = checked.get()
|
||||||
|
set(value) = checked.set(value)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否已生成
|
||||||
|
*/
|
||||||
|
fun isGenerated() = anaStatus == "1"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态标签文本
|
||||||
|
*/
|
||||||
|
fun getStatusLabel() = if (isGenerated()) "已生成" else "未生成"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态标签颜色
|
||||||
|
*/
|
||||||
|
fun getStatusColor() = if (isGenerated()) "#00C853" else "#FF5252"
|
||||||
|
}
|
||||||
@@ -261,7 +261,8 @@ interface Constant {
|
|||||||
const val GjjChuKuListActivity = "AppIntImpPickUpDLV" //出库
|
const val GjjChuKuListActivity = "AppIntImpPickUpDLV" //出库
|
||||||
const val GjjQueryListActivity = "AppIntImpSearch" //查询
|
const val GjjQueryListActivity = "AppIntImpSearch" //查询
|
||||||
|
|
||||||
const val GjjPacketParseActivity = "AppIntExpPacketParse" //报文解析
|
const val GjjPacketParseActivity = "AppIntExpPacketParse" //报文解析(旧)
|
||||||
|
const val IntImpMsgParseActivity = "AppIntImpMsgParse" //电报解析(电报生成)
|
||||||
const val GjjManifestListActivity = "AppIntExpManifest" //舱单
|
const val GjjManifestListActivity = "AppIntExpManifest" //舱单
|
||||||
const val GjjTallyListActivity = "AppIntExpTally" //理货
|
const val GjjTallyListActivity = "AppIntExpTally" //理货
|
||||||
const val GjjGoodsListActivity = "AppIntExpGjjGoods" //货物交接
|
const val GjjGoodsListActivity = "AppIntExpGjjGoods" //货物交接
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ import com.lukouguoji.module_base.bean.LogBean
|
|||||||
import com.lukouguoji.module_base.bean.ManifestTotalDto
|
import com.lukouguoji.module_base.bean.ManifestTotalDto
|
||||||
import com.lukouguoji.module_base.bean.MessageBean
|
import com.lukouguoji.module_base.bean.MessageBean
|
||||||
import com.lukouguoji.module_base.bean.MoveStashBean
|
import com.lukouguoji.module_base.bean.MoveStashBean
|
||||||
|
import com.lukouguoji.module_base.bean.MsgPoolPage
|
||||||
|
import com.lukouguoji.module_base.bean.MsgReceivePool
|
||||||
import com.lukouguoji.module_base.bean.PackageBean
|
import com.lukouguoji.module_base.bean.PackageBean
|
||||||
import com.lukouguoji.module_base.bean.PacketParseBean
|
import com.lukouguoji.module_base.bean.PacketParseBean
|
||||||
import com.lukouguoji.module_base.bean.PageInfo
|
import com.lukouguoji.module_base.bean.PageInfo
|
||||||
@@ -1516,4 +1518,20 @@ interface Api {
|
|||||||
|
|
||||||
@GET("file/verifyVersion")
|
@GET("file/verifyVersion")
|
||||||
suspend fun getAppUpdate(@Query("versionCode") versionCode: Int): AppUpdateResponse<AppUpdateResponseInfo>
|
suspend fun getAppUpdate(@Query("versionCode") versionCode: Int): AppUpdateResponse<AppUpdateResponseInfo>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 国际进港-电报解析
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询国际进港电报
|
||||||
|
*/
|
||||||
|
@POST("IntImpMsg/pageQuery")
|
||||||
|
suspend fun getIntImpMsgList(@Body data: RequestBody): BaseResultBean<PageInfo<MsgReceivePool>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量生成电报
|
||||||
|
*/
|
||||||
|
@POST("IntImpMsg/batchGenerate")
|
||||||
|
suspend fun batchGenerateMsg(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
|
||||||
}
|
}
|
||||||
@@ -166,6 +166,7 @@ object ARouterConstants {
|
|||||||
const val ACTIVITY_URL_GJJ_MANIFEST = "/gjj/GjjManifestListActivity" //国际进港 舱单列表
|
const val ACTIVITY_URL_GJJ_MANIFEST = "/gjj/GjjManifestListActivity" //国际进港 舱单列表
|
||||||
const val ACTIVITY_URL_GJJ_Tally = "/gjj/GjjTallyListActivity" //国际进港 理货
|
const val ACTIVITY_URL_GJJ_Tally = "/gjj/GjjTallyListActivity" //国际进港 理货
|
||||||
const val ACTIVITY_URL_GJJ_GOODS = "/gjj/GjjGoodsListActivity" //国际进港 货物交接
|
const val ACTIVITY_URL_GJJ_GOODS = "/gjj/GjjGoodsListActivity" //国际进港 货物交接
|
||||||
|
const val ACTIVITY_URL_INT_IMP_MSG_PARSE = "/gjj/IntImpMsgParseActivity" //国际进港 电报解析(电报生成)
|
||||||
|
|
||||||
///////////////// 航班查询模块
|
///////////////// 航班查询模块
|
||||||
/**
|
/**
|
||||||
|
|||||||
5
module_base/src/main/res/drawable/bg_status_error.xml
Normal file
5
module_base/src/main/res/drawable/bg_status_error.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#FF5252" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
</shape>
|
||||||
5
module_base/src/main/res/drawable/bg_status_success.xml
Normal file
5
module_base/src/main/res/drawable/bg_status_success.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#00C853" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.lukouguoji.gjj.activity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
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.ActivityIntImpMsgParseBinding
|
||||||
|
import com.lukouguoji.gjj.viewModel.IntImpMsgParseViewModel
|
||||||
|
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||||
|
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_MSG_PARSE)
|
||||||
|
class IntImpMsgParseActivity :
|
||||||
|
BaseBindingActivity<ActivityIntImpMsgParseBinding, IntImpMsgParseViewModel>() {
|
||||||
|
|
||||||
|
override fun layoutId() = R.layout.activity_int_imp_msg_parse
|
||||||
|
override fun viewModelClass() = IntImpMsgParseViewModel::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<String>(ConstantEvent.EVENT_REFRESH).observe(this) {
|
||||||
|
viewModel.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始加载数据
|
||||||
|
viewModel.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun start(context: Context) {
|
||||||
|
val starter = Intent(context, IntImpMsgParseActivity::class.java)
|
||||||
|
context.startActivity(starter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.lukouguoji.gjj.holder
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import com.lukouguoji.gjj.databinding.ItemIntImpMsgParseBinding
|
||||||
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
|
import com.lukouguoji.module_base.bean.MsgReceivePool
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际进港电报解析列表项ViewHolder
|
||||||
|
*/
|
||||||
|
class IntImpMsgParseViewHolder(view: View) :
|
||||||
|
BaseViewHolder<MsgReceivePool, ItemIntImpMsgParseBinding>(view) {
|
||||||
|
|
||||||
|
override fun onBind(item: Any?, position: Int) {
|
||||||
|
val bean = getItemBean(item) ?: return
|
||||||
|
binding.bean = bean
|
||||||
|
binding.position = position
|
||||||
|
binding.executePendingBindings()
|
||||||
|
|
||||||
|
// 添加卡片点击事件 - 查看详情
|
||||||
|
notifyItemClick(position, binding.cardView)
|
||||||
|
|
||||||
|
// 添加选择图标点击事件 - 切换选择状态
|
||||||
|
binding.ivCheck.setOnClickListener {
|
||||||
|
// 反转checked状态
|
||||||
|
bean.checked.set(!bean.checked.get())
|
||||||
|
|
||||||
|
// 立即更新UI
|
||||||
|
binding.executePendingBindings()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package com.lukouguoji.gjj.viewModel
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.lukouguoji.gjj.R
|
||||||
|
import com.lukouguoji.gjj.holder.IntImpMsgParseViewHolder
|
||||||
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
|
import com.lukouguoji.module_base.bean.MsgReceivePool
|
||||||
|
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.launchLoadingCollect
|
||||||
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际进港-电报解析 ViewModel
|
||||||
|
*/
|
||||||
|
class IntImpMsgParseViewModel : BasePageViewModel() {
|
||||||
|
|
||||||
|
// ========== 搜索条件 ==========
|
||||||
|
val flightDate = MutableLiveData("") // 航班日期
|
||||||
|
val flightNo = MutableLiveData("") // 航班号
|
||||||
|
val sendAddress = MutableLiveData("") // 发站(择始发站)
|
||||||
|
val receiveAddress = MutableLiveData("HFE") // 收报地址(目的站)
|
||||||
|
val msgType = MutableLiveData("") // 报文类型
|
||||||
|
|
||||||
|
// ========== 统计信息 ==========
|
||||||
|
val totalCount = MutableLiveData("0") // 合计条数
|
||||||
|
|
||||||
|
// ========== 全选状态 ==========
|
||||||
|
val isAllChecked = MutableLiveData(false)
|
||||||
|
|
||||||
|
init {
|
||||||
|
// 监听全选状态,自动更新所有列表项
|
||||||
|
isAllChecked.observeForever { checked ->
|
||||||
|
val list = pageModel.rv?.commonAdapter()?.items as? List<MsgReceivePool> ?: return@observeForever
|
||||||
|
list.forEach { it.checked.set(checked) }
|
||||||
|
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 适配器配置 ==========
|
||||||
|
val itemViewHolder = IntImpMsgParseViewHolder::class.java
|
||||||
|
val itemLayoutId = R.layout.item_int_imp_msg_parse
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索按钮点击
|
||||||
|
*/
|
||||||
|
fun searchClick() {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全选按钮点击(切换全选状态)
|
||||||
|
*/
|
||||||
|
fun checkAllClick() {
|
||||||
|
val list = pageModel.rv?.commonAdapter()?.items as? List<MsgReceivePool> ?: return
|
||||||
|
|
||||||
|
// 切换全选状态
|
||||||
|
val shouldCheckAll = !isAllChecked.value!!
|
||||||
|
list.forEach { it.checked.set(shouldCheckAll) }
|
||||||
|
isAllChecked.value = shouldCheckAll
|
||||||
|
|
||||||
|
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电报生成(批量操作)
|
||||||
|
*/
|
||||||
|
fun generateMsg() {
|
||||||
|
val list = pageModel.rv?.commonAdapter()?.items as? List<MsgReceivePool> ?: return
|
||||||
|
val selectedItems = list.filter { it.isSelected }
|
||||||
|
|
||||||
|
if (selectedItems.isEmpty()) {
|
||||||
|
showToast("请选择要生成的电报")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取选中项的ID列表
|
||||||
|
val ids = selectedItems.mapNotNull { it.id }
|
||||||
|
val requestData = mapOf("ids" to ids).toRequestBody()
|
||||||
|
|
||||||
|
launchLoadingCollect({ NetApply.api.batchGenerateMsg(requestData) }) {
|
||||||
|
onSuccess = {
|
||||||
|
showToast("电报生成成功")
|
||||||
|
viewModelScope.launch {
|
||||||
|
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||||
|
}
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据(重写BasePageViewModel)
|
||||||
|
*/
|
||||||
|
override fun getData() {
|
||||||
|
// 构建搜索条件
|
||||||
|
val filterParams = mutableMapOf(
|
||||||
|
"fdate" to flightDate.value?.ifEmpty { null },
|
||||||
|
"fno" to flightNo.value?.ifEmpty { null },
|
||||||
|
"sendAddress" to sendAddress.value?.ifEmpty { null },
|
||||||
|
"msgType" to msgType.value?.ifEmpty { null }
|
||||||
|
)
|
||||||
|
|
||||||
|
// 列表参数(含分页)
|
||||||
|
val listParams = (filterParams + mapOf(
|
||||||
|
"pageNum" to pageModel.page,
|
||||||
|
"pageSize" to pageModel.limit
|
||||||
|
)).toRequestBody()
|
||||||
|
|
||||||
|
// 获取列表(带Loading)
|
||||||
|
launchLoadingCollect({ NetApply.api.getIntImpMsgList(listParams) }) {
|
||||||
|
onSuccess = { result ->
|
||||||
|
// 处理PageInfo结构
|
||||||
|
val pageInfo = result.data
|
||||||
|
if (pageInfo != null) {
|
||||||
|
val list = pageInfo.list ?: emptyList()
|
||||||
|
val pages = pageInfo.pages ?: 1
|
||||||
|
|
||||||
|
// 更新统计信息
|
||||||
|
totalCount.value = (pageInfo.total ?: 0).toString()
|
||||||
|
|
||||||
|
// 处理分页数据
|
||||||
|
pageModel.handleDataList(list)
|
||||||
|
pageModel.haveMore.postValue(pages > pageModel.page)
|
||||||
|
} else {
|
||||||
|
pageModel.handleDataList(emptyList())
|
||||||
|
pageModel.haveMore.postValue(false)
|
||||||
|
totalCount.value = "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
183
module_gjj/src/main/res/layout/activity_int_imp_msg_parse.xml
Normal file
183
module_gjj/src/main/res/layout/activity_int_imp_msg_parse.xml
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="com.lukouguoji.gjj.viewModel.IntImpMsgParseViewModel" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/color_f2"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/title_tool_bar" />
|
||||||
|
|
||||||
|
<!-- 搜索区域 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<!-- 航班日期 -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
hint='@{"请选择航班日期"}'
|
||||||
|
icon="@{@drawable/img_date}"
|
||||||
|
type="@{SearchLayoutType.DATE}"
|
||||||
|
value="@={viewModel.flightDate}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 航班号 -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
hint='@{"请输入航班号"}'
|
||||||
|
type="@{SearchLayoutType.INPUT}"
|
||||||
|
value="@={viewModel.flightNo}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 择始发站 -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
hint='@{"请选择始发站"}'
|
||||||
|
type="@{SearchLayoutType.INPUT}"
|
||||||
|
value="@={viewModel.sendAddress}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 目的站(固定HFE) -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
hint='@{"HFE"}'
|
||||||
|
type="@{SearchLayoutType.INPUT}"
|
||||||
|
value="@={viewModel.receiveAddress}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 报文类型 -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
hint='@{"请选择报文类型"}'
|
||||||
|
type="@{SearchLayoutType.INPUT}"
|
||||||
|
value="@={viewModel.msgType}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 搜索按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="24dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:onClick="@{()-> viewModel.searchClick()}"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:src="@drawable/img_search" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Grid列表 -->
|
||||||
|
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||||
|
android:id="@+id/srl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv"
|
||||||
|
itemLayoutId="@{viewModel.itemLayoutId}"
|
||||||
|
viewHolder="@{viewModel.itemViewHolder}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="3"
|
||||||
|
tools:itemCount="9"
|
||||||
|
tools:listitem="@layout/item_int_imp_msg_parse" />
|
||||||
|
|
||||||
|
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||||
|
|
||||||
|
<!-- 底部统计和操作按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingHorizontal="15dp">
|
||||||
|
|
||||||
|
<!-- 全选按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:onClick="@{()-> viewModel.checkAllClick()}"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/checkIcon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:src="@drawable/img_check_all" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="全选"
|
||||||
|
android:textColor="@color/color_66"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 统计信息 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text='@{"合计:"+viewModel.totalCount+"条"}'
|
||||||
|
android:textColor="@color/bottom_tool_tips_text_color"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 电报生成按钮 -->
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:onClick="@{()-> viewModel.generateMsg()}"
|
||||||
|
android:text="电报生成" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</layout>
|
||||||
174
module_gjj/src/main/res/layout/item_int_imp_msg_parse.xml
Normal file
174
module_gjj/src/main/res/layout/item_int_imp_msg_parse.xml
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="bean"
|
||||||
|
type="com.lukouguoji.module_base.bean.MsgReceivePool" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="position"
|
||||||
|
type="Integer" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/cardView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
app:cardBackgroundColor="@android:color/white"
|
||||||
|
app:cardCornerRadius="8dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="12dp">
|
||||||
|
|
||||||
|
<!-- 顶部:选择图标 + 报文类型 + 状态标签 -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<!-- 选择图标 -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_check"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
|
||||||
|
android:src="@drawable/img_plane"
|
||||||
|
tools:src="@drawable/img_plane" />
|
||||||
|
|
||||||
|
<!-- 报文类型标题 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_msg_type"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_toRightOf="@id/iv_check"
|
||||||
|
android:text="@{`报文类型 ` + bean.msgType}"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="报文类型 FFM" />
|
||||||
|
|
||||||
|
<!-- 状态标签 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:background="@{bean.isGenerated() ? @drawable/bg_status_success : @drawable/bg_status_error}"
|
||||||
|
android:paddingHorizontal="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
|
android:text="@{bean.getStatusLabel()}"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="已生成" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<!-- 收报时间 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="收报时间 "
|
||||||
|
android:textColor="@color/text_normal"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{bean.receiveTime}"
|
||||||
|
android:textColor="@color/text_normal"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="2025-08-27 12:22:34" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 报文内容 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="报文内容 "
|
||||||
|
android:textColor="@color/text_normal"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="4"
|
||||||
|
android:text="@{bean.teleContent}"
|
||||||
|
android:textColor="@color/text_gray"
|
||||||
|
android:textSize="13sp"
|
||||||
|
tools:text="ZCZC DFA0156 270443 QK\nHFEFI8X.\nSELFMKE 270443 FFM/4\n1/KE135/\n27AUG/ICN/HL8348 HFE/NIL\nLAST" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 查看详情按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:src="@drawable/ic_arrow_right"
|
||||||
|
app:tint="@color/colorPrimary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="4dp"
|
||||||
|
android:text="查看详情"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</layout>
|
||||||
Reference in New Issue
Block a user