修改派车打印、提交

optimize
jianghaiqing 2 years ago
parent 0668d3534d
commit 64fc9bc3d1

@ -54,6 +54,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingPrintTemplate> _bookingPrintTemplateTemplate; private readonly SqlSugarRepository<BookingPrintTemplate> _bookingPrintTemplateTemplate;
private readonly SqlSugarRepository<DjyUserConfig> _djyUserConfigConfig; private readonly SqlSugarRepository<DjyUserConfig> _djyUserConfigConfig;
private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository; private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
private readonly ITaskManageExternalService _taskManageExternalService; private readonly ITaskManageExternalService _taskManageExternalService;
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
@ -67,6 +68,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingPrintTemplate> bookingPrintTemplateTemplate, SqlSugarRepository<BookingPrintTemplate> bookingPrintTemplateTemplate,
SqlSugarRepository<DjyUserConfig> djyUserConfigConfig, SqlSugarRepository<DjyUserConfig> djyUserConfigConfig,
SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository, SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository,
SqlSugarRepository<SysUser> sysUserRepository,
ITaskManageExternalService taskManageExternalService) ITaskManageExternalService taskManageExternalService)
{ {
_cache = cache; _cache = cache;
@ -81,6 +83,7 @@ namespace Myshipping.Application
_bookingPrintTemplateTemplate = bookingPrintTemplateTemplate; _bookingPrintTemplateTemplate = bookingPrintTemplateTemplate;
_djyUserConfigConfig = djyUserConfigConfig; _djyUserConfigConfig = djyUserConfigConfig;
_bookingExcelTemplateRepository = bookingExcelTemplateRepository; _bookingExcelTemplateRepository = bookingExcelTemplateRepository;
_sysUserRepository = sysUserRepository;
} }
/// <summary> /// <summary>
@ -136,6 +139,15 @@ namespace Myshipping.Application
}).ToArray()); }).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) if (entity.Id == 0)
{ {
entity.Status = BookingTruckStatus.TEMP.ToString(); entity.Status = BookingTruckStatus.TEMP.ToString();
@ -819,7 +831,7 @@ namespace Myshipping.Application
catch (Exception ex) catch (Exception ex)
{ {
result.succ = false; result.succ = false;
result.msg = $"撤销异常,原因:{ex.Message}"; result.msg = ex.GetMessage();
} }
return result; return result;
@ -922,7 +934,7 @@ namespace Myshipping.Application
var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == id); var model = _bookingTruckRepository.AsQueryable().First(a => a.Id == id);
if (model == null) if (model == null)
throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废"); throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException));
//校验 //校验
ValidateTruck(OperateTypeEnum.Cancel, new BookingTruck[] { model }); ValidateTruck(OperateTypeEnum.Cancel, new BookingTruck[] { model });
@ -972,7 +984,7 @@ namespace Myshipping.Application
if (!taskRlt.succ) 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) catch (Exception ex)
{ {
result.succ = false; result.succ = false;
result.msg = $"撤销异常,原因:{ex.Message}"; result.msg = ex.GetMessage("撤销失败");
} }
return result; return result;

@ -67,6 +67,19 @@ namespace Myshipping.Application
var service = _namedServiceProvider.GetService(nameof(TaskManageService)); var service = _namedServiceProvider.GetService(nameof(TaskManageService));
var rlt = await service.CancelTaskJob(info); 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) catch (Exception ex)
{ {

@ -39,6 +39,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<DjyUserConfig> _djyUserConfigConfig; private readonly SqlSugarRepository<DjyUserConfig> _djyUserConfigConfig;
private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository; private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository; private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
const string PRINT_DATASOURCE_KEY = "booking_order"; const string PRINT_DATASOURCE_KEY = "booking_order";
@ -49,6 +50,7 @@ namespace Myshipping.Application
SqlSugarRepository<DjyUserConfig> djyUserConfigConfig, SqlSugarRepository<DjyUserConfig> djyUserConfigConfig,
SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository, SqlSugarRepository<BookingExcelTemplate> bookingExcelTemplateRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<SysUser> sysUserRepository,
ISysCacheService cache, ILogger<BookingTruckService> logger) ISysCacheService cache, ILogger<BookingTruckService> logger)
{ {
_cache = cache; _cache = cache;
@ -62,6 +64,7 @@ namespace Myshipping.Application
_djyUserConfigConfig = djyUserConfigConfig; _djyUserConfigConfig = djyUserConfigConfig;
_bookingExcelTemplateRepository = bookingExcelTemplateRepository; _bookingExcelTemplateRepository = bookingExcelTemplateRepository;
_bookingOrderRepository = bookingOrderRepository; _bookingOrderRepository = bookingOrderRepository;
_sysUserRepository = sysUserRepository;
} }
/// <summary> /// <summary>
@ -116,6 +119,14 @@ namespace Myshipping.Application
}).ToArray()); }).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)) if (string.IsNullOrWhiteSpace(entity.PK_ID))
{ {
entity.Status = BookingTruckStatus.TEMP.ToString(); entity.Status = BookingTruckStatus.TEMP.ToString();

Loading…
Cancel
Save