nodyang@aliyun.com 1 week ago
parent 4c16bcfb27
commit 6ee596983b

@ -28,19 +28,23 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.al = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Msg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.dataGridView2 = new System.Windows.Forms.DataGridView();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.al = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Msg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel1 = new System.Windows.Forms.Panel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.hslLanternSimple1 = new HslControls.HslLanternSimple();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tableLayoutPanel1 // tableLayoutPanel1
@ -58,21 +62,37 @@
this.tableLayoutPanel1.Size = new System.Drawing.Size(910, 276); this.tableLayoutPanel1.Size = new System.Drawing.Size(910, 276);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// panel1 // dataGridView2
// //
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.dataGridView2.AllowUserToAddRows = false;
this.panel1.Location = new System.Drawing.Point(0, 0); this.dataGridView2.AllowUserToDeleteRows = false;
this.panel1.Name = "panel1"; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.panel1.Size = new System.Drawing.Size(910, 320); this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.panel1.TabIndex = 1; this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2});
this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView2.Location = new System.Drawing.Point(458, 3);
this.dataGridView2.Name = "dataGridView2";
this.dataGridView2.ReadOnly = true;
this.dataGridView2.RowTemplate.Height = 23;
this.dataGridView2.Size = new System.Drawing.Size(449, 270);
this.dataGridView2.TabIndex = 1;
//
// dataGridViewTextBoxColumn1
// //
// flowLayoutPanel1 this.dataGridViewTextBoxColumn1.DataPropertyName = "AlartTime";
this.dataGridViewTextBoxColumn1.HeaderText = "警告时间";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true;
this.dataGridViewTextBoxColumn1.Width = 150;
// //
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; // dataGridViewTextBoxColumn2
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 320); //
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.flowLayoutPanel1.Size = new System.Drawing.Size(910, 339); this.dataGridViewTextBoxColumn2.DataPropertyName = "Msg";
this.flowLayoutPanel1.TabIndex = 2; this.dataGridViewTextBoxColumn2.HeaderText = "警告内容";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
// //
// dataGridView1 // dataGridView1
// //
@ -86,12 +106,12 @@
this.dataGridView1.Location = new System.Drawing.Point(3, 3); this.dataGridView1.Location = new System.Drawing.Point(3, 3);
this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true; this.dataGridView1.ReadOnly = true;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Red; dataGridViewCellStyle6.BackColor = System.Drawing.Color.Red;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle6.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.Red; dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Red;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.White; dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.White;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle1; this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(449, 270); this.dataGridView1.Size = new System.Drawing.Size(449, 270);
this.dataGridView1.TabIndex = 0; this.dataGridView1.TabIndex = 0;
@ -112,50 +132,64 @@
this.Msg.Name = "Msg"; this.Msg.Name = "Msg";
this.Msg.ReadOnly = true; this.Msg.ReadOnly = true;
// //
// dataGridView2 // panel1
//
this.dataGridView2.AllowUserToAddRows = false;
this.dataGridView2.AllowUserToDeleteRows = false;
this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2});
this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView2.Location = new System.Drawing.Point(458, 3);
this.dataGridView2.Name = "dataGridView2";
this.dataGridView2.ReadOnly = true;
this.dataGridView2.RowTemplate.Height = 23;
this.dataGridView2.Size = new System.Drawing.Size(449, 270);
this.dataGridView2.TabIndex = 1;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "AlartTime";
this.dataGridViewTextBoxColumn1.HeaderText = "警告时间";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true;
this.dataGridViewTextBoxColumn1.Width = 150;
// //
// dataGridViewTextBoxColumn2 this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(910, 330);
this.panel1.TabIndex = 1;
// //
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; // groupBox2
this.dataGridViewTextBoxColumn2.DataPropertyName = "Msg"; //
this.dataGridViewTextBoxColumn2.HeaderText = "警告内容"; this.groupBox2.BackgroundImage = global::RfidWeb.Properties.Resources.Snipaste_2024_11_14_10_33_44;
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.groupBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.dataGridViewTextBoxColumn2.ReadOnly = true; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 330);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(910, 329);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "料盘侧(收料2)";
//
// groupBox1
//
this.groupBox1.BackgroundImage = global::RfidWeb.Properties.Resources.Snipaste_2024_11_14_10_28_21;
this.groupBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.groupBox1.Controls.Add(this.hslLanternSimple1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(910, 330);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "卷料侧(收料1)";
//
// hslLanternSimple1
//
this.hslLanternSimple1.LanternBackground = System.Drawing.Color.DarkViolet;
this.hslLanternSimple1.Location = new System.Drawing.Point(44, 215);
this.hslLanternSimple1.Name = "hslLanternSimple1";
this.hslLanternSimple1.Size = new System.Drawing.Size(15, 14);
this.hslLanternSimple1.TabIndex = 0;
this.hslLanternSimple1.Text = "hslLanternSimple1";
// //
// UserAlarmShow // UserAlarmShow
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.Name = "UserAlarmShow"; this.Name = "UserAlarmShow";
this.Size = new System.Drawing.Size(910, 935); this.Size = new System.Drawing.Size(910, 935);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -163,13 +197,15 @@
#endregion #endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn al; private System.Windows.Forms.DataGridViewTextBoxColumn al;
private System.Windows.Forms.DataGridViewTextBoxColumn Msg; private System.Windows.Forms.DataGridViewTextBoxColumn Msg;
private System.Windows.Forms.DataGridView dataGridView2; private System.Windows.Forms.DataGridView dataGridView2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
private HslControls.HslLanternSimple hslLanternSimple1;
} }
} }

@ -62,167 +62,6 @@ namespace RfidWeb.Frm
} }
public class HimAlarmManager
{
private HmiChAlarm hmiChAlarm = new HmiChAlarm();
private HmiCqAlarm hmiCq = new HmiCqAlarm();
EsStop esStop=new EsStop();
AlarmDataService alarmDataService = new AlarmDataService();
public Dictionary<string, DateTime> GetList()
{
List<AlarmData> list = alarmDataService.GetList();
ICache cache = Cache.Default;
Dictionary<string, DateTime> dictionary = cache[CacheKeyManager.AramlList] as Dictionary<string, DateTime>
?? new Dictionary<string, DateTime>();
var a = hmiChAlarm.GetPlcDb();
var dicCha = list.Where(x => x.PlcAb == "A" && x.Address == "CH_alarm"
&& !string.IsNullOrEmpty(x.Msg))
.ToDictionary(x => x.No, x => x.Msg);
for (int i = 0; i < 31; i++)
{
var obj = a.GetValue("A" + i);
if (obj != null)
{
if (dicCha.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
var dicChb = list.Where(x => x.PlcAb == "B" && x.Address == "CH_alarm"
&& !string.IsNullOrEmpty(x.Msg))
.ToDictionary(x => x.No, x => x.Msg);
for (int i = 0; i < 31; i++)
{
var obj = a.GetValue("B" + i);
if (obj != null)
{
if (dicChb.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
a = hmiCq.GetPlcDb();
var dicCqA = list.Where(x => x.PlcAb == "A" && x.Address == "CQ_alarm"
&& !string.IsNullOrEmpty(x.Msg))
.ToDictionary(x => x.No, x => x.Msg);
for (int i = 0; i < 31; i++)
{
var obj = a.GetValue("A" + i);
if (obj != null)
{
if (dicCqA.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
var dicCqB = list.Where(x => x.PlcAb == "B" && x.Address == "CQ_alarm"
&& !string.IsNullOrEmpty(x.Msg))
.ToDictionary(x => x.No, x => x.Msg);
for (int i = 0; i < 31; i++)
{
var obj = a.GetValue("B" + i);
if (obj != null)
{
if (dicCqB.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
var listEs= list.Where(x => x.PlcAb == "" && x.Address == "estop_temporary_storage"
&& !string.IsNullOrEmpty(x.Msg))
.ToDictionary(x => x.No, x => x.Msg);
var bools = esStop.GetDb();
for (int i = 0; i < 31; i++)
{
var obj = bools[i];
if (listEs.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
cache.Set(CacheKeyManager.AramlList, dictionary, TimeSpan.FromMinutes(10));
return dictionary;
}
}
} }
} }

@ -123,6 +123,12 @@
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="al.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="al.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

@ -100,6 +100,26 @@ namespace RfidWeb.Properties {
} }
} }
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Snipaste_2024_11_14_10_28_21 {
get {
object obj = ResourceManager.GetObject("Snipaste_2024-11-14_10-28-21", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Snipaste_2024_11_14_10_33_44 {
get {
object obj = ResourceManager.GetObject("Snipaste_2024-11-14_10-33-44", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>

@ -121,9 +121,27 @@
<data name="海威图标在上" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="海威图标在上" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\海威图标在上.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\海威图标在上.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="左箭头" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\左箭头.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="消音开" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\消音开.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Snipaste_2024-11-14_10-28-21" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Snipaste_2024-11-14_10-28-21.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="照明关" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\照明关.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="右箭头" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="右箭头" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\右箭头.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\右箭头.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="脱机" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\脱机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="2024-11-12_170754_114" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\2024-11-12_170754_114.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="frmMain" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="frmMain" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\frmMain.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\frmMain.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -134,22 +152,10 @@
<data name="frmBei" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="frmBei" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\frmBei.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\frmBei.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="脱机" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\脱机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="左箭头" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\左箭头.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="消音开" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\消音开.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="照明关" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\照明关.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="log" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="log" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\log.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\log.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="2024-11-12_170754_114" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Snipaste_2024-11-14_10-33-44" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\2024-11-12_170754_114.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Snipaste_2024-11-14_10-33-44.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

@ -192,8 +192,9 @@
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestFactory.cs" /> <Compile Include="Tool\HimAlarmManager.cs" />
<Compile Include="UserManager.cs" /> <Compile Include="Tool\TestFactory.cs" />
<Compile Include="Tool\UserManager.cs" />
<EmbeddedResource Include="FormLogin.resx"> <EmbeddedResource Include="FormLogin.resx">
<DependentUpon>FormLogin.cs</DependentUpon> <DependentUpon>FormLogin.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@ -278,6 +279,8 @@
<None Include="Resources\海威图标在上.jpg" /> <None Include="Resources\海威图标在上.jpg" />
<None Include="Resources\log.png" /> <None Include="Resources\log.png" />
<None Include="Resources\2024-11-12_170754_114.png" /> <None Include="Resources\2024-11-12_170754_114.png" />
<None Include="Resources\Snipaste_2024-11-14_10-28-21.png" />
<None Include="Resources\Snipaste_2024-11-14_10-33-44.png" />
<Content Include="Resources\照明开.png" /> <Content Include="Resources\照明开.png" />
<None Include="Resources\脱机.png" /> <None Include="Resources\脱机.png" />
</ItemGroup> </ItemGroup>

@ -1,7 +1,196 @@
namespace RfidWeb using System;
using System.Collections.Generic;
using System.Linq;
using DB.Entity;
using DB.Service;
using NewLife.Caching;
using NewLife.Reflection;
using Tool.Model;
namespace RfidWeb
{ {
public class HimAlarmManager public class HimAlarmManager
{ {
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();
cache.Set(CacheKeyManager.CH_alarm, a,timeOut);
var dicCha = GetDic(list, "A", "CH_alarm");
for (int i = 0; i < Max; i++)
{
var obj = a.GetValue("A" + i);
if (obj != null)
{
if (dicCha.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
var dicChb = GetDic(list, "B", "CH_alarm");
for (int i = 0; i < Max; i++)
{
var obj = a.GetValue("B" + i);
if (obj != null)
{
if (dicChb.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
}
private void SetCQ_alarm(Dictionary<string, DateTime> dictionary,List<AlarmData> list)
{
var a = hmiCq.GetPlcDb();
cache.Set(CacheKeyManager.CQ_alarm, a,timeOut);
var dicCqA = GetDic(list, "A", "CQ_alarm");
for (int i = 0; i < Max; i++)
{
var obj = a.GetValue("A" + i);
if (obj != null)
{
if (dicCqA.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
var dicCqB =GetDic(list, "B", "CQ_alarm");
for (int i = 0; i < Max; i++)
{
var obj = a.GetValue("B" + i);
if (obj != null)
{
if (dicCqB.TryGetValue(i, out var value))
{
if (Convert.ToBoolean(obj))
{
if (!dictionary.ContainsKey(value))
{
dictionary[value] = DateTime.Now;
}
}
else
{
dictionary.Remove(value);
}
}
}
}
}
private void SetEsStop(Dictionary<string, DateTime> dictionary,List<AlarmData> list)
{
var listEs= GetDic(list, "", "estop_temporary_storage");
var bools = esStop.GetDb();
//全局的异常
cache.Set(CacheKeyManager.estop_temporary_storage, 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);
}
}
}
ICache cache = Cache.Default;
public Dictionary<string, DateTime> GetList()
{
Dictionary<string, DateTime> dictionary = cache[CacheKeyManager.AramlList] as Dictionary<string, DateTime>
?? new Dictionary<string, DateTime>();
List<AlarmData> list = alarmDataService.GetList();
SetCH_alarm(dictionary,list);
SetCQ_alarm(dictionary,list);
SetEsStop(dictionary,list);
cache.Set(CacheKeyManager.AramlList, dictionary, TimeSpan.FromMinutes(10));
return dictionary;
}
}
} }

@ -8,8 +8,6 @@ namespace Tool
{ {
public class GridViewData public class GridViewData
{ {
public string AlartTime { get; set; } public string AlartTime { get; set; }
public string Msg { get; set; } public string Msg { get; set; }
} }

@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using HslCommunication;
using NewLife.Caching; using NewLife.Caching;
using NewLife.Reflection; using NewLife.Reflection;
@ -17,61 +13,4 @@ namespace Tool.Model
{ {
} }
} }
public class HmiCqModel : BoolModelFactory
{
public HmiCqModel() : base("HMI_button_CQ_ON[0]", "HMI_button_CQ_ON[1]")
{
}
}
public class HmiLpModel : BoolModelFactory
{
public HmiLpModel() : base("HMI_button_LP_ON[0]", "HMI_button_LP_ON[1]")
{
}
}
public class HmiChAlarm : BoolModelFactory
{
public HmiChAlarm() : base("CH_alarm_A", "CH_alarm_B")
{
}
}
public class HmiCqAlarm : BoolModelFactory
{
public HmiCqAlarm() : base("CQ_alarm_A", "CQ_alarm_B")
{
}
}
public class EsStop
{
public List<bool> GetDb()
{
bool[] bitArray = new bool[32];
var readUInt32 = PlcConnect.Instance.ReadUInt32("estop_temporary_storage");
var bo = readUInt32.IsSuccess;
var context = readUInt32.Content;
if (bo)
{
for (int i = 0; i < 31; i++)
{
bitArray[i] = context.GetBoolByIndex(i);
}
}
return bitArray.ToList();
}
}
} }

@ -68,5 +68,11 @@ namespace Tool.Model
public static readonly string AramlList = "AramlList"; public static readonly string AramlList = "AramlList";
public static readonly string AramlDataList = "AramlDataList"; public static readonly string AramlDataList = "AramlDataList";
public static readonly string CH_alarm = "CH_alarm";
public static readonly string CQ_alarm = "CQ_alarm";
public static readonly string estop_temporary_storage = "estop_temporary_storage";
} }
} }

@ -67,9 +67,13 @@
<Compile Include="HmiHelp.cs" /> <Compile Include="HmiHelp.cs" />
<Compile Include="HttpUtil.cs" /> <Compile Include="HttpUtil.cs" />
<Compile Include="ILogNetFactory.cs" /> <Compile Include="ILogNetFactory.cs" />
<Compile Include="Model\AlarmMsgFactory.cs" />
<Compile Include="Model\BoolModelFactory.cs" /> <Compile Include="Model\BoolModelFactory.cs" />
<Compile Include="Model\EsStop.cs" />
<Compile Include="Model\HmiChAlarm.cs" />
<Compile Include="Model\HmiChModel.cs" /> <Compile Include="Model\HmiChModel.cs" />
<Compile Include="Model\HmiCqAlarm.cs" />
<Compile Include="Model\HmiCqModel.cs" />
<Compile Include="Model\HmiLpModel.cs" />
<Compile Include="Model\HmiPoint.cs" /> <Compile Include="Model\HmiPoint.cs" />
<Compile Include="Model\PlcBoolModel.cs" /> <Compile Include="Model\PlcBoolModel.cs" />
<Compile Include="PagedList.cs" /> <Compile Include="PagedList.cs" />

Loading…
Cancel
Save