From 75b7a7b73cb1748136a380d3ae4424c94f1c6d3e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 27 May 2024 19:39:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E8=88=B9=E8=88=B6=E7=9B=B8=E5=85=B3=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskRouteChangeAdvisoryDetailInfo.cs | 45 +++++++ .../TaskRouteChangeAdvisoryInfo.cs | 104 +++++++++++++++ .../Enum/TaskFileCategoryEnum.cs | 5 + .../TaskManageOrderRouteChangeAdvisoryInfo.cs | 87 +++++++++++++ .../TaskRouteChangeAdvisoryShowDto.cs | 97 ++++++++++++++ .../TaskManagePlat/Dtos/TaskManageMapper.cs | 16 +++ .../Dtos/TaskManageOrderMessageMainInfo.cs | 5 + .../Interface/IRouteChangeAdvisoryService.cs | 37 ++++++ .../Interface/ITaskManageService.cs | 8 ++ .../RouteChangeAdvisoryService.cs | 123 ++++++++++++++++++ .../TaskCautionNoticeService.cs | 12 ++ .../TaskManagePlat/TaskManageService.cs | 80 ++++++++++++ 12 files changed, 619 insertions(+) create mode 100644 Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryDetailInfo.cs create mode 100644 Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryInfo.cs create mode 100644 Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskManageOrderRouteChangeAdvisoryInfo.cs create mode 100644 Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskRouteChangeAdvisoryShowDto.cs create mode 100644 Myshipping.Application/Service/TaskManagePlat/Interface/IRouteChangeAdvisoryService.cs create mode 100644 Myshipping.Application/Service/TaskManagePlat/RouteChangeAdvisoryService.cs diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryDetailInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryDetailInfo.cs new file mode 100644 index 00000000..28a0efb5 --- /dev/null +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryDetailInfo.cs @@ -0,0 +1,45 @@ +using Myshipping.Application.Entity; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 航线船舶截止时间调整的通知处理明细 + /// + [SugarTable("task_route_change_advisory_detail")] + [Description("航线船舶截止时间调整的通知处理明细")] + public class TaskRouteChangeAdvisoryDetailInfo : TaskManageDbEntity + { + /// + /// 父主键 + /// + public string P_ID { get; set; } + + /// + /// 订舱ID + /// + public Nullable BOOKING_ID { get; set; } + + /// + /// 是否已转发客户 1-是 0-否 + /// + + public bool IS_TRANSFER_USER { get; set; } + + /// + /// 最后转发客户邮件时间 + /// + public Nullable LST_TRANSFER_USER_DATE { get; set; } + + /// + /// 最后转发客户邮件结果 + /// + public string LST_TRANSFER_NOTES { get; set; } + } +} diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryInfo.cs new file mode 100644 index 00000000..6727d784 --- /dev/null +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskRouteChangeAdvisoryInfo.cs @@ -0,0 +1,104 @@ +using Myshipping.Application.Entity; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 航线船舶截止时间调整的通知 + /// + [SugarTable("task_route_change_advisory")] + [Description("航线船舶截止时间调整的通知")] + public class TaskRouteChangeAdvisoryInfo : TaskManageDbEntity + { + /// + /// 任务主键 + /// + public string TASK_ID { get; set; } + + /// + /// 船名 + /// + public string VESSEL { get; set; } + + /// + /// 航次 + /// + public string VOYNO { get; set; } + + /// + /// 船公司 + /// + public string CARRIER { get; set; } + + /// + /// 装货港提取 + /// + public string READ_PORTLOAD { get; set; } + + /// + /// 原ETD + /// + public Nullable ORIG_ETD { get; set; } + + /// + /// MDGF提交截止时间 + /// + public Nullable MDGF_CUT_DATE { get; set; } + + /// + /// ETA(预计到港时间) + /// + public Nullable ETA { get; set; } + + /// + /// ETD(预计离港时间) + /// + public Nullable ETD { get; set; } + + /// + /// 样单截止日期 + /// + public Nullable SI_CUT_DATE { get; set; } + + /// + /// 码头移箱截止时间 + /// + public Nullable TM_SHIFT_CUT_DATE { get; set; } + + /// + /// 截VGM时间 + /// + public Nullable VGM_CUTOFF_TIME { get; set; } + + /// + /// 截港/场站收据截止 + /// + public Nullable CY_CUT_DATE { get; set; } + + /// + /// 航线代码 + /// + public string ROUTE_CODE { get; set; } + + /// + /// 邮件对应标题 + /// + public string EMAIL_SUBJECT { get; set; } + + /// + /// 装货港代码 + /// + public string PORTLOADID { get; set; } + + /// + /// 装货港 + /// + public string PORTLOAD { get; set; } + } +} diff --git a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs index da982df0..76119098 100644 --- a/Myshipping.Application/Enum/TaskFileCategoryEnum.cs +++ b/Myshipping.Application/Enum/TaskFileCategoryEnum.cs @@ -58,6 +58,11 @@ namespace Myshipping.Application [Description("SI Submitted")] SI_SUBMITTED, /// + /// Advisory + /// + [Description("Advisory")] + ADVISORY, + /// /// 空 /// [Description("NONE")] diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskManageOrderRouteChangeAdvisoryInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskManageOrderRouteChangeAdvisoryInfo.cs new file mode 100644 index 00000000..3e524db3 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskManageOrderRouteChangeAdvisoryInfo.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskManageOrderRouteChangeAdvisoryInfo + { + /// + /// 船公司代码 + /// + + public string CarrierId { get; set; } + + /// + /// 计费周 + /// + public int Week { get; set; } + + /// + /// 船名 + /// + public string Vessel { get; set; } + + /// + /// 航次 + /// + public string Voyno { get; set; } + + /// + /// 预计离港时间 + /// + public DateTime origETD { get; set; } + + /// + /// 完整 MDGF 截止时间/冻柜/开顶柜/框架箱/超限货物最晚提箱时间: + /// + public Nullable MDGFCutDate { get; set; } + + /// + /// 预计到港 + /// + public Nullable ETA { get; set; } + + /// + /// 预计离港: + /// + public Nullable ETD { get; set; } + + /// + /// 提单样本截止时间 + /// + public Nullable SICutDate { get; set; } + + /// + /// 码头移箱截止 + /// + public Nullable TerminalShiftCutDate { get; set; } + + /// + /// VGM截止时间 + /// + public Nullable VGMCutDate { get; set; } + + /// + /// 截港/场站收据截止 + /// + public Nullable CYCutDate { get; set; } + + /// + /// 启运港名称 + /// + public string LoadPortName { get; set; } + + /// + /// 航线代码 + /// + public string RouteCode { get; set; } + + /// + /// 邮件对应标题 + /// + public string MailSubject { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskRouteChangeAdvisoryShowDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskRouteChangeAdvisoryShowDto.cs new file mode 100644 index 00000000..647677f0 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Advisory/TaskRouteChangeAdvisoryShowDto.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskRouteChangeAdvisoryShowDto + { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 任务ID + /// + public string TaskPKId { get; set; } + + /// + /// 船公司代码 + /// + + public string CarrierId { get; set; } + + /// + /// 计费周 + /// + public int Week { get; set; } + + /// + /// 船名 + /// + public string Vessel { get; set; } + + /// + /// 航次 + /// + public string Voyno { get; set; } + + /// + /// 预计离港时间 + /// + public DateTime origETD { get; set; } + + /// + /// 完整 MDGF 截止时间/冻柜/开顶柜/框架箱/超限货物最晚提箱时间: + /// + public Nullable MDGFCutDate { get; set; } + + /// + /// 预计到港 + /// + public Nullable ETA { get; set; } + + /// + /// 预计离港: + /// + public Nullable ETD { get; set; } + + /// + /// 提单样本截止时间 + /// + public Nullable SICutDate { get; set; } + + /// + /// 码头移箱截止 + /// + public Nullable TerminalShiftCutDate { get; set; } + + /// + /// VGM截止时间 + /// + public Nullable VGMCutDate { get; set; } + + /// + /// 截港/场站收据截止 + /// + public Nullable CYCutDate { get; set; } + + /// + /// 启运港名称 + /// + public string LoadPortName { get; set; } + + /// + /// 航线代码 + /// + public string RouteCode { get; set; } + + /// + /// 创建日期 + /// + public DateTime CreateTime { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index a066bb89..f13400c9 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -1166,6 +1166,22 @@ namespace Myshipping.Application .Map(dest => dest.NOTIFY_EMAIL, src => src.Email) .Map(dest => dest.NOTIFY_MOBILE, src => src.Mobile); + + config.ForType() + .Map(dest => dest.VESSEL, src => src.Vessel) + .Map(dest => dest.VOYNO, src => src.Voyno) + .Map(dest => dest.CARRIER, src => src.CarrierId) + .Map(dest => dest.ORIG_ETD, src => src.origETD) + .Map(dest => dest.READ_PORTLOAD, src => src.LoadPortName) + .Map(dest => dest.MDGF_CUT_DATE, src => src.MDGFCutDate) + .Map(dest => dest.ETA, src => src.ETA) + .Map(dest => dest.ETD, src => src.ETD) + .Map(dest => dest.SI_CUT_DATE, src => src.SICutDate) + .Map(dest => dest.TM_SHIFT_CUT_DATE, src => src.TerminalShiftCutDate) + .Map(dest => dest.VGM_CUTOFF_TIME, src => src.VGMCutDate) + .Map(dest => dest.CY_CUT_DATE, src => src.CYCutDate) + .Map(dest => dest.ROUTE_CODE, src => src.RouteCode) + .Map(dest => dest.EMAIL_SUBJECT, src => src.MailSubject); } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs index 58e60d67..25f81c90 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -239,5 +239,10 @@ namespace Myshipping.Application /// 重要通知 /// public TaskManageOrderCautionNoticeInfo CautionNoticeInfo { get; set; } + + /// + /// 船舶相关截止时间的通知 + /// + public TaskManageOrderRouteChangeAdvisoryInfo RouteChangeAdvisoryInfo { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/IRouteChangeAdvisoryService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/IRouteChangeAdvisoryService.cs new file mode 100644 index 00000000..c022ac1e --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/IRouteChangeAdvisoryService.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 船舶相关截止时间的通知 + /// + public interface IRouteChangeAdvisoryService + { + /// + /// 获取船舶相关截止时间的通知详情 + /// + /// 船舶相关截止时间的通知任务主键 + /// 返回详情 + Task GetInfoByTaskId(string taskPkId); + + /// + /// 自动转发船舶相关截止时间的通知 + /// + /// 船舶相关截止时间的通知任务主键 + /// 租户ID + /// 返回回执 + Task AutoTransferNotice(string taskPKId, long tenantId); + + /// + /// 检索同一航次对应的订舱订单(并对应记录) + /// + /// 船舶相关截止时间的通知任务主键 + /// 租户ID + /// 返回回执 + Task QueryVesselVoynoBookingOrder(string taskPKId, long tenantId); + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs index dd4fca33..cdbd3c61 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs @@ -303,5 +303,13 @@ namespace Myshipping.Application /// 截单回执任务详情JSON /// 返回回执 Task CreateSISubmittedTaskJob(IFormFile file, IFormFile modifyFile, string jsonData); + + /// + /// 创建Advisory任务 + /// + /// 文件 + /// Advisory任务详情JSON + /// 返回回执 + Task CreateAdvisoryTaskJob(IFormFile file, IFormFile modifyFile, string jsonData); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/RouteChangeAdvisoryService.cs b/Myshipping.Application/Service/TaskManagePlat/RouteChangeAdvisoryService.cs new file mode 100644 index 00000000..91c21e96 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/RouteChangeAdvisoryService.cs @@ -0,0 +1,123 @@ +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Myshipping.Application.Entity; +using Myshipping.Core.Entity; +using Myshipping.Core.Service; +using Myshipping.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Furion.FriendlyException; + +namespace Myshipping.Application +{ + /// + /// 船舶相关截止时间的通知 + /// + [ApiDescriptionSettings("Application", Name = "RouteChangeAdvisory", Order = 10)] + public class RouteChangeAdvisoryService : IRouteChangeAdvisoryService, IDynamicApiController, ITransient + { + private readonly ISysCacheService _cache; + private readonly ILogger _logger; + private readonly SqlSugarRepository _taskBaseRepository; + private readonly SqlSugarRepository _taskRouteChangeAdvisoryInfoRepository; + private readonly SqlSugarRepository _taskRouteChangeAdvisoryDetailInfoRepository; + private readonly SqlSugarRepository _djyUserMailAccount; + + public RouteChangeAdvisoryService(ISysCacheService cache, ILogger logger, + SqlSugarRepository taskBaseRepository, + SqlSugarRepository taskRouteChangeAdvisoryInfoRepository, + SqlSugarRepository taskRouteChangeAdvisoryDetailInfoRepository, + SqlSugarRepository djyUserMailAccount) + { + _cache = cache; + _logger = logger; + + _taskBaseRepository = taskBaseRepository; + _taskRouteChangeAdvisoryInfoRepository = taskRouteChangeAdvisoryInfoRepository; + _taskRouteChangeAdvisoryDetailInfoRepository = _taskRouteChangeAdvisoryDetailInfoRepository; + _djyUserMailAccount = djyUserMailAccount; + + } + + /// + /// 获取船舶相关截止时间的通知详情 + /// + /// 船舶相关截止时间的通知任务主键 + /// 返回详情 + public async Task GetInfoByTaskId(string taskPkId) + { + TaskRouteChangeAdvisoryShowDto dto = new TaskRouteChangeAdvisoryShowDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var advisoryInfo = _taskRouteChangeAdvisoryInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (advisoryInfo == null) + throw Oops.Oh($"船舶相关截止时间的通知主键{taskPkId}无法获取业务信息"); + + + dto = new TaskRouteChangeAdvisoryShowDto + { + PKId = advisoryInfo.PK_ID, + TaskPKId = advisoryInfo.TASK_ID, + CarrierId = advisoryInfo.CARRIER, + CreateTime = advisoryInfo.CreatedTime, + }; + + + return dto; + } + + /// + /// 自动转发船舶相关截止时间的通知 + /// + /// 船舶相关截止时间的通知任务主键 + /// 租户ID + /// 返回回执 + public async Task AutoTransferNotice(string taskPKId, long tenantId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + + } + catch(Exception ex) + { + + } + + return result; + } + + /// + /// 检索同一航次对应的订舱订单(并对应记录) + /// + /// 船舶相关截止时间的通知任务主键 + /// 租户ID + /// 返回回执 + public async Task QueryVesselVoynoBookingOrder(string taskPKId, long tenantId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + try + { + + } + catch (Exception ex) + { + + } + + return result; + } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskCautionNoticeService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskCautionNoticeService.cs index 58cf8cd8..d2bfc867 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskCautionNoticeService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskCautionNoticeService.cs @@ -171,6 +171,12 @@ namespace Myshipping.Application a.STATUS = emailRlt.succ ? "SUCC" : "FAILURE"; a.STATUS_NAME = emailRlt.succ ? "成功" : "失败"; + + _taskCautionNoticeDetailInfoRepository.AsUpdateable(a).UpdateColumns(p => new + { + p.STATUS, + p.STATUS_NAME + }).ExecuteCommand(); } } else if (a.NOTIFY_METHOD == CautionNoticeMethodEnum.DingDing.ToString()) @@ -183,6 +189,12 @@ namespace Myshipping.Application a.STATUS = "SUCC"; a.STATUS_NAME = "成功"; + + _taskCautionNoticeDetailInfoRepository.AsUpdateable(a).UpdateColumns(p => new + { + p.STATUS, + p.STATUS_NAME + }).ExecuteCommand(); } }); } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index a9c0bca8..0a255b60 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -119,6 +119,10 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskCautionNoticeInfoRepository; private readonly SqlSugarRepository _taskCautionNoticeDetailInfoRepository; + private readonly SqlSugarRepository _taskRouteChangeAdvisoryInfoRepository; + private readonly SqlSugarRepository _taskRouteChangeAdvisoryDetailInfoRepository; + + private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly ISysCacheService _cache; private readonly ILogger _logger; @@ -182,6 +186,8 @@ namespace Myshipping.Application SqlSugarRepository taskPODDischargeGateoutFullDetailInfoRepository, SqlSugarRepository taskCautionNoticeInfoRepository, SqlSugarRepository taskCautionNoticeDetailInfoRepository, + SqlSugarRepository taskRouteChangeAdvisoryInfoRepository, + SqlSugarRepository taskRouteChangeAdvisoryDetailInfoRepository, INamedServiceProvider namedBookingOrderServiceProvider, IDjyWebsiteAccountConfigService webAccountConfig, ISysCacheService cache, @@ -250,6 +256,9 @@ namespace Myshipping.Application _taskCautionNoticeInfoRepository = taskCautionNoticeInfoRepository; _taskCautionNoticeDetailInfoRepository = taskCautionNoticeDetailInfoRepository; + + _taskRouteChangeAdvisoryInfoRepository = taskRouteChangeAdvisoryInfoRepository; + _taskRouteChangeAdvisoryDetailInfoRepository = taskRouteChangeAdvisoryDetailInfoRepository; } #region 创建任务 @@ -476,6 +485,12 @@ namespace Myshipping.Application fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString(); } + else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "advisoryfiles"; + + fileCategory = TaskFileCategoryEnum.ADVISORY.ToString(); + } var noExtensionFileName = Path.GetFileNameWithoutExtension(file.FileName); var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, noExtensionFileName, @@ -1495,7 +1510,36 @@ namespace Myshipping.Application #region 航线船舶截止时间调整的通知 if (info.Main.TaskType == TaskBaseTypeEnum.ROUTE_CUT_CHANGE) { + TaskRouteChangeAdvisoryInfo taskRouteChangeAdvisoryInfo = info.Main.RouteChangeAdvisoryInfo.Adapt(); + + taskRouteChangeAdvisoryInfo.PK_ID = IDGen.NextID().ToString(); + taskRouteChangeAdvisoryInfo.TASK_ID = taskInfo.PK_ID; + + taskRouteChangeAdvisoryInfo.CreatedTime = taskInfo.CreatedTime; + taskRouteChangeAdvisoryInfo.UpdatedTime = taskInfo.CreatedTime; + + taskRouteChangeAdvisoryInfo.CreatedUserId = taskInfo.CreatedUserId; + taskRouteChangeAdvisoryInfo.CreatedUserName = taskInfo.CreatedUserName; + taskRouteChangeAdvisoryInfo.TenantId = taskInfo.TenantId; + taskRouteChangeAdvisoryInfo.TenantName = taskInfo.TenantName; + + if (!string.IsNullOrWhiteSpace(taskRouteChangeAdvisoryInfo.READ_PORTLOAD)) + { + var portList = _cache.GetAllCodePortLoad().GetAwaiter().GetResult(); + + if (portList != null && portList.Count > 0) + { + var portInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EnName) && a.EnName.Equals(taskRouteChangeAdvisoryInfo.READ_PORTLOAD,StringComparison.OrdinalIgnoreCase)); + if (portInfo != null) + { + taskRouteChangeAdvisoryInfo.PORTLOADID = portInfo?.EdiCode; + taskRouteChangeAdvisoryInfo.PORTLOAD = portInfo?.EnName; + } + } + } + + await _taskRouteChangeAdvisoryInfoRepository.InsertAsync(taskRouteChangeAdvisoryInfo); } #endregion @@ -5951,6 +5995,42 @@ namespace Myshipping.Application } #endregion + #region 创建Advisory任务 + /// + /// 创建Advisory任务 + /// + /// 文件 + /// BC任务详情JSON + /// 返回回执 + [HttpPost("/TaskManage/CreateAdvisoryTaskJob"), AllowAnonymous, ApiUser(ApiCode = "BCTaskManage")] + public async Task CreateAdvisoryTaskJob(IFormFile file, IFormFile modifyFile, string jsonData) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + string batchNo = IDGen.NextID().ToString(); + + _logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, jsonData); + + + try + { + TaskManageOrderMessageInfo info = JSON.Deserialize(jsonData); + + if (info == null) + throw Oops.Bah("jsonData请求内容错误,无法反序列化报文"); + + result = await InitTaskJob(info, batchNo, file, null); + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"请求任务异常,{ex.Message}"; + } + + return result; + } + #endregion + #region 获取文件类型 /// /// 获取文件类型