feat - 添加新设备,用配置文件配置CFX配置

master
SoulStar 3 weeks ago
parent 8071408ef0
commit cea8cc9585

@ -30,6 +30,8 @@ namespace Sln.Iot.Business
private UnitsArrivedEvent unitsArrivedEvent = new UnitsArrivedEvent(); private UnitsArrivedEvent unitsArrivedEvent = new UnitsArrivedEvent();
private WorkStartedEvent workStartedEvent = new WorkStartedEvent(); private WorkStartedEvent workStartedEvent = new WorkStartedEvent();
private WorkStageStartedEvent workStageStartedEvent = new WorkStageStartedEvent(); private WorkStageStartedEvent workStageStartedEvent = new WorkStageStartedEvent();
private WorkCompletedEvent workCompletedEvent = new WorkCompletedEvent();
private UnitsDepartedEvent unitsDepartedEvent = new UnitsDepartedEvent();
private TrayBindingService trayBindingService = TrayBindingService.Instance; private TrayBindingService trayBindingService = TrayBindingService.Instance;
private CFXConnect1 connect1 = CFXConnect1.Instance; private CFXConnect1 connect1 = CFXConnect1.Instance;
@ -99,6 +101,7 @@ namespace Sln.Iot.Business
//CFX //CFX
Task.Run(() => Task.Run(() =>
{ {
//单元抵达事件 //单元抵达事件
connect1.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode))); connect1.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode)));
connect2.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode))); connect2.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode)));
@ -109,6 +112,9 @@ namespace Sln.Iot.Business
connect2.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode))); connect2.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode)));
connect3.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode))); connect3.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode)));
_log.Info($"工作开始ID:{tid}"); _log.Info($"工作开始ID:{tid}");
connect2.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
connect2.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
//预热炉工段开启 //预热炉工段开启
connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreHeatOven", 1))); connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreHeatOven", 1)));
_log.Info($"预热炉工段开始 ID:{tid}"); _log.Info($"预热炉工段开始 ID:{tid}");

@ -1,5 +1,6 @@
using CFX; using CFX;
using CFX.Structures; using CFX.Structures;
using CFX.Structures.PressInsertion;
using HslCommunication; using HslCommunication;
using Sln.Iot.CFX.CFXBusiness; using Sln.Iot.CFX.CFXBusiness;
using Sln.Iot.CFX.CFXConnect; using Sln.Iot.CFX.CFXConnect;
@ -38,11 +39,13 @@ namespace Sln.Iot.Business
private WorkStageCompletedEvent workStageCompletedEvent = new WorkStageCompletedEvent(); private WorkStageCompletedEvent workStageCompletedEvent = new WorkStageCompletedEvent();
private UnitsProcessedEvent unitsProcessedEvent = new UnitsProcessedEvent(); private UnitsProcessedEvent unitsProcessedEvent = new UnitsProcessedEvent();
private WorkCompletedEvent workCompletedEvent = new WorkCompletedEvent(); private WorkCompletedEvent workCompletedEvent = new WorkCompletedEvent();
private UnitsArrivedEvent unitsArrivedEvent = new UnitsArrivedEvent();
private WorkStartedEvent workStartedEvent = new WorkStartedEvent();
// CFX连接 // CFX连接
private CFXConnect1 connect1 = CFXConnect1.Instance; private CFXConnect1 connect1 = CFXConnect1.Instance;
private CFXConnect2 connect2 = CFXConnect2.Instance;
private CFXConnect3 connect3 = CFXConnect3.Instance; private CFXConnect3 connect3 = CFXConnect3.Instance;
private CFXConnect4 connect4 = CFXConnect4.Instance;
public RFID06Business() public RFID06Business()
{ {
@ -109,14 +112,18 @@ namespace Sln.Iot.Business
connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "CureOven", 3))); connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "CureOven", 3)));
_log.Info($"固化炉工段完成, {tid}"); _log.Info($"固化炉工段完成, {tid}");
connect4.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode)));
connect4.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode)));
//工单完成事件 //工单完成事件
connect1.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode))); connect1.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
connect2.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode))); connect4.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
connect3.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode))); connect3.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
_log.Info($"工单完成 ID:{tid}"); _log.Info($"工单完成 ID:{tid}");
//单元离站事件 //单元离站事件
connect1.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode))); connect1.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
connect2.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode))); connect4.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
connect3.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode))); connect3.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
_log.Info($"{traycode} 单元离站 "); _log.Info($"{traycode} 单元离站 ");

@ -40,7 +40,7 @@ namespace Sln.Iot.CFX.CFXConnect
CFXEventTools cFXEventTools = CFXEventTools.Instance; CFXEventTools cFXEventTools = CFXEventTools.Instance;
public string CFXHandle { get; set; } = "CFX.A00.SDSH000001"; public string CFXHandle { get; set; } = "CFX.A00.OT00470018";
protected override CFXMessage HandleRequest(CFXEnvelope request) protected override CFXMessage HandleRequest(CFXEnvelope request)
{ {

@ -16,7 +16,7 @@ using Sln.Iot.CFX.Event;
namespace Sln.Iot.CFX.CFXConnect namespace Sln.Iot.CFX.CFXConnect
{ {
/// <summary> /// <summary>
/// 提升机连接 /// 提升机1连接
/// </summary> /// </summary>
public class CFXConnect2 : CFXHelper public class CFXConnect2 : CFXHelper
{ {
@ -42,7 +42,7 @@ namespace Sln.Iot.CFX.CFXConnect
CFXEventTools cFXEventTools = CFXEventTools.Instance; CFXEventTools cFXEventTools = CFXEventTools.Instance;
public string CFXHandle { get; set; } = "SDSH000002"; public string CFXHandle { get; set; } = "CFX.A00.OT00470019";
protected override CFXMessage HandleRequest(CFXEnvelope request) protected override CFXMessage HandleRequest(CFXEnvelope request)
{ {
@ -112,7 +112,7 @@ namespace Sln.Iot.CFX.CFXConnect
var validateresult = Endpoint.ExecuteRequest(uri, new CFXEnvelope(msg) var validateresult = Endpoint.ExecuteRequest(uri, new CFXEnvelope(msg)
{ {
Source = Endpoint.CFXHandle, Source = Endpoint.CFXHandle,
Target = "CFX.A00.SDSH000002" Target = "inline-control"
}); });
if (validateresult == null) if (validateresult == null)

@ -42,7 +42,7 @@ namespace Sln.Iot.CFX.CFXConnect
CFXEventTools cFXEventTools = CFXEventTools.Instance; CFXEventTools cFXEventTools = CFXEventTools.Instance;
public string CFXHandle { get; set; } = "SDSH000003"; public string CFXHandle { get; set; } = "CFX.A00.OT00470017";
protected override CFXMessage HandleRequest(CFXEnvelope request) protected override CFXMessage HandleRequest(CFXEnvelope request)
{ {
@ -112,7 +112,7 @@ namespace Sln.Iot.CFX.CFXConnect
var validateresult = Endpoint.ExecuteRequest(uri, new CFXEnvelope(msg) var validateresult = Endpoint.ExecuteRequest(uri, new CFXEnvelope(msg)
{ {
Source = Endpoint.CFXHandle, Source = Endpoint.CFXHandle,
Target = "CFX.A00.SDSH000003" Target = "inline-control"
}); });
if (validateresult == null) if (validateresult == null)

@ -0,0 +1,132 @@
using CFX.InformationSystem.UnitValidation;
using CFX.ResourcePerformance;
using CFX.Structures;
using CFX;
using Sln.Iot.CFX.RequestReceived;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CFX.Production;
using Sln.Iot.CFX.CFXRequestes;
using Sln.Iot.CFX.CFXBusiness;
using Sln.Iot.CFX.Event;
namespace Sln.Iot.CFX.CFXConnect
{
/// <summary>
/// 提升机2连接
/// </summary>
public class CFXConnect4 : CFXHelper
{
private static readonly Lazy<CFXConnect4> lazy = new Lazy<CFXConnect4>(() => new CFXConnect4());
public static CFXConnect4 Instance
{
get
{
return lazy.Value;
}
}
AreYouThereRequestReceived4 areYouThereRequestReceived4 = new AreYouThereRequestReceived4();
GetEndpointInformationRequestReceived4 getEndpointInformationRequestReceived4 = new GetEndpointInformationRequestReceived4();
WhoIsThereRequestReceived4 whoIsThereRequestReceived4 = new WhoIsThereRequestReceived4();
GetActiveRecipeRequestReceived4 getActiveRecipeRequestReceived4 = new GetActiveRecipeRequestReceived4();
GetActiveFaultsRequestReceived4 getActiveFaultsRequestReceived4 = new GetActiveFaultsRequestReceived4();
HandleFaultRequestReceived4 handleFaultRequestReceived4 = new HandleFaultRequestReceived4();
ModifyStationParametersRequestReceived4 modifyStationParametersRequestReceived4 = new ModifyStationParametersRequestReceived4();
//HeartbeatEvent heartbeatEvent = new HeartbeatEvent();
CFXEventTools cFXEventTools = CFXEventTools.Instance;
public string CFXHandle { get; set; } = "CFX.A00.OT00470020";
protected override CFXMessage HandleRequest(CFXEnvelope request)
{
CFXMessage response = null;
if (request.MessageBody is AreYouThereRequest) //存在性检测请求
{
areYouThereRequestReceived4.Handle(request.MessageBody as AreYouThereRequest, out response);
}
else if (request.MessageBody is GetEndpointInformationRequest) //获取终端节点信息请求
{
getEndpointInformationRequestReceived4.Handle(request.MessageBody as GetEndpointInformationRequest, out response);
}
else if (request.MessageBody is WhoIsThereRequest) //设备存在性查询请求
{
whoIsThereRequestReceived4.Handle(request.MessageBody as WhoIsThereRequest, out response);
}
else if (request.MessageBody is GetActiveRecipeRequest) //获取当前激活配方请求
{
getActiveRecipeRequestReceived4.Handle(request.MessageBody as GetActiveRecipeRequest, out response);
}
else if (request.MessageBody is GetActiveFaultsRequest) //获取当前错误状态请求
{
getActiveFaultsRequestReceived4.Handle(request.MessageBody as GetActiveFaultsRequest, out response);
}
else if (request.MessageBody is HandleFaultRequest) //处理错误请求
{
handleFaultRequestReceived4.Handle(request.MessageBody as HandleFaultRequest, out response);
}
else if (request.MessageBody is ModifyStationParametersRequest) //设备修改参数请求
{
modifyStationParametersRequestReceived4.Handle(request.MessageBody as ModifyStationParametersRequest, out response);
}
else //不支持的请求类型
{
response = new NotSupportedResponse()
{
RequestResult = new RequestResult()
{
Result = StatusResult.Failed,
ResultCode = 0,
Message = $"不支持的请求类型:{request.MessageBody.GetType().Name}"
}
};
}
return response;
}
/// <summary>
/// 发送生产单元验证请求接收通知
/// </summary>
public void SendValidateUnitsRequest(string uri, string primaryIdentifier, string[] unitsIdentifier)
{
try
{
ValidateUnitsRequest msg = new ValidateUnitsRequest()
{
Validations = new List<ValidationType>()
{
ValidationType.UnitTraceValidation,
},
PrimaryIdentifier = primaryIdentifier,
Units = cFXEventTools.UnitPositionTrans(unitsIdentifier)
};
var validateresult = Endpoint.ExecuteRequest(uri, new CFXEnvelope(msg)
{
Source = Endpoint.CFXHandle,
Target = "inline-control"
});
if (validateresult == null)
{
return;
}
var response = validateresult.MessageBody as ValidateUnitsResponse;
//响应逻辑
}
catch (Exception ex)
{
}
}
}
}

@ -52,7 +52,7 @@ public class AreYouThereRequestReceived1 : BaseAreYouThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000001", CFXHandle = "CFX.A00.OT00470018",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -52,7 +52,7 @@ public class AreYouThereRequestReceived2 : BaseAreYouThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000002", CFXHandle = "CFX.A00.OT00470019",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -52,7 +52,7 @@ public class AreYouThereRequestReceived3 : BaseAreYouThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000003", CFXHandle = "CFX.A00.OT00470017",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -0,0 +1,63 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX.CoreCommunications
* 8D142D51-E08D-42FC-8C59-4551A1B36306
*
* WenJY
*
* 2025-10-24 14:58:25
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.Structures;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.1.1-端点在位查询请求
/// AreYouThereRequest/Response
/// </summary>
public class AreYouThereRequestReceived4 : BaseAreYouThereRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(AreYouThereRequest request)
{
CFXMessage response = new AreYouThereResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
CFXHandle = "CFX.A00.OT00470020",
RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/"
};
return response;
}
}

@ -78,15 +78,15 @@ public class GetActiveFaultsRequestReceived1 : BaseGetActiveFaultsRequestReceive
ResultCode = 0, ResultCode = 0,
Message = "", Message = "",
}, },
//ActiveFaults = faults ActiveFaults = faults
ActiveFaults = new List<Fault>() //ActiveFaults = new List<Fault>()
{ //{
new Fault() // new Fault()
{ // {
Description = "测试错误1", // Description = "测试错误1",
FaultCode = "5003", // FaultCode = "5003",
} // }
} //}
}; };
return response; return response;

@ -69,14 +69,15 @@ public class GetActiveFaultsRequestReceived2 : BaseGetActiveFaultsRequestReceive
ResultCode = 0, ResultCode = 0,
Message = "", Message = "",
}, },
ActiveFaults = new List<Fault>() ActiveFaults = faults
{ //ActiveFaults = new List<Fault>()
new Fault() //{
{ // new Fault()
Description = "测试错误1", // {
FaultCode = "5003", // Description = "测试错误1",
} // FaultCode = "5003",
} // }
//}
}; };
return response; return response;

@ -69,14 +69,15 @@ public class GetActiveFaultsRequestReceived3 : BaseGetActiveFaultsRequestReceive
ResultCode = 0, ResultCode = 0,
Message = "", Message = "",
}, },
ActiveFaults = new List<Fault>() ActiveFaults = faults
{ //ActiveFaults = new List<Fault>()
new Fault() //{
{ // new Fault()
Description = "测试错误1", // {
FaultCode = "5003", // Description = "测试错误1",
} // FaultCode = "5003",
} // }
//}
}; };
return response; return response;

@ -0,0 +1,85 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX
* CB14024A-08C4-4FF4-BD6C-8E8667D00263
*
* WenJY
*
* 2025-10-24 15:23:00
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.ResourcePerformance;
using CFX.Structures;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Repository.service;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.4.1.5 - 查询当前有无错误
/// GetActiveFaultsRequest/Response
/// </summary>
public class GetActiveFaultsRequestReceived4 : BaseGetActiveFaultsRequestReceived
{
private readonly ErrorService errorService = ErrorService.Instance;
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(GetActiveFaultsRequest request)
{
// 获取现在所有的错误
var errorList = errorService.GetOvenList().ToList();
List<Fault> faults = new List<Fault>();
foreach (var fault in errorList)
{
faults.Add(new Fault()
{
Description = fault.ErrorName,
FaultCode = fault.ErrorCode,
});
}
CFXMessage response = new GetActiveFaultsResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
ActiveFaults = faults
//ActiveFaults = new List<Fault>()
//{
// new Fault()
// {
// Description = "测试错误1",
// FaultCode = "5003",
// }
//}
};
return response;
}
}

@ -0,0 +1,62 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX
* 686D7EAB-9E42-43B2-B990-AF162E76F781
*
* WenJY
*
* 2025-10-24 15:18:38
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.Production;
using CFX.Structures;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.3.1.3 - 获取激活配方请求
/// GetActiveRecipeRequest/Response
/// </summary>
public class GetActiveRecipeRequestReceived4 : BaseGetActiveRecipeRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(GetActiveRecipeRequest request)
{
CFXMessage response = new GetActiveRecipeResponse()
{
ActiveRecipeName = "No Recipe Device",
ActiveRecipeRevision = "1.0",
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = ""
}
//配方数据
};
return response;
}
}

@ -55,14 +55,14 @@ public class GetEndpointInformationRequestReceived1 : BaseGetEndpointInformation
}, },
EndpointInformation = new Endpoint() EndpointInformation = new Endpoint()
{ {
CFXHandle = "CFX.A00.SDSH000001", CFXHandle = "CFX.A00.OT00470018",
CFXVersion = "2.0", CFXVersion = "2.0",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/", RequestTargetAddress = "amqp://127.0.0.1:8888/",
ModelNumber = "XYZ真空注胶机", ModelNumber = "真空注胶机",
NumberOfLanes = 1, NumberOfLanes = 1,
Vendor = "木子贸易中山有限公司", Vendor = "木子贸易中山有限公司",
SerialNumber = "SDSH000001", SerialNumber = "OT00470018",
Stages = new List<StageInformation> Stages = new List<StageInformation>
{ {
new StageInformation() new StageInformation()

@ -55,14 +55,14 @@ public class GetEndpointInformationRequestReceived2 : BaseGetEndpointInformation
}, },
EndpointInformation = new Endpoint() EndpointInformation = new Endpoint()
{ {
CFXHandle = "CFX.A00.SDSH000002", CFXHandle = "CFX.A00.OT00470019",
CFXVersion = "2.0", CFXVersion = "2.0",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/", RequestTargetAddress = "amqp://127.0.0.1:8888/",
ModelNumber = "升降回流", ModelNumber = "升降回流机-1",
NumberOfLanes = 1, NumberOfLanes = 1,
Vendor = "木子贸易中山有限公司", Vendor = "木子贸易中山有限公司",
SerialNumber = "SDSH000002", SerialNumber = "OT00470019",
Stages = new List<StageInformation> Stages = new List<StageInformation>
{ {
new StageInformation() new StageInformation()
@ -74,15 +74,15 @@ public class GetEndpointInformationRequestReceived2 : BaseGetEndpointInformation
StageSequence = 1, StageSequence = 1,
} }
}, },
new StageInformation() //new StageInformation()
{ //{
Stage = new Stage() // Stage = new Stage()
{ // {
StageName = "ConveyorOut", // StageName = "ConveyorOut",
StageType = StageType.Work, // StageType = StageType.Work,
StageSequence = 2, // StageSequence = 2,
} // }
} //}
}, },
SupportedTopics = CFXSupportedTopicList.SupportedTopics SupportedTopics = CFXSupportedTopicList.SupportedTopics
} }

@ -55,14 +55,14 @@ public class GetEndpointInformationRequestReceived3 : BaseGetEndpointInformation
}, },
EndpointInformation = new Endpoint() EndpointInformation = new Endpoint()
{ {
CFXHandle = "CFX.A00.SDSH000003", CFXHandle = "CFX.A00.OT00470017",
CFXVersion = "2.0", CFXVersion = "2.0",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/", RequestTargetAddress = "amqp://127.0.0.1:8888/",
ModelNumber = "隧道烤箱", ModelNumber = "隧道烤箱",
NumberOfLanes = 1, NumberOfLanes = 1,
Vendor = "木子贸易中山有限公司", Vendor = "木子贸易中山有限公司",
SerialNumber = "SDSH000003", SerialNumber = "OT00470017",
Stages = new List<StageInformation> Stages = new List<StageInformation>
{ {
new StageInformation() new StageInformation()

@ -0,0 +1,93 @@
#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.CFX.CFXBusiness;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.1.4 - 获取端点信息请求
/// GetEndpointInformationRequest/Response
/// </summary>
public class GetEndpointInformationRequestReceived4 : BaseGetEndpointInformationRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(GetEndpointInformationRequest request)
{
CFXMessage response = new GetEndpointInformationResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
EndpointInformation = new Endpoint()
{
CFXHandle = "CFX.A00.OT00470020",
CFXVersion = "2.0",
RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/",
ModelNumber = "升降回流机-2",
NumberOfLanes = 1,
Vendor = "木子贸易中山有限公司",
SerialNumber = "OT00470020",
Stages = new List<StageInformation>
{
//new StageInformation()
//{
// Stage = new Stage()
// {
// StageName = "ConveyorIn",
// StageType = StageType.Work,
// StageSequence = 1,
// }
//},
new StageInformation()
{
Stage = new Stage()
{
StageName = "ConveyorOut",
StageType = StageType.Work,
StageSequence = 1,
}
}
},
SupportedTopics = CFXSupportedTopicList.SupportedTopics
}
};
return response;
}
}

@ -0,0 +1,65 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX
* F3C2C0B6-F8E7-4869-B396-291233785B23
*
* WenJY
*
* 2025-10-24 15:20:11
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.ResourcePerformance;
using CFX.Structures;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.4.1.4 - 处理故障请求
/// HandleFaultRequest/Response
/// </summary>
public class HandleFaultRequestReceived4 : BaseHandleFaultRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(HandleFaultRequest request)
{
if (request.HandleRemote == true)
{
//熄灭报警灯
}
CFXMessage response = new HandleFaultResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
};
return response;
}
}

@ -0,0 +1,63 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX.CoreCommunications
* 8E7C0E19-8462-42CA-AC22-F89BF2927C6A
*
* WenJY
*
* 2025-10-24 15:00:54
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.ResourcePerformance;
using CFX.Structures;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.1.5 - 广播查询请求
/// WhoIsThereRequest/Response
/// </summary>
public class ModifyStationParametersRequestReceived4 : BaseModifyStationParametersRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(ModifyStationParametersRequest request)
{
//配方修改
//同时主动上报StationParameterModified
CFXMessage response = new ModifyStationParametersResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
};
return response;
}
}

@ -55,7 +55,7 @@ public class WhoIsThereRequestReceived1 : BaseWhoIsThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000001", CFXHandle = "CFX.A00.OT00470018",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -55,7 +55,7 @@ public class WhoIsThereRequestReceived2 : BaseWhoIsThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000002", CFXHandle = "CFX.A00.OT00470019",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -55,7 +55,7 @@ public class WhoIsThereRequestReceived3 : BaseWhoIsThereRequestReceived
Message = "", Message = "",
}, },
CFXHandle = "CFX.A00.SDSH000003", CFXHandle = "CFX.A00.OT00470017",
RequestNetworkUri = "amqp://127.0.0.1:1235/", RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/" RequestTargetAddress = "amqp://127.0.0.1:8888/"
}; };

@ -0,0 +1,70 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Iot.CFX.CoreCommunications
* 8E7C0E19-8462-42CA-AC22-F89BF2927C6A
*
* WenJY
*
* 2025-10-24 15:00:54
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using CFX;
using CFX.Structures;
using Sln.Iot.CFX.CFXBusiness;
using Sln.Iot.CFX.RequestReceived;
using Sln.Iot.Serilog;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.1.5 - 广播查询请求
/// WhoIsThereRequest/Response
/// </summary>
public class WhoIsThereRequestReceived4 : BaseWhoIsThereRequestReceived
{
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(WhoIsThereRequest request)
{
if (CFXSupportedTopicList.IsSupportJudge(request.SupportedTopics))
{
CFXMessage response = new WhoIsThereResponse()
{
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = "",
},
CFXHandle = "CFX.A00.OT00470020",
RequestNetworkUri = "amqp://127.0.0.1:1235/",
RequestTargetAddress = "amqp://127.0.0.1:8888/"
};
return response;
}
else
{
return null;
}
}
}

@ -40,10 +40,28 @@ namespace Sln.Iot.Config
public List<PLCConfig> PLCConfig { get; set; } public List<PLCConfig> PLCConfig { get; set; }
/// <summary> /// <summary>
/// CFX配置 /// CFX配置-真空箱
/// </summary> /// </summary>
public List<PLCConfig> CFXConfig { get; set; } public CFXConfig VacuumConfig { get; set; }
/// <summary>
/// CFX配置-提升机1
/// </summary>
public CFXConfig Lift1Config { get; set; }
/// <summary>
/// CFX配置-烤炉
/// </summary>
public CFXConfig OvenConfig { get; set; }
/// <summary>
/// CFX配置-提升机2
/// </summary>
public CFXConfig Lift2Config { get; set; }
/// <summary>
/// Gets the current application configuration instance.
/// </summary>
public AppConfig Value => this; public AppConfig Value => this;
} }
} }

@ -11,6 +11,11 @@ namespace Sln.Iot.Config
/// </summary> /// </summary>
public class CFXConfig public class CFXConfig
{ {
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary> /// <summary>
/// CFXHandle /// CFXHandle
/// </summary> /// </summary>
@ -24,6 +29,6 @@ namespace Sln.Iot.Config
/// <summary> /// <summary>
/// 上位系统URI /// 上位系统URI
/// </summary> /// </summary>
public int UpperURI { get; set; } public string UpperURI { get; set; }
} }
} }

@ -65,18 +65,21 @@ namespace Sln.Iot
//CFX接口启动 //CFX接口启动
//真空注胶机 //真空注胶机
CFXConnect1.Instance.Init("CFX.A00.SDSH000001", CFXConnect1.Instance.Init(appConfig.VacuumConfig.CFXHandle,
new Uri("amqp://127.0.0.1:1235"), new Uri(appConfig.VacuumConfig.LocalURI),
new Uri("amqp://127.0.0.1:30031")); new Uri(appConfig.VacuumConfig.UpperURI));
//升降回流 //提升机1
CFXConnect2.Instance.Init("CFX.A00.SDSH000002", CFXConnect2.Instance.Init(appConfig.Lift1Config.CFXHandle,
new Uri("amqp://127.0.0.1:1236"), new Uri(appConfig.Lift1Config.LocalURI),
new Uri("amqp://127.0.0.1:30031")); new Uri(appConfig.Lift1Config.UpperURI));
//隧道烤箱 //隧道烤箱
CFXConnect3.Instance.Init("CFX.A00.SDSH000003", CFXConnect3.Instance.Init(appConfig.OvenConfig.CFXHandle,
new Uri("amqp://127.0.0.1:1237"), new Uri(appConfig.OvenConfig.LocalURI),
new Uri("amqp://127.0.0.1:30031")); new Uri(appConfig.OvenConfig.UpperURI));
//提升机2
CFXConnect4.Instance.Init(appConfig.Lift2Config.CFXHandle,
new Uri(appConfig.Lift2Config.LocalURI),
new Uri(appConfig.Lift2Config.UpperURI));
////CFX接口启动 ////CFX接口启动
////真空注胶机 ////真空注胶机
@ -114,6 +117,7 @@ namespace Sln.Iot
CFXConnect1.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect1.Instance.CFXHandle))); CFXConnect1.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect1.Instance.CFXHandle)));
CFXConnect2.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect2.Instance.CFXHandle))); CFXConnect2.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect2.Instance.CFXHandle)));
CFXConnect3.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect3.Instance.CFXHandle))); CFXConnect3.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect3.Instance.CFXHandle)));
CFXConnect4.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect4.Instance.CFXHandle)));
} }
} }
} }

@ -1,6 +1,29 @@
{ {
"AppConfig": { "AppConfig": {
"logPath": "D:\\log", "logPath": "D:\\log",
"VacuumConfig": {
"DeviceName": "Vacuum",
"CFXHandle": "CFX.A00.OT00470018",
"LocalURI": "amqp://127.0.0.1:1235",
"UpperURI": "amqp://127.0.0.1:30031"
},
"Lift1Config": {
"DeviceName": "Lift1",
"CFXHandle": "CFX.A00.OT00470019",
"LocalURI": "amqp://127.0.0.1:1236",
"UpperURI": "amqp://127.0.0.1:30031"
},
"OvenConfig": {
"DeviceName": "Oven",
"CFXHandle": "CFX.A00.OT00470017",
"LocalURI": "amqp://127.0.0.1:1237",
"UpperURI": "amqp://127.0.0.1:30031"
},
"Lift2Config": {
"DeviceName": "Lift2",
"CFXHandle": "CFX.A00.OT00470020",
"LocalURI": "amqp://127.0.0.1:1238",
"UpperURI": "amqp://127.0.0.1:30031"
}
} }
} }

Loading…
Cancel
Save