|
|
|
@ -11,6 +11,7 @@ using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
@ -74,20 +75,25 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取给定任务的下一默认任务类型
|
|
|
|
|
/// 获取给定任务的下一任务类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="current">任务信息</param>
|
|
|
|
|
/// <param name="current"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
internal static TaskBaseTypeEnum? GetDefaultNextType(BusinessTask current)
|
|
|
|
|
public async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
|
|
|
|
|
{
|
|
|
|
|
if (current.TaskType == TaskBaseTypeEnum.NOT_SPECIFIED || current.TaskType == TaskBaseTypeEnum.WAIT_CHECKOUT_BILL) //流程的最后一步
|
|
|
|
|
return null;
|
|
|
|
|
TaskFlowRuner flowRuner = new TaskFlowRuner(TenantDb, ServiceProvider);
|
|
|
|
|
|
|
|
|
|
int currentTypeVal = (int)current.TaskType;
|
|
|
|
|
if (currentTypeVal >= 300) //300开始的枚举值为可选服务项目,不存在前后关联性
|
|
|
|
|
return null;
|
|
|
|
|
var result = await flowRuner.GetWorkFlowNextConfig(new TaskFlowDataContext(
|
|
|
|
|
|
|
|
|
|
), current.NextId);
|
|
|
|
|
|
|
|
|
|
return (TaskBaseTypeEnum)(currentTypeVal + 1);
|
|
|
|
|
if (result.HasValue)
|
|
|
|
|
{
|
|
|
|
|
current.NextId = result.Value.configId;
|
|
|
|
|
return result.Value.taskType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -341,7 +347,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
CreateBy = long.Parse(User.UserId),
|
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
task.NextType = GetDefaultNextType(task);
|
|
|
|
|
task.NextType = await GetNextTypeAsync(task);
|
|
|
|
|
await TenantDb.Insertable(task).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//审核任务需创建工作流
|
|
|
|
@ -511,7 +517,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
|
ActionService.Value.TriggerAction(task);
|
|
|
|
|
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? GetDefaultNextType(task) : null);
|
|
|
|
|
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? await GetNextTypeAsync(task) : null);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|