获取给定任务的下一任务类型

usertest
嵇文龙 3 months ago
parent c52fec3e9a
commit 4fba5113f4

@ -189,7 +189,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
else if (svcName == "拖车")
dto.TaskTypeName = TaskBaseTypeEnum.WAIT_TUOCHE.ToString();
else if (svcName == "保险")
dto.TaskTypeName = TaskBaseTypeEnum.WAIT_Insurance.ToString();
dto.TaskTypeName = TaskBaseTypeEnum.WAIT_INSURANCE.ToString();
else if (svcName == "出号")
dto.TaskTypeName = TaskBaseTypeEnum.WAIT_CHUHAO.ToString();
else if (svcName == "内点入货")

@ -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)
{

@ -255,7 +255,7 @@ namespace DS.WMS.Core.TaskPlat.Method
}
else
{
var contitionContent = JsonConvert.DeserializeObject<ContitionContent>(item.Condition)!;
var contitionContent = JsonConvert.DeserializeObject<ConditionContent>(item.Condition)!;
if (ConditionHelper.IsPass(contitionContent, dataContext))
{
allotTargetList.Add(item);
@ -385,7 +385,7 @@ namespace DS.WMS.Core.TaskPlat.Method
}
else
{
var contitionContent = JsonConvert.DeserializeObject<ContitionContent>(allotItem.Condition)!;
var contitionContent = JsonConvert.DeserializeObject<ConditionContent>(allotItem.Condition)!;
if (ConditionHelper.IsPass(contitionContent, dataContext))
{
itemResult.Add(allotItem);

@ -81,7 +81,7 @@ namespace DS.WMS.Core.TaskPlat
var conditionItem = allConditionList.FirstOrDefault(x => x.ConfigId == configItem.Id);
if (conditionItem != null && !string.IsNullOrEmpty(conditionItem.Content))
{
var contitionContent = JsonConvert.DeserializeObject<ContitionContent>(conditionItem.Content)!;
var contitionContent = JsonConvert.DeserializeObject<ConditionContent>(conditionItem.Content)!;
var oldValue = configMatchCount[configItem.Id];
if (ConditionHelper.IsPass(contitionContent, dataContext))
@ -179,7 +179,7 @@ namespace DS.WMS.Core.TaskPlat
continue;
}
var contitionContent = JsonConvert.DeserializeObject<ContitionContent>(condition.Content)!;
var contitionContent = JsonConvert.DeserializeObject<ConditionContent>(condition.Content)!;
if (ConditionHelper.IsPass(contitionContent, dataContext))
{
matchedConfigList.Add(waitMatchConfigItem);
@ -403,7 +403,7 @@ namespace DS.WMS.Core.TaskPlat
}
else
{
var contitionContent = JsonConvert.DeserializeObject<ContitionContent>(condition.Content)!;
var contitionContent = JsonConvert.DeserializeObject<ConditionContent>(condition.Content)!;
if (ConditionHelper.IsPass(contitionContent, dataContext))
{
matchedConfigList.Add(item);

Loading…
Cancel
Save