|
|
|
@ -1336,6 +1336,8 @@ namespace Myshipping.Application
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"任务BC MBLNO:{taskBCInfo.MBL_NO} 生成舱位异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh($"MBLNO:{taskBCInfo.MBL_NO} 生成舱位异常,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return id;
|
|
|
|
@ -1434,12 +1436,13 @@ namespace Myshipping.Application
|
|
|
|
|
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
|
|
|
|
|
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == id && !a.IsDeleted).ToList();
|
|
|
|
|
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == id && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = generateModel.CustomerId.Value })
|
|
|
|
|
.GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
Dictionary<long, Tuple<string, string>> finalContactDict = new Dictionary<long, Tuple<string, string>>();
|
|
|
|
|
|
|
|
|
|
generateModel.CustomerContactList.ForEach(contact =>
|
|
|
|
|
{
|
|
|
|
@ -1451,6 +1454,8 @@ namespace Myshipping.Application
|
|
|
|
|
a.Id == contact.CustomerContactId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
finalContactDict.Add(contact.CustomerContactId, new Tuple<string, string>(djyCustomerContactMan?.Email, contact.CustomerContactName));
|
|
|
|
|
|
|
|
|
|
if (djyCustomerContactMan != null)
|
|
|
|
|
{
|
|
|
|
|
var bookingContact = bookingContactList
|
|
|
|
@ -1493,7 +1498,45 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这里对于入库后的联系人再做一下比对,如果有差异需要邮件推送消息
|
|
|
|
|
var checkbookingContactList = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == id && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
if (finalContactDict.Any(x => string.IsNullOrWhiteSpace(x.Value.Item1)))
|
|
|
|
|
{
|
|
|
|
|
//推送邮件提醒
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={taskBCInfo.MBL_NO} 生成订舱的联系人失败"
|
|
|
|
|
, $"MBLNO={taskBCInfo.MBL_NO} 生成订舱的联系人失败,有联系人没有关联到邮箱信息 {string.Join(",",finalContactDict.Where(x => string.IsNullOrWhiteSpace(x.Value.Item1)).ToArray())}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var checkRlt = generateModel.CustomerContactList.GroupJoin(finalContactDict, l => l.CustomerContactId, r => r.Key,
|
|
|
|
|
(l, r) =>
|
|
|
|
|
{
|
|
|
|
|
var currArg = r.ToList();
|
|
|
|
|
|
|
|
|
|
if(currArg.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currModel = currArg.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(currModel.Value.Item1))
|
|
|
|
|
{
|
|
|
|
|
return new { UName = currModel.Value.Item2, IsNoEmail = true };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new { UName = currModel.Value.Item2, IsNoEmail = false };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new { UName = l.CustomerContactName, IsNoEmail = true };
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
if (checkRlt.Any(t => t.IsNoEmail))
|
|
|
|
|
{
|
|
|
|
|
//推送邮件提醒
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={taskBCInfo.MBL_NO} 生成订舱的联系人失败"
|
|
|
|
|
, $"MBLNO={taskBCInfo.MBL_NO} 生成订舱的联系人失败,有联系人没有关联到邮箱信息 {string.Join(",", checkRlt.Where(x => x.IsNoEmail).Select(x => x.UName).ToArray())}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (generateModel.ProjectList != null && generateModel.ProjectList.Count > 0)
|
|
|
|
@ -3648,7 +3691,7 @@ namespace Myshipping.Application
|
|
|
|
|
DjyCustomerContactOutput djyCustomerContactMan = djyCustomerInfo.Contacts
|
|
|
|
|
.FirstOrDefault(a => a.Id == contact.CustomerContactId);
|
|
|
|
|
|
|
|
|
|
if (contact == null)
|
|
|
|
|
if (djyCustomerContactMan == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"委托单位{model.CustomerName} 联系人 {contact.CustomerContactName}获取失败,联系人不存在或已作废 taskid={model.BCTaskId}");
|
|
|
|
|
|
|
|
|
|