init commit

This commit is contained in:
zhaowei.huang
2026-06-14 11:19:15 +08:00
parent e79a3815a5
commit c8e540d272
174 changed files with 60830 additions and 39 deletions
@@ -0,0 +1,58 @@
using StandardScene.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static StandardScene.Chained.AbstractLoopMission;
namespace StandardScene.Chained.Loop
{
/// <summary>
/// 进入点规则:返回是否允许进入。
/// </summary>
public interface IEnterRule
{
bool CanEnter(LoopPoint point, LoopTask task, object context = null);
}
/// <summary>
/// 离开点规则:返回是否允许离开。
/// </summary>
public interface IExitRule
{
bool CanExit(LoopPoint point, LoopTask task, object context = null);
}
/// <summary>
/// 合流规则:从候选任务中选择一个
/// </summary>
public interface IJoinRule
{
LoopTask SelectJoin(IEnumerable<LoopTask> candidates, LoopPoint point);
}
/// <summary>
/// 分流规则:为任务选取下一分支标识
/// </summary>
public interface IBranchRule
{
string SelectBranch(LoopPoint point, LoopTask task, object context = null);
}
/// <summary>
/// 任务策略接口:提供任务数据来源与基础策略决策(由 LoopViewer 或其它组件实现/替换)。
/// </summary>
public interface ITaskStrategy
{
/// <summary>
/// 返回当前策略下的任务集合(策略负责数据来源,例如读取 LoopViewer 的 JSON)。
/// </summary>
IEnumerable<LoopTask> GetTasks();
/// <summary>
/// 刷新策略数据(例如重新加载 JSON)。
/// </summary>
void Refresh();
}
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StandardScene.Chained.Loop
{
/// <summary>
/// 触发器适配器统一接口:外部设备(PLC、按钮盒、API 网关等)实现此接口并触发事件。
/// </summary>
public interface ITriggerAdapter : IDisposable
{
/// <summary>
/// 外部触发事件:Source 用于区分来源("PLC","ButtonBox","API"等),Key/Value 为业务自定义负载。
/// </summary>
event EventHandler<TriggerEventArgs> TriggerRaised;
/// <summary>
/// 可选:启动适配器(开启轮询、建立连接等)。
/// </summary>
void Start();
/// <summary>
/// 可选:停止适配器。
/// </summary>
void Stop();
}
public class TriggerEventArgs : EventArgs
{
public string Source { get; set; } = string.Empty;
public string Key { get; set; } = string.Empty;
public object Value { get; set; }
}
}