diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskBaseInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskBaseInfo.cs
index 2ce5e0a1..e464523c 100644
--- a/Myshipping.Application/Entity/TaskManagePlat/TaskBaseInfo.cs
+++ b/Myshipping.Application/Entity/TaskManagePlat/TaskBaseInfo.cs
@@ -106,5 +106,10 @@ namespace Myshipping.Application.Entity
/// 反馈结果
///
public string RESULT_NOTE { get; set; }
+
+ ///
+ /// 开船日期
+ ///
+ public Nullable ETD { get; set; }
}
}
diff --git a/Myshipping.Application/Helper/MapsterExtHelper.cs b/Myshipping.Application/Helper/MapsterExtHelper.cs
new file mode 100644
index 00000000..739ac26e
--- /dev/null
+++ b/Myshipping.Application/Helper/MapsterExtHelper.cs
@@ -0,0 +1,66 @@
+using Furion.FriendlyException;
+using Mapster;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application.Helper
+{
+ public static class MapsterExtHelper
+ {
+ ///
+ /// 动态获取属性对应关系
+ ///
+ ///
+ ///
+ /// 字段代码
+ /// 返回对应的字段代码
+ public static string GetAdaptProperty(string property)
+ where TDto : class
+ where TEntity : class
+ {
+ try
+ {
+ var adapt = default(TDto).BuildAdapter().CreateMapExpression().Body as BlockExpression;
+
+ var tryInfo = adapt.Expressions.FirstOrDefault(a => a.NodeType.ToString() == "Try");
+
+ if (tryInfo == null)
+ throw Oops.Oh($"{nameof(GetAdaptProperty)} 读取TRY异常");
+
+ var block = ((TryExpression)tryInfo).Body as BlockExpression;
+
+ if (block == null)
+ throw Oops.Oh($"{nameof(GetAdaptProperty)} 读取BlockExpression异常");
+
+ var blockNode = block.Expressions.FirstOrDefault(t => t.NodeType.ToString() == "Block");
+
+ var member = (blockNode as BlockExpression).Expressions.Where(t => {
+ var right = ((t as BinaryExpression).Right as MemberExpression);
+
+ if (right == null)
+ return false;
+
+ var currInfo = right.Member;
+
+ return currInfo.Name.Equals(property, StringComparison.OrdinalIgnoreCase);
+ }).FirstOrDefault();
+
+ if (member != null)
+ return ((member as BinaryExpression).Left as MemberExpression).Member.Name;
+
+ }
+ catch (Exception ex)
+ {
+ throw Oops.Oh($"{nameof(GetAdaptProperty)} 读取BlockExpression异常");
+ }
+
+ return string.Empty;
+ }
+
+
+ }
+}
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 142942d7..8a4e7f28 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -3761,6 +3761,11 @@
反馈结果
+
+
+ 开船日期
+
+
任务账单费用明细
@@ -4776,6 +4781,15 @@
已挂起
+
+
+ 动态获取属性对应关系
+
+
+
+ 字段代码
+ 返回对应的字段代码
+
获取场站数据辅助类(调用爬虫新运踪接口)
@@ -10794,6 +10808,233 @@
+
+
+ 我的任务查询
+
+
+
+
+ 提单号
+
+
+
+
+
+ 开船日期起始
+
+
+
+
+
+ 开船日期结束
+
+
+
+
+
+ 任务起始日期
+
+ 2022-12-01
+
+
+
+ 任务起始结束
+
+
+
+
+
+ 任务类型
+
+
+
+
+
+ 任务来源
+
+
+
+
+
+ 接收人
+
+
+
+
+
+ 当前页码
+
+ 1
+
+
+
+ 页码容量
+
+ 20
+
+
+
+ 排序字段
+
+ TaskType
+
+
+
+ 排序方法,默认降序
+
+ true
+
+
+
+ 任务
+
+
+
+
+ 主键
+
+
+
+
+ 任务流水号
+
+
+
+
+ 任务类型
+
+
+
+
+ 任务来源
+
+
+
+
+ 状态 Create-待处理;Retransmit-已转发;Complete-已完成;Cancel-已取消;Pending-已挂起
+
+
+
+
+ 任务标题
+
+
+
+
+ 任务描述
+
+
+
+
+ 外业务编号
+
+
+
+
+ 外业务类型 BOOK_ORDER-订舱 MAIL_RECV-邮件接收
+
+
+
+
+ 基础业务类型
+
+
+
+
+ 船公司代号
+
+
+
+
+ 主单号
+
+
+
+
+ 备注
+
+
+
+
+ 是否异常 1-异常 0-未异常
+
+
+
+
+ 是否公共 0-非公共 1-公共(当无法确认任务所属人的情况被默认为公共)
+
+
+
+
+ 是否完成 1-已完成 0-未完成
+
+
+
+
+ 任务启动时间
+
+
+
+
+ 任务完成时间
+
+
+
+
+ 订舱业务主键
+
+
+
+
+ 反馈结果
+
+
+
+
+ 开船日期
+
+
+
+
+ 创建时间
+
+
+
+
+ 修改时间
+
+
+
+
+ 创建人ID
+
+
+
+
+ 创建人名称
+
+
+
+
+ 修改人ID
+
+
+
+
+ 修改人名称
+
+
+
+
+ 租户id
+
+
+
+
+ 租户名称
+
+
费用明细
@@ -11444,6 +11685,13 @@
是否强制计算
返回回执
+
+
+ 任务台账查询
+
+ 任务台账查询请求
+ 返回结果
+
任务管理
@@ -11478,5 +11726,12 @@
是否强制计算
返回回执
+
+
+ 任务台账查询
+
+ 任务台账查询请求
+ 返回结果
+
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/QueryTaskManageDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/QueryTaskManageDto.cs
new file mode 100644
index 00000000..14f757ce
--- /dev/null
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/QueryTaskManageDto.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// 我的任务查询
+ ///
+ public class QueryTaskManageDto
+ {
+ ///
+ /// 提单号
+ ///
+ ///
+ public string MBlNo { get; set; }
+
+ ///
+ /// 开船日期起始
+ ///
+ ///
+ public string ETDBegin { get; set; }
+
+ ///
+ /// 开船日期结束
+ ///
+ ///
+ public string ETDEnd { get; set; }
+
+ ///
+ /// 任务起始日期
+ ///
+ /// 2022-12-01
+ public string TaskDateBegin { get; set; }
+
+ ///
+ /// 任务起始结束
+ ///
+ ///
+ public string TaskDateEnd { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ ///
+ public string TaskType { get; set; }
+
+ ///
+ /// 任务来源
+ ///
+ ///
+ public string TaskSource { get; set; }
+
+ ///
+ /// 接收人
+ ///
+ ///
+ public string TaskRecvName { get; set; }
+
+ ///
+ /// 当前页码
+ ///
+ /// 1
+ public int PageNo { get; set; } = 1;
+
+ ///
+ /// 页码容量
+ ///
+ /// 20
+ public int PageSize { get; set; } = 20;
+
+ ///
+ /// 排序字段
+ ///
+ /// TaskType
+ public string SortField { get; set; }
+
+ ///
+ /// 排序方法,默认降序
+ ///
+ /// true
+ public bool descSort { get; set; } = true;
+ }
+}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs
new file mode 100644
index 00000000..666cadc2
--- /dev/null
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskBaseInfoDto.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// 任务
+ ///
+ public class TaskBaseInfoDto
+ {
+ ///
+ /// 主键
+ ///
+ public string PKId { get; set; }
+ ///
+ /// 任务流水号
+ ///
+ public string TaskNo { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ public string TaskType { get; set; }
+
+ ///
+ /// 任务来源
+ ///
+ public string TaskSource { get; set; }
+
+ ///
+ /// 状态 Create-待处理;Retransmit-已转发;Complete-已完成;Cancel-已取消;Pending-已挂起
+ ///
+ public string Status { get; set; }
+
+ ///
+ /// 任务标题
+ ///
+ public string TaskTitle { get; set; }
+
+ ///
+ /// 任务描述
+ ///
+ public string TaskDesp { get; set; }
+
+ ///
+ /// 外业务编号
+ ///
+ public string OutBusiNo { get; set; }
+
+ ///
+ /// 外业务类型 BOOK_ORDER-订舱 MAIL_RECV-邮件接收
+ ///
+ public string OutBusiType { get; set; }
+
+ ///
+ /// 基础业务类型
+ ///
+ public string TaskBaseType { get; set; }
+
+ ///
+ /// 船公司代号
+ ///
+ public string CarrierId { get; set; }
+
+ ///
+ /// 主单号
+ ///
+ public string MblNo { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 是否异常 1-异常 0-未异常
+ ///
+ public int IsExcept { get; set; }
+
+ ///
+ /// 是否公共 0-非公共 1-公共(当无法确认任务所属人的情况被默认为公共)
+ ///
+ public int IsPublic { get; set; }
+
+ ///
+ /// 是否完成 1-已完成 0-未完成
+ ///
+ public int IsComplete { get; set; }
+
+ ///
+ /// 任务启动时间
+ ///
+ public string BeginDate { get; set; }
+
+ ///
+ /// 任务完成时间
+ ///
+ public string CompleteDate { get; set; }
+
+ ///
+ /// 订舱业务主键
+ ///
+ public string BookOrderNo { get; set; }
+
+ ///
+ /// 反馈结果
+ ///
+ public string ResultNote { get; set; }
+
+ ///
+ /// 开船日期
+ ///
+ public string ETD { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreatedTime { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public Nullable UpdatedTime { get; set; }
+
+ ///
+ /// 创建人ID
+ ///
+ public long CreatedUserId { get; set; }
+
+ ///
+ /// 创建人名称
+ ///
+ public string CreatedUserName { get; set; }
+
+ ///
+ /// 修改人ID
+ ///
+ public long UpdatedUserId { get; set; }
+
+ ///
+ /// 修改人名称
+ ///
+ public string UpdatedUserName { get; set; }
+
+ ///
+ /// 租户id
+ ///
+ public string TenantId { get; set; }
+
+ ///
+ /// 租户名称
+ ///
+ public string TenantName { get; set; }
+
+ }
+}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
index 870815d0..9b8a46c5 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
@@ -72,6 +72,63 @@ namespace Myshipping.Application
.Map(dest => dest.TAREWEIGHT, src => src.TAREWEIGHT)
.Map(dest => dest.WEIGHKGS, src => src.WEIGHKGS)
.Map(dest => dest.WEIGHTYPE, src => src.WEIGHTYPE);
+
+
+ config.ForType()
+ .Map(dest => dest.PKId, src => src.PK_ID)
+ .Map(dest => dest.TaskNo, src => src.TASK_NO)
+ .Map(dest => dest.TaskType, src => src.TASK_TYPE)
+ .Map(dest => dest.TaskSource, src => src.TASK_SOURCE)
+ .Map(dest => dest.Status, src => src.STATUS)
+ .Map(dest => dest.TaskTitle, src => src.TASK_TITLE)
+ .Map(dest => dest.TaskDesp, src => src.TASK_DESP)
+ .Map(dest => dest.OutBusiNo, src => src.OUT_BUSI_NO)
+ .Map(dest => dest.OutBusiType, src => src.OUT_BUSI_TYPE)
+ .Map(dest => dest.CarrierId, src => src.CARRIER_ID)
+ .Map(dest => dest.MblNo, src => src.MBL_NO)
+ .Map(dest => dest.Remark, src => src.REMARK)
+ .Map(dest => dest.IsExcept, src => src.IS_EXCEPT)
+ .Map(dest => dest.IsPublic, src => src.IS_PUBLIC)
+ .Map(dest => dest.IsComplete, src => src.IS_COMPLETE)
+ .Map(dest => dest.BeginDate, src => src.BEGIN_DATE)
+ .Map(dest => dest.CompleteDate, src => src.COMPLETE_DATE)
+ .Map(dest => dest.BookOrderNo, src => src.BOOK_ORDER_NO)
+ .Map(dest => dest.ResultNote, src => src.RESULT_NOTE)
+ .Map(dest => dest.ETD, src => src.ETD)
+ .Map(dest => dest.CreatedTime, src => src.CreatedTime)
+ .Map(dest => dest.UpdatedTime, src => src.UpdatedTime)
+ .Map(dest => dest.CreatedUserId, src => src.CreatedUserId)
+ .Map(dest => dest.CreatedUserName, src => src.CreatedUserName)
+ .Map(dest => dest.UpdatedUserId, src => src.UpdatedUserId)
+ .Map(dest => dest.UpdatedUserName, src => src.UpdatedUserName);
+
+ config.ForType()
+ .Map(dest => dest.PK_ID, src => src.PKId)
+ .Map(dest => dest.TASK_NO, src => src.TaskNo)
+ .Map(dest => dest.TASK_TYPE, src => src.TaskType)
+ .Map(dest => dest.TASK_SOURCE, src => src.TaskSource)
+ .Map(dest => dest.STATUS, src => src.Status)
+ .Map(dest => dest.TASK_TITLE, src => src.TaskTitle)
+ .Map(dest => dest.TASK_DESP, src => src.TaskDesp)
+ .Map(dest => dest.OUT_BUSI_NO, src => src.OutBusiNo)
+ .Map(dest => dest.OUT_BUSI_TYPE, src => src.OutBusiType)
+ .Map(dest => dest.CARRIER_ID, src => src.CarrierId)
+ .Map(dest => dest.MBL_NO, src => src.MblNo)
+ .Map(dest => dest.REMARK, src => src.Remark)
+ .Map(dest => dest.IS_EXCEPT, src => src.IsExcept)
+ .Map(dest => dest.IS_PUBLIC, src => src.IsPublic)
+ .Map(dest => dest.IS_COMPLETE, src => src.IsComplete)
+ .Map(dest => dest.BEGIN_DATE, src => src.BeginDate)
+ .Map(dest => dest.COMPLETE_DATE, src => src.CompleteDate)
+ .Map(dest => dest.BOOK_ORDER_NO, src => src.BookOrderNo)
+ .Map(dest => dest.RESULT_NOTE, src => src.ResultNote)
+ .Map(dest => dest.ETD, src => src.ETD)
+ .Map(dest => dest.CreatedTime, src => src.CreatedTime)
+ .Map(dest => dest.UpdatedTime, src => src.UpdatedTime)
+ .Map(dest => dest.CreatedUserId, src => src.CreatedUserId)
+ .Map(dest => dest.CreatedUserName, src => src.CreatedUserName)
+ .Map(dest => dest.UpdatedUserId, src => src.UpdatedUserId)
+ .Map(dest => dest.UpdatedUserName, src => src.UpdatedUserName);
}
}
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs
index 4a76bdd2..868d3b7a 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageService.cs
@@ -1,4 +1,6 @@
-using System;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -31,5 +33,12 @@ namespace Myshipping.Application
/// 是否强制计算
/// 返回回执
Task GetCurrentTotalStat(bool isReCalc = false);
+
+ ///
+ /// 任务台账查询
+ ///
+ /// 任务台账查询请求
+ /// 返回结果
+ Task GetPageAsync(QueryTaskManageDto QuerySearch);
}
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs
index 45b71eef..7d925ed7 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs
@@ -6,18 +6,23 @@ using Furion.RemoteRequest;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
+using Myshipping.Application.Helper;
using Myshipping.Core;
using Myshipping.Core.Entity;
using MySqlX.XDevAPI.Common;
+using NPOI.SS.Formula.Functions;
using SqlSugar;
+using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
@@ -522,5 +527,89 @@ namespace Myshipping.Application
return resultInfo;
}
+
+
+ ///
+ /// 任务台账查询
+ ///
+ /// 任务台账查询请求
+ /// 返回结果
+ [HttpPost("/TaskManage/GetPage")]
+ public async Task GetPageAsync(QueryTaskManageDto QuerySearch)
+ {
+ List mblList = new List();
+
+ if(!string.IsNullOrWhiteSpace(QuerySearch.MBlNo))
+ {
+ if (Regex.IsMatch(QuerySearch.MBlNo, "(\\t|\\n\\r|\\n)"))
+ {
+ mblList = Regex.Replace(QuerySearch.MBlNo, "(\\t |\\n\\r |\\n)", "#").Split(new char[] { '#' }).Select(t=>t?.Trim()).ToList();
+ }
+ else
+ {
+ mblList.Add(QuerySearch.MBlNo.Trim());
+ }
+ }
+
+ DateTime etdBegin = DateTime.MinValue;
+ DateTime etdEnd = DateTime.MinValue;
+
+ DateTime taskDateBegin = DateTime.MinValue;
+ DateTime taskDateEnd = DateTime.MinValue;
+
+ if (!string.IsNullOrWhiteSpace(QuerySearch.ETDBegin))
+ {
+ if(!DateTime.TryParse(QuerySearch.ETDBegin, out etdBegin))
+ throw Oops.Oh($"开船起始日期格式错误,{QuerySearch.ETDBegin}");
+ }
+
+ if (!string.IsNullOrWhiteSpace(QuerySearch.ETDEnd))
+ {
+ if (!DateTime.TryParse(QuerySearch.ETDEnd, out etdEnd))
+ throw Oops.Oh($"开船结束日期格式错误,{QuerySearch.ETDEnd}");
+
+ etdEnd = etdEnd.AddDays(1);
+ }
+
+ if (!string.IsNullOrWhiteSpace(QuerySearch.TaskDateBegin))
+ {
+ if (!DateTime.TryParse(QuerySearch.TaskDateBegin, out taskDateBegin))
+ throw Oops.Oh($"任务起始日期格式错误,{QuerySearch.TaskDateBegin}");
+ }
+
+ if (!string.IsNullOrWhiteSpace(QuerySearch.TaskDateEnd))
+ {
+ if (!DateTime.TryParse(QuerySearch.TaskDateEnd, out taskDateEnd))
+ throw Oops.Oh($"任务结束日期格式错误,{QuerySearch.TaskDateEnd}");
+
+ etdEnd = etdEnd.AddDays(1);
+ }
+
+ string entityOrderCol = "CreatedTime";
+
+ //这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段
+ if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
+ entityOrderCol = MapsterExtHelper.GetAdaptProperty(QuerySearch.SortField);
+
+ var entities = await _taskBaseInfoRepository.AsQueryable().Filter(null, true)
+ .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.MBlNo), t => mblList.Any(p => p.Contains(t.MBL_NO, StringComparison.OrdinalIgnoreCase)))
+ .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.TaskRecvName), t => t.CreatedUserName.Contains(QuerySearch.TaskRecvName.Trim(), StringComparison.OrdinalIgnoreCase))
+ .WhereIF(etdBegin != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value >= etdBegin)
+ .WhereIF(etdEnd != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value < etdEnd)
+ .WhereIF(taskDateBegin != DateTime.MinValue, t => t.CreatedTime >= taskDateBegin)
+ .WhereIF(taskDateEnd != DateTime.MinValue, t => t.CreatedTime < taskDateEnd)
+ .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.TaskType), t => t.TASK_TYPE.Equals(QuerySearch.TaskType, StringComparison.OrdinalIgnoreCase))
+ .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.TaskSource), t => t.TASK_SOURCE.Equals(QuerySearch.TaskSource, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
+ .ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
+ return new
+ {
+ PageNo = entities.PageIndex,
+ PageSize = entities.PageSize,
+ TotalPage = entities.TotalPages,
+ TotalRows = entities.TotalCount,
+ Rows = entities.Items.Select(t => t.Adapt()).ToList()
+ };
+ }
}
}