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