|
|
|
@ -708,9 +708,19 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (bookingOrderId > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//更新库存
|
|
|
|
|
//_bookingSlotService.
|
|
|
|
|
List<BookingSlotBaseWithCtnDto> slots = new List<BookingSlotBaseWithCtnDto>();
|
|
|
|
|
|
|
|
|
|
var slotInfo = _bookingSlotService.Detail(bookingSlotId).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
BookingSlotBaseWithCtnDto baseInfo = slotInfo.Adapt<BookingSlotBaseWithCtnDto>();
|
|
|
|
|
baseInfo.Id = bookingSlotId;
|
|
|
|
|
baseInfo.CtnList = slotInfo.CtnList.Adapt<List<BookingSlotCtnDto>>();
|
|
|
|
|
|
|
|
|
|
slots.Add(baseInfo);
|
|
|
|
|
|
|
|
|
|
//对应订舱和舱位关系
|
|
|
|
|
var allocRlt = _bookingSlotService.ImportSlots(slots, bookingOrderId, false);
|
|
|
|
|
|
|
|
|
|
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcOrder.PK_ID);
|
|
|
|
|
|
|
|
|
|
if (bcEntity != null)
|
|
|
|
@ -737,8 +747,11 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
var currBCOrder = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcEntity.PK_ID);
|
|
|
|
|
|
|
|
|
|
if (currBCOrder != null)
|
|
|
|
|
if (currBCOrder != null && model.IsDirectSend)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
await GenerateSendEmail(currBCOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskEntity = _taskBaseRepository.AsQueryable().First(u => u.PK_ID == bcEntity.TASK_ID);
|
|
|
|
|
|
|
|
|
@ -779,8 +792,11 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (bookingOrderId > 0)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
await GenerateSendEmail(bcOrder);
|
|
|
|
|
if (model.IsDirectSend)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
await GenerateSendEmail(bcOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcTaskInfo.PK_ID);
|
|
|
|
|
|
|
|
|
@ -1112,56 +1128,67 @@ namespace Myshipping.Application
|
|
|
|
|
if (id > 0)
|
|
|
|
|
{
|
|
|
|
|
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
|
|
|
|
|
if (generateModel.CustomerContactId.HasValue && generateModel.CustomerContactId.Value > 0)
|
|
|
|
|
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var bookingContact = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == id && !a.IsDeleted).First();
|
|
|
|
|
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == id && !a.IsDeleted).ToList();
|
|
|
|
|
|
|
|
|
|
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = generateModel.CustomerId.Value })
|
|
|
|
|
.GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
DjyCustomerContactOutput djyCustomerContactMan = null;
|
|
|
|
|
|
|
|
|
|
if (djyCustomerInfo.Contacts != null && djyCustomerInfo.Contacts.Count > 0)
|
|
|
|
|
generateModel.CustomerContactList.ForEach(contact =>
|
|
|
|
|
{
|
|
|
|
|
djyCustomerContactMan = djyCustomerInfo.Contacts.FirstOrDefault(a =>
|
|
|
|
|
a.Remark.Equals("BCNotice", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
DjyCustomerContactOutput djyCustomerContactMan = null;
|
|
|
|
|
|
|
|
|
|
if (bookingContact == null)
|
|
|
|
|
{
|
|
|
|
|
bookingContact = new BookingOrderContact {
|
|
|
|
|
Name = generateModel.CustomerContactName,
|
|
|
|
|
BookingId = id,
|
|
|
|
|
Email = djyCustomerContactMan.Email,
|
|
|
|
|
Remark = djyCustomerContactMan.Remark,
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await _bookingOrderContactRepository.InsertAsync(bookingContact);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bookingContact.Name = generateModel.CustomerContactName;
|
|
|
|
|
bookingContact.Email = djyCustomerContactMan.Email;
|
|
|
|
|
bookingContact.Remark = djyCustomerContactMan.Remark;
|
|
|
|
|
bookingContact.UpdatedTime = DateTime.Now;
|
|
|
|
|
bookingContact.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
bookingContact.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
_bookingOrderContactRepository.AsUpdateable(bookingContact).UpdateColumns(it => new
|
|
|
|
|
if (djyCustomerInfo.Contacts != null && djyCustomerInfo.Contacts.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
it.Name,
|
|
|
|
|
it.Email,
|
|
|
|
|
it.Remark,
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName
|
|
|
|
|
djyCustomerContactMan = djyCustomerInfo.Contacts.FirstOrDefault(a =>
|
|
|
|
|
a.Id == contact.CustomerContactId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
if (djyCustomerContactMan != null)
|
|
|
|
|
{
|
|
|
|
|
var bookingContact = bookingContactList
|
|
|
|
|
.FirstOrDefault(x => x.Email.Equals(djyCustomerContactMan.Email, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (bookingContact == null)
|
|
|
|
|
{
|
|
|
|
|
bookingContact = new BookingOrderContact
|
|
|
|
|
{
|
|
|
|
|
Name = djyCustomerContactMan.Name,
|
|
|
|
|
BookingId = id,
|
|
|
|
|
Email = djyCustomerContactMan.Email,
|
|
|
|
|
Remark = djyCustomerContactMan.Remark,
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_bookingOrderContactRepository.Insert(bookingContact);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bookingContact.Name = djyCustomerContactMan.Name;
|
|
|
|
|
bookingContact.Email = djyCustomerContactMan.Email;
|
|
|
|
|
bookingContact.Remark = djyCustomerContactMan.Remark;
|
|
|
|
|
bookingContact.UpdatedTime = DateTime.Now;
|
|
|
|
|
bookingContact.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
bookingContact.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
_bookingOrderContactRepository.AsUpdateable(bookingContact).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.Name,
|
|
|
|
|
it.Email,
|
|
|
|
|
it.Remark,
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (generateModel.ProjectList != null && generateModel.ProjectList.Count > 0)
|
|
|
|
@ -1383,15 +1410,15 @@ namespace Myshipping.Application
|
|
|
|
|
//订舱OP的邮箱
|
|
|
|
|
string opEmail = string.Empty;
|
|
|
|
|
|
|
|
|
|
var bookingContact = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.First(a => a.BookingId == taskBCInfo.BOOKING_ORDER_ID);
|
|
|
|
|
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.BookingId == taskBCInfo.BOOKING_ORDER_ID).ToList();
|
|
|
|
|
|
|
|
|
|
if (bookingContact == null && string.IsNullOrWhiteSpace(bookingContact.Email))
|
|
|
|
|
if (bookingContactList == null || bookingContactList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"当前订舱未指定的联系人,toEmail={toEmail}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toEmail = bookingContact.Email.Trim();
|
|
|
|
|
toEmail = string.Join(";", bookingContactList.Select(x => x.Email.Trim()).Distinct().ToArray());
|
|
|
|
|
|
|
|
|
|
//获取操作OP的邮箱
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingOrderEntity.OPID))
|
|
|
|
@ -1419,6 +1446,12 @@ namespace Myshipping.Application
|
|
|
|
|
_logger.LogInformation($"提取当前公共邮箱的配置完成,id={publicMailAccount.Id}");
|
|
|
|
|
|
|
|
|
|
string emailTitle = $"Booking Confirmation : {taskBCInfo.MBL_NO}";
|
|
|
|
|
|
|
|
|
|
if (taskBCInfo.BUSI_TYPE == "BookingAmendment")
|
|
|
|
|
{
|
|
|
|
|
emailTitle = $"【变更】Booking Amendment : {taskBCInfo.MBL_NO}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string filePath = string.Empty;
|
|
|
|
|
|
|
|
|
|
//读取邮件模板并填充数据
|
|
|
|
@ -1716,6 +1749,31 @@ namespace Myshipping.Application
|
|
|
|
|
return await GenerateSendEmail(bcOrder);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取当前比对结果
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">BC任务主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/TaskManageBC/GetCompareResult")]
|
|
|
|
|
public async Task<List<CompareResultDetailInfo>> GetCompareResult(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(taskPKId))
|
|
|
|
|
throw Oops.Oh($"BC任务主键不能为空");
|
|
|
|
|
|
|
|
|
|
var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
|
|
|
|
|
if (bcTaskInfo == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == bcTaskInfo.PK_ID);
|
|
|
|
|
|
|
|
|
|
if (bcOrder == null)
|
|
|
|
|
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息");
|
|
|
|
|
|
|
|
|
|
return await _bookingSlotService.GetSlotCompareResult(bcOrder.BOOKING_SLOT_ID.Value, bcOrder.BATCH_NO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|