DisplayBoard.cs 1.3 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGVControl
{
    public class DisplayBoard
    {
        /// <summary>
        /// 异常列表
        /// </summary>
        public List<AlarmMsg> MsgList { get; private set; }
        /// <summary>
        /// 看板类
        /// </summary>
        public DisplayBoard()
        {
            MsgList = new List<AlarmMsg>();
        }
        /// <summary>
        /// 添加上报信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="type">默认类型是异常,1表示正常信息</param>
        public void Add(string name, string key, string value, int type = 0)
        {
            MsgList.Add(new AlarmMsg(name, key, value, type));
        }

        private void ClearAlram()
        {
            if (MsgList != null && MsgList.Count > 0)
                MsgList.Clear();
        }
        public void UpdateAlarmMsg()
        {
            if (MsgList != null && MsgList.Count > 0)
            {
                AGVManager.updateDeviceAlarmMsg(MsgList);
                ClearAlram();
            }

        }
    }
}