wanshenmean
2026-03-17 737dec3c384f394fd6f9849b4480b697d1ba35d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace WIDESEAWCS_S7Simulator.Application.Protocol;
 
/// <summary>
/// 协议监控配置。
/// 在这里配置轮询频率、模板与处理器的绑定关系,避免把设备逻辑写死在代码里。
/// </summary>
public class ProtocolMonitoringOptions
{
    public int PollingIntervalMs { get; set; } = 200;
    public List<TemplateProtocolBinding> TemplateBindings { get; set; } = new();
    public List<MirrorAckRuleOptions> MirrorAckRules { get; set; } = new();
 
    /// <summary>
    /// 输送线多段规则集合。
    /// 一段线体对应一个 RuleId,按顺序执行。
    /// </summary>
    public List<string> WcsLineRuleIds { get; set; } = new();
 
    /// <summary>
    /// PlcLink 堆垛机规则集合。
    /// </summary>
    public List<string> PlcLinkStackerRuleIds { get; set; } = new();
 
    /// <summary>
    /// 堆垛机交互规则集合。
    /// 通过 RuleId 绑定具体的位交互映射逻辑。
    /// </summary>
    public List<string> StackerInteractionRuleIds { get; set; } = new();
}
 
/// <summary>
/// 协议模板与设备协议处理器的绑定关系。
/// </summary>
public class TemplateProtocolBinding
{
    public string TemplateId { get; set; } = string.Empty;
    public string ProtocolName { get; set; } = string.Empty;
}
 
/// <summary>
/// 通用 ACK 镜像规则。
/// 字段键全部由配置驱动,不同设备可使用不同映射。
/// </summary>
public class MirrorAckRuleOptions
{
    public string RuleId { get; set; } = string.Empty;
    public string WcsAckFieldKey { get; set; } = "WCS_ACK";
    public string PlcStbFieldKey { get; set; } = "PLC_STB";
    public string? WcsTaskIdFieldKey { get; set; } = "WCS_TASK_ID";
    public string? PlcTaskIdFieldKey { get; set; } = "PLC_TASK_ID";
    public string? WcsTargetIdFieldKey { get; set; } = "WCS_TARGET_ID";
    public string? PlcTargetIdFieldKey { get; set; } = "PLC_TARGET_ID";
    public List<string> ClearFieldKeysOnAck0 { get; set; } = new();
    public List<string> ClearFieldKeysOnAck2 { get; set; } = new();
}