using CFX;
using CFX.Production;
using CFX.Structures;
using Sln.Iot.Serilog;

namespace Sln.Iot.CFX.Event
{
    /// <summary>
    /// 配方修改事件
    /// </summary>
    public class RecipeModifiedEvent
    {
        /// <summary>
        /// 数据封装处理
        /// </summary>
        /// <returns></returns>
        public CFXMessage Handle()
        {
            CFXMessage eve = null;
            try
            {
                eve = new RecipeModified()
                {
                    RecipeName = "配方A",
                    Revision = "1.0",
                    ModifiedBy = new Operator()
                    {
                        ActorType = ActorType.Human,
                        FirstName = "王",
                        LastName = "晟睿",
                        LoginName = "admin",
                        OperatorIdentifier = "OP-1000"
                    },
                    Reason = RecipeModificationReason.UpdatedGeometry,
                    Notes = "修改了配方的几何信息",
                };
            }
            catch (Exception e)
            {
                SerilogHelper.Instance.Error("终端节点连接事件数据封装异常", e);
            }
            return eve;
        }
    }
}
