|
|
|
@ -9,25 +9,12 @@ using Tool.Model;
|
|
|
|
|
|
|
|
|
|
namespace RfidWeb
|
|
|
|
|
{
|
|
|
|
|
public class HimAlarmManager
|
|
|
|
|
public class HimAlarmManager:BaseManager
|
|
|
|
|
{
|
|
|
|
|
private HmiChAlarm hmiChAlarm = new HmiChAlarm();
|
|
|
|
|
private HmiCqAlarm hmiCq = new HmiCqAlarm();
|
|
|
|
|
EsStop esStop=new EsStop();
|
|
|
|
|
AlarmDataService alarmDataService = new AlarmDataService();
|
|
|
|
|
|
|
|
|
|
private readonly int Max = 31;
|
|
|
|
|
private readonly TimeSpan timeOut = TimeSpan.FromSeconds(5);
|
|
|
|
|
|
|
|
|
|
private Dictionary<int, string> GetDic(List<AlarmData> list, string plcAb, string address)
|
|
|
|
|
{
|
|
|
|
|
var dicCha = list.Where(x => x.PlcAb == plcAb && x.Address == address
|
|
|
|
|
&& !string.IsNullOrEmpty(x.Msg))
|
|
|
|
|
.ToDictionary(x => x.No, x => x.Msg);
|
|
|
|
|
|
|
|
|
|
return dicCha;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SetCH_alarm(Dictionary<string, DateTime> dictionary,List<AlarmData> list)
|
|
|
|
|
{
|
|
|
|
|
var a = hmiChAlarm.GetPlcDb();
|
|
|
|
@ -176,7 +163,6 @@ namespace RfidWeb
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ICache cache = Cache.Default;
|
|
|
|
|
public Dictionary<string, DateTime> GetList()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -194,63 +180,4 @@ namespace RfidWeb
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class PromptAlarmManager
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private Dictionary<int, string> GetDic(List<AlarmData> list, string plcAb, string address)
|
|
|
|
|
{
|
|
|
|
|
var dicCha = list.Where(x => x.PlcAb == plcAb && x.Address == address
|
|
|
|
|
&& !string.IsNullOrEmpty(x.Msg))
|
|
|
|
|
.ToDictionary(x => x.No, x => x.Msg);
|
|
|
|
|
|
|
|
|
|
return dicCha;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AlarmDataService alarmDataService = new AlarmDataService();
|
|
|
|
|
PromptAlarm cPromptAlarm=new PromptAlarm();
|
|
|
|
|
private readonly int Max = 31;
|
|
|
|
|
private readonly TimeSpan timeOut = TimeSpan.FromSeconds(5);
|
|
|
|
|
|
|
|
|
|
ICache cache = Cache.Default;
|
|
|
|
|
public Dictionary<string, DateTime> GetList()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, DateTime> dictionary = cache[CacheKeyManager.Prompt_alarmList] as Dictionary<string, DateTime>
|
|
|
|
|
?? new Dictionary<string, DateTime>();
|
|
|
|
|
|
|
|
|
|
List<AlarmData> list = alarmDataService.GetList();
|
|
|
|
|
|
|
|
|
|
var listEs = GetDic(list, "", "Prompt_alarm");
|
|
|
|
|
var bools = cPromptAlarm.GetDb();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cache.Set(CacheKeyManager.Prompt_alarm, bools, timeOut);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Max; i++)
|
|
|
|
|
{
|
|
|
|
|
var obj = bools[i];
|
|
|
|
|
if (!listEs.TryGetValue(i, out var value)) continue;
|
|
|
|
|
if (Convert.ToBoolean(obj))
|
|
|
|
|
{
|
|
|
|
|
if (!dictionary.ContainsKey(value))
|
|
|
|
|
{
|
|
|
|
|
dictionary[value] = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dictionary.Remove(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cache.Set(CacheKeyManager.Prompt_alarmList, dictionary, TimeSpan.FromMinutes(10));
|
|
|
|
|
return dictionary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
}
|