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.

85 lines
2.2 KiB
C#

#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.PLC;
using Sln.Iot.Serilog;
using static System.Runtime.CompilerServices.RuntimeHelpers;
using System.Text;
namespace Sln.Iot.CFX.CFXRequestes;
/// <summary>
/// 5.4.3.1.3 - 获取激活配方请求
/// GetActiveRecipeRequest/Response
/// </summary>
public class GetActiveRecipeRequestReceived1 : BaseGetActiveRecipeRequestReceived
{
private readonly PLCConnect _plc = PLCConnect.Instance;
/// <summary>
/// 子类重写处理
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override CFXMessage SubHandle(GetActiveRecipeRequest request)
{
string restr1 = string.Empty;
string restr2 = string.Empty;
////获取现在激活的配方
//var res1 = _plc.ReadBytes(_plc.DeltaInstance1, "D600", 10);
//var res2 = _plc.ReadBytes(_plc.DeltaInstance2, "D600", 10);
//if (res1.IsSuccess)
//{
// restr1 = Encoding.ASCII.GetString(res1.Content);
//}
//if (res2.IsSuccess)
//{
// restr2 = Encoding.ASCII.GetString(res2.Content);
//}
CFXMessage response = new GetActiveRecipeResponse()
{
ActiveRecipeName = $"Recipe1:[{restr1}];Recipe2:[{restr2}]",
ActiveRecipeRevision = "1.0",
Result = new RequestResult()
{
Result = StatusResult.Success,
ResultCode = 0,
Message = ""
}
//配方数据
};
return response;
}
}