|
|
|
@ -708,9 +708,19 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (bookingOrderId > 0)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
//更新库存
|
|
|
|
|
//_bookingSlotService.
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
@ -778,9 +791,12 @@ namespace Myshipping.Application
|
|
|
|
|
var bookingOrderId = GenerateBookingOrder(bcOrder, bcCtnList, fileList, model).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
if (bookingOrderId > 0)
|
|
|
|
|
{
|
|
|
|
|
if (model.IsDirectSend)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
await GenerateSendEmail(bcOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcTaskInfo.PK_ID);
|
|
|
|
|
|
|
|
|
@ -1112,26 +1128,34 @@ 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();
|
|
|
|
|
|
|
|
|
|
generateModel.CustomerContactList.ForEach(contact =>
|
|
|
|
|
{
|
|
|
|
|
DjyCustomerContactOutput djyCustomerContactMan = null;
|
|
|
|
|
|
|
|
|
|
if (djyCustomerInfo.Contacts != null && djyCustomerInfo.Contacts.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
djyCustomerContactMan = djyCustomerInfo.Contacts.FirstOrDefault(a =>
|
|
|
|
|
a.Remark.Equals("BCNotice", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
a.Id == contact.CustomerContactId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (djyCustomerContactMan != null)
|
|
|
|
|
{
|
|
|
|
|
var bookingContact = bookingContactList
|
|
|
|
|
.FirstOrDefault(x => x.Email.Equals(djyCustomerContactMan.Email, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (bookingContact == null)
|
|
|
|
|
{
|
|
|
|
|
bookingContact = new BookingOrderContact {
|
|
|
|
|
Name = generateModel.CustomerContactName,
|
|
|
|
|
bookingContact = new BookingOrderContact
|
|
|
|
|
{
|
|
|
|
|
Name = djyCustomerContactMan.Name,
|
|
|
|
|
BookingId = id,
|
|
|
|
|
Email = djyCustomerContactMan.Email,
|
|
|
|
|
Remark = djyCustomerContactMan.Remark,
|
|
|
|
@ -1140,11 +1164,11 @@ namespace Myshipping.Application
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await _bookingOrderContactRepository.InsertAsync(bookingContact);
|
|
|
|
|
_bookingOrderContactRepository.Insert(bookingContact);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bookingContact.Name = generateModel.CustomerContactName;
|
|
|
|
|
bookingContact.Name = djyCustomerContactMan.Name;
|
|
|
|
|
bookingContact.Email = djyCustomerContactMan.Email;
|
|
|
|
|
bookingContact.Remark = djyCustomerContactMan.Remark;
|
|
|
|
|
bookingContact.UpdatedTime = DateTime.Now;
|
|
|
|
@ -1163,6 +1187,9 @@ namespace Myshipping.Application
|
|
|
|
|
}).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>
|
|
|
|
|