|
|
@ -1,256 +1,256 @@
|
|
|
|
using DevExpress.Xpo.DB;
|
|
|
|
// using DevExpress.Xpo.DB;
|
|
|
|
using FastReport.Export.Dbf;
|
|
|
|
// using FastReport.Export.Dbf;
|
|
|
|
using HslCommunication;
|
|
|
|
// using HslCommunication;
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
// using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
// using Mesnac.Codd.Session;
|
|
|
|
using Mesnac.DoUtils;
|
|
|
|
// using Mesnac.DoUtils;
|
|
|
|
using Mesnac.PlcUtils;
|
|
|
|
// using Mesnac.PlcUtils;
|
|
|
|
using System;
|
|
|
|
// using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
// using System.Collections.Generic;
|
|
|
|
using System.Data;
|
|
|
|
// using System.Data;
|
|
|
|
using System.Linq;
|
|
|
|
// using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
// using System.Text;
|
|
|
|
using System.Threading;
|
|
|
|
// using System.Threading;
|
|
|
|
using static DevExpress.Xpo.Helpers.AssociatedCollectionCriteriaHelper;
|
|
|
|
// using static DevExpress.Xpo.Helpers.AssociatedCollectionCriteriaHelper;
|
|
|
|
|
|
|
|
//
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
|
|
|
|
// namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
public class AlarmSaveHelper
|
|
|
|
// public class AlarmSaveHelper
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 报警保存事件定义
|
|
|
|
// /// 报警保存事件定义
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
public event EventHandler OnAlarmSave;
|
|
|
|
// // public event EventHandler OnAlarmSave;
|
|
|
|
public event EventHandler OnAlarmSaveExtend;
|
|
|
|
// // public event EventHandler OnAlarmSaveExtend;
|
|
|
|
public object sender = null;
|
|
|
|
// public object sender = null;
|
|
|
|
public object senderExtend = null;
|
|
|
|
// public object senderExtend = null;
|
|
|
|
private int WordLength = 16; //定义字长
|
|
|
|
// private int WordLength = 16; //定义字长
|
|
|
|
|
|
|
|
//
|
|
|
|
// private PlcBusiness plcBusiness = PlcBusiness.Instance;
|
|
|
|
// // private PlcBusiness plcBusiness = PlcBusiness.Instance;
|
|
|
|
|
|
|
|
//
|
|
|
|
// private DoControl doControl = DoControl.Instance;
|
|
|
|
// // private DoControl doControl = DoControl.Instance;
|
|
|
|
|
|
|
|
//
|
|
|
|
private static readonly Lazy<AlarmSaveHelper> lazy = new Lazy<AlarmSaveHelper>(() => new AlarmSaveHelper());
|
|
|
|
// private static readonly Lazy<AlarmSaveHelper> lazy = new Lazy<AlarmSaveHelper>(() => new AlarmSaveHelper());
|
|
|
|
|
|
|
|
//
|
|
|
|
public static AlarmSaveHelper Instance
|
|
|
|
// public static AlarmSaveHelper Instance
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
get
|
|
|
|
// get
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
return lazy.Value;
|
|
|
|
// return lazy.Value;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
private AlarmSaveHelper() { }
|
|
|
|
// private AlarmSaveHelper() { }
|
|
|
|
|
|
|
|
//
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 保存报警信息
|
|
|
|
// /// 保存报警信息
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
public void Save()
|
|
|
|
// public void Save()
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
List<Entity.AlarmInfo> _alarmInfoList = Cache.CacheHelper.AlarmInfoList;
|
|
|
|
// List<Entity.AlarmInfo> _alarmInfoList = Cache.CacheHelper.AlarmInfoList;
|
|
|
|
List<Entity.SimpleAlarmInfo> _alarmBlockWordList = Cache.CacheHelper.BlockWordList;
|
|
|
|
// List<Entity.SimpleAlarmInfo> _alarmBlockWordList = Cache.CacheHelper.BlockWordList;
|
|
|
|
ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Debug("报警参数-实时刷新自动保存报警...");
|
|
|
|
// ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Debug("报警参数-实时刷新自动保存报警...");
|
|
|
|
|
|
|
|
//
|
|
|
|
#region 读取PLC的报警数据 原方法 Delete By wenjy 2023-08-07 17:10:07
|
|
|
|
// #region 读取PLC的报警数据 原方法 Delete By wenjy 2023-08-07 17:10:07
|
|
|
|
//foreach (Entity.AlarmInfo info in _alarmInfoList)
|
|
|
|
// //foreach (Entity.AlarmInfo info in _alarmInfoList)
|
|
|
|
//{
|
|
|
|
// //{
|
|
|
|
// Int16[] buff = null;
|
|
|
|
// // Int16[] buff = null;
|
|
|
|
// if (BasePlcHelper.Instance.PlcRead(info.AlarmPLC, info.AlarmBlock, info.Start, info.Length, out buff))
|
|
|
|
// // if (BasePlcHelper.Instance.PlcRead(info.AlarmPLC, info.AlarmBlock, info.Start, info.Length, out buff))
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
// // foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// if (sai.AlramPLC == info.AlarmPLC && sai.AlarmBlock == info.AlarmBlock) //匹配数据块
|
|
|
|
// // if (sai.AlramPLC == info.AlarmPLC && sai.AlarmBlock == info.AlarmBlock) //匹配数据块
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// sai.AlarmData = buff[sai.AlarmAddress - info.Start]; //对起始字偏移,为当前字的报警值
|
|
|
|
// // sai.AlarmData = buff[sai.AlarmAddress - info.Start]; //对起始字偏移,为当前字的报警值
|
|
|
|
// sai.AlarmData = Mesnac.Basic.DataProcessor.Swap(sai.AlarmData); //注意:西门子PLC需要高低位转换
|
|
|
|
// // sai.AlarmData = Mesnac.Basic.DataProcessor.Swap(sai.AlarmData); //注意:西门子PLC需要高低位转换
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// else
|
|
|
|
// // else
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Warn(String.Format("从PLC读取报警数据失败:PLC={0},Block={1},Start={2},Len={3}", info.AlarmPLC, info.AlarmBlock, info.Start, info.Length));
|
|
|
|
// // ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Warn(String.Format("从PLC读取报警数据失败:PLC={0},Block={1},Start={2},Len={3}", info.AlarmPLC, info.AlarmBlock, info.Start, info.Length));
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
|
|
|
|
//
|
|
|
|
//}
|
|
|
|
// //}
|
|
|
|
|
|
|
|
//
|
|
|
|
#endregion
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
//
|
|
|
|
#region 保存报警数据 原方法 Delete By wenjy 2023-08-07 18:05:06
|
|
|
|
// #region 保存报警数据 原方法 Delete By wenjy 2023-08-07 18:05:06
|
|
|
|
|
|
|
|
//
|
|
|
|
//foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
// //foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
//{
|
|
|
|
// //{
|
|
|
|
// int[] binaryAlarmData = Mesnac.Basic.DataProcessor.ParseBinaryValue(sai.AlarmData, WordLength);
|
|
|
|
// // int[] binaryAlarmData = Mesnac.Basic.DataProcessor.ParseBinaryValue(sai.AlarmData, WordLength);
|
|
|
|
// for (int i = 0; i < WordLength; i++)
|
|
|
|
// // for (int i = 0; i < WordLength; i++)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// if (sai.IsSaveAlarm[i] == true && binaryAlarmData[i] == 0)
|
|
|
|
// // if (sai.IsSaveAlarm[i] == true && binaryAlarmData[i] == 0)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// //更新报警状态
|
|
|
|
// // //更新报警状态
|
|
|
|
// Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, i);
|
|
|
|
// // Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, i);
|
|
|
|
// if (alarmInfo != null)
|
|
|
|
// // if (alarmInfo != null)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// Alarm.AlarmHelper.UpdateAlarmLogData(alarmInfo.Alarm_ID,DateTime.Now.ToString());
|
|
|
|
// // Alarm.AlarmHelper.UpdateAlarmLogData(alarmInfo.Alarm_ID,DateTime.Now.ToString());
|
|
|
|
// //清除显示的报警列表信息
|
|
|
|
// // //清除显示的报警列表信息
|
|
|
|
// if(Global.PublicVar.Instance.AlarmStrList.Exists(x => x == alarmInfo.AlarmName))
|
|
|
|
// // if(Global.PublicVar.Instance.AlarmStrList.Exists(x => x == alarmInfo.AlarmName))
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// Global.PublicVar.Instance.AlarmStrList.Remove(alarmInfo.AlarmName);
|
|
|
|
// // Global.PublicVar.Instance.AlarmStrList.Remove(alarmInfo.AlarmName);
|
|
|
|
// Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// // Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// // Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// if (binaryAlarmData[i] == 0)
|
|
|
|
// // if (binaryAlarmData[i] == 0)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// sai.IsSaveAlarm[i] = false;
|
|
|
|
// // sai.IsSaveAlarm[i] = false;
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// if (sai.IsSaveAlarm[i] == false && binaryAlarmData[i] == 1)
|
|
|
|
// // if (sai.IsSaveAlarm[i] == false && binaryAlarmData[i] == 1)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// sai.IsSaveAlarm[i] = true;
|
|
|
|
// // sai.IsSaveAlarm[i] = true;
|
|
|
|
// //数据保存
|
|
|
|
// // //数据保存
|
|
|
|
// Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, i);
|
|
|
|
// // Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, i);
|
|
|
|
// if (alarmInfo != null)
|
|
|
|
// // if (alarmInfo != null)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// Entity.LR_Alarmlog alarmLogData = new Entity.LR_Alarmlog();
|
|
|
|
// // Entity.LR_Alarmlog alarmLogData = new Entity.LR_Alarmlog();
|
|
|
|
// alarmLogData.Equip_Code = alarmInfo.Equip_Code;
|
|
|
|
// // alarmLogData.Equip_Code = alarmInfo.Equip_Code;
|
|
|
|
// alarmLogData.Alarm_ID = alarmInfo.Alarm_ID;
|
|
|
|
// // alarmLogData.Alarm_ID = alarmInfo.Alarm_ID;
|
|
|
|
// alarmLogData.Alarm_OccurTime = DateTime.Now.ToString();
|
|
|
|
// // alarmLogData.Alarm_OccurTime = DateTime.Now.ToString();
|
|
|
|
// alarmLogData.Alarm_ClearTime = String.Empty;
|
|
|
|
// // alarmLogData.Alarm_ClearTime = String.Empty;
|
|
|
|
// alarmLogData.Alarm_Status = 1;
|
|
|
|
// // alarmLogData.Alarm_Status = 1;
|
|
|
|
// alarmLogData.Alarm_GUID = Guid.NewGuid().ToString().ToUpper();
|
|
|
|
// // alarmLogData.Alarm_GUID = Guid.NewGuid().ToString().ToUpper();
|
|
|
|
// Alarm.AlarmHelper.InsertAlarmLogData(alarmLogData);
|
|
|
|
// // Alarm.AlarmHelper.InsertAlarmLogData(alarmLogData);
|
|
|
|
// Global.PublicVar.Instance.AlarmStrList.Add(alarmInfo.AlarmName);
|
|
|
|
// // Global.PublicVar.Instance.AlarmStrList.Add(alarmInfo.AlarmName);
|
|
|
|
// Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// // Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// // Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
//}
|
|
|
|
// //}
|
|
|
|
|
|
|
|
//
|
|
|
|
#endregion
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
//
|
|
|
|
try
|
|
|
|
// try
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
foreach (Entity.AlarmInfo info in _alarmInfoList)
|
|
|
|
// foreach (Entity.AlarmInfo info in _alarmInfoList)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
string address = $"DB{info.AlarmBlock}.DBX{info.AlarmWord}.{info.AlarmBit}";
|
|
|
|
// string address = $"DB{info.AlarmBlock}.DBX{info.AlarmWord}.{info.AlarmBit}";
|
|
|
|
// OperateResult<bool> result = plcBusiness.readBoolValue(address);
|
|
|
|
// // OperateResult<bool> result = plcBusiness.readBoolValue(address);
|
|
|
|
// ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Debug(string.Format("{0}读取{1}", address, result.IsSuccess == true ? $"成功;读取结果:{result.Content}" : "失败"));
|
|
|
|
// // ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Debug(string.Format("{0}读取{1}", address, result.IsSuccess == true ? $"成功;读取结果:{result.Content}" : "失败"));
|
|
|
|
// if (result.IsSuccess == true)
|
|
|
|
// // if (result.IsSuccess == true)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// if (result.Content)
|
|
|
|
// // if (result.Content)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// AlarmLogicalProcessing(_alarmBlockWordList, info);
|
|
|
|
// // AlarmLogicalProcessing(_alarmBlockWordList, info);
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// AlarmLight(result.Content); //控制报警灯 True红灯;False绿灯
|
|
|
|
// // AlarmLight(result.Content); //控制报警灯 True红灯;False绿灯
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
#region 触发事件
|
|
|
|
// #region 触发事件
|
|
|
|
|
|
|
|
//
|
|
|
|
if (OnAlarmSave != null && Global.PublicVar.Instance.isFlashFlag)
|
|
|
|
// // if (OnAlarmSave != null && Global.PublicVar.Instance.isFlashFlag)
|
|
|
|
{
|
|
|
|
// // {
|
|
|
|
OnAlarmSave(sender, System.EventArgs.Empty);
|
|
|
|
// // OnAlarmSave(sender, System.EventArgs.Empty);
|
|
|
|
}
|
|
|
|
// // }
|
|
|
|
if (OnAlarmSaveExtend != null && Global.PublicVar.Instance.isFlashFlagExtend)
|
|
|
|
// // if (OnAlarmSaveExtend != null && Global.PublicVar.Instance.isFlashFlagExtend)
|
|
|
|
{
|
|
|
|
// // {
|
|
|
|
OnAlarmSaveExtend(senderExtend, System.EventArgs.Empty);
|
|
|
|
// // OnAlarmSaveExtend(senderExtend, System.EventArgs.Empty);
|
|
|
|
}
|
|
|
|
// // }
|
|
|
|
|
|
|
|
//
|
|
|
|
#endregion
|
|
|
|
// #endregion
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
catch (Exception ex)
|
|
|
|
// catch (Exception ex)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Error(String.Format("AlarmSaveHelper逻辑异常:{0}", ex.Message), ex);
|
|
|
|
// ICSharpCode.Core.LoggingService<AlarmSaveHelper>.Error(String.Format("AlarmSaveHelper逻辑异常:{0}", ex.Message), ex);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 报警逻辑处理
|
|
|
|
// /// 报警逻辑处理
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
/// <param name="_alarmBlockWordList"></param>
|
|
|
|
// /// <param name="_alarmBlockWordList"></param>
|
|
|
|
/// <param name="info"></param>
|
|
|
|
// /// <param name="info"></param>
|
|
|
|
private void AlarmLogicalProcessing(List<Entity.SimpleAlarmInfo> _alarmBlockWordList, Entity.AlarmInfo info)
|
|
|
|
// private void AlarmLogicalProcessing(List<Entity.SimpleAlarmInfo> _alarmBlockWordList, Entity.AlarmInfo info)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
if(_alarmBlockWordList != null)
|
|
|
|
// if(_alarmBlockWordList != null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
// foreach (Entity.SimpleAlarmInfo sai in _alarmBlockWordList)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
if (sai.AlramPLC == info.AlarmPLC && sai.AlarmBlock == info.AlarmBlock && sai.AlarmBit == info.AlarmBit) //匹配数据块
|
|
|
|
// if (sai.AlramPLC == info.AlarmPLC && sai.AlarmBlock == info.AlarmBlock && sai.AlarmBit == info.AlarmBit) //匹配数据块
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
sai.AlarmData = 1; //对起始字偏移,为当前字的报警值
|
|
|
|
// sai.AlarmData = 1; //对起始字偏移,为当前字的报警值
|
|
|
|
|
|
|
|
//
|
|
|
|
Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, Convert.ToInt32(sai.AlarmBit));
|
|
|
|
// Entity.PmtAlarmInfo alarmInfo = Cache.CacheHelper.GetPmtAlarmInfoFromCache(sai.AlramPLC, sai.AlarmBlock, sai.AlarmAddress, Convert.ToInt32(sai.AlarmBit));
|
|
|
|
if (alarmInfo != null)
|
|
|
|
// if (alarmInfo != null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
UpdateAlarmLogData(alarmInfo); //更新报警状态
|
|
|
|
// UpdateAlarmLogData(alarmInfo); //更新报警状态
|
|
|
|
InsertAlarmLogData(alarmInfo); //保存报警信息
|
|
|
|
// InsertAlarmLogData(alarmInfo); //保存报警信息
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 更新报警状态
|
|
|
|
// /// 更新报警状态
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
/// <param name="sai"></param>
|
|
|
|
// /// <param name="sai"></param>
|
|
|
|
private void UpdateAlarmLogData(Entity.PmtAlarmInfo alarmInfo)
|
|
|
|
// private void UpdateAlarmLogData(Entity.PmtAlarmInfo alarmInfo)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
if (alarmInfo != null)
|
|
|
|
// if (alarmInfo != null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
Alarm.AlarmHelper.UpdateAlarmLogData(alarmInfo.Alarm_ID, DateTime.Now.ToString());
|
|
|
|
// Alarm.AlarmHelper.UpdateAlarmLogData(alarmInfo.Alarm_ID, DateTime.Now.ToString());
|
|
|
|
//清除显示的报警列表信息
|
|
|
|
// //清除显示的报警列表信息
|
|
|
|
if (Global.PublicVar.Instance.AlarmStrList.Exists(x => x == alarmInfo.AlarmName))
|
|
|
|
// if (Global.PublicVar.Instance.AlarmStrList.Exists(x => x == alarmInfo.AlarmName))
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
Global.PublicVar.Instance.AlarmStrList.Remove(alarmInfo.AlarmName);
|
|
|
|
// Global.PublicVar.Instance.AlarmStrList.Remove(alarmInfo.AlarmName);
|
|
|
|
Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 保存报警信息
|
|
|
|
// /// 保存报警信息
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
/// <param name="sai"></param>
|
|
|
|
// /// <param name="sai"></param>
|
|
|
|
private void InsertAlarmLogData(Entity.PmtAlarmInfo alarmInfo)
|
|
|
|
// private void InsertAlarmLogData(Entity.PmtAlarmInfo alarmInfo)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
if (alarmInfo != null)
|
|
|
|
// if (alarmInfo != null)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
//保存报警信息
|
|
|
|
// //保存报警信息
|
|
|
|
Entity.LR_Alarmlog alarmLogData = new Entity.LR_Alarmlog();
|
|
|
|
// Entity.LR_Alarmlog alarmLogData = new Entity.LR_Alarmlog();
|
|
|
|
alarmLogData.Equip_Code = alarmInfo.Equip_Code;
|
|
|
|
// alarmLogData.Equip_Code = alarmInfo.Equip_Code;
|
|
|
|
alarmLogData.Alarm_ID = alarmInfo.Alarm_ID;
|
|
|
|
// alarmLogData.Alarm_ID = alarmInfo.Alarm_ID;
|
|
|
|
alarmLogData.Alarm_OccurTime = DateTime.Now.ToString();
|
|
|
|
// alarmLogData.Alarm_OccurTime = DateTime.Now.ToString();
|
|
|
|
alarmLogData.Alarm_ClearTime = String.Empty;
|
|
|
|
// alarmLogData.Alarm_ClearTime = String.Empty;
|
|
|
|
alarmLogData.Alarm_Status = 1;
|
|
|
|
// alarmLogData.Alarm_Status = 1;
|
|
|
|
alarmLogData.Alarm_GUID = Guid.NewGuid().ToString().ToUpper();
|
|
|
|
// alarmLogData.Alarm_GUID = Guid.NewGuid().ToString().ToUpper();
|
|
|
|
|
|
|
|
//
|
|
|
|
Alarm.AlarmHelper.InsertAlarmLogData(alarmLogData);
|
|
|
|
// Alarm.AlarmHelper.InsertAlarmLogData(alarmLogData);
|
|
|
|
Global.PublicVar.Instance.AlarmStrList.Add(alarmInfo.AlarmName);
|
|
|
|
// Global.PublicVar.Instance.AlarmStrList.Add(alarmInfo.AlarmName);
|
|
|
|
Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlag = true;
|
|
|
|
Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
// Global.PublicVar.Instance.isFlashFlagExtend = true;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/// <summary>
|
|
|
|
// /// <summary>
|
|
|
|
/// 报警灯控制
|
|
|
|
// /// 报警灯控制
|
|
|
|
/// </summary>
|
|
|
|
// /// </summary>
|
|
|
|
/// <param name="flag">是否报警</param>
|
|
|
|
// /// <param name="flag">是否报警</param>
|
|
|
|
private void AlarmLight(bool flag)
|
|
|
|
// private void AlarmLight(bool flag)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
// if(flag)
|
|
|
|
// // if(flag)
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// //打开报警灯:FIRST 关闭绿灯 SECOND 打开红灯
|
|
|
|
// // //打开报警灯:FIRST 关闭绿灯 SECOND 打开红灯
|
|
|
|
// doControl.DOControl(DoUtils.enumInfo.DOName.Green, DoUtils.enumInfo.DOOnOff.Off);
|
|
|
|
// // doControl.DOControl(DoUtils.enumInfo.DOName.Green, DoUtils.enumInfo.DOOnOff.Off);
|
|
|
|
// doControl.DOControl(DoUtils.enumInfo.DOName.Red, DoUtils.enumInfo.DOOnOff.On);
|
|
|
|
// // doControl.DOControl(DoUtils.enumInfo.DOName.Red, DoUtils.enumInfo.DOOnOff.On);
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
// else
|
|
|
|
// // else
|
|
|
|
// {
|
|
|
|
// // {
|
|
|
|
// // 关闭报警灯:FIRST 打开红灯 SECOND 关闭绿灯
|
|
|
|
// // // 关闭报警灯:FIRST 打开红灯 SECOND 关闭绿灯
|
|
|
|
// doControl.DOControl(DoUtils.enumInfo.DOName.Red, DoUtils.enumInfo.DOOnOff.Off);
|
|
|
|
// // doControl.DOControl(DoUtils.enumInfo.DOName.Red, DoUtils.enumInfo.DOOnOff.Off);
|
|
|
|
// doControl.DOControl(DoUtils.enumInfo.DOName.Green, DoUtils.enumInfo.DOOnOff.On);
|
|
|
|
// // doControl.DOControl(DoUtils.enumInfo.DOName.Green, DoUtils.enumInfo.DOOnOff.On);
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|