|
|
|
@ -212,7 +212,12 @@ namespace DS.WMS.Core.TaskPlat
|
|
|
|
|
flowLogDetail.ConfigId = executeConfig.Id;
|
|
|
|
|
|
|
|
|
|
// 如果当前节点要执行(或者配置了默认执行节点)取出下一批要进行条件判断的节点列表
|
|
|
|
|
waitMatchConfigList = configList.Where(x => x.ParentConfigId == executeConfig.Id).ToList();
|
|
|
|
|
waitMatchConfigList.Clear();
|
|
|
|
|
if (!string.IsNullOrEmpty(executeConfig.NextConfigId))
|
|
|
|
|
{
|
|
|
|
|
var ids = executeConfig.NextConfigId.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => Convert.ToInt64(x));
|
|
|
|
|
waitMatchConfigList = configList.Where(x => ids.Contains(x.Id)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 注入参数
|
|
|
|
|
var paramItemList = paramList.Where(x => x.ConfigId == executeConfig.Id).ToList();
|
|
|
|
@ -373,20 +378,27 @@ namespace DS.WMS.Core.TaskPlat
|
|
|
|
|
|
|
|
|
|
if (allConfigList.Count == 0) return null;
|
|
|
|
|
|
|
|
|
|
List<TaskFlowConfig> waitMatchConfigList = new();
|
|
|
|
|
long configId;
|
|
|
|
|
if (currentConfigId == null)
|
|
|
|
|
{
|
|
|
|
|
waitMatchConfigList.Add(allConfigList.First(x => x.IsMain));
|
|
|
|
|
configId = allConfigList.First(x => x.IsMain).Id;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var currentConfig = allConfigList.FirstOrDefault(x => x.Id == currentConfigId);
|
|
|
|
|
if (currentConfig == null) return null;
|
|
|
|
|
|
|
|
|
|
waitMatchConfigList.AddRange(allConfigList.Where(x => x.ParentConfigId == currentConfig.Id));
|
|
|
|
|
configId = currentConfigId.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (waitMatchConfigList.Count == 0) return null;
|
|
|
|
|
List<TaskFlowConfig> waitMatchConfigList = new();
|
|
|
|
|
for (int i = 0; i < allConfigList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var currentConfig = allConfigList.FirstOrDefault(x => x.Id == configId);
|
|
|
|
|
if (currentConfig == null || string.IsNullOrEmpty(currentConfig.NextConfigId))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
var nextIds = currentConfig.NextConfigId.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => Convert.ToInt64(x));
|
|
|
|
|
waitMatchConfigList = allConfigList.Where(x => nextIds.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
|
|
if (waitMatchConfigList.Count == 0) return null; // 如果走了这一步的return,说明配置有问题:配置了下一节点的id,但是却查不到
|
|
|
|
|
|
|
|
|
|
var configIdList = waitMatchConfigList.Select(x => x.Id);
|
|
|
|
|
var conditionList = await tenantDb.Queryable<TaskFlowCondition>()
|
|
|
|
@ -426,14 +438,30 @@ namespace DS.WMS.Core.TaskPlat
|
|
|
|
|
executeConfig = waitMatchConfigList.FirstOrDefault(x => x.IsUnMatchDefault);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (executeConfig == null) return null;
|
|
|
|
|
|
|
|
|
|
if (executeConfig == null)
|
|
|
|
|
{
|
|
|
|
|
// 如果最终还是没有匹配到,则需要判断情况
|
|
|
|
|
// 如果待匹配的分支只有1个,则继续循环判断下一节点;否则如果待匹配的分支有多个,则无法判断下一节点
|
|
|
|
|
if (waitMatchConfigList.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
configId = waitMatchConfigList[0].Id;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var taskType = await tenantDb.Queryable<TaskFlowModule>().Where(x => x.Id == executeConfig.ExecuteModuleId).Select(x => x.TaskType).FirstAsync();
|
|
|
|
|
|
|
|
|
|
if (taskType != null && Enum.TryParse(typeof(TaskBaseTypeEnum), taskType, out object? temp))
|
|
|
|
|
{
|
|
|
|
|
return ((TaskBaseTypeEnum)temp, executeConfig.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
static string WriteLog(string throwMsg, Exception ex)
|
|
|
|
|