|
|
|
@ -30,6 +30,9 @@ using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity;
|
|
|
|
|
using Mesnac.Core.Service;
|
|
|
|
|
using Mesnac.Basic;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Util;
|
|
|
|
|
using DevExpress.XtraRichEdit.Import.Doc;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using DevExpress.Utils.Filtering.Internal;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
|
|
|
|
|
{
|
|
|
|
@ -277,7 +280,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
|
|
|
|
|
conCurrentCache.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int bao = 0;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Plc读数线程池,定时器退出删除
|
|
|
|
|
/// </summary>
|
|
|
|
@ -510,7 +513,27 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
|
|
|
|
|
|
|
|
|
|
ThreadPool.QueueUserWorkItem(new WaitCallback(NewThread));
|
|
|
|
|
|
|
|
|
|
AlarmControl();
|
|
|
|
|
|
|
|
|
|
if (bao > 2)
|
|
|
|
|
{
|
|
|
|
|
bao = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ThreadPool.QueueUserWorkItem((ty) =>
|
|
|
|
|
{
|
|
|
|
|
AlarmControl();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
bao = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bao += 1;
|
|
|
|
|
|
|
|
|
|
//现有报警刷新
|
|
|
|
|
var db2110 = new Db2110Help();
|
|
|
|
|
|
|
|
|
@ -881,35 +904,92 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
|
|
|
|
|
b3 = DB2103.bytes;
|
|
|
|
|
b7 = DB2107.bytes;
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
List<WarnTable> list = new List<WarnTable>();
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
//string nowtime = DateTime.Now.ToString();
|
|
|
|
|
//报警点位遍历
|
|
|
|
|
foreach (DataRow rows in AllAlarmTable.Rows)
|
|
|
|
|
{
|
|
|
|
|
int Alarm_ID = Convert.ToInt32(rows["Alarm_ID"]);
|
|
|
|
|
string otherInfo = rows["Alarm_Other_Info"].ToString();
|
|
|
|
|
string cnInfo = rows["Alarm_Cn_Info"].ToString();
|
|
|
|
|
|
|
|
|
|
WarnTable warnTable = new WarnTable();
|
|
|
|
|
warnTable.CnInfo = cnInfo;
|
|
|
|
|
warnTable.AlarmId = Alarm_ID;
|
|
|
|
|
warnTable.OtherInfo = otherInfo;
|
|
|
|
|
warnTable.CreateTime = DateTime.Now;
|
|
|
|
|
warnTable.UpdateTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((int)rows["Alarm_Block"] == 2102 && b2[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(rows["Alarm_Other_Info"].ToString());
|
|
|
|
|
sb.Append(" ");
|
|
|
|
|
sb.Append(rows["Alarm_Cn_Info"].ToString());
|
|
|
|
|
sb.Append(@" \ ");
|
|
|
|
|
warnTable.Status = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warnTable.Status = 0;
|
|
|
|
|
}
|
|
|
|
|
else if ((int)rows["Alarm_Block"] == 2107 && b7[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((int)rows["Alarm_Block"] == 2107 && b7[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(rows["Alarm_Other_Info"].ToString());
|
|
|
|
|
sb.Append(" ");
|
|
|
|
|
sb.Append(rows["Alarm_Cn_Info"].ToString());
|
|
|
|
|
sb.Append(@" \ ");
|
|
|
|
|
|
|
|
|
|
warnTable.Status = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warnTable.Status = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if ((int)rows["Alarm_Block"] == 2103 && b3[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
|
|
|
|
|
|
|
|
|
|
if ((int)rows["Alarm_Block"] == 2103 && b3[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(rows["Alarm_Other_Info"].ToString());
|
|
|
|
|
sb.Append(" ");
|
|
|
|
|
sb.Append(rows["Alarm_Cn_Info"].ToString());
|
|
|
|
|
sb.Append(@" \ ");
|
|
|
|
|
|
|
|
|
|
warnTable.Status = 1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warnTable.Status = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list.Add(warnTable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Sql = FreeDb.FreeSqlUnit.Instance;
|
|
|
|
|
long cou = Sql.Queryable<WarnTable>().Count();
|
|
|
|
|
if (cou > 50000)
|
|
|
|
|
{
|
|
|
|
|
Sql.Delete<WarnTable>().Where(x => x.CreateTime < DateTime.Now).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//只记录等于1的
|
|
|
|
|
var ls=list.Where(x=>x.Status==1);
|
|
|
|
|
Sql.Insert<WarnTable>(ls).ExecuteInserted();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string str = sb.ToString();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(str))
|
|
|
|
|
{
|
|
|
|
@ -928,6 +1008,9 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 图像数据读取、控件赋值
|
|
|
|
|