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); } }
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); } }
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); } }
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); } }