|
|
|
@ -1506,7 +1506,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
var portInfo = await PlaceReceiptToPortload(taskRouteChangeAdvisoryInfo.READ_PORTLOAD, portCodeList, () => mappingPortService.GetAllList());
|
|
|
|
|
|
|
|
|
|
if (!portInfo.Succeeded)
|
|
|
|
|
if (!portInfo.Succeeded || portInfo.Data == null)
|
|
|
|
|
{
|
|
|
|
|
logger.LogInformation($"通过收货地城市名称未匹配到港口信息,航线船舶截止时间调整的通知Id:{taskRouteChangeAdvisoryInfo.Id}");
|
|
|
|
|
}
|
|
|
|
@ -3164,6 +3164,90 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 完成任务(可批量)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids">任务主键数组</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
public async Task<DataResult<TaskManageOrderResultDto>> CompleteTask(long[] ids)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
string batchNo = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
var hasAuthor = await HasTaskHandleAuthority(ids);
|
|
|
|
|
if (!hasAuthor.Succeeded && hasAuthor.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (ids.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = string.Format(MultiLanguageConst.GetDescription(MultiLanguageConst.TaskNotHaveAuthorSingle), string.Join("、", hasAuthor.Data));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = string.Format(MultiLanguageConst.GetDescription(MultiLanguageConst.TaskNotHaveAuthor), string.Join("、", hasAuthor.Data!));
|
|
|
|
|
}
|
|
|
|
|
return DataResult<TaskManageOrderResultDto>.FailedData(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskList = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId))
|
|
|
|
|
.Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TaskManageOrderResultDto> taskRunList = new List<TaskManageOrderResultDto>();
|
|
|
|
|
logger.LogInformation("批次={no} ids={ids} 完成任务开始", batchNo, string.Join(",", ids));
|
|
|
|
|
|
|
|
|
|
var noList = ids.Select((a, idx) => new { no = idx + 1, id = a }).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var bk in taskList)
|
|
|
|
|
{
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
taskRunList.Add(await InnerManualTask(batchNo, bk, TaskOperTypeEnum.COMPLETE_TASK, sortNo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "执行成功";
|
|
|
|
|
|
|
|
|
|
var downResultList = taskRunList.Select(x => x).ToList();
|
|
|
|
|
|
|
|
|
|
if (downResultList.Any(x => !x.succ))
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = "执行失败";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = downResultList.FirstOrDefault().msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.ext = downResultList;
|
|
|
|
|
|
|
|
|
|
var succ = downResultList.Count(x => x.succ);
|
|
|
|
|
var fail = downResultList.Count(x => !x.succ);
|
|
|
|
|
|
|
|
|
|
if (succ > 0)
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal = succ.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal = "- ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fail > 0)
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal += "/" + fail.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal += " -";
|
|
|
|
|
}
|
|
|
|
|
return DataResult<TaskManageOrderResultDto>.Success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消任务(可批量)
|
|
|
|
@ -3172,12 +3256,30 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
public async Task<DataResult<TaskManageOrderResultDto>> CancelTask(long[] ids)
|
|
|
|
|
{
|
|
|
|
|
ArgumentNullException.ThrowIfNull(ids);
|
|
|
|
|
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
string batchNo = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
var hasAuthor = await HasTaskHandleAuthority(ids);
|
|
|
|
|
if (!hasAuthor.Succeeded && hasAuthor.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (ids.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = string.Format(MultiLanguageConst.GetDescription(MultiLanguageConst.TaskNotHaveAuthorSingle), string.Join("、", hasAuthor.Data));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = string.Format(MultiLanguageConst.GetDescription(MultiLanguageConst.TaskNotHaveAuthor), string.Join("、", hasAuthor.Data!));
|
|
|
|
|
}
|
|
|
|
|
return DataResult<TaskManageOrderResultDto>.FailedData(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskList = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId))
|
|
|
|
|
.Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
|
|
|
@ -3493,76 +3595,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 完成任务(可批量)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids">任务主键数组</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
public async Task<DataResult<TaskManageOrderResultDto>> CompleteTask(long[] ids)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
string batchNo = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
var taskList = await tenantDb.Queryable<TaskBaseInfo>().ClearFilter(typeof(IOrgId))
|
|
|
|
|
.Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TaskManageOrderResultDto> taskRunList = new List<TaskManageOrderResultDto>();
|
|
|
|
|
logger.LogInformation("批次={no} ids={ids} 完成任务开始", batchNo, string.Join(",", ids));
|
|
|
|
|
|
|
|
|
|
var noList = ids.Select((a, idx) => new { no = idx + 1, id = a }).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var bk in taskList)
|
|
|
|
|
{
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
taskRunList.Add(await InnerManualTask(batchNo, bk, TaskOperTypeEnum.COMPLETE_TASK, sortNo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "执行成功";
|
|
|
|
|
|
|
|
|
|
var downResultList = taskRunList.Select(x => x).ToList();
|
|
|
|
|
|
|
|
|
|
if (downResultList.Any(x => !x.succ))
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = "执行失败";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = downResultList.FirstOrDefault().msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.ext = downResultList;
|
|
|
|
|
|
|
|
|
|
var succ = downResultList.Count(x => x.succ);
|
|
|
|
|
var fail = downResultList.Count(x => !x.succ);
|
|
|
|
|
|
|
|
|
|
if (succ > 0)
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal = succ.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal = "- ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fail > 0)
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal += "/" + fail.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal += " -";
|
|
|
|
|
}
|
|
|
|
|
return DataResult<TaskManageOrderResultDto>.Success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 领取任务到当前登陆人(可批量)
|
|
|
|
|
/// </summary>
|
|
|
|
@ -3664,9 +3696,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试用
|
|
|
|
|
/// </summary>
|
|
|
|
|