|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
@ -184,7 +183,7 @@ public class FlowRuntime
|
|
|
|
|
{
|
|
|
|
|
conditionNodes.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return conditionNodes;
|
|
|
|
|
}
|
|
|
|
@ -229,354 +228,177 @@ public class FlowRuntime
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parent"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public virtual string GetNextConditionNodeId(FlowChild parent)
|
|
|
|
|
public string GetNextConditionNodeId(FlowChild parent)
|
|
|
|
|
{
|
|
|
|
|
var conditionNodes = GetFlowConditions(parent);
|
|
|
|
|
var conditionId = string.Empty;
|
|
|
|
|
string? conditionId = null;
|
|
|
|
|
if (conditionNodes.Count == 1)
|
|
|
|
|
conditionId = conditionNodes[0].Id;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < conditionNodes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == conditionNodes.Count - 1)
|
|
|
|
|
var conditions = conditionNodes[i].Conditions;
|
|
|
|
|
var conditionalCollections = new List<ConditionalCollections>();
|
|
|
|
|
if (conditions.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
// return ChildNodes.Where(x => x.Pid == conditionNodes[i].Id).First().Id;
|
|
|
|
|
conditionId = conditionNodes[i].Id;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var conditions = conditionNodes[i].Conditions;
|
|
|
|
|
var conditionalCollections = new List<ConditionalCollections>();
|
|
|
|
|
if (conditions.LogicalOperator == "and")
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
{
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var conditionalModels =
|
|
|
|
|
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
|
|
|
|
|
JsonConvert.SerializeObject(conditionalCollections));
|
|
|
|
|
// var info = db.Queryable<SysUser>().Where(x => x.Id == BusinessId).Where(conditionalModels)
|
|
|
|
|
// .First();
|
|
|
|
|
var info = db.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).First();
|
|
|
|
|
if (info.IsNotNull())
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionId = conditionNodes[i].Id;
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ChildNodes.Where(x => x.Pid == conditionId).First().Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string? GetClientNextConditionNodeId(FlowChild parent)
|
|
|
|
|
{
|
|
|
|
|
var conditionNodes = GetFlowConditions(parent);
|
|
|
|
|
var conditionId = string.Empty;
|
|
|
|
|
for (int i = 0; i < conditionNodes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == conditionNodes.Count - 1)
|
|
|
|
|
{
|
|
|
|
|
// return ChildNodes.Where(x => x.Pid == conditionNodes[i].Id).First().Id;
|
|
|
|
|
conditionId = conditionNodes[i].Id;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var conditions = conditionNodes[i].Conditions;
|
|
|
|
|
var conditionalCollections = new List<ConditionalCollections>();
|
|
|
|
|
if (conditions.LogicalOperator == "and")
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
{
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var item in conditions.Conditions)
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item.Operator),
|
|
|
|
|
FieldValue = item.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conditionList.Count > 0)
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = conditionList
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
|
|
|
|
foreach (var group in conditions.Groups)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (group.LogicalOperator == "and")
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.And,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item1 in group.Conditions)
|
|
|
|
|
{
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
|
|
|
|
|
(WhereType.Or,
|
|
|
|
|
new ConditionalModel
|
|
|
|
|
{
|
|
|
|
|
FieldName = item1.Field,
|
|
|
|
|
ConditionalType = GetConditionalType(item1.Operator),
|
|
|
|
|
FieldValue = item1.Value
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
if (groupList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
conditionalCollections.Add(new ConditionalCollections
|
|
|
|
|
{
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
ConditionalList = groupList
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var conditionalModels =
|
|
|
|
|
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
|
|
|
|
|
JsonConvert.SerializeObject(conditionalCollections));
|
|
|
|
|
// var info = db.Queryable<SysUser>().Where(x => x.Id == BusinessId).Where(conditionalModels)
|
|
|
|
|
// .First();
|
|
|
|
|
var info = tenantDb.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).First();
|
|
|
|
|
if (info.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
conditionId = conditionNodes[i].Id;
|
|
|
|
|
}
|
|
|
|
|
var conditionalModels = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(JsonConvert.SerializeObject(conditionalCollections));
|
|
|
|
|
if (conditionalModels.Count == 0) //跳过默认条件
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
ISqlSugarClient sugarClient = tenantDb ?? db;
|
|
|
|
|
var exists = sugarClient.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).Any();
|
|
|
|
|
if (exists)
|
|
|
|
|
{
|
|
|
|
|
conditionId = conditionNodes[i].Id;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ChildNodes?.Find(x => x.Pid == conditionId)?.Id;
|
|
|
|
|
return ChildNodes.Where(x => x.Pid == conditionId).First().Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取下一个节点
|
|
|
|
|
/// </summary>
|
|
|
|
|