|
|
|
|
|
using CFX.Structures;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Sln.Iot.CFX.CFXBusiness
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备支持能力列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class CFXSupportedTopicList
|
|
|
|
|
|
{
|
|
|
|
|
|
public static List<SupportedTopic> SupportedTopics = new List<SupportedTopic>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SupportedTopic()
|
|
|
|
|
|
{
|
|
|
|
|
|
TopicName = "CFX",
|
|
|
|
|
|
TopicSupportType = TopicSupportType.Publisher,
|
|
|
|
|
|
SupportedMessages = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"EndpointConnected",
|
|
|
|
|
|
"EndpointShuttingDown",
|
|
|
|
|
|
"GetEndpointInformationRequest/Response",
|
|
|
|
|
|
"AreYouThereRequest/Response",
|
|
|
|
|
|
"WhoIsThereRequest/Response",
|
|
|
|
|
|
"NotSupportedResponse",
|
|
|
|
|
|
"Heartbeat"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SupportedTopic()
|
|
|
|
|
|
{
|
|
|
|
|
|
TopicName = "CFX.Production",
|
|
|
|
|
|
TopicSupportType = TopicSupportType.Publisher,
|
|
|
|
|
|
SupportedMessages = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"UnitsArrived",
|
|
|
|
|
|
"WorkStarted",
|
|
|
|
|
|
"WorkStageStarted",
|
|
|
|
|
|
"WorkStageCompleted",
|
|
|
|
|
|
"WorkStagePaused",
|
|
|
|
|
|
"WorkStageResumed",
|
|
|
|
|
|
"WorkCompleted",
|
|
|
|
|
|
"UnitsDeparted",
|
|
|
|
|
|
"RecipeActivated",
|
|
|
|
|
|
"RecipeModified",
|
|
|
|
|
|
"GetActiveRecipeRequest/Response",
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SupportedTopic()
|
|
|
|
|
|
{
|
|
|
|
|
|
TopicName = "CFX.Production.Processing",
|
|
|
|
|
|
TopicSupportType = TopicSupportType.Publisher,
|
|
|
|
|
|
SupportedMessages = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"UnitsProcessed",
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SupportedTopic()
|
|
|
|
|
|
{
|
|
|
|
|
|
TopicName = "CFX.InformationSystem.UnitValidation",
|
|
|
|
|
|
TopicSupportType = TopicSupportType.Publisher,
|
|
|
|
|
|
SupportedMessages = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"ValidateUnitsRequest/Response",
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SupportedTopic()
|
|
|
|
|
|
{
|
|
|
|
|
|
TopicName = "CFX.ResourcePerformance",
|
|
|
|
|
|
TopicSupportType = TopicSupportType.Publisher,
|
|
|
|
|
|
SupportedMessages = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
"FaultOccurred",
|
|
|
|
|
|
"FaultAcknowledged",
|
|
|
|
|
|
"FaultCleared",
|
|
|
|
|
|
"HandleFaultRequest/Response",
|
|
|
|
|
|
"GetActiveFaultRequest/Response",
|
|
|
|
|
|
"LogEntryRecorded",
|
|
|
|
|
|
"StationOffline",
|
|
|
|
|
|
"StationOnline",
|
|
|
|
|
|
"StationStateChanged",
|
|
|
|
|
|
"StationParametersModified",
|
|
|
|
|
|
"ModifyStationParametersRequest/Response",
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否支持该能力列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="topics">查询的能力列表</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static bool IsSupportJudge(List<SupportedTopic> topics)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (SupportedTopic topic in topics)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (string message in topic.SupportedMessages)
|
|
|
|
|
|
{
|
|
|
|
|
|
var supportedTopic = SupportedTopics.FirstOrDefault(t => t.TopicName == topic.TopicName);
|
|
|
|
|
|
if (supportedTopic == null || !supportedTopic.SupportedMessages.Contains(message))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|