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 fa0b4be..878e019 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 @@ -417,7 +417,10 @@ interface Api { * 接口路径: /IntExpCheckInCheck/back */ @POST("IntExpCheckInCheck/back") - suspend fun backGjcInspection(@Query("reason") reason: String, @Body data: RequestBody): BaseResultBean + suspend fun backGjcInspection( + @Query("reason") reason: String, + @Body data: RequestBody + ): BaseResultBean /** * 条件查询-国际出港-收运审核-统计数据(总件数、总重量、运单总数) @@ -572,8 +575,8 @@ interface Api { * 国际出港组装 - 查询待组装运单列表 * 接口路径: /IntExpAssemble/queryWaitingAssemble */ - @POST("IntExpAssemble/queryWaitingAssemble") - suspend fun queryWaitingAssemble(@Body data: RequestBody): BaseResultBean> + @GET("IntExpAssemble/queryWaitingAssemble") + suspend fun queryWaitingAssemble(@Query("wbNo") wbNo: String): BaseResultBean> /** * 国际出港出库交接-分页查询 @@ -1215,6 +1218,7 @@ interface Api { */ @POST suspend fun getWbNoList(@Url url: String, @Body data: RequestBody): BaseResultBean> + /** * 获取-国内出港-分配-列表 */ @@ -1233,6 +1237,7 @@ interface Api { */ @POST("flt/searchHandoverByFid") suspend fun getHandover(@Query("fid") fid: String): BaseResultBean + /** * 获取-国内出港-存放-列表 */ @@ -1289,7 +1294,6 @@ interface Api { fun queryWbDetailById(@Query("wbId") wbId: Int): BaseResultBean - /** * 获取-货物转运-列表 */ @@ -1337,6 +1341,7 @@ interface Api { */ @POST("DomTransportLog/search") suspend fun getTransportLogList(@Body data: RequestBody): BaseListBean + /** * 国内 单证交接 列表 */ @@ -1345,5 +1350,5 @@ interface Api { @GET("file/verifyVersion") - suspend fun getAppUpdate(@Query("versionCode") versionCode : Int): AppUpdateResponse + suspend fun getAppUpdate(@Query("versionCode") versionCode: Int): AppUpdateResponse } \ No newline at end of file diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/page/assemble/IntExpAssembleStartActivity.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/page/assemble/IntExpAssembleStartActivity.kt index ce75ba2..a851ee9 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/page/assemble/IntExpAssembleStartActivity.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/page/assemble/IntExpAssembleStartActivity.kt @@ -47,8 +47,8 @@ class IntExpAssembleStartActivity : // 初始化列表 initRecyclerViews() - // 加载模拟数据 - viewModel.initMockData() + // 初始化加载待组装运单数据 + viewModel.loadInitialWaitingAssemble() // 加载组装位置数据(从API) viewModel.loadAssemblePosition() diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/IntExpAssembleStartViewModel.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/IntExpAssembleStartViewModel.kt index 9fcd5e3..4863274 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/IntExpAssembleStartViewModel.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/IntExpAssembleStartViewModel.kt @@ -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() + } + } + } + /** * 卸货按钮点击 diff --git a/module_gjc/src/main/res/layout/activity_int_exp_assemble_start.xml b/module_gjc/src/main/res/layout/activity_int_exp_assemble_start.xml index 1e4198c..139ccfa 100644 --- a/module_gjc/src/main/res/layout/activity_int_exp_assemble_start.xml +++ b/module_gjc/src/main/res/layout/activity_int_exp_assemble_start.xml @@ -137,27 +137,22 @@ - @@ -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"/> + android:textSize="13sp" + android:gravity="center" /> diff --git a/module_gjc/src/main/res/layout/item_assemble_waybill.xml b/module_gjc/src/main/res/layout/item_assemble_waybill.xml index 3e77e32..7f10d58 100644 --- a/module_gjc/src/main/res/layout/item_assemble_waybill.xml +++ b/module_gjc/src/main/res/layout/item_assemble_waybill.xml @@ -2,10 +2,13 @@ + + + @@ -14,56 +17,57 @@ + android:paddingVertical="12dp"> + android:textSize="14sp" /> + android:textSize="14sp" /> + android:textSize="14sp" /> + android:textSize="14sp" />