CNCAnalysis.cs 1.19 KB
using HHECS.BllModel;
using HHECS.DAQHandle.Dto;
using HHECS.DAQShared.Common.Enums;
using HHECS.DAQShared.Common.Utils;
using HHECS.DAQShared.Models;

namespace HHECS.DAQHandle.EquipmentHandle
{
    internal class CNCAnalysis : AnalysisBase
    {
        public CNCAnalysis(AnalysisParameter parameter) : base(parameter)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="equipment"></param>
        /// <param name="record"></param>
        /// <returns></returns>
        protected override BllResult<EquipmentStatus> GetEquipmentStatus(EquipmentExtend equipment, EquipmentDataRecord record)
        {
            try
            {
                var tagResult = JsonConvertToTagList(record.Tags);
                if (!tagResult.Success)
                {
                    return BllResultFactory.Error<EquipmentStatus>(tagResult.Msg);
                }
                return EquipmentStatusHelper.GetEquipmentStatus(EquipmentTypeConst.CNC, equipment.EquipmentProps, tagResult.Data);
            }
            catch (Exception ex)
            {
                return BllResultFactory.Error<EquipmentStatus>(ex.Message);
            }
        }
    }
}