|
|
|
@ -26,6 +26,7 @@ using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
@ -337,7 +338,7 @@ namespace Myshipping.Application
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取登陆人相关的任务统计信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取登陆人相关的任务统计信息
|
|
|
|
|
/// </summary>
|
|
|
|
@ -549,7 +550,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return resultInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 任务台账查询
|
|
|
|
@ -823,6 +824,7 @@ namespace Myshipping.Application
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 远程请求正本下载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 远程请求正本下载
|
|
|
|
|
/// </summary>
|
|
|
|
@ -881,7 +883,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 扣费
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 扣费
|
|
|
|
|
/// </summary>
|
|
|
|
@ -931,6 +935,169 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|