diff --git a/ds-wms-service/DS.Module.Core/Extensions/DateTimeExtension.cs b/ds-wms-service/DS.Module.Core/Extensions/DateTimeExtension.cs
index df80b9ae..4ae3db40 100644
--- a/ds-wms-service/DS.Module.Core/Extensions/DateTimeExtension.cs
+++ b/ds-wms-service/DS.Module.Core/Extensions/DateTimeExtension.cs
@@ -1,4 +1,6 @@
using Newtonsoft.Json.Linq;
+using System.Globalization;
+using static System.Runtime.InteropServices.JavaScript.JSType;
namespace DS.Module.Core.Extensions;
@@ -32,7 +34,24 @@ public static class DateTimeExtension
var week = new string[] { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
return week[day];
}
+ public static int GetWeekOfYear(this DateTime dt, CultureInfo ci)
+ {
+ // 获取与当前环境区域性相关的 CultureInfo 对象,或者你可以使用特定的区域性,例如 "zh-CN"
+ CultureInfo cultureInfo = new CultureInfo("zh-CN");
+
+ // 从 CultureInfo 对象获取 Calendar 对象
+ Calendar calendar = ci.Calendar;
+
+ // 定义 CalendarWeekRule,通常是使用当前文化的 DateTimeFormat
+ CalendarWeekRule calendarWeekRule = cultureInfo.DateTimeFormat.CalendarWeekRule;
+ // 一周的第一天
+ DayOfWeek firstDayOfWeek = cultureInfo.DateTimeFormat.FirstDayOfWeek;
+
+ // 获取指定日期在一年中的周数
+ int weekOfYear = calendar.GetWeekOfYear(dt, calendarWeekRule, firstDayOfWeek);
+ return weekOfYear;
+ }
///
/// 获取datetime值
///
diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/WSLWeeklyModel.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/WSLWeeklyModel.cs
index 22a3cec1..ac746a2c 100644
--- a/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/WSLWeeklyModel.cs
+++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/WSLWeeklyModel.cs
@@ -18,13 +18,119 @@ namespace DS.WMS.Core.QuarztJobs.Dtos
public class WSLWeeklyItem
{
- public long CustomerId { get; set; }
+ ///
+ /// 状态
+ ///
+ public string? BusinessStatusName { get; set; }
+
+ ///
+ /// 船公司
+ ///
+ public string Carrier { get; set; }
+ ///
+ /// 货代公司(订舱口)
+ ///
+ public string Forwarder { get; set; }
+ ///
+ /// 约主名称
+ ///
+ public string ContractClientName { get; set; }
+
+ ///
+ /// 运费协议号(约号)
+ ///
+ public string ContractNo { get; set; }
+ ///
+ /// 主提单号
+ ///
public string? MBLNO { get; set; }
+ ///
+ /// 委托编号
+ ///
public string? CustomerNo { get; set; }
+ ///
+ /// ETD
+ ///
public string? ETD { get; set; }
- public string? Status { get; set; }
+ ///
+ /// 周数
+ ///
+
+ public int? Weeks { get; set; }
+ ///
+ /// 装货港 起运港
+ ///
+ public string LoadPort { get; set; }
+
+ ///
+ /// 卸货港 目的港
+ ///
+ public string DischargePort { get; set; }
+
+
+
+
+ ///
+ /// Desc:MBL付费方式 t_code_frt
+ ///
+ public string MBLFrt { get; set; }
+
+
+ ///
+ /// Desc:单证人员
+ ///
+ public string DocName { get; set; }
+
+ ///
+ /// 操作员名称
+ ///
+ public string OperatorName { get; set; }
+ ///
+ /// 客服名称
+ ///
+ public string CustomerServiceName { get; set; }
+
+
+ ///
+ /// 揽货人
+ ///
+ public string Sale { get; set; }
+
+ ///
+ /// 航线人员名称 商务
+ ///
+ public string Laner { get; set; }
+ ///
+ /// 船名 t_code_vessel
+ ///
+ public string Vessel { get; set; }
+
+
+ ///
+ /// 航次
+ ///
+ public string Voyno { get; set; }
+
+ ///
+ /// 发货人 t_info_client CUSTNAME
+ ///
+ public string Shipper { get; set; }
+ ///
+ /// 收货人 t_info_client CUSTNAME
+ ///
+ public string Consignee { get; set; }
+ ///
+ /// 通知人 t_info_client CUSTNAME
+ ///
+ public string NotifyParty { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+
+ public string? CreateTime { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
index bda5b6a8..bab01c4d 100644
--- a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
+++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
@@ -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)