feat: 国际出港 出港组装 开始组装
This commit is contained in:
@@ -47,8 +47,8 @@ class IntExpAssembleStartActivity :
|
||||
// 初始化列表
|
||||
initRecyclerViews()
|
||||
|
||||
// 加载模拟数据
|
||||
viewModel.initMockData()
|
||||
// 初始化加载待组装运单数据
|
||||
viewModel.loadInitialWaitingAssemble()
|
||||
|
||||
// 加载组装位置数据(从API)
|
||||
viewModel.loadAssemblePosition()
|
||||
|
||||
@@ -11,7 +11,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
|
||||
import com.lukouguoji.module_base.model.ScanModel
|
||||
|
||||
/**
|
||||
@@ -41,113 +40,16 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
val waybillViewHolder = AssembleWaybillViewHolder::class.java
|
||||
|
||||
// ========== ULD信息 ==========
|
||||
val uldInfo = MutableLiveData(UldInfoBean().apply {
|
||||
uldNo = "PMC12345MU"
|
||||
materialWeight = ""
|
||||
uldStatus = "正常"
|
||||
})
|
||||
val uldInfo = MutableLiveData(UldInfoBean())
|
||||
|
||||
// ========== 运单信息 ==========
|
||||
val waybillInfo = MutableLiveData(WaybillInfoBean().apply {
|
||||
waybillNo = "78112345678"
|
||||
waybillPieces = "100"
|
||||
waybillWeight = "200"
|
||||
assembleCount = ""
|
||||
assembleWeight = ""
|
||||
operator = "张三"
|
||||
})
|
||||
val waybillInfo = MutableLiveData(WaybillInfoBean())
|
||||
|
||||
/**
|
||||
* 初始化模拟数据
|
||||
* 初始化模拟数据(已废弃)
|
||||
*/
|
||||
fun initMockData() {
|
||||
// 组装信息列表(左侧)
|
||||
assembleInfoList.value = mutableListOf(
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "PMC12345MU"
|
||||
weightInfo = "100/290kg"
|
||||
hasArrow = true
|
||||
isOrange = false
|
||||
showIndex = true
|
||||
},
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "AKE453654CZ"
|
||||
weightInfo = "100/290kg"
|
||||
hasArrow = true
|
||||
isOrange = false
|
||||
showIndex = true
|
||||
},
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "AKE598190CZ"
|
||||
weightInfo = "100/290kg"
|
||||
hasArrow = true
|
||||
isOrange = false
|
||||
showIndex = true
|
||||
},
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "78112345678"
|
||||
weightInfo = "100/100kg"
|
||||
hasArrow = false
|
||||
isOrange = true
|
||||
showIndex = false
|
||||
},
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "78112345999"
|
||||
weightInfo = "150/200kg"
|
||||
hasArrow = false
|
||||
isOrange = true
|
||||
showIndex = false
|
||||
},
|
||||
AssembleInfoBean().apply {
|
||||
uldNo = "78112345454"
|
||||
weightInfo = "120/300kg"
|
||||
hasArrow = false
|
||||
isOrange = true
|
||||
showIndex = false
|
||||
}
|
||||
)
|
||||
|
||||
// 组装位置列表(左侧)- 已改为从API加载,不再使用模拟数据
|
||||
// assemblePositionList.value = mutableListOf(
|
||||
// AssemblePositionBean().apply {
|
||||
// positionName = "组装区001"
|
||||
// isSelected = true
|
||||
// },
|
||||
// AssemblePositionBean().apply {
|
||||
// positionName = "组装区002"
|
||||
// isSelected = false
|
||||
// },
|
||||
// AssemblePositionBean().apply {
|
||||
// positionName = "组装区003"
|
||||
// isSelected = false
|
||||
// },
|
||||
// AssemblePositionBean().apply {
|
||||
// positionName = "组装区004"
|
||||
// isSelected = false
|
||||
// }
|
||||
// )
|
||||
|
||||
// 运单列表(右侧)
|
||||
waybillList.value = mutableListOf(
|
||||
AssembleWaybillBean().apply {
|
||||
waybillNo = "99912345678"
|
||||
pieces = "25"
|
||||
weight = "350.5"
|
||||
isMarked = false
|
||||
},
|
||||
AssembleWaybillBean().apply {
|
||||
waybillNo = "99912345679"
|
||||
pieces = "18"
|
||||
weight = "280.0"
|
||||
isMarked = true // 标记为红色
|
||||
},
|
||||
AssembleWaybillBean().apply {
|
||||
waybillNo = "99912345680"
|
||||
pieces = "32"
|
||||
weight = "520.8"
|
||||
isMarked = false
|
||||
}
|
||||
)
|
||||
// 不再加载mock数据
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,11 +113,8 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
return
|
||||
}
|
||||
|
||||
// 构建请求参数
|
||||
val params = mapOf("wbNo" to wbNo).toRequestBody()
|
||||
|
||||
// 发起网络请求
|
||||
launchLoadingCollect({ NetApply.api.queryWaitingAssemble(params) }) {
|
||||
launchLoadingCollect({ NetApply.api.queryWaitingAssemble(wbNo) }) {
|
||||
onSuccess = { result ->
|
||||
// 数据转换: GjcWarehouse -> AssembleWaybillBean
|
||||
val warehouseList = result.data ?: mutableListOf()
|
||||
@@ -246,6 +145,36 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化加载待组装运单列表(页面打开时调用)
|
||||
*/
|
||||
fun loadInitialWaitingAssemble() {
|
||||
launchLoadingCollect({ NetApply.api.queryWaitingAssemble("") }) {
|
||||
onSuccess = { result ->
|
||||
val warehouseList = result.data ?: mutableListOf()
|
||||
val waybillBeanList = warehouseList.map { warehouse ->
|
||||
AssembleWaybillBean().apply {
|
||||
waybillNo = warehouse.no
|
||||
pieces = warehouse.pc.toString()
|
||||
weight = String.format("%.1f", warehouse.weight)
|
||||
flight = warehouse.flight
|
||||
isMarked = false
|
||||
}
|
||||
}.toMutableList()
|
||||
|
||||
waybillList.value = waybillBeanList
|
||||
|
||||
if (waybillBeanList.isEmpty()) {
|
||||
showToast("暂无待组装运单")
|
||||
}
|
||||
}
|
||||
onFailed = { code, message ->
|
||||
showToast("加载失败: $message")
|
||||
waybillList.value = mutableListOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 卸货按钮点击
|
||||
|
||||
@@ -137,27 +137,22 @@
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:dividerColor="@color/line" />
|
||||
|
||||
<!-- 运单列表表头 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_height="28dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/color_f2"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingHorizontal="8dp">
|
||||
|
||||
<!-- 序号 -->
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
|
||||
<Space
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="序号"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- 运单号 -->
|
||||
@@ -166,29 +161,27 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="运单号"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
android:textSize="13sp"/>
|
||||
|
||||
<!-- 件数 -->
|
||||
<TextView
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="件数"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="13sp"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- 重量 -->
|
||||
<TextView
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="重量"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="end" />
|
||||
android:textSize="13sp"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- 配载航班 -->
|
||||
<TextView
|
||||
@@ -197,8 +190,7 @@
|
||||
android:layout_weight="1.2"
|
||||
android:text="配载航班"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="13sp"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="bean"
|
||||
type="com.lukouguoji.module_base.bean.AssembleWaybillBean" />
|
||||
|
||||
<variable
|
||||
name="position"
|
||||
type="Integer" />
|
||||
@@ -14,56 +17,57 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:background="@color/white">
|
||||
android:paddingVertical="12dp">
|
||||
|
||||
<!-- 序号 -->
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@{String.valueOf(position + 1)}"
|
||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 运单号 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.waybillNo}"
|
||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 件数 -->
|
||||
<TextView
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.pieces}"
|
||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 重量 -->
|
||||
<TextView
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.weight}"
|
||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||
android:textSize="14sp"
|
||||
android:gravity="end" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 配载航班 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.2"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.flight}"
|
||||
android:textColor="@{bean.isMarked ? @color/text_red : @color/text_normal}"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user