diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index 8d5cd091..c5be6701 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -2224,6 +2224,20 @@ namespace Myshipping.Application _logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model)); + string operUserId = bookingOrder.CreatedUserId.ToString(); + string operUserName = bookingOrder.CreatedUserName; + + //这里因为没有登录所以导致异常,因为当前接口是不验证登录的所以这里加了异常捕获,异常后登录人从订舱上制单人取。 + try + { + operUserId = UserManager.UserId.ToString(); + operUserName = UserManager.Name; + } + catch (Exception ex) + { + _logger.LogInformation("批次={no} 这里因为是非登录请求接口所以自动捕获异常", batchNo); + } + TrackingMessageInfo msgInfo = new TrackingMessageInfo { Head = new TrackingMessageHeadInfo @@ -2249,8 +2263,8 @@ namespace Myshipping.Application OperTenantId = bookingOrder.TenantId.Value, OperTenantName = bookingOrder.TenantName, OpertType = TrackingOperTypeEnum.MANUAL, - OperUserId = UserManager.UserId.ToString(), - OperUserName = UserManager.Name, + OperUserId = operUserId, + OperUserName = operUserName, SourceType = model.SourceType, StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo { @@ -2318,6 +2332,19 @@ namespace Myshipping.Application _logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model)); + string operUserId = bookingOrder.CreatedUserId.ToString(); + string operUserName = bookingOrder.CreatedUserName; + + try + { + operUserId = UserManager.UserId.ToString(); + operUserName = UserManager.Name; + } + catch (Exception ex) + { + _logger.LogInformation("批次={no} 这里因为是非登录请求接口所以自动捕获异常", batchNo); + } + TrackingMessageInfo msgInfo = new TrackingMessageInfo { Head = new TrackingMessageHeadInfo @@ -2343,8 +2370,8 @@ namespace Myshipping.Application OperTenantId = bookingOrder.TenantId.Value, OperTenantName = bookingOrder.TenantName, OpertType = TrackingOperTypeEnum.MANUAL, - OperUserId = UserManager.UserId.ToString(), - OperUserName = UserManager.Name, + OperUserId = operUserId, + OperUserName = operUserName, SourceType = model.SourceType, StatusList = model.StatusCodes.Select(a => new TrackingMessageMainStatusInfo {