コード例 #1
0
        public void AddTaskWarn(WarningTypeE warntype, ushort devid, uint transid = 0)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.dev_id == devid && !c.resolve);

            if (warn == null)
            {
                if (stopwarnadding)
                {
                    return;
                }
                if ((DateTime.Now - inittime).TotalSeconds < 20)
                {
                    return;
                }
                warn = new Warning()
                {
                    dev_id   = devid,
                    type     = (byte)warntype,
                    trans_id = transid
                };
                string devname = PubMaster.Device.GetDeviceName(devid);
                string warnmsg = PubMaster.Dic.GetDtlStrCode(warntype.ToString());
                warn.content = devname + ": " + warnmsg;
                AddWaring(warn);
            }
        }
コード例 #2
0
        public void RemoveTraWarn(WarningTypeE warntype, ushort trackid)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.track_id == trackid && !c.resolve);

            if (warn != null)
            {
                RemoveWarning(warn);
            }
        }
コード例 #3
0
        /// <summary>
        /// 清除任务报警
        /// </summary>
        /// <param name="transid"></param>
        public void RemoveTaskWarn(WarningTypeE warntype, uint transid)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.trans_id == transid && !c.resolve);

            if (warn != null)
            {
                RemoveWarning(warn);
            }
        }
コード例 #4
0
        public void RemoveDevWarn(WarningTypeE warntype, ushort devid)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.dev_id == devid && !c.resolve);

            if (warn != null)
            {
                RemoveWarning(warn);
            }
        }
コード例 #5
0
        public void AddTraWarn(WarningTypeE warntype, ushort trackid, string trackname = null)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.track_id == trackid && !c.resolve);

            if (warn == null)
            {
                warn = new Warning()
                {
                    track_id = trackid,
                    type     = (byte)warntype,
                };
                string traname = trackname ?? PubMaster.Track.GetTrackName(trackid);
                string warnmsg = PubMaster.Dic.GetDtlStrCode(warntype.ToString());
                warn.content = traname + ": " + warnmsg;
                AddWaring(warn);
            }
        }
コード例 #6
0
        public void AddDevWarn(WarningTypeE warntype, ushort devid, uint transid = 0, uint trackid = 0)
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.dev_id == devid && !c.resolve);

            if (warn == null)
            {
                if (stopwarnadding)
                {
                    return;
                }
                if ((DateTime.Now - inittime).TotalSeconds < 20)
                {
                    return;
                }
                warn = new Warning()
                {
                    dev_id   = devid,
                    type     = (byte)warntype,
                    trans_id = transid,
                    track_id = (ushort)trackid
                };
                string devname = PubMaster.Device.GetDeviceName(devid);
                warn.area_id = (ushort)PubMaster.Device.GetDeviceArea(devid);
                string warnmsg = PubMaster.Dic.GetDtlStrCode(warntype.ToString(), out byte level);
                if (trackid > 0)
                {
                    string trackname = PubMaster.Track.GetTrackName(trackid);
                    warn.content = devname + ": (" + trackname + ") " + warnmsg;
                }
                else
                {
                    warn.content = devname + ": " + warnmsg;
                }
                warn.level = level;
                AddWaring(warn);
            }
        }
コード例 #7
0
        public void AddTaskWarn(uint areaid, WarningTypeE warntype, ushort devid, uint transid = 0, string result = "")
        {
            Warning warn = List.Find(c => c.type == (byte)warntype && c.dev_id == devid && c.trans_id == transid && !c.resolve);

            if (warn == null)
            {
                if (stopwarnadding)
                {
                    return;
                }
                if ((DateTime.Now - inittime).TotalSeconds < 20)
                {
                    return;
                }
                warn = new Warning()
                {
                    area_id  = (ushort)areaid,
                    dev_id   = devid,
                    type     = (byte)warntype,
                    trans_id = transid
                };
                string devname = PubMaster.Device.GetDeviceName(devid);
                //warn.area_id = (ushort)PubMaster.Device.GetDeviceArea(devid);
                string warnmsg = PubMaster.Dic.GetDtlStrCode(warntype.ToString(), out byte level);
                if (devid != 0)
                {
                    warn.content = devname + ": " + warnmsg + " > " + result;
                }
                else
                {
                    warn.content = "任务[" + transid + "] : " + warnmsg + " > " + result;
                }
                warn.level = level;
                AddWaring(warn);
            }
        }