diff --git a/Myshipping.Application/Enum/TaskShareLinkStatusEnum.cs b/Myshipping.Application/Enum/TaskShareLinkStatusEnum.cs index d894f1f7..5281ef12 100644 --- a/Myshipping.Application/Enum/TaskShareLinkStatusEnum.cs +++ b/Myshipping.Application/Enum/TaskShareLinkStatusEnum.cs @@ -34,6 +34,12 @@ namespace Myshipping.Application /// 重复KEY被取消 /// [Description("重复KEY被取消")] - REPEAT_KEY + REPEAT_KEY, + + /// + /// 已完结 + /// + [Description("已完结")] + COMPLETE, } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationShowDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationShowDto.cs index 3af02262..984731f9 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationShowDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationShowDto.cs @@ -51,12 +51,12 @@ namespace Myshipping.Application /// /// 原船记录 /// - public TaskRollingNominationShipDto From { get; set; } + public List From { get; set; } /// /// 换船记录 /// - public TaskRollingNominationShipDto To { get; set; } + public List To { get; set; } /// /// 单票汇总列表 diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/ShareLink/PushShareLinkFeedBackDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/ShareLink/PushShareLinkFeedBackDto.cs index a2f4217d..61db3150 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/ShareLink/PushShareLinkFeedBackDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/ShareLink/PushShareLinkFeedBackDto.cs @@ -25,5 +25,10 @@ namespace Myshipping.Application /// 用户意见内容 /// public string userOpinionTxt { get; set; } + + /// + /// 是否人工触发(默认true) true-人工触发 false-定时触发 + /// + public bool isManual { get; set; } = true; } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs index 29605999..04a3271e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs @@ -174,17 +174,17 @@ namespace Myshipping.Application shipList = _taskRollingNominationShipInfoRepository.AsQueryable() .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && !a.IsDeleted).ToList(); - var fromEntity = shipList.FirstOrDefault(a => - a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)); + var fromEntity = shipList.Where(a => + a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)).ToList(); - if (fromEntity != null) - model.From = fromEntity.Adapt(); + if (fromEntity.Count > 0) + model.From = fromEntity.Select(p=>p.Adapt()).ToList(); - var toEntity = shipList.FirstOrDefault(a => - a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase)); + var toEntity = shipList.Where(a => + a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase)).ToList(); - if (toEntity != null) - model.To = toEntity.Adapt(); + if (toEntity.Count > 0) + model.To = toEntity.Select(p => p.Adapt()).ToList(); var withDispatchList = _taskRollingNominationDetailInfoRepository.AsQueryable().Filter(null, true) @@ -193,6 +193,20 @@ namespace Myshipping.Application && (string.IsNullOrWhiteSpace(dispatch.PK_ID) || (!string.IsNullOrWhiteSpace(dispatch.PK_ID) && dispatch.IsDeleted == false))) .Select((detail, dispatch) => new { Detail = detail, Dispatch = dispatch }).ToList(); + if (withDispatchList.Any(p => p.Detail != null)) + { + var detailList = + withDispatchList.Where(p => p.Detail != null) + .Select(p => p.Detail).ToList(); + + var portList = detailList.Where(p => !string.IsNullOrWhiteSpace(p.PLACEOF_RECEIPT)) + .Select(p => p.PLACEOF_RECEIPT?.Trim()).Distinct().ToList(); + + model.From = model.From.Where(p=> portList.Any(p2=>p2.Equals(p.Port?.Trim()))).ToList(); + + model.To = model.To.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList(); + } + List> tuples = new List>(); if (withDispatchList.Any(a => diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageShareLinkService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageShareLinkService.cs index 84bfa62a..acdc2943 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageShareLinkService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageShareLinkService.cs @@ -7,11 +7,13 @@ using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.StaticFiles.Infrastructure; using Microsoft.Extensions.Logging; using Myshipping.Application.ConfigOption; using Myshipping.Application.Entity; using Myshipping.Core; using Myshipping.Core.Service; +using NPOI.Util; using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; @@ -503,19 +505,23 @@ namespace Myshipping.Application.Service.TaskManagePlat }; var shipList = _taskRollingNominationShipInfoRepository.AsQueryable().Filter(null, true) - .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && !a.IsDeleted).ToList(); + .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && a.IsDeleted == false).ToList(); - var fromEntity = shipList.FirstOrDefault(a => - a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)); + if (shipList.Count == 0) + shipList = _taskRollingNominationShipInfoRepository.AsQueryable().Filter(null, true) + .Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 0 && a.IsDeleted == false).ToList(); - if (fromEntity != null) - model.From = fromEntity.Adapt(); + var fromEntity = shipList.Where(a => + a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase)).ToList(); - var toEntity = shipList.FirstOrDefault(a => - a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase)); + if (fromEntity.Count > 0) + model.From = fromEntity.Select(p => p.Adapt()).ToList(); - if (toEntity != null) - model.To = toEntity.Adapt(); + var toEntity = shipList.Where(a => + a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase)).ToList(); + + if (toEntity.Count > 0) + model.To = toEntity.Select(p => p.Adapt()).ToList(); List> tuples = new List>(); @@ -526,6 +532,13 @@ namespace Myshipping.Application.Service.TaskManagePlat model.TotalLoadCtnStat = string.Join(",", model.LoadDetailList.GroupBy(x => x.CtnAll) .Select(x => $"{x.Key}*{x.Sum(t => t.CtnNum)}").ToArray()); + + var portList = model.LoadDetailList.Where(p => !string.IsNullOrWhiteSpace(p.PlaceOfReceipt)) + .Select(p => p.PlaceOfReceipt?.Trim()).Distinct().ToList(); + + model.From = model.From.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList(); + + model.To = model.To.Where(p => portList.Any(p2 => p2.Equals(p.Port?.Trim()))).ToList(); } } catch (Exception ex) @@ -551,6 +564,7 @@ namespace Myshipping.Application.Service.TaskManagePlat /* 1、验证shareKey是否有效。 2、查看分享记录找到对应的预甩调度详情。 + 3、用户已经提交过意见的不能再发起 3、更新用户反馈意见。 4、返回成功 */ @@ -568,9 +582,18 @@ namespace Myshipping.Application.Service.TaskManagePlat if (shareEntity == null) throw Oops.Oh($"链接分享不存在"); + if(shareEntity.STATUS != TaskShareLinkStatusEnum.ACTIVE.ToString()) + { + if(shareEntity.STATUS != TaskShareLinkStatusEnum.COMPLETE.ToString()) + throw Oops.Oh($"预甩通知用户已反馈,不能重复提交"); + + throw Oops.Oh($"分享链接已失效,请咨询操作重新获取"); + } + shareEntity.USER_OPINION = model.userOpinion; shareEntity.USER_OPINION_TXT = model.userOpinionTxt; shareEntity.CONFIRM_DATE = DateTime.Now; + shareEntity.IS_MANUAL = model.isManual; await _taskShareLinkInfoRepository.AsUpdateable(shareEntity) .UpdateColumns(it => new @@ -578,8 +601,11 @@ namespace Myshipping.Application.Service.TaskManagePlat it.USER_OPINION, it.USER_OPINION_TXT, it.CONFIRM_DATE, + it.IS_MANUAL, }).ExecuteCommandAsync(); + //需要回写预甩任务的 + result.succ = true; result.msg = "成功"; }