mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-19 16:06:33 +08:00
修改了远程环境的节点加载流程、容器节点子节点的位置关系
This commit is contained in:
@@ -48,7 +48,6 @@ namespace Serein.NodeFlow.Env
|
||||
/// <exception cref="NotImplementedException">超时触发</exception>
|
||||
public async Task SendAsync(string theme, object? data = null, int overtimeInMs = 100)
|
||||
{
|
||||
|
||||
var msgId = MsgIdHelper.GenerateId().ToString();
|
||||
SereinEnv.WriteLine(InfoType.INFO, $"[{msgId}] => {theme}");
|
||||
await SendCommandAsync(msgId, theme, data); // 客户端发送消息
|
||||
@@ -62,12 +61,17 @@ namespace Serein.NodeFlow.Env
|
||||
public async Task<TResult> SendAndWaitDataAsync<TResult>(string theme, object? data = null, int overtimeInMs = 50)
|
||||
{
|
||||
var msgId = MsgIdHelper.GenerateId().ToString();
|
||||
//_ = Task.Run(async () =>
|
||||
//{
|
||||
// await Task.Delay(500);
|
||||
//});
|
||||
await SendCommandAsync(msgId, theme, data); // 客户端发送消息
|
||||
return (await remoteFlowEnvironment.WaitTriggerAsync<TResult>(msgId)).Value;
|
||||
_ = SendCommandAsync(msgId, theme, data); // 客户端发送消息
|
||||
var result = await remoteFlowEnvironment.WaitTriggerAsync<TResult>(msgId);
|
||||
if (result.Type == TriggerDescription.Overtime)
|
||||
{
|
||||
throw new Exception($"主题【{theme}】异常,服务端未响应");
|
||||
}
|
||||
else if (result.Type == TriggerDescription.TypeInconsistency)
|
||||
{
|
||||
throw new Exception($"主题【{theme}】异常,服务端返回数据类型与预期不一致{result.Value?.GetType()}");
|
||||
}
|
||||
return result.Value;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,12 +100,66 @@ namespace Serein.NodeFlow.Env
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, sereinProjectData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始流程
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.StartFlow, IsReturnValue = false)]
|
||||
public void StartFlow([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
/// <summary>
|
||||
/// 结束流程
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.ExitFlow, IsReturnValue = false)]
|
||||
public void ExitFlow([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置了某个节点为起始节点
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="nodeGuid">节点Guid</param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.SetStartNode, IsReturnValue = false)]
|
||||
public void SetStartNode([UseMsgId] string msgId, string nodeGuid)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, nodeGuid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从某个节点开始运行
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.StartFlowInSelectNode, IsReturnValue = false)]
|
||||
public void StartFlowInSelectNode([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置节点的中断
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.SetNodeInterrupt, IsReturnValue = false)]
|
||||
public void SetNodeInterrupt([UseMsgId] string msgId)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync<object>(msgId, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加中断监视表达式
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.AddInterruptExpression, IsReturnValue = false)]
|
||||
public void AddInterruptExpression([UseMsgId] string msgId)
|
||||
{
|
||||
@@ -109,43 +167,77 @@ namespace Serein.NodeFlow.Env
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建节点
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="nodeInfo"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.CreateNode, IsReturnValue = false)]
|
||||
public void CreateNode([UseMsgId] string msgId, [UseData] NodeInfo nodeInfo)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, nodeInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除节点
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.RemoveNode, IsReturnValue = false)]
|
||||
public void RemoveNode([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建节点之间的调用关系
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.ConnectInvokeNode, IsReturnValue = false)]
|
||||
public void ConnectInvokeNode([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除节点之间的调用关系
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.RemoveInvokeConnect, IsReturnValue = false)]
|
||||
public void RemoveInvokeConnect([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建节点之间参数获取关系
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.ConnectArgSourceNode, IsReturnValue = false)]
|
||||
public void ConnectArgSourceNode([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除节点之间参数获取关系
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.RemoveArgSourceConnect, IsReturnValue = false)]
|
||||
public void RemoveArgSourceConnect([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
_ = remoteFlowEnvironment.InvokeTriggerAsync(msgId, state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变参数
|
||||
/// </summary>
|
||||
/// <param name="msgId"></param>
|
||||
/// <param name="state"></param>
|
||||
[AutoSocketHandle(ThemeValue = EnvMsgTheme.ChangeParameter, IsReturnValue = false)]
|
||||
public void ChangeParameter([UseMsgId] string msgId, bool state)
|
||||
{
|
||||
@@ -153,8 +245,6 @@ namespace Serein.NodeFlow.Env
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user