diff --git a/Myshipping.Application/Enum/TaskBaseTypeEnum.cs b/Myshipping.Application/Enum/TaskBaseTypeEnum.cs index eabaed0c..e72453e1 100644 --- a/Myshipping.Application/Enum/TaskBaseTypeEnum.cs +++ b/Myshipping.Application/Enum/TaskBaseTypeEnum.cs @@ -156,5 +156,15 @@ namespace Myshipping.Application /// [Description("VGM未提交")] VGM_MISSING, + /// + /// 目的港未提货 + /// + [Description("目的港未提货")] + POD_DISCHARGE_FULL, + /// + /// 目的港未返空箱 + /// + [Description("目的港未返空箱")] + POD_GATEOUT_FULL, } } diff --git a/Myshipping.Application/Myshipping.Application.csproj b/Myshipping.Application/Myshipping.Application.csproj index 7d74091e..352f920b 100644 --- a/Myshipping.Application/Myshipping.Application.csproj +++ b/Myshipping.Application/Myshipping.Application.csproj @@ -52,6 +52,7 @@ + diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/CutDateChange/TaskCutDateChangeShowDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/CutDateChange/TaskCutDateChangeShowDto.cs index bb500aed..33b37bf6 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/CutDateChange/TaskCutDateChangeShowDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/CutDateChange/TaskCutDateChangeShowDto.cs @@ -95,5 +95,15 @@ namespace Myshipping.Application /// 截关时间文本 海关放行截止时间(Customs Clearance Deadline) /// public string ClosingDateTxt { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 通知接收时间 + /// + public Nullable NoticeDate { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullDto.cs new file mode 100644 index 00000000..9ff53fa7 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullDto.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// + /// + public class TaskPODDischargeGateoutFullDto + { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 任务主键 + /// + public string TaskId { get; set; } + + /// + /// 主单号 + /// + public string MBlNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 箱号 + /// + public string CtnNo { get; set; } + + /// + /// 收货人 + /// + public string CNee { get; set; } + + /// + /// 卸货日期 + /// + public Nullable DischargeDate { get; set; } + + /// + /// 卸货港 + /// + public string DischargePort { get; set; } + + /// + /// 超期天数 + /// + public Nullable OverdueDays { get; set; } + + /// + /// 通知接收时间 + /// + public Nullable NoticeDate { get; set; } + + /// + /// 订舱ID + /// + public Nullable BookingId { get; set; } + + /// + /// 已发消息提醒 1-已发 0-未发 + /// + public bool IsNotice { get; set; } + + /// + /// 消息提醒时间 + /// + public Nullable SendNoticeDate { get; set; } + + /// + /// 通知类型 CHARGE_FULL-卸船未提货,GATEOUT_FULL-提箱未返空箱 + /// + public string NoticeType { get; set; } + + /// + /// 通知类型 CHARGE_FULL-卸船未提货,GATEOUT_FULL-提箱未返空箱 + /// + public string NoticeTypeName { get; set; } + + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullShowDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullShowDto.cs new file mode 100644 index 00000000..ab7d0554 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/PODException/TaskPODDischargeGateoutFullShowDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskPODDischargeGateoutFullShowDto : TaskPODDischargeGateoutFullDto + { + /// + /// 是否已完成 + /// + public bool IsComplete { get; set; } + + /// + /// 完成时间 + /// + public Nullable CompleteTime { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedDto.cs new file mode 100644 index 00000000..bcd23103 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedDto.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 截单回执 + /// + public class TaskSISubmittedDto + { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 任务主键 + /// + public string TaskId { get; set; } + + /// + /// 主单号 + /// + public string MBlNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 通知接收时间 + /// + public Nullable NoticeDate { get; set; } + + /// + /// 订舱ID + /// + public Nullable BookingId { get; set; } + + /// + /// 提取签单方式名称 + /// + public string TakeIssueTypeName { get; set; } + + /// + /// 签单方式名称 + /// + public string IssueType { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedShowDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedShowDto.cs new file mode 100644 index 00000000..541ac742 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/SISubmitted/TaskSISubmittedShowDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class TaskSISubmittedShowDto: TaskSISubmittedDto + { + /// + /// 是否已完成 + /// + public bool IsComplete { get; set; } + + /// + /// 完成时间 + /// + public Nullable CompleteTime { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index 8b076c9a..5c63cd37 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -1018,7 +1018,54 @@ namespace Myshipping.Application .Map(dest => dest.VGMCutoffTimeTxt, src => src.VGM_CUT_TXT) .Map(dest => dest.ClosingDate, src => src.CLOSING_DATE) .Map(dest => dest.ClosingDateTxt, src => src.CLOSING_DATE_TXT); - } + + config.ForType() + .Map(dest => dest.MBL_NO, src => src.MblNo) + .Map(dest => dest.CARRIER, src => src.Carrier) + .Map(dest => dest.TAKE_ISSUETYPE_NAME, src => src.TakeIssueTypeName) + .Map(dest => dest.ISSUETYPE, src => src.IssueType) + .Map(dest => dest.NOTICE_DATE, src => src.NoticeDate); + + config.ForType() + .Map(dest => dest.MBL_NO, src => src.MBlNo) + .Map(dest => dest.CARRIER, src => src.Carrier) + .Map(dest => dest.NOTICE_DATE, src => src.NoticeDate); + + config.ForType() + .Map(dest => dest.MBL_NO, src => src.MBlNo) + .Map(dest => dest.CARRIER, src => src.Carrier) + .Map(dest => dest.NOTICE_TYPE, src => src.NoticeType) + .Map(dest => dest.NOTICE_TYPE_NAME, src => src.NoticeTypeName) + .Map(dest => dest.NOTICE_DATE, src => src.NoticeDate); + + + config.ForType() + .Map(dest => dest.MBL_NO, src => src.MBlNo) + .Map(dest => dest.CTN_NO, src => src.CtnNo) + .Map(dest => dest.CNEE, src => src.Cnee) + .Map(dest => dest.DISCHARGE_PORT, src => src.DischargePort) + .Map(dest => dest.DISCHARGE_DATE, src => src.DischargeDate) + .Map(dest => dest.OVERDUE_DAYS, src => src.OverdueDays); + + + config.ForType() + .Map(dest => dest.MBlNo, src => src.MBL_NO) + .Map(dest => dest.Carrier, src => src.CARRIER) + .Map(dest => dest.TakeIssueTypeName, src => src.TAKE_ISSUETYPE_NAME) + .Map(dest => dest.IssueType, src => src.ISSUETYPE) + .Map(dest => dest.BookingId, src => src.BOOKING_ID); + + config.ForType() + .Map(dest => dest.MBlNo, src => src.MBL_NO) + .Map(dest => dest.CtnNo, src => src.CTN_NO) + .Map(dest => dest.CNee, src => src.CNEE) + .Map(dest => dest.DischargeDate, src => src.DISCHARGE_DATE) + .Map(dest => dest.DischargePort, src => src.DISCHARGE_PORT) + .Map(dest => dest.OverdueDays, src => src.OVERDUE_DAYS) + .Map(dest => dest.BookingId, src => src.BOOKING_ID) + .Map(dest => dest.IsNotice, src => src.IS_NOTICE) + .Map(dest => dest.SendNoticeDate, src => src.SEND_NOTICE_DATE); + } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderDraftInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderDraftInfo.cs new file mode 100644 index 00000000..36652d94 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderDraftInfo.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// + /// + public class TaskManageOrderDraftInfo + { + /// + /// 主单号 + /// + public string MBlNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 通知接收时间 + /// + public Nullable NoticeDate { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs index 9b5e7763..b046655a 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -219,5 +219,15 @@ namespace Myshipping.Application /// VGM回执 /// public List VGMFeedBack { get; set; } - } + + /// + /// 目的港未提货未返箱 + /// + public TaskManageOrderPODDischargeGateoutFull PODDischargeGateoutFull { get; set; } + + /// + /// 格式单 + /// + public TaskManageOrderDraftInfo DraftInfo { get; set; } +} } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderPODDischargeGateoutFull.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderPODDischargeGateoutFull.cs new file mode 100644 index 00000000..332d257d --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderPODDischargeGateoutFull.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 任务目的港未提货未返箱 + /// + public class TaskManageOrderPODDischargeGateoutFull + { + /// + /// 主单号 + /// + public string MBlNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 通知类型 CHARGE_FULL-卸船未提货,GATEOUT_FULL-提箱未返空箱 + /// + public string NoticeType { get; set; } + + /// + /// 通知类型名称 CHARGE_FULL-卸船未提货,GATEOUT_FULL-提箱未返空箱 + /// + public string NoticeTypeName { get; set; } + + /// + /// 通知接收时间 + /// + public Nullable NoticeDate { get; set; } + + /// + /// 明细 + /// + public List DetailList { get; set; } + } + + /// + /// 任务目的港未提货未返箱明细 + /// + public class TaskManageOrderPODDischargeGateoutFullDetail + { + /// + /// 主单号 + /// + public string MBlNo { get; set; } + + /// + /// 箱号 + /// + public string CtnNo { get; set; } + + /// + /// 收货人 + /// + public string Cnee { get; set; } + + /// + /// 收货人 + /// + public Nullable DischargeDate { get; set; } + + /// + /// 卸货港 + /// + public string DischargePort { get; set; } + + /// + /// 超期天数 + /// + public Nullable OverdueDays { get; set; } + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs index 45e33e12..76583f00 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderSIFeedBackInfo.cs @@ -12,10 +12,26 @@ namespace Myshipping.Application /// public class TaskManageOrderSIFeedBackInfo { + /// + /// 提单号 + /// + public string MblNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 船公司 + /// + public Nullable NoticeDate { get; set; } + /// /// 发货人 /// public string Shipper { get; set; } + /// /// 收货人 /// @@ -50,6 +66,13 @@ namespace Myshipping.Application /// /// TELEX public string IssueType { get; set; } + + /// + /// 提取签单方式 + /// + /// TELEX + public string TakeIssueTypeName { get; set; } + /// /// 装货港代码 /// diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageCutDateChangeService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageCutDateChangeService.cs index 037194af..3b61f13f 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageCutDateChangeService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageCutDateChangeService.cs @@ -11,15 +11,30 @@ namespace Myshipping.Application /// /// 获取截止时间变更详情 /// - /// 截止时间主键 + /// 截止时间变更主键 /// 返回回执 Task> GetInfo(string pkId); /// /// 通过任务主键获取截止时间变更详情 /// - /// 截止时间任务主键 + /// 截止时间变更任务主键 /// 返回回执 Task> GetInfoByTaskId(string taskPkId); + + /// + /// 重新处理截止时间变更任务 + /// 对未匹配订舱订单的任务记录,重新对应订单订单 + /// + /// 截止时间变更任务主键 + /// 返回回执 + Task SearchAndConnectBookingInfo(string taskPkId); + + /// + /// 推送及时消息 + /// + /// 截止时间变更任务主键 + /// 返回回执 + Task SendInstantMessage(string taskPkId); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManagePODDischargeGateoutFullService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManagePODDischargeGateoutFullService.cs new file mode 100644 index 00000000..a7d7ea23 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManagePODDischargeGateoutFullService.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Service.TaskManagePlat.Interface +{ + /// + /// 任务目的港未提货未返箱 + /// + public interface ITaskManagePODDischargeGateoutFullService + { + /// + /// 获取目的港未提货未返箱详情 + /// + /// 目的港未提货未返箱主键 + /// 返回回执 + Task> GetInfo(string pkId); + + /// + /// 通过任务主键获取目的港未提货未返箱详情 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + Task> GetInfoByTaskId(string taskPkId); + + /// + /// 推送及时消息 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + Task SendInstantMessage(string taskPkId); + + /// + /// 重新处理目的港未提货未返箱任务 + /// 对未匹配目的港未提货未返箱的任务记录重新对应订单 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + Task SearchAndConnectBookingInfo(string taskPkId); + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs new file mode 100644 index 00000000..126f38c7 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 截单回执任务 + /// + public interface ITaskManageSISubmittedService + { + /// + /// 获取截单回执详情 + /// + /// 截单回执主键 + /// 返回回执 + Task GetInfo(string pkId); + + /// + /// 通过任务主键获取截单回执详情 + /// + /// 截单回执任务主键 + /// 返回回执 + Task GetInfoByTaskId(string taskPkId); + + /// + /// 同步更新订舱订单的截单状态 + /// + /// 截单回执任务主键 + /// 返回回执 + Task SyncBookingSIStatus(string taskPkId); + + /// + /// 重新处理截单任务 + /// 对未匹配订舱订单的任务记录重新对应订单订单 + /// + /// 截单回执任务主键 + /// 返回回执 + Task SearchAndConnectBookingInfo(string taskPkId); + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageCutDateChangeService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageCutDateChangeService.cs index 70e8e833..f46e5172 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageCutDateChangeService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageCutDateChangeService.cs @@ -4,6 +4,11 @@ using Mapster; using Microsoft.AspNetCore.Mvc; using Myshipping.Application.Entity; using Myshipping.Core; +using Myshipping.Core.Helper; +using Npoi.Mapper; +using NPOI.OpenXmlFormats.Wordprocessing; +using Org.BouncyCastle.Crypto; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -21,21 +26,24 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskCutDateChangeInfoRepository; private readonly SqlSugarRepository _taskCutDateChangeDetailInfoRepository; private readonly SqlSugarRepository _taskBaseRepository; + private readonly SqlSugarRepository _bookingOrderRepository; public TaskManageCutDateChangeService(SqlSugarRepository taskCutDateChangeInfoRepository, SqlSugarRepository taskCutDateChangeDetailInfoRepository, - SqlSugarRepository taskBaseRepository) + SqlSugarRepository taskBaseRepository, + SqlSugarRepository bookingOrderRepository) { _taskCutDateChangeInfoRepository = taskCutDateChangeInfoRepository; _taskCutDateChangeDetailInfoRepository = taskCutDateChangeDetailInfoRepository; _taskBaseRepository = taskBaseRepository; + _bookingOrderRepository = bookingOrderRepository; } #region 获取截止时间变更详情 /// /// 获取截止时间变更详情 /// - /// 截止时间主键 + /// 截止时间变更主键 /// 返回回执 [HttpGet("/TaskManageCutDate/GetInfo")] public async Task> GetInfo(string pkId) @@ -56,6 +64,8 @@ namespace Myshipping.Application { TaskCutDateChangeShowDto model = p.Adapt(); + model.NoticeDate = cutChangeOrder.NOTICE_DATE; + model.Carrier = cutChangeOrder.CARRIER; return model; }).ToList(); @@ -69,7 +79,7 @@ namespace Myshipping.Application /// /// 通过任务主键获取截止时间变更详情 /// - /// 截止时间任务主键 + /// 截止时间变更任务主键 /// 返回回执 [HttpGet("/TaskManageCutDate/GetInfoByTaskId")] public async Task> GetInfoByTaskId(string taskPkId) @@ -95,6 +105,8 @@ namespace Myshipping.Application { TaskCutDateChangeShowDto model = p.Adapt(); + model.NoticeDate = cutChangeOrder.NOTICE_DATE; + model.Carrier = cutChangeOrder.CARRIER; return model; }).ToList(); @@ -103,5 +115,149 @@ namespace Myshipping.Application return list; } #endregion + + #region 重新处理截止时间变更任务 + /// + /// 重新处理截止时间变更任务 + /// 对未匹配订舱订单的任务记录,重新对应订单订单 + /// + /// 截止时间变更任务主键 + /// 返回回执 + public async Task SearchAndConnectBookingInfo(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var cutDateChange = _taskCutDateChangeInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (cutDateChange == null) + throw Oops.Oh($"截止时间变更主键{taskPkId}无法获取业务信息"); + + var detailList = _taskCutDateChangeDetailInfoRepository.AsQueryable() + .Where(a => a.P_ID == cutDateChange.PK_ID).ToList(); + + //如果都有订单订单记录,则提示错误不进行对应 + if (!detailList.Any(t => !t.BOOKING_ID.HasValue)) + { + throw Oops.Oh($"当前截止时间变更已有匹配的订舱订单,不能执行操作"); + } + + var mblList = detailList.Select(a => a.MBL_NO).Distinct().ToList(); + + var bookingList = _bookingOrderRepository.AsQueryable().Filter(null, true) + .Where(a => mblList.Contains(a.MBLNO) && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)).ToList(); + + if (bookingList.Count == 0) + throw Oops.Oh($"提单号未提取有效的订舱订单"); + + List msgList = new List(); + + detailList.ForEach(async t => + { + //只处理没有订舱ID的记录 + if (!t.BOOKING_ID.HasValue) + { + var currBook = bookingList.FirstOrDefault(p => p.MBLNO == t.MBL_NO); + + if (currBook != null) + { + t.BOOKING_ID = currBook.Id; + t.UpdatedUserId = UserManager.UserId; + t.UpdatedUserName = UserManager.Name; + + //更新任务BC + await _taskCutDateChangeDetailInfoRepository.AsUpdateable(t).UpdateColumns(it => new + { + it.BOOKING_ID, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName + + }).ExecuteCommandAsync(); + } + else + { + msgList.Add(t.MBL_NO); + } + } + }); + + if (msgList.Count > 0) + throw Oops.Oh($"提单号{(string.Join(",", msgList.ToArray()))}未提取有效的订舱订单"); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion + + #region 推送及时消息 + /// + /// 推送及时消息 + /// + /// 截止时间任务主键 + /// 返回回执 + public async Task SendInstantMessage(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var cutDateChange = _taskCutDateChangeInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (cutDateChange == null) + throw Oops.Oh($"截止时间变更主键{taskPkId}无法获取业务信息"); + + var detailList = _taskCutDateChangeDetailInfoRepository.AsQueryable() + .Where(a => a.P_ID == cutDateChange.PK_ID).ToList(); + + //如果都有订单订单记录,则提示错误不进行对应 + if (!detailList.Any(t => t.BOOKING_ID.HasValue)) + { + throw Oops.Oh($"当前截止时间变更没有匹配的订舱订单,不能执行操作"); + } + + var ids = detailList.Where(a => a.BOOKING_ID.HasValue).Select(a => a.BOOKING_ID.Value).ToList(); + + var bookingList = _bookingOrderRepository.AsQueryable().Filter(null, true) + .Where(a => ids.Contains(a.Id) && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)).ToList(); + + if (bookingList.Count == 0) + throw Oops.Oh($"提单号未提取有效的订舱订单"); + + Dictionary> msgList = new Dictionary>(); + + msgList = bookingList.GroupBy(a => a.OP).Select(a => + { + var currList = a.ToList(); + + return new { Key = a.Key, list = currList.Select(a => a.MBLNO).ToList() }; + }).ToDictionary(a => a.Key, b => b.list); + + if (msgList.Count > 0) + { + msgList.ForEach(t => + { + DingTalkGroupHelper.SendDingTalkGroupMessage("KangqianNotify", "截止时间变更消息", $"@{t.Key} 收到如下提单号{(string.Join(",",t.Value.ToArray()))}的截止时间变更消息"); + }); + } + + if(detailList.Any(t=>!t.BOOKING_ID.HasValue)) + throw Oops.Oh($"提单号{(string.Join(",", detailList.Where(t => !t.BOOKING_ID.HasValue).Select(t=>t.MBL_NO).ToArray()))}未提取有效的订舱订单"); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs new file mode 100644 index 00000000..691cff57 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs @@ -0,0 +1,278 @@ +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Myshipping.Application.Entity; +using Myshipping.Application.Service.TaskManagePlat.Interface; +using Myshipping.Core; +using Myshipping.Core.Helper; +using Npoi.Mapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 任务目的港未提货未返箱 + /// + [ApiDescriptionSettings("Application", Name = "PODDischargeGateoutFull", Order = 10)] + public class TaskManagePODDischargeGateoutFullService: ITaskManagePODDischargeGateoutFullService, IDynamicApiController + { + private readonly SqlSugarRepository _taskPODDischargeGateoutFullInfoRep; + private readonly SqlSugarRepository _taskPODDischargeGateoutFullDetailInfoRep; + private readonly SqlSugarRepository _taskBaseRepository; + private readonly ILogger _logger; + private readonly SqlSugarRepository _bookingOrderRepository; + + public TaskManagePODDischargeGateoutFullService(ILogger logger, + SqlSugarRepository taskPODDischargeGateoutFullInfoRep, + SqlSugarRepository taskPODDischargeGateoutFullDetailInfoRep, + SqlSugarRepository taskBaseRepository, + SqlSugarRepository bookingOrderRepository) + { + _taskPODDischargeGateoutFullInfoRep = taskPODDischargeGateoutFullInfoRep; + _taskBaseRepository = taskBaseRepository; + _taskPODDischargeGateoutFullDetailInfoRep = taskPODDischargeGateoutFullDetailInfoRep; + _logger = logger; + _bookingOrderRepository = bookingOrderRepository; + } + + #region 获取目的港未提货未返箱详情 + /// + /// 获取目的港未提货未返箱详情 + /// + /// 目的港未提货未返箱主键 + /// 返回回执 + [HttpGet("/PODDischargeGateoutFull/GetInfo")] + public async Task> GetInfo(string pkId) + { + List list = new List(); + + var dischargeFull = _taskPODDischargeGateoutFullInfoRep.AsQueryable() + .First(a => a.PK_ID == pkId); + + if (dischargeFull == null) + throw Oops.Oh($"目的港未提货未返箱主键{pkId}无法获取业务信息"); + + var dischargeFullDetail = _taskPODDischargeGateoutFullDetailInfoRep.AsQueryable() + .Where(a => a.P_ID == dischargeFull.PK_ID).ToList(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == dischargeFull.TASK_ID); + + if (taskBase == null) + throw Oops.Oh($"任务主键无法获取业务信息"); + + list = dischargeFullDetail.Select(x => { + var dto = x.Adapt(); + + dto.PKId = dischargeFull.PK_ID; + dto.TaskId = dischargeFull.TASK_ID; + dto.IsComplete = taskBase.IS_COMPLETE == 1 ? true : false; + dto.CompleteTime = taskBase.COMPLETE_DATE; + dto.NoticeType = dischargeFull.NOTICE_TYPE; + dto.NoticeTypeName = dischargeFull.NOTICE_TYPE_NAME; + + return dto; + }).ToList(); + + return list; + } + #endregion + + #region 通过任务主键获取目的港未提货未返箱详情 + /// + /// 通过任务主键获取目的港未提货未返箱详情 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + [HttpGet("/PODDischargeGateoutFull/GetInfoByTaskId")] + public async Task> GetInfoByTaskId(string taskPkId) + { + List list = new List(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var dischargeFull = _taskPODDischargeGateoutFullInfoRep.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (dischargeFull == null) + throw Oops.Oh($"目的港未提货未返箱主键{taskPkId}无法获取业务信息"); + + var dischargeFullDetail = _taskPODDischargeGateoutFullDetailInfoRep.AsQueryable() + .Where(a => a.P_ID == dischargeFull.PK_ID).ToList(); + + list = dischargeFullDetail.Select(x => { + var dto = x.Adapt(); + + dto.PKId = dischargeFull.PK_ID; + dto.TaskId = dischargeFull.TASK_ID; + dto.IsComplete = taskBase.IS_COMPLETE == 1 ? true : false; + dto.CompleteTime = taskBase.COMPLETE_DATE; + dto.NoticeType = dischargeFull.NOTICE_TYPE; + dto.NoticeTypeName = dischargeFull.NOTICE_TYPE_NAME; + + return dto; + }).ToList(); + + return list; + } + #endregion + + #region 推送及时消息 + /// + /// 推送及时消息 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + [HttpGet("/PODDischargeGateoutFull/SendInstantMessage")] + public async Task SendInstantMessage(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var dischargeFull = _taskPODDischargeGateoutFullInfoRep.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (dischargeFull == null) + throw Oops.Oh($"目的港未提货未返箱主键{taskPkId}无法获取业务信息"); + + var detailList = _taskPODDischargeGateoutFullDetailInfoRep.AsQueryable() + .Where(a => a.P_ID == dischargeFull.PK_ID).ToList(); + + //如果都有订单订单记录,则提示错误不进行对应 + if (!detailList.Any(t => t.BOOKING_ID.HasValue)) + { + throw Oops.Oh($"当前目的港未提货未返箱没有匹配的订舱订单,不能执行操作"); + } + + var ids = detailList.Where(a => a.BOOKING_ID.HasValue).Select(a => a.BOOKING_ID.Value).ToList(); + + var bookingList = _bookingOrderRepository.AsQueryable().Filter(null, true) + .Where(a => ids.Contains(a.Id) && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)).ToList(); + + if (bookingList.Count == 0) + throw Oops.Oh($"提单号未提取有效的订舱订单"); + + Dictionary> msgList = new Dictionary>(); + + msgList = bookingList.GroupBy(a => a.OP).Select(a => + { + var currList = a.ToList(); + + return new { Key = a.Key, list = currList.Select(a => a.MBLNO).ToList() }; + }).ToDictionary(a => a.Key, b => b.list); + + if (msgList.Count > 0) + { + msgList.ForEach(t => + { + string title = "目的港未提货消息"; + + if (dischargeFull.NOTICE_TYPE == "GATEOUT_FULL") + title = "提箱未返空箱消息"; + + DingTalkGroupHelper.SendDingTalkGroupMessage("KangqianNotify", title, $"@{t.Key} 收到如下提单号{(string.Join(",", t.Value.ToArray()))}的{title}消息"); + }); + } + + if (detailList.Any(t => !t.BOOKING_ID.HasValue)) + throw Oops.Oh($"提单号{(string.Join(",", detailList.Where(t => !t.BOOKING_ID.HasValue).Select(t => t.MBL_NO).ToArray()))}未提取有效的订舱订单"); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion + + #region 重新处理目的港未提货未返箱任务 + /// + /// 重新处理目的港未提货未返箱任务 + /// 对未匹配目的港未提货未返箱的任务记录重新对应订单 + /// + /// 目的港未提货未返箱任务主键 + /// 返回回执 + [HttpGet("/PODDischargeGateoutFull/SearchAndConnectBookingInfo")] + public async Task SearchAndConnectBookingInfo(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var dischargeFull = _taskPODDischargeGateoutFullInfoRep.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (dischargeFull == null) + throw Oops.Oh($"目的港未提货未返箱主键{taskPkId}无法获取业务信息"); + + var detailList = _taskPODDischargeGateoutFullDetailInfoRep.AsQueryable() + .Where(a => a.P_ID == dischargeFull.PK_ID).ToList(); + + //如果都有订单订单记录,则提示错误不进行对应 + if (!detailList.Any(t => !t.BOOKING_ID.HasValue)) + { + throw Oops.Oh($"目的港未提货未返箱已有匹配的订舱订单,不能执行操作"); + } + + var mblList = detailList.Select(a => a.MBL_NO).Distinct().ToList(); + + var bookingList = _bookingOrderRepository.AsQueryable().Filter(null, true) + .Where(a => mblList.Contains(a.MBLNO) && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)).ToList(); + + if (bookingList.Count == 0) + throw Oops.Oh($"提单号未提取有效的订舱订单"); + + List msgList = new List(); + + detailList.ForEach(async t => + { + //只处理没有订舱ID的记录 + if (!t.BOOKING_ID.HasValue) + { + var currBook = bookingList.FirstOrDefault(p => p.MBLNO == t.MBL_NO); + + if (currBook != null) + { + t.BOOKING_ID = currBook.Id; + t.UpdatedUserId = UserManager.UserId; + t.UpdatedUserName = UserManager.Name; + + //更新任务BC + await _taskPODDischargeGateoutFullDetailInfoRep.AsUpdateable(t).UpdateColumns(it => new + { + it.BOOKING_ID, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName + + }).ExecuteCommandAsync(); + } + else + { + msgList.Add(t.MBL_NO); + } + } + }); + + if (msgList.Count > 0) + throw Oops.Oh($"提单号{(string.Join(",", msgList.ToArray()))}未提取有效的订舱订单"); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs new file mode 100644 index 00000000..5bfe9af8 --- /dev/null +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs @@ -0,0 +1,219 @@ +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Furion.JsonSerialization; +using ICSharpCode.SharpZipLib.Zip; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Myshipping.Application.Entity; +using Myshipping.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 截单回执 + /// + [ApiDescriptionSettings("Application", Name = "TaskManageSISubmitted", Order = 10)] + public class TaskManageSISubmittedService : ITaskManageSISubmittedService, IDynamicApiController + { + private readonly SqlSugarRepository _taskSISubmittedRepository; + private readonly SqlSugarRepository _taskBaseRepository; + private readonly SqlSugarRepository _bookingOrderRepository; + private readonly ILogger _logger; + private readonly IBookingValueAddedService _bookingValueAddedService; + + public TaskManageSISubmittedService(ILogger logger, + SqlSugarRepository taskSISubmittedRepository, + SqlSugarRepository taskBaseRepository, + SqlSugarRepository bookingOrderRepository, + IBookingValueAddedService bookingValueAddedService) + { + _logger = logger; + _taskSISubmittedRepository = taskSISubmittedRepository; + _taskBaseRepository = taskBaseRepository; + _bookingOrderRepository = bookingOrderRepository; + _bookingValueAddedService = bookingValueAddedService; + } + + #region 获取截单回执详情 + /// + /// 获取截单回执详情 + /// + /// 截单回执主键 + /// 返回回执 + [HttpGet("/TaskManageSISubmitted/GetInfo")] + public async Task GetInfo(string pkId) + { + TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto(); + + var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.PK_ID == pkId); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{pkId}无法获取业务信息"); + + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == siSubmitted.TASK_ID); + + if (taskBase == null) + throw Oops.Oh($"任务主键无法获取业务信息"); + + dto = siSubmitted.Adapt(); + + if (dto != null) + { + dto.IsComplete = taskBase.IS_COMPLETE == 1 ? true : false; + dto.CompleteTime = taskBase.COMPLETE_DATE; + } + + return dto; + } + #endregion + + #region 通过任务主键获取截单回执详情 + /// + /// 通过任务主键获取截单回执详情 + /// + /// 截单回执任务主键 + /// 返回回执 + [HttpGet("/TaskManageSISubmitted/GetInfoByTaskId")] + public async Task GetInfoByTaskId(string taskPkId) + { + TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{taskPkId}无法获取业务信息"); + + dto = siSubmitted.Adapt(); + + if (dto != null) + { + dto.IsComplete = taskBase.IS_COMPLETE == 1 ? true : false; + dto.CompleteTime = taskBase.COMPLETE_DATE; + } + + return dto; + } + #endregion + + #region 同步更新订舱订单的截单状态 + /// + /// 同步更新订舱订单的截单状态 + /// + /// 截单回执任务主键 + /// 返回回执 + [HttpGet("/TaskManageSISubmitted/SyncBookingSIStatus")] + public async Task SyncBookingSIStatus(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{taskPkId}无法获取业务信息"); + + if(!siSubmitted.BOOKING_ID.HasValue|| siSubmitted.BOOKING_ID.Value < 1) + throw Oops.Oh($"当前截单回执未匹配到对应的订舱订单,请重对应截单"); + + var bookingOrder = _bookingOrderRepository.AsQueryable() + .FirstAsync(a => a.Id == siSubmitted.BOOKING_ID.Value); + + if (bookingOrder == null) + throw Oops.Oh($"订舱订单信息获取失败"); + + //推送截单货物状态 + var pushModel = new ModifyServiceProjectStatusDto + { + BookingId = bookingOrder.Id, + SourceType = TrackingSourceTypeEnum.AUTO, + StatusCodes = new List { + new ModifyServiceProjectStatusDetailDto { StatusCode = "JD" } } + }; + + if (siSubmitted.NOTICE_DATE.HasValue) + { + pushModel.StatusCodes[0].SetActDate = siSubmitted.NOTICE_DATE.Value; + } + + var saveStatusRlt = await _bookingValueAddedService.SaveServiceStatus(pushModel); + + _logger.LogInformation("请求JSON={json} 异步推送服务状态[JD 截单]完成,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt)); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion + + #region 重新处理截单任务 + /// + /// 重新处理截单任务 + /// 对未匹配订舱订单的任务记录重新对应订单订单 + /// + /// 截单回执任务主键 + /// 返回回执 + [HttpGet("/TaskManageSISubmitted/SearchAndConnectBookingInfo")] + public async Task SearchAndConnectBookingInfo(string taskPkId) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + + if (taskBase == null) + throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); + + var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{taskPkId}无法获取业务信息"); + + if (siSubmitted.BOOKING_ID.HasValue) + throw Oops.Oh($"当前截单回执已有匹配的订舱订单"); + + string mblNo = siSubmitted.MBL_NO.ToUpper().Trim(); + + var bookingInfo = _bookingOrderRepository.AsQueryable().Filter(null, true) + .FirstAsync(a => a.MBLNO == mblNo && a.IsDeleted == false && (a.ParentId == null || a.ParentId == 0)); + + if(bookingInfo == null) + throw Oops.Oh($"提单号{mblNo}未提取有效的订舱订单"); + + siSubmitted.BOOKING_ID = bookingInfo.Id; + siSubmitted.UpdatedUserId = UserManager.UserId; + siSubmitted.UpdatedUserName = UserManager.Name; + + //更新任务BC + await _taskSISubmittedRepository.AsUpdateable(siSubmitted).UpdateColumns(it => new + { + it.BOOKING_ID, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName + + }).ExecuteCommandAsync(); + + result.succ = true; + result.msg = "成功"; + + return result; + } + #endregion + } +} diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 5bdaf87a..70b97b49 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -74,7 +74,7 @@ namespace Myshipping.Application public class TaskManageService : ITaskManageService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _taskBaseInfoRepository; - private readonly SqlSugarRepository _taskSIFeedBackInfoRepository; + private readonly SqlSugarRepository _taskSISubmittedRepository; private readonly SqlSugarRepository _taskSIFeedBackContaInfoRepository; private readonly SqlSugarRepository _taskBillFeeDetailInfoRepository; private readonly SqlSugarRepository _taskFileInfoRepository; @@ -109,6 +109,10 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskRollingNominationInfoRepository; private readonly SqlSugarRepository _taskRollingNominationShipInfoRepository; private readonly SqlSugarRepository _taskRollingNominationDetailInfoRepository; + private readonly SqlSugarRepository _taskDraftInfoRepository; + private readonly SqlSugarRepository _taskPODDischargeGateoutFullInfoRepository; + private readonly SqlSugarRepository _taskPODDischargeGateoutFullDetailInfoRepository; + private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly ISysCacheService _cache; @@ -132,7 +136,7 @@ namespace Myshipping.Application const int LARA_PARER_DRAFT_VAR = 3; public TaskManageService(SqlSugarRepository taskBaseInfoRepository, - SqlSugarRepository taskSIFeedBackInfoRepository, + SqlSugarRepository taskSISubmittedRepository, SqlSugarRepository taskSIFeedBackContaInfoRepository, SqlSugarRepository taskBillFeeDetailInfoRepository, SqlSugarRepository taskFileInfoRepository, @@ -164,6 +168,9 @@ namespace Myshipping.Application SqlSugarRepository taskRollingNominationDetailInfoRepository, SqlSugarRepository bookingCtnVGMRepository, SqlSugarRepository bookingSlotBaseRepository, + SqlSugarRepository taskDraftInfoRepository, + SqlSugarRepository taskPODDischargeGateoutFullInfoRepository, + SqlSugarRepository taskPODDischargeGateoutFullDetailInfoRepository, INamedServiceProvider namedBookingOrderServiceProvider, IDjyWebsiteAccountConfigService webAccountConfig, ISysCacheService cache, @@ -174,7 +181,7 @@ namespace Myshipping.Application ILogger logger) { _taskBaseInfoRepository = taskBaseInfoRepository; - _taskSIFeedBackInfoRepository = taskSIFeedBackInfoRepository; + _taskSISubmittedRepository = taskSISubmittedRepository; _taskSIFeedBackContaInfoRepository = taskSIFeedBackContaInfoRepository; _taskBillFeeDetailInfoRepository = taskBillFeeDetailInfoRepository; _taskFileInfoRepository = taskFileInfoRepository; @@ -219,6 +226,9 @@ namespace Myshipping.Application _logger = logger; _bookingSlotBaseRepository = bookingSlotBaseRepository; + _taskDraftInfoRepository = taskDraftInfoRepository; + _taskPODDischargeGateoutFullInfoRepository = taskPODDischargeGateoutFullInfoRepository; + _taskPODDischargeGateoutFullDetailInfoRepository = taskPODDischargeGateoutFullDetailInfoRepository; } #region 创建任务 @@ -565,21 +575,22 @@ namespace Myshipping.Application if (info.Main.SIFeedBack == null) throw Oops.Oh($"任务类型={info.Main.TaskType.ToString()} SIFeedBack信息必传"); - TaskSIFeedBackInfo taskSIFeedBackInfo = info.Main.SIFeedBack.Adapt(); + TaskSISubmitted taskSISubmitted = info.Main.SIFeedBack.Adapt(); - taskSIFeedBackInfo.PK_ID = IDGen.NextID().ToString(); - taskSIFeedBackInfo.TASK_PKID = taskInfo.PK_ID; + taskSISubmitted.PK_ID = IDGen.NextID().ToString(); + taskSISubmitted.TASK_ID = taskInfo.PK_ID; - taskSIFeedBackInfo.CreatedTime = taskInfo.CreatedTime; - taskSIFeedBackInfo.UpdatedTime = taskInfo.CreatedTime; + taskSISubmitted.CreatedTime = taskInfo.CreatedTime; + taskSISubmitted.UpdatedTime = taskInfo.CreatedTime; - taskSIFeedBackInfo.CreatedUserId = taskInfo.CreatedUserId; - taskSIFeedBackInfo.CreatedUserName = taskInfo.CreatedUserName; - taskSIFeedBackInfo.TenantId = taskInfo.TenantId; - taskSIFeedBackInfo.TenantName = taskInfo.TenantName; + taskSISubmitted.CreatedUserId = taskInfo.CreatedUserId; + taskSISubmitted.CreatedUserName = taskInfo.CreatedUserName; + taskSISubmitted.TenantId = taskInfo.TenantId; + taskSISubmitted.TenantName = taskInfo.TenantName; - await _taskSIFeedBackInfoRepository.InsertAsync(taskSIFeedBackInfo); + await _taskSISubmittedRepository.InsertAsync(taskSISubmitted); + /* //SI反馈箱信息入库 if (info.Main.SIFeedBack.ContaList != null && info.Main.SIFeedBack.ContaList.Count > 0) { @@ -600,7 +611,7 @@ namespace Myshipping.Application await _taskSIFeedBackContaInfoRepository.InsertAsync(contaInfo); }); - } + }*/ } #endregion @@ -1234,7 +1245,66 @@ namespace Myshipping.Application #endregion #region DRAFT转发客户 + if (info.Main.TaskType == TaskBaseTypeEnum.DRAFT) + { + TaskDraftInfo taskDraftInfo = info.Main.DraftInfo.Adapt(); + + taskDraftInfo.PK_ID = IDGen.NextID().ToString(); + taskDraftInfo.TASK_ID = taskInfo.PK_ID; + + taskDraftInfo.CreatedTime = taskInfo.CreatedTime; + taskDraftInfo.UpdatedTime = taskInfo.CreatedTime; + + taskDraftInfo.CreatedUserId = taskInfo.CreatedUserId; + taskDraftInfo.CreatedUserName = taskInfo.CreatedUserName; + taskDraftInfo.TenantId = taskInfo.TenantId; + taskDraftInfo.TenantName = taskInfo.TenantName; + + await _taskDraftInfoRepository.InsertAsync(taskDraftInfo); + } + #endregion + + #region 任务目的港未提货/任务目的港提货未返空 + if (info.Main.TaskType == TaskBaseTypeEnum.POD_DISCHARGE_FULL) + { + TaskPODDischargeGateoutFullInfo dischargeGateout = info.Main.PODDischargeGateoutFull.Adapt(); + + dischargeGateout.PK_ID = IDGen.NextID().ToString(); + dischargeGateout.TASK_ID = taskInfo.PK_ID; + dischargeGateout.CreatedTime = taskInfo.CreatedTime; + dischargeGateout.UpdatedTime = taskInfo.CreatedTime; + + dischargeGateout.CreatedUserId = taskInfo.CreatedUserId; + dischargeGateout.CreatedUserName = taskInfo.CreatedUserName; + dischargeGateout.TenantId = taskInfo.TenantId; + dischargeGateout.TenantName = taskInfo.TenantName; + + await _taskPODDischargeGateoutFullInfoRepository.InsertAsync(dischargeGateout); + + //明细入库 + if (info.Main.PODDischargeGateoutFull.DetailList != null + && info.Main.PODDischargeGateoutFull.DetailList.Count > 0) + { + info.Main.PODDischargeGateoutFull.DetailList.ForEach(async ctn => + { + var detailInfo = ctn.Adapt(); + + detailInfo.PK_ID = IDGen.NextID().ToString(); + detailInfo.P_ID = dischargeGateout.PK_ID; + + detailInfo.CreatedTime = taskInfo.CreatedTime; + detailInfo.UpdatedTime = taskInfo.CreatedTime; + + detailInfo.CreatedUserId = taskInfo.CreatedUserId; + detailInfo.CreatedUserName = taskInfo.CreatedUserName; + detailInfo.TenantId = taskInfo.TenantId; + detailInfo.TenantName = taskInfo.TenantName; + + await _taskPODDischargeGateoutFullDetailInfoRepository.InsertAsync(detailInfo); + }); + } + } #endregion if (info.Main.SerialMsgInfo != null) @@ -4162,7 +4232,7 @@ namespace Myshipping.Application model.TaskId = taskInfo.PK_ID; - var siFeedBackList = _taskSIFeedBackInfoRepository.EntityContext.Queryable() + var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable() .InnerJoin((si, ctn) => si.PK_ID == ctn.P_PKID) .Where((si, ctn) => si.TASK_PKID == model.TaskId && si.TenantId == UserManager.TENANT_ID) .Select((si, ctn) => new { si = si, ctn = ctn }).ToList();