using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JSMachine.WMS.Common.Dto.Business { /// /// agv执行失败报警信息 /// public class AgvTaskFailedAlarmInfo { public Guid AgvTaskId { get; set; } public string Operation { get; set; } } public static class GlobalAgvTaskFailedAlarmInfo { private static ConcurrentDictionary AgvTaskFailedAlarmInfoes = new(); /// /// 新增告警 /// /// public static void AddAlarmInfo(AgvTaskFailedAlarmInfo alarmInfo) { AgvTaskFailedAlarmInfoes.AddOrUpdate(alarmInfo.AgvTaskId, alarmInfo, (key, value) => alarmInfo); } /// /// 获取所有告警 /// /// public static List GetAlarmInfoes() { return AgvTaskFailedAlarmInfoes.Select(p => p.Value).ToList(); } /// /// 删除警告 /// /// public static void RemoveAlarmInfo(Guid agvTaskId) { AgvTaskFailedAlarmInfoes.TryRemove(agvTaskId, out AgvTaskFailedAlarmInfo info); } } }