wet 2 years ago
commit 50fc06c8b0

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 任务操作类型枚举
/// </summary>
public enum TaskOperTypeEnum
{
/// <summary>
/// 完成任务
/// </summary>
[Description("完成任务")]
COMPLETE_TASK,
/// <summary>
/// 取消任务
/// </summary>
[Description("取消任务")]
CANCEL_TASK,
/// <summary>
/// 挂起任务
/// </summary>
[Description("挂起任务")]
PENDING_TASK,
}
}

@ -4961,6 +4961,26 @@
手工完成 手工完成
</summary> </summary>
</member> </member>
<member name="T:Myshipping.Application.TaskOperTypeEnum">
<summary>
任务操作类型枚举
</summary>
</member>
<member name="F:Myshipping.Application.TaskOperTypeEnum.COMPLETE_TASK">
<summary>
完成任务
</summary>
</member>
<member name="F:Myshipping.Application.TaskOperTypeEnum.CANCEL_TASK">
<summary>
取消任务
</summary>
</member>
<member name="F:Myshipping.Application.TaskOperTypeEnum.PENDING_TASK">
<summary>
挂起任务
</summary>
</member>
<member name="T:Myshipping.Application.TaskSourceEnum"> <member name="T:Myshipping.Application.TaskSourceEnum">
<summary> <summary>
任务来源枚举 任务来源枚举
@ -12725,6 +12745,27 @@
<param name="PKIds">任务主键数组</param> <param name="PKIds">任务主键数组</param>
<returns>返回结果</returns> <returns>返回结果</returns>
</member> </member>
<member name="M:Myshipping.Application.ITaskManageService.CompleteTask(System.String[])">
<summary>
完成任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.ITaskManageService.CancelTask(System.String[])">
<summary>
取消任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.ITaskManageService.PendingTask(System.String[])">
<summary>
挂起任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
<member name="T:Myshipping.Application.TaskManageService"> <member name="T:Myshipping.Application.TaskManageService">
<summary> <summary>
任务管理 任务管理
@ -12799,5 +12840,26 @@
<param name="isCharge">是否执行扣费 true-执行扣费 false-不执行扣费(主要是符合扣费条件但是由于超时没有得到准确回执)</param> <param name="isCharge">是否执行扣费 true-执行扣费 false-不执行扣费(主要是符合扣费条件但是由于超时没有得到准确回执)</param>
<returns>返回回执</returns> <returns>返回回执</returns>
</member> </member>
<member name="M:Myshipping.Application.TaskManageService.CompleteTask(System.String[])">
<summary>
完成任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.TaskManageService.CancelTask(System.String[])">
<summary>
取消任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.TaskManageService.PendingTask(System.String[])">
<summary>
挂起任务(可批量)
</summary>
<param name="PKIds">任务主键数组</param>
<returns>返回结果</returns>
</member>
</members> </members>
</doc> </doc>

@ -48,5 +48,27 @@ namespace Myshipping.Application
/// <param name="PKIds">任务主键数组</param> /// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns> /// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> DownloadOriginalTask(string[] PKIds); Task<TaskManageOrderResultDto> DownloadOriginalTask(string[] PKIds);
/// <summary>
/// 完成任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> CompleteTask(string[] PKIds);
/// <summary>
/// 取消任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> CancelTask(string[] PKIds);
/// <summary>
/// 挂起任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> PendingTask(string[] PKIds);
} }
} }

@ -26,6 +26,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -337,7 +338,7 @@ namespace Myshipping.Application
return result; return result;
} }
#region 获取登陆人相关的任务统计信息
/// <summary> /// <summary>
/// 获取登陆人相关的任务统计信息 /// 获取登陆人相关的任务统计信息
/// </summary> /// </summary>
@ -549,7 +550,7 @@ namespace Myshipping.Application
return resultInfo; return resultInfo;
} }
#endregion
/// <summary> /// <summary>
/// 任务台账查询 /// 任务台账查询
@ -823,6 +824,7 @@ namespace Myshipping.Application
return result; return result;
} }
#region 远程请求正本下载
/// <summary> /// <summary>
/// 远程请求正本下载 /// 远程请求正本下载
/// </summary> /// </summary>
@ -881,7 +883,9 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion
#region 扣费
/// <summary> /// <summary>
/// 扣费 /// 扣费
/// </summary> /// </summary>
@ -931,6 +935,169 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion
#region 完成任务(可批量)
/// <summary>
/// 完成任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
[HttpPost("/TaskManage/CompleteTask")]
public async Task<TaskManageOrderResultDto> CompleteTask(string[] PKIds)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} ids={ids} 完成任务开始", batchNo, string.Join(",", PKIds));
try
{
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
_logger.LogInformation("批次={no} 获取任务完成Num={Num}", batchNo, taskList.Count);
taskList.ForEach(async tsk => {
await InnerManualTask(batchNo, tsk, TaskOperTypeEnum.COMPLETE_TASK);
});
}
catch (Exception ex)
{
throw Oops.Bah($"完成任务异常,{0}", ex.Message);
}
return result;
}
#endregion
private async Task<TaskManageOrderResultDto> InnerManualTask(string batchNo, TaskBaseInfo taskBaseInfo, TaskOperTypeEnum taskOperTypeEnum)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var model = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskBaseInfo.PK_ID);
if (taskOperTypeEnum == TaskOperTypeEnum.COMPLETE_TASK)
{
if (taskBaseInfo.TASK_TYPE == TaskBusiTypeEnum.CANCELLATION.ToString())
{
//收到订舱已被取消邮件后生成的任务,如果点击完成,(订舱状态变为【退舱】,注意这里还需要确认)
}
model.COMPLETE_DATE = DateTime.Now;
model.COMPLETE_DEAL = TaskCompleteDealEnum.MANUAL.ToString();
model.COMPLETE_DEAL = TaskCompleteDealEnum.MANUAL.GetDescription();
model.IS_COMPLETE = 1;
_taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
{
it.COMPLETE_DATE,
it.COMPLETE_DEAL,
it.COMPLETE_DEAL_NAME,
it.IS_COMPLETE
}).ExecuteCommand();
}
else if (taskOperTypeEnum == TaskOperTypeEnum.CANCEL_TASK)
{
if (taskBaseInfo.TASK_TYPE == TaskBusiTypeEnum.CHANGE_SHIP.ToString())
{
model.STATUS = TaskStatusEnum.Cancel.ToString();
}
else if(taskBaseInfo.TASK_TYPE == TaskBusiTypeEnum.ABORT_CHANGE_SHIP.ToString())
{
/*
1.
2.
3.
*/
//查询同票主单的是否有未处理的换船通知
//_taskBaseInfoRepository.AsQueryable().Where(t=>t.MBL_NO.Equals(taskBaseInfo.MBL_NO) && )
}
}
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"异常,{ex.Message}";
}
return result;
}
#region 取消任务(可批量)
/// <summary>
/// 取消任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
[HttpPost("/TaskManage/CancelTask")]
public async Task<TaskManageOrderResultDto> CancelTask(string[] PKIds)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} ids={ids} 取消任务开始", batchNo, string.Join(",", PKIds));
try
{
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
_logger.LogInformation("批次={no} 获取任务完成Num={Num}", batchNo, taskList.Count);
taskList.ForEach(async tsk => {
await InnerManualTask(batchNo, tsk, TaskOperTypeEnum.CANCEL_TASK);
});
}
catch (Exception ex)
{
throw Oops.Bah($"完成任务异常,{0}", ex.Message);
}
return result;
}
#endregion
#region 挂起任务(可批量)
/// <summary>
/// 挂起任务(可批量)
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
[HttpPost("/TaskManage/PendingTask")]
public async Task<TaskManageOrderResultDto> PendingTask(string[] PKIds)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} ids={ids} 挂起任务开始", batchNo, string.Join(",", PKIds));
try
{
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
_logger.LogInformation("批次={no} 获取任务完成Num={Num}", batchNo, taskList.Count);
taskList.ForEach(async tsk => {
await InnerManualTask(batchNo, tsk, TaskOperTypeEnum.PENDING_TASK);
});
}
catch (Exception ex)
{
throw Oops.Bah($"完成任务异常,{0}", ex.Message);
}
return result;
}
#endregion
} }
} }

Loading…
Cancel
Save