|
|
|
@ -110,6 +110,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (!await EnsureModuleAuthorized())
|
|
|
|
|
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
|
|
|
|
|
|
|
|
|
|
if (request.HasCabin.GetValueOrDefault())
|
|
|
|
|
{
|
|
|
|
|
//如果为现舱,获取下一任务类型进行创建
|
|
|
|
|
var nextType = await GetNextTypeAsync(request.BusinessId, request.BusinessType, request.TaskType);
|
|
|
|
|
if (nextType.HasValue)
|
|
|
|
|
request.TaskTypeName = nextType.Value.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
|
|
|
|
|
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
|
|
|
|
@ -742,14 +750,24 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
|
|
|
|
|
{
|
|
|
|
|
var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
|
|
|
|
|
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
|
|
|
|
|
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
|
|
|
|
|
new TaskFlowDataContext(
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
), current.TaskType);
|
|
|
|
|
return await GetNextTypeAsync(current.BusinessId, current.BusinessType, current.TaskType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return taskType;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取给定任务的下一任务类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bsId">业务ID</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <param name="currentType">当前任务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(long bsId, BusinessType businessType, TaskBaseTypeEnum currentType)
|
|
|
|
|
{
|
|
|
|
|
var order = await ActionService.GetBusinessDataAsync(bsId, businessType);
|
|
|
|
|
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
|
|
|
|
|
return await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
|
|
|
|
|
new TaskFlowDataContext(
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
), currentType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|