diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 9ab4a93c..2b3bfba5 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -54,6 +54,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookingPrintTemplateTemplate; private readonly SqlSugarRepository _djyUserConfigConfig; private readonly SqlSugarRepository _bookingExcelTemplateRepository; + private readonly SqlSugarRepository _sysUserRepository; private readonly ITaskManageExternalService _taskManageExternalService; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; @@ -67,6 +68,7 @@ namespace Myshipping.Application SqlSugarRepository bookingPrintTemplateTemplate, SqlSugarRepository djyUserConfigConfig, SqlSugarRepository bookingExcelTemplateRepository, + SqlSugarRepository sysUserRepository, ITaskManageExternalService taskManageExternalService) { _cache = cache; @@ -81,6 +83,7 @@ namespace Myshipping.Application _bookingPrintTemplateTemplate = bookingPrintTemplateTemplate; _djyUserConfigConfig = djyUserConfigConfig; _bookingExcelTemplateRepository = bookingExcelTemplateRepository; + _sysUserRepository = sysUserRepository; } /// @@ -136,6 +139,15 @@ namespace Myshipping.Application }).ToArray()); } + if (entity.DispatcherId.HasValue && entity.DispatcherId.Value > 0) + { + var dispatchUser = _sysUserRepository.AsQueryable().First(a => a.Id == entity.DispatcherId.Value); + + if (dispatchUser != null) + entity.DispatcherName = dispatchUser.Name; + } + + if (entity.Id == 0) { entity.Status = BookingTruckStatus.TEMP.ToString(); @@ -819,7 +831,7 @@ namespace Myshipping.Application catch (Exception ex) { result.succ = false; - result.msg = $"撤销异常,原因:{ex.Message}"; + result.msg = ex.GetMessage(); } return result; @@ -922,7 +934,7 @@ namespace Myshipping.Application var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == id); if (model == null) - throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废"); + throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException)); //校验 ValidateTruck(OperateTypeEnum.Cancel, new BookingTruck[] { model }); @@ -972,7 +984,7 @@ namespace Myshipping.Application if (!taskRlt.succ) { - throw Oops.Oh($"请求撤销派车调度失败,原因={taskRlt.msg}"); + throw Oops.Oh($"请求撤销派车调度失败,原因={taskRlt.msg}", typeof(InvalidOperationException)); } //更新派车订单为已提交 @@ -998,7 +1010,7 @@ namespace Myshipping.Application catch (Exception ex) { result.succ = false; - result.msg = $"撤销异常,原因:{ex.Message}"; + result.msg = ex.GetMessage("撤销失败"); } return result; diff --git a/Myshipping.Application/Service/BookingTruck/TaskManageExternalService.cs b/Myshipping.Application/Service/BookingTruck/TaskManageExternalService.cs index 7c375d54..7e00b2f5 100644 --- a/Myshipping.Application/Service/BookingTruck/TaskManageExternalService.cs +++ b/Myshipping.Application/Service/BookingTruck/TaskManageExternalService.cs @@ -67,6 +67,19 @@ namespace Myshipping.Application var service = _namedServiceProvider.GetService(nameof(TaskManageService)); var rlt = await service.CancelTaskJob(info); + + if (!rlt.succ) + { + result.succ = false; + result.msg = $"提交派车失败,原因:{rlt.msg}"; + } + else + { + result.succ = true; + result.msg = "提交成功"; + //提取任务流水号 + result.ext = rlt.ext; + } } catch (Exception ex) { diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs index 5fce0f37..643329a4 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs @@ -39,6 +39,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _djyUserConfigConfig; private readonly SqlSugarRepository _bookingExcelTemplateRepository; private readonly SqlSugarRepository _bookingOrderRepository; + private readonly SqlSugarRepository _sysUserRepository; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; const string PRINT_DATASOURCE_KEY = "booking_order"; @@ -49,6 +50,7 @@ namespace Myshipping.Application SqlSugarRepository djyUserConfigConfig, SqlSugarRepository bookingExcelTemplateRepository, SqlSugarRepository bookingOrderRepository, + SqlSugarRepository sysUserRepository, ISysCacheService cache, ILogger logger) { _cache = cache; @@ -62,6 +64,7 @@ namespace Myshipping.Application _djyUserConfigConfig = djyUserConfigConfig; _bookingExcelTemplateRepository = bookingExcelTemplateRepository; _bookingOrderRepository = bookingOrderRepository; + _sysUserRepository = sysUserRepository; } /// @@ -116,6 +119,14 @@ namespace Myshipping.Application }).ToArray()); } + if (entity.DispatcherId.HasValue && entity.DispatcherId.Value > 0) + { + var dispatchUser = _sysUserRepository.AsQueryable().First(a => a.Id == entity.DispatcherId.Value); + + if (dispatchUser != null) + entity.DispatcherName = dispatchUser.Name; + } + if (string.IsNullOrWhiteSpace(entity.PK_ID)) { entity.Status = BookingTruckStatus.TEMP.ToString();