版本260406

This commit is contained in:
2026-04-06 22:04:05 +08:00
parent 7dc5e73af7
commit 0b150470be
216 changed files with 98993 additions and 33 deletions

View File

@@ -0,0 +1,54 @@
using OrpaonVision.Core.Results;
using OrpaonVision.SiteApp.Runtime.Contracts;
using OrpaonVision.SiteApp.Runtime.Options;
namespace OrpaonVision.SiteApp.Runtime.Services
{
/// <summary>
/// 运行状态机简化实现MVP 阶段)。
/// </summary>
public sealed class SimpleRuntimeStateMachineService : IRuntimeStateMachineService
{
private readonly RuntimeOptions _options;
private int _currentLayer;
/// <summary>
/// 构造函数。
/// </summary>
public SimpleRuntimeStateMachineService(RuntimeOptions options)
{
_options = options;
_currentLayer = 1;
}
/// <inheritdoc />
public RuntimeStateSnapshotDto GetSnapshot()
{
return new RuntimeStateSnapshotDto
{
CurrentLayer = _currentLayer,
TotalLayers = _options.TotalLayers,
StateText = _currentLayer > _options.TotalLayers ? "工位完成" : "运行中"
};
}
/// <inheritdoc />
public Result MoveToNextLayer()
{
if (_currentLayer >= _options.TotalLayers)
{
return Result.Fail("STATE_MACHINE_FINISHED", "当前已到最后一层,无法继续切层。");
}
_currentLayer += 1;
return Result.Success("STATE_MACHINE_MOVED", $"已切换到第 {_currentLayer} 层。");
}
/// <inheritdoc />
public void Reset()
{
_currentLayer = 1;
}
}
}