|
|
@ -67,7 +67,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository<BookingDeliveryRecord> bookingDeliveryRecordRep,
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository<BookingDeliveryRecord> bookingDeliveryRecordRep,
|
|
|
|
ISysDataUserMenu sysDataUserMenuService,
|
|
|
|
ISysDataUserMenu sysDataUserMenuService,
|
|
|
|
SqlSugarRepository<BookingDeliveryRecordCtn> bookingDeliveryRecordCtnRep, SqlSugarRepository<BookingDeliveryRecordShipSchedule> bookingDeliveryRecordShipScheduleRep,
|
|
|
|
SqlSugarRepository<BookingDeliveryRecordCtn> bookingDeliveryRecordCtnRep, SqlSugarRepository<BookingDeliveryRecordShipSchedule> bookingDeliveryRecordShipScheduleRep,
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccount, SqlSugarRepository<BookingDeliveryRecordJobRun> bookingDeliveryRecordJobRunScheduleRep)
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccount, SqlSugarRepository<BookingDeliveryRecordJobRun> bookingDeliveryRecordJobRunScheduleRep, SqlSugarRepository<SysUser> sysUserRepository)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
_cache = cache;
|
|
|
|
_cache = cache;
|
|
|
@ -78,6 +78,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
_bookingDeliveryRecordShipScheduleRep = bookingDeliveryRecordShipScheduleRep;
|
|
|
|
_bookingDeliveryRecordShipScheduleRep = bookingDeliveryRecordShipScheduleRep;
|
|
|
|
_djyUserMailAccount = djyUserMailAccount;
|
|
|
|
_djyUserMailAccount = djyUserMailAccount;
|
|
|
|
_bookingDeliveryRecordJobRunScheduleRep = bookingDeliveryRecordJobRunScheduleRep;
|
|
|
|
_bookingDeliveryRecordJobRunScheduleRep = bookingDeliveryRecordJobRunScheduleRep;
|
|
|
|
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 检索海运船期详情
|
|
|
|
#region 检索海运船期详情
|
|
|
@ -2344,8 +2345,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
DateTime startDate = new DateTime(nowDate.Year, nowDate.Month, nowDate.Day);
|
|
|
|
DateTime startDate = new DateTime(nowDate.Year, nowDate.Month, nowDate.Day);
|
|
|
|
|
|
|
|
|
|
|
|
var runList = _bookingDeliveryRecordJobRunScheduleRep.AsQueryable().Filter(null, true)
|
|
|
|
var runList = _bookingDeliveryRecordJobRunScheduleRep.AsQueryable().Filter(null, true)
|
|
|
|
.Where(a => a.CreatedTime >= startDate && a.IsDeleted == false && a.IS_SEND_REPORT == false).ToList();
|
|
|
|
.Where(a => a.SEND_TIME >= startDate && a.IsDeleted == false && a.IS_SEND_REPORT == false).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (runList.Count > 0)
|
|
|
|
if (runList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2358,11 +2358,11 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var nextJobTime = DateTime.MinValue;
|
|
|
|
var nextJobTime = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
var nextOrder = _bookingDeliveryRecordRep.AsQueryable().Filter(null, true)
|
|
|
|
var waitList = _bookingDeliveryRecordRep.AsQueryable().Filter(null, true)
|
|
|
|
.Where(a => a.IsDeleted == false && a.JOB_TIME != null && a.JOB_TIME.Value >= nowDate && a.CreatedUserId == b.Key).OrderBy(a=>a.JOB_TIME.Value).First();
|
|
|
|
.Where(a => a.IsDeleted == false && a.JOB_TIME != null && a.JOB_TIME.Value >= nowDate && a.CreatedUserId == b.Key && a.STATUS == "TEMP").OrderBy(a=>a.JOB_TIME.Value).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (nextOrder != null)
|
|
|
|
if (waitList.Count > 0)
|
|
|
|
nextJobTime = nextOrder.JOB_TIME.Value;
|
|
|
|
nextJobTime = waitList.FirstOrDefault().JOB_TIME.Value;
|
|
|
|
|
|
|
|
|
|
|
|
var opUser = _sysUserRepository.AsQueryable().Filter(null, true).First(a => a.Id == b.Key);
|
|
|
|
var opUser = _sysUserRepository.AsQueryable().Filter(null, true).First(a => a.Id == b.Key);
|
|
|
|
|
|
|
|
|
|
|
@ -2390,15 +2390,21 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
|
|
string baseHtml = File.ReadAllText(templatePath);
|
|
|
|
string baseHtml = File.ReadAllText(templatePath);
|
|
|
|
|
|
|
|
|
|
|
|
HtmlDocument html = new HtmlDocument();
|
|
|
|
|
|
|
|
html.LoadHtml(baseHtml);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baseHtml = baseHtml.Replace("#ReportTime#", nowDate.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
baseHtml = baseHtml.Replace("#ReportTime#", nowDate.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
|
|
baseHtml = baseHtml.Replace("#total#", currList.Count.ToString());
|
|
|
|
baseHtml = baseHtml.Replace("#total#", currList.Count.ToString());
|
|
|
|
baseHtml = baseHtml.Replace("#succ#", currList.Count(x=>x.STATUS == "SUCC").ToString());
|
|
|
|
baseHtml = baseHtml.Replace("#succ#", currList.Count(x=>x.STATUS == "SUCC").ToString());
|
|
|
|
baseHtml = baseHtml.Replace("#failure#", currList.Count(x => x.STATUS == "FAILURE").ToString());
|
|
|
|
baseHtml = baseHtml.Replace("#failure#", currList.Count(x => x.STATUS == "FAILURE").ToString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(waitList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
baseHtml = baseHtml.Replace("#wait#", currList.Count().ToString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
baseHtml = baseHtml.Replace("#wait#", "0");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (nextJobTime != DateTime.MinValue)
|
|
|
|
if (nextJobTime != DateTime.MinValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
baseHtml = baseHtml.Replace("#NextTime#", nextJobTime.ToString("yyyy-MM-dd HH:mm"));
|
|
|
|
baseHtml = baseHtml.Replace("#NextTime#", nextJobTime.ToString("yyyy-MM-dd HH:mm"));
|
|
|
@ -2408,6 +2414,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
baseHtml = baseHtml.Replace("#NextTime#", "");
|
|
|
|
baseHtml = baseHtml.Replace("#NextTime#", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HtmlDocument html = new HtmlDocument();
|
|
|
|
|
|
|
|
html.LoadHtml(baseHtml);
|
|
|
|
|
|
|
|
|
|
|
|
var tableNode = html.DocumentNode.SelectSingleNode(".//table[@id='show-table']");
|
|
|
|
var tableNode = html.DocumentNode.SelectSingleNode(".//table[@id='show-table']");
|
|
|
|
|
|
|
|
|
|
|
@ -2417,10 +2425,10 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < currList.Count; i++)
|
|
|
|
for (int i = 0; i < currList.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tableBuilder.Append($"<tr><td>{(currList[i].SEND_TIME.HasValue ? currList[i].SEND_TIME.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")}</td>");
|
|
|
|
tableBuilder.Append($"<tr><td>{i+1}</td><td>{(currList[i].SEND_TIME.HasValue ? currList[i].SEND_TIME.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")}</td>");
|
|
|
|
tableBuilder.Append($"<td>{currList[i].STATUS_NAME}</td><td>{currList[i].BOOKING_REFERENCE}</td><td>{currList[i].PLACERECEIPT}</td><td>{currList[i].PLACEDELIVERY}</td>");
|
|
|
|
tableBuilder.Append($"<td>{currList[i].STATUS_NAME}</td><td>{currList[i].BOOKING_REFERENCE}</td><td>{currList[i].PLACERECEIPT_CITY}</td><td>{currList[i].PLACEDELIVERY_CITY}</td>");
|
|
|
|
tableBuilder.Append($"<td>{currList[i].CTN_STAT}</td><td>{(currList[i].ETD.HasValue ? currList[i].ETD.Value.ToString("yyyy-MM-dd HH:mm") : "")}</td>");
|
|
|
|
tableBuilder.Append($"<td>{currList[i].CTN_STAT}</td><td>{(currList[i].ETD.HasValue ? currList[i].ETD.Value.ToString("yyyy-MM-dd HH:mm") : "")}</td>");
|
|
|
|
tableBuilder.Append($"<td>{(currList[i].TOTAL_CARGO_WEIGHT.HasValue? currList[i].TOTAL_CARGO_WEIGHT.Value.ToString():"")}</td><td>{currList[i].PRICE_OWNER_REFERENCE}</td>");
|
|
|
|
tableBuilder.Append($"<td>{(currList[i].TOTAL_CARGO_WEIGHT.HasValue? currList[i].TOTAL_CARGO_WEIGHT.Value.ToString():"")}</td><td>{currList[i].PRICE_REFERENCE}</td>");
|
|
|
|
tableBuilder.Append($"<td>{(currList[i].IS_RECV_BC ? "1" : "")}</td><td>{(currList[i].IS_RECV_BK_CANCEL ? "1" : "")}</td><td>{(currList[i].JOB_TIME.HasValue ? currList[i].JOB_TIME.Value.ToString("yyyy-MM-dd HH:mm") : "")}</td></tr>");
|
|
|
|
tableBuilder.Append($"<td>{(currList[i].IS_RECV_BC ? "1" : "")}</td><td>{(currList[i].IS_RECV_BK_CANCEL ? "1" : "")}</td><td>{(currList[i].JOB_TIME.HasValue ? currList[i].JOB_TIME.Value.ToString("yyyy-MM-dd HH:mm") : "")}</td></tr>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2428,11 +2436,12 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
tableNode.ChildNodes.Add(HtmlNode.CreateNode(tableBuilder.ToString()));
|
|
|
|
tableNode.ChildNodes.Add(HtmlNode.CreateNode(tableBuilder.ToString()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emailHtml = html.DocumentNode.OuterHtml;
|
|
|
|
|
|
|
|
|
|
|
|
EmailApiUserDefinedDto emailApiUserDefinedDto = new EmailApiUserDefinedDto
|
|
|
|
EmailApiUserDefinedDto emailApiUserDefinedDto = new EmailApiUserDefinedDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SendTo = opUser.Email,
|
|
|
|
SendTo = opUser.Email,
|
|
|
|
//CCTo = opEmail,
|
|
|
|
CCTo = string.Join(";", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList().ToArray()),
|
|
|
|
Title = $"马士基API定时订舱统计报告 {nowDate.ToString("yyyy-MM-dd HH:mm:ss")}",
|
|
|
|
Title = $"马士基API定时订舱统计报告 {nowDate.ToString("yyyy-MM-dd HH:mm:ss")}",
|
|
|
|
Body = emailHtml,
|
|
|
|
Body = emailHtml,
|
|
|
|
Account = publicMailAccount.MailAccount?.Trim(),
|
|
|
|
Account = publicMailAccount.MailAccount?.Trim(),
|
|
|
|