You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
6.6 KiB
C#

#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX.CoreCommunications
* 4063233D-BE40-415F-B28C-EBA14C47EA52
*
* WenJY
*
* 2025-10-24 15:00:21
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.Structures;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.RequestReceived;
/// <summary>
/// 5.4.1.4 - 获取端点信息请求
/// GetEndpointInformationRequest/Response
/// </summary>
public class BaseGetEndpointInformationRequestReceived
{
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="response"></param>
public void Handle(GetEndpointInformationRequest request, out CFXMessage response)
{
try
{
response = SubHandle(request);
}
catch (Exception e)
{
//无法响应时上传NotSupportedResponse
response = new NotSupportedResponse()
{
RequestResult = new RequestResult()
{
Result = StatusResult.Failed,
ResultCode = 0,
Message = e.Message
}
};
SerilogHelper.Instance.Error("请求数据解析异常", e);
}
}
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public virtual CFXMessage SubHandle(GetEndpointInformationRequest request)
{
CFXMessage response = new GetEndpointInformationResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
EndpointInformation = new Endpoint()
{
CFXHandle = "CFX.A00.SDSH000003",
CFXVersion = "1.0",
RequestNetworkUri = "amqp://127.0.0.1:1235",
RequestTargetAddress = "amqp://127.0.0.1:8888",
ModelNumber = "设备型号",
NumberOfLanes = 1,
Vendor = "木子贸易",
SerialNumber = "设备序列号",
Stages = new List<StageInformation>
{
new StageInformation()
{
Stage = new Stage()
{
StageName = "工位名称",
StageType = StageType.Work,
StageSequence = 1,
}
}
},
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",
}
},
}
}
};
return response;
}
}