修改BC任务

optimize
jianghaiqing 10 months ago
parent b5a676e7eb
commit 930d5ae9dd

@ -76,5 +76,11 @@ namespace Myshipping.Application
/// <returns>返回回执</returns>
Task<List<ServiceProjectBaseDto>> GetProjectList();
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SendEmail(string taskPKId);
}
}

@ -51,6 +51,7 @@ namespace Myshipping.Application
private readonly IBookingOrderService _bookingOrderService;
private readonly IBookingSlotService _bookingSlotService;
private readonly IBookingValueAddedService _bookingValueAddedService;
private readonly IDjyCustomerService _djyCustomerService;
const string CONST_BC_FILE_CODE = "bc";
const string CONST_BC_FILE_NAME = "Booking Confirmation";
@ -68,6 +69,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingFile> bookingFileRepository,
IServiceWorkFlowBaseService serviceWorkFlowBaseService,
IBookingOrderService bookingOrderService, ILogger<TaskManageBCService> logger,
IDjyCustomerService djyCustomerService,
IBookingSlotService bookingSlotService, ISysCacheService cache, IBookingValueAddedService bookingValueAddedService)
{
_taskBaseRepository = taskBaseRepository;
@ -83,6 +85,7 @@ namespace Myshipping.Application
_cache = cache;
_bookingValueAddedService = bookingValueAddedService;
_bookingFileRepository = bookingFileRepository;
_djyCustomerService = djyCustomerService;
_logger = logger;
}
@ -682,7 +685,7 @@ namespace Myshipping.Application
if (bookingOrderId > 0)
{
//更新库存
_bookingSlotService.
//_bookingSlotService.
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcOrder.PK_ID);
if (bcEntity != null)
@ -1246,5 +1249,110 @@ namespace Myshipping.Application
await _bookingFileRepository.InsertAsync(bookFile);
}
#endregion
private async Task<TaskManageOrderResultDto> InnerSendEmail(long bookingOrderId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
/*
1BCNotice
2OP
3BCNotice
4
5
*/
//读取订舱数据
var bookingOrderEntity = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingOrderId);
if(bookingOrderEntity == null)
{
throw Oops.Oh($"订舱详情获取失败,请确认订舱是否存在或已删除");
}
if(!bookingOrderEntity.CUSTOMERID.HasValue || (bookingOrderEntity.CUSTOMERID.HasValue && bookingOrderEntity.CUSTOMERID.Value == 0))
{
throw Oops.Oh($"订舱的委托客户不能为空");
}
var yardList = await _djyCustomerService.QuerytDjyCustomerInfo("", new string[] { "yard" }, 999);
/*
if (yardList.Count > 0)
{
if ((string.IsNullOrWhiteSpace(model.YARDCONTRACT) || string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL))
&& !string.IsNullOrWhiteSpace(model.YARD))
{
var currYardList = yardList.Select(a =>
{
return new
{
KNum = a.ShortName.IndexOf(model.YARD),
Equls = a.ShortName.Equals(model.YARD, StringComparison.OrdinalIgnoreCase) ? 1 : 0,
Obj = a
};
}).Where(a => a.KNum >= 0).ToList();
if (currYardList.Count > 0)
{
var yardInfo = currYardList
.OrderByDescending(a => a.Equls)
.ThenBy(a => a.KNum)
.FirstOrDefault().Obj;
if (yardInfo != null)
{
if (string.IsNullOrWhiteSpace(model.YARDCONTRACT))
{
model.YARDCONTRACT = yardInfo.Chief?.Trim();
}
if (string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL))
model.YARDCONTRACTTEL = yardInfo.Tel?.Trim();
}
}
}
}
*/
}
catch (Exception ex)
{
}
return result;
}
#region 发送邮件
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SendEmail(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 InnerSendEmail(0);
}
#endregion
}
}

Loading…
Cancel
Save