修改派车任务

optimize
jianghaiqing 2 years ago
parent 0492344622
commit 1a8274426d

@ -25,6 +25,13 @@ namespace Myshipping.Application
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfo(string pkId); Task<TaskManageOrderResultDto> GetInfo(string pkId);
/// <summary>
/// 通过任务主键获取派车详情
/// </summary>
/// <param name="taskPkId">派车主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfoByTaskId(string taskPkId);
/// <summary> /// <summary>
/// 打印派车 /// 打印派车
/// </summary> /// </summary>

@ -25,9 +25,11 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<TaskTruckInfo> _taskTruckRepository; private readonly SqlSugarRepository<TaskTruckInfo> _taskTruckRepository;
private readonly SqlSugarRepository<TaskTruckCtn> _taskTruckContaRepository; private readonly SqlSugarRepository<TaskTruckCtn> _taskTruckContaRepository;
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
public TaskManageTruckService(SqlSugarRepository<TaskTruckInfo> taskTruckRepository, public TaskManageTruckService(SqlSugarRepository<TaskTruckInfo> taskTruckRepository,
SqlSugarRepository<TaskTruckCtn> taskTruckContaRepository, SqlSugarRepository<TaskTruckCtn> taskTruckContaRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
ISysCacheService cache, ILogger<BookingTruckService> logger) ISysCacheService cache, ILogger<BookingTruckService> logger)
{ {
_cache = cache; _cache = cache;
@ -35,6 +37,7 @@ namespace Myshipping.Application
_taskTruckRepository = taskTruckRepository; _taskTruckRepository = taskTruckRepository;
_taskTruckContaRepository = taskTruckContaRepository; _taskTruckContaRepository = taskTruckContaRepository;
_taskBaseRepository = taskBaseRepository;
} }
/// <summary> /// <summary>
@ -161,7 +164,7 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 获取派车详情 /// 获取派车详情
/// </summary> /// </summary>
/// <param name="id">派车主键</param> /// <param name="pkId">派车主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpGet("/TaskManageTruck/GetInfo")] [HttpGet("/TaskManageTruck/GetInfo")]
public async Task<TaskManageOrderResultDto> GetInfo(string pkId) public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
@ -179,6 +182,49 @@ namespace Myshipping.Application
TaskTruckShowDto model = truckOrder.Adapt<TaskTruckShowDto>(); TaskTruckShowDto model = truckOrder.Adapt<TaskTruckShowDto>();
if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<TaskTruckCtnDto>>();
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取派车详情异常,原因:{ex.Message}";
}
return result;
}
/// <summary>
/// 通过任务主键获取派车详情
/// </summary>
/// <param name="taskPkId">派车主键</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageTruck/GetInfoByTaskId")]
public async Task<TaskManageOrderResultDto> 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<TaskTruckShowDto>();
if (truckCtnList.Count > 0) if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<TaskTruckCtnDto>>(); model.ContaList = truckCtnList.Adapt<List<TaskTruckCtnDto>>();

Loading…
Cancel
Save