diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageTruckService.cs index 805475b4..40404d1a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageTruckService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageTruckService.cs @@ -25,6 +25,13 @@ namespace Myshipping.Application /// 返回回执 Task GetInfo(string pkId); + /// + /// 通过任务主键获取派车详情 + /// + /// 派车主键 + /// 返回回执 + Task GetInfoByTaskId(string taskPkId); + /// /// 打印派车 /// diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs index 46c3733a..3e65bbbc 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs @@ -25,9 +25,11 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskTruckRepository; private readonly SqlSugarRepository _taskTruckContaRepository; + private readonly SqlSugarRepository _taskBaseRepository; public TaskManageTruckService(SqlSugarRepository taskTruckRepository, SqlSugarRepository taskTruckContaRepository, + SqlSugarRepository taskBaseRepository, ISysCacheService cache, ILogger logger) { _cache = cache; @@ -35,6 +37,7 @@ namespace Myshipping.Application _taskTruckRepository = taskTruckRepository; _taskTruckContaRepository = taskTruckContaRepository; + _taskBaseRepository = taskBaseRepository; } /// @@ -161,7 +164,7 @@ namespace Myshipping.Application /// /// 获取派车详情 /// - /// 派车主键 + /// 派车主键 /// 返回回执 [HttpGet("/TaskManageTruck/GetInfo")] public async Task GetInfo(string pkId) @@ -179,6 +182,49 @@ namespace Myshipping.Application TaskTruckShowDto model = truckOrder.Adapt(); + if (truckCtnList.Count > 0) + model.ContaList = truckCtnList.Adapt>(); + + + result.succ = true; + result.ext = model; + + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"获取派车详情异常,原因:{ex.Message}"; + } + + return result; + } + + /// + /// 通过任务主键获取派车详情 + /// + /// 派车主键 + /// 返回回执 + [HttpGet("/TaskManageTruck/GetInfoByTaskId")] + public async Task GetInfoByTaskId(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + var taskBase =_taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if(taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var truckOrder = _taskTruckRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (truckOrder == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取派车业务信息"); + + var truckCtnList = _taskTruckContaRepository.AsQueryable().Where(a => a.P_ID == truckOrder.PK_ID).ToList(); + + TaskTruckShowDto model = truckOrder.Adapt(); + if (truckCtnList.Count > 0) model.ContaList = truckCtnList.Adapt>();