StationMonitorAnalysis.cs 1.88 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
{
    /// <summary>
    /// 站台监控数据解析
    /// </summary>
    internal class StationMonitorAnalysis : AnalysisBase
    {
        public StationMonitorAnalysis(AnalysisParameter parameter) : base(parameter)
        {
        }

        protected override BllResult UpdateEquipmentAlarm(Equipment equipment, IEnumerable<EquipmentDataRecord> records)
        {
            //需要采集输送线报警的项目
            var projectCodes = new List<string>
            {
                "HH-TPS-20240830"
            };
            if (projectCodes.Contains(equipment.ProjectCode))
            {
                return base.UpdateEquipmentAlarm(equipment, records);
            }

            //输送线报警暂不记录
            return BllResultFactory.Success();
        }

        protected override BllResult UpdateEquipmentStatus(Equipment equipment, IEnumerable<EquipmentDataRecord> records)
        {
            //输送线状态暂不记录
            return BllResultFactory.Success();
        }

        protected override BllResult<EquipmentStatus> GetEquipmentStatus(Equipment equipment, EquipmentDataRecord record)
        {
            try
            {
                var tagResult = JsonConvertToTagList(record.Tags);
                if (!tagResult.Success)
                {
                    return BllResultFactory.Error<EquipmentStatus>(tagResult.Msg);
                }

                return EquipmentStatusHelper.GetEquipmentStatus(EquipmentTypeConst.StationMonitor, equipment.EquipmentProps, tagResult.Data);
            }
            catch (Exception ex)
            {
                return BllResultFactory.Error<EquipmentStatus>(ex.Message);
            }
        }
    }
}