|
|
@ -9,6 +9,9 @@ using Microsoft.Extensions.Logging;
|
|
|
|
using MiniExcelLibs;
|
|
|
|
using MiniExcelLibs;
|
|
|
|
using Quartz;
|
|
|
|
using Quartz;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
using System.Diagnostics.Contracts;
|
|
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.QuarztJobs
|
|
|
|
namespace DS.WMS.Core.QuarztJobs
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -43,13 +46,13 @@ namespace DS.WMS.Core.QuarztJobs
|
|
|
|
|
|
|
|
|
|
|
|
public async Task Execute(IJobExecutionContext context)
|
|
|
|
public async Task Execute(IJobExecutionContext context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogInformation("开始生成【WSLWeekly报表服务】...");
|
|
|
|
logger.LogInformation("开始生成【SUNNINESS-CARGOO REPORT报表服务】...");
|
|
|
|
|
|
|
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "CargooWeeklyReport.xlsx");
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "CargooWeeklyReport.xlsx");
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ex = new ApplicationException("【WSLWeekly报表服务】未能在下列路径找到模板文件:" + path);
|
|
|
|
var ex = new ApplicationException("【SUNNINESS-CARGOO REPORT报表服务】未能在下列路径找到模板文件:" + path);
|
|
|
|
await ex.LogAsync(db);
|
|
|
|
await ex.LogAsync(db);
|
|
|
|
throw ex;
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -91,10 +94,17 @@ namespace DS.WMS.Core.QuarztJobs
|
|
|
|
.OrderBy(x=>x.ETD)
|
|
|
|
.OrderBy(x=>x.ETD)
|
|
|
|
.Select(x => new WSLWeeklyItem()
|
|
|
|
.Select(x => new WSLWeeklyItem()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CustomerNo = x.CustomerNo,
|
|
|
|
|
|
|
|
|
|
|
|
BusinessStatusName = x.BusinessStatusName,
|
|
|
|
|
|
|
|
Carrier = x.Carrier,
|
|
|
|
|
|
|
|
Forwarder = x.Forwarder,
|
|
|
|
|
|
|
|
ContractClientName = x.ContractClientName,
|
|
|
|
|
|
|
|
ContractNo = x.ContractNo,
|
|
|
|
MBLNO = x.MBLNO,
|
|
|
|
MBLNO = x.MBLNO,
|
|
|
|
|
|
|
|
CustomerNo = x.CustomerNo,
|
|
|
|
ETD = x.ETD.HasValue ? x.ETD.Value.ToString("yyyy-MM-dd") : string.Empty,
|
|
|
|
ETD = x.ETD.HasValue ? x.ETD.Value.ToString("yyyy-MM-dd") : string.Empty,
|
|
|
|
Status = x.IsRefund == true? "已退舱":"",
|
|
|
|
//Weeks = x.ETD.HasValue ? x.ETD.Value.GetWeekOfYear(CultureInfo.CurrentCulture),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
@ -126,9 +136,9 @@ namespace DS.WMS.Core.QuarztJobs
|
|
|
|
|
|
|
|
|
|
|
|
var mailResult = await api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams);
|
|
|
|
var mailResult = await api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams);
|
|
|
|
if (mailResult.IsSuccessStatusCode)
|
|
|
|
if (mailResult.IsSuccessStatusCode)
|
|
|
|
logger.LogInformation("已发送【WSLWeekly报表服务】...");
|
|
|
|
logger.LogInformation("已发送【SUNNINESS-CARGOO REPORT报表服务】...");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
logger.LogInformation("发送【WSLWeekly报表服务】失败!");
|
|
|
|
logger.LogInformation("发送【SUNNINESS-CARGOO REPORT报表服务】失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|