整理代码

1114
nodyang@aliyun.com 6 days ago
parent 17a51e5d92
commit e5b2104f15

@ -34,11 +34,11 @@
this.panContent = new System.Windows.Forms.Panel(); this.panContent = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel(); this.panel9 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel(); this.panel8 = new System.Windows.Forms.Panel();
this.buttonUpdateLog = new System.Windows.Forms.Button();
this.hslLanternSimplePlc = new HslControls.HslLanternSimple(); this.hslLanternSimplePlc = new HslControls.HslLanternSimple();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.btnShow = new System.Windows.Forms.Button(); this.btnShow = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.btnMes = new System.Windows.Forms.Button(); this.btnMes = new System.Windows.Forms.Button();
this.btnAccount = new System.Windows.Forms.Button(); this.btnAccount = new System.Windows.Forms.Button();
this.btnAlarm = new System.Windows.Forms.Button(); this.btnAlarm = new System.Windows.Forms.Button();
@ -50,7 +50,6 @@
this.labTime = new System.Windows.Forms.Label(); this.labTime = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.buttonUpdateLog = new System.Windows.Forms.Button();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel6.SuspendLayout(); this.panel6.SuspendLayout();
this.panel7.SuspendLayout(); this.panel7.SuspendLayout();
@ -117,7 +116,6 @@
this.panel8.Controls.Add(this.button2); this.panel8.Controls.Add(this.button2);
this.panel8.Controls.Add(this.button1); this.panel8.Controls.Add(this.button1);
this.panel8.Controls.Add(this.btnShow); this.panel8.Controls.Add(this.btnShow);
this.panel8.Controls.Add(this.button3);
this.panel8.Controls.Add(this.btnMes); this.panel8.Controls.Add(this.btnMes);
this.panel8.Controls.Add(this.btnAccount); this.panel8.Controls.Add(this.btnAccount);
this.panel8.Controls.Add(this.btnAlarm); this.panel8.Controls.Add(this.btnAlarm);
@ -130,6 +128,21 @@
this.panel8.Size = new System.Drawing.Size(370, 954); this.panel8.Size = new System.Drawing.Size(370, 954);
this.panel8.TabIndex = 3; this.panel8.TabIndex = 3;
// //
// buttonUpdateLog
//
this.buttonUpdateLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
this.buttonUpdateLog.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonUpdateLog.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonUpdateLog.ForeColor = System.Drawing.SystemColors.Window;
this.buttonUpdateLog.Location = new System.Drawing.Point(22, 522);
this.buttonUpdateLog.Margin = new System.Windows.Forms.Padding(4);
this.buttonUpdateLog.Name = "buttonUpdateLog";
this.buttonUpdateLog.Size = new System.Drawing.Size(300, 65);
this.buttonUpdateLog.TabIndex = 11;
this.buttonUpdateLog.Text = "参数修改记录";
this.buttonUpdateLog.UseVisualStyleBackColor = false;
this.buttonUpdateLog.Click += new System.EventHandler(this.buttonUpdateLog_Click);
//
// hslLanternSimplePlc // hslLanternSimplePlc
// //
this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 641); this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 641);
@ -181,18 +194,6 @@
this.btnShow.UseVisualStyleBackColor = false; this.btnShow.UseVisualStyleBackColor = false;
this.btnShow.Click += new System.EventHandler(this.btnShow_Click); this.btnShow.Click += new System.EventHandler(this.btnShow_Click);
// //
// button3
//
this.button3.BackgroundImage = global::RfidWeb.Properties.Resources.;
this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.button3.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(135, 812);
this.button3.Margin = new System.Windows.Forms.Padding(4);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(166, 87);
this.button3.TabIndex = 5;
this.button3.UseVisualStyleBackColor = true;
//
// btnMes // btnMes
// //
this.btnMes.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173))))); this.btnMes.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
@ -338,21 +339,6 @@
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "佳通RFID层合裁切设备"; this.label1.Text = "佳通RFID层合裁切设备";
// //
// buttonUpdateLog
//
this.buttonUpdateLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
this.buttonUpdateLog.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonUpdateLog.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonUpdateLog.ForeColor = System.Drawing.SystemColors.Window;
this.buttonUpdateLog.Location = new System.Drawing.Point(22, 522);
this.buttonUpdateLog.Margin = new System.Windows.Forms.Padding(4);
this.buttonUpdateLog.Name = "buttonUpdateLog";
this.buttonUpdateLog.Size = new System.Drawing.Size(300, 65);
this.buttonUpdateLog.TabIndex = 11;
this.buttonUpdateLog.Text = "参数修改记录";
this.buttonUpdateLog.UseVisualStyleBackColor = false;
this.buttonUpdateLog.Click += new System.EventHandler(this.buttonUpdateLog_Click);
//
// FormMain // FormMain
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -385,7 +371,6 @@
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnShow; private System.Windows.Forms.Button btnShow;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private HslControls.HslLanternSimple hslLanternSimplePlc; private HslControls.HslLanternSimple hslLanternSimplePlc;

@ -21,12 +21,15 @@ using Tool.Model;
namespace RfidWeb namespace RfidWeb
{ {
public partial class FormMain : Form public partial class FormMain : Form
{ {
private ILogNet logNet = ILogNetFactory.GetLogNet; private ILogNet logNet = ILogNetFactory.GetLogNet;
private ICache cache; private ICache cache;
TimerX _timer; TimerX _timer;
List<Button> buttons=new List<Button>(); List<Button> buttons=new List<Button>();
public FormMain() public FormMain()
{ {
cache=Cache.Default; cache=Cache.Default;
@ -66,7 +69,7 @@ namespace RfidWeb
buttons.Add(btnAlarm); buttons.Add(btnAlarm);
buttons.Add(btnAccount); buttons.Add(btnAccount);
buttons.Add(btnMes); buttons.Add(btnMes);
buttons.Add(buttonUpdateLog);
btnShow_Click(new object(), EventArgs.Empty); btnShow_Click(new object(), EventArgs.Empty);
} }
@ -76,15 +79,19 @@ namespace RfidWeb
/// <summary>移除过期的缓存项</summary> /// <summary>移除过期的缓存项</summary>
void TimeState(Object state) void TimeState(Object state)
{ {
bool isExit = UserManager.IsExit(); bool isExit = UserManager.IsExit();
this.Invoke(() => this.Invoke(() =>
{ {
labTime.Text = DateTime.Now.ToFullString(); labTime.Text = DateTime.Now.ToFullString();
this.Invoke(() => this.Invoke(() =>
{ {
//不存在 //不存在
if (!isExit) if (!isExit)
{ {
@ -101,12 +108,26 @@ namespace RfidWeb
}); });
ThreadPoolX.QueueUserWorkItem(ShowLed);
ThreadPoolX.QueueUserWorkItem(UpdateLog); ThreadPoolX.QueueUserWorkItem(UpdateLog);
} }
private UpdateLogService updateLogService = new UpdateLogService(); private UpdateLogService updateLogService = new UpdateLogService();
private PointService pointService = new PointService(); private PointService pointService = new PointService();
private void ShowLed()
{
if (cache.ContainsKey(CacheKeyManager.Home)) return;
cache.Set(CacheKeyManager.Home, DateTime.Now, TimeSpan.FromSeconds(10));
bool result =PlcConnect.Instance.ReadPlcType().IsSuccess;
hslLanternSimplePlc.LanternBackground = result ? Color.LimeGreen : Color.Red;
cache.Remove(CacheKeyManager.Home);
}
/// <summary>
/// 参数变化
/// </summary>
private void UpdateLog() private void UpdateLog()
{ {

@ -236,9 +236,9 @@
// //
this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
@ -249,7 +249,7 @@
this.ID, this.ID,
this.UserName, this.UserName,
this.RoleName}); this.RoleName});
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
@ -261,7 +261,7 @@
this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true; this.dataGridView1.ReadOnly = true;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;

@ -29,10 +29,10 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FromAlarmLog)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FromAlarmLog));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.panelTop = new System.Windows.Forms.Panel(); this.panelTop = new System.Windows.Forms.Panel();
this.ucBtnSelect = new HZH_Controls.Controls.UCBtnExt(); this.ucBtnSelect = new HZH_Controls.Controls.UCBtnExt();
this.textBoxSel = new HZH_Controls.Controls.TextBoxEx(); this.textBoxSel = new HZH_Controls.Controls.TextBoxEx();
@ -129,40 +129,40 @@
// //
this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToDeleteRows = false;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID, this.ID,
this.UserName, this.UserName,
this.RoleName, this.RoleName,
this.Alarm}); this.Alarm});
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle7; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 80); this.dataGridView1.Location = new System.Drawing.Point(0, 80);
this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true; this.dataGridView1.ReadOnly = true;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle8; this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(910, 693); this.dataGridView1.Size = new System.Drawing.Size(910, 693);
this.dataGridView1.TabIndex = 3; this.dataGridView1.TabIndex = 3;
@ -170,8 +170,8 @@
// ID // ID
// //
this.ID.DataPropertyName = "ID"; this.ID.DataPropertyName = "ID";
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.ID.DefaultCellStyle = dataGridViewCellStyle6; this.ID.DefaultCellStyle = dataGridViewCellStyle2;
this.ID.HeaderText = "ID"; this.ID.HeaderText = "ID";
this.ID.Name = "ID"; this.ID.Name = "ID";
this.ID.ReadOnly = true; this.ID.ReadOnly = true;

@ -29,6 +29,10 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
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();
@ -100,14 +104,34 @@
// //
this.dataGridView2.AllowUserToAddRows = false; this.dataGridView2.AllowUserToAddRows = false;
this.dataGridView2.AllowUserToDeleteRows = false; this.dataGridView2.AllowUserToDeleteRows = false;
this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2}); this.dataGridViewTextBoxColumn2});
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.Red;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Red;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView2.DefaultCellStyle = dataGridViewCellStyle2;
this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView2.Location = new System.Drawing.Point(458, 3); this.dataGridView2.Location = new System.Drawing.Point(458, 3);
this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.Name = "dataGridView2";
this.dataGridView2.ReadOnly = true; this.dataGridView2.ReadOnly = true;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F);
this.dataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView2.RowTemplate.Height = 23; this.dataGridView2.RowTemplate.Height = 23;
this.dataGridView2.Size = new System.Drawing.Size(449, 270); this.dataGridView2.Size = new System.Drawing.Size(449, 270);
this.dataGridView2.TabIndex = 1; this.dataGridView2.TabIndex = 1;
@ -115,7 +139,7 @@
// dataGridViewTextBoxColumn1 // dataGridViewTextBoxColumn1
// //
this.dataGridViewTextBoxColumn1.DataPropertyName = "AlartTime"; this.dataGridViewTextBoxColumn1.DataPropertyName = "AlartTime";
this.dataGridViewTextBoxColumn1.HeaderText = "警告时间"; this.dataGridViewTextBoxColumn1.HeaderText = "提醒时间";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true; this.dataGridViewTextBoxColumn1.ReadOnly = true;
this.dataGridViewTextBoxColumn1.Width = 150; this.dataGridViewTextBoxColumn1.Width = 150;
@ -124,7 +148,7 @@
// //
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn2.DataPropertyName = "Msg"; this.dataGridViewTextBoxColumn2.DataPropertyName = "Msg";
this.dataGridViewTextBoxColumn2.HeaderText = "警告内容"; this.dataGridViewTextBoxColumn2.HeaderText = "提醒内容";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true; this.dataGridViewTextBoxColumn2.ReadOnly = true;
// //
@ -132,6 +156,14 @@
// //
this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToDeleteRows = false;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.al, this.al,
@ -140,12 +172,13 @@
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; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.BackColor = System.Drawing.Color.Red;
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.Red; dataGridViewCellStyle5.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.White; dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Red;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle1; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.White;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle5;
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;
@ -154,8 +187,10 @@
// //
this.al.DataPropertyName = "AlartTime"; this.al.DataPropertyName = "AlartTime";
this.al.HeaderText = "警告时间"; this.al.HeaderText = "警告时间";
this.al.MaxInputLength = 500;
this.al.Name = "al"; this.al.Name = "al";
this.al.ReadOnly = true; this.al.ReadOnly = true;
this.al.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.al.Width = 150; this.al.Width = 150;
// //
// Msg // Msg
@ -233,7 +268,6 @@
this.hslLabelComboQDWD2SS.TextInfo = "裁刀2温度:"; this.hslLabelComboQDWD2SS.TextInfo = "裁刀2温度:";
this.hslLabelComboQDWD2SS.TextUnit = "°C"; this.hslLabelComboQDWD2SS.TextUnit = "°C";
this.hslLabelComboQDWD2SS.TextValue = "00"; this.hslLabelComboQDWD2SS.TextValue = "00";
this.hslLabelComboQDWD2SS.TextValueBackcolor = System.Drawing.Color.IndianRed;
this.hslLabelComboQDWD2SS.TextValueColorTransFun = null; this.hslLabelComboQDWD2SS.TextValueColorTransFun = null;
// //
// hslLabelComboQDWD1SS // hslLabelComboQDWD1SS
@ -262,7 +296,6 @@
this.hslLabelComboCQ_Chip2_counter.TextInfo = "裁刀2数量:"; this.hslLabelComboCQ_Chip2_counter.TextInfo = "裁刀2数量:";
this.hslLabelComboCQ_Chip2_counter.TextUnit = "Pcs"; this.hslLabelComboCQ_Chip2_counter.TextUnit = "Pcs";
this.hslLabelComboCQ_Chip2_counter.TextValue = "00"; this.hslLabelComboCQ_Chip2_counter.TextValue = "00";
this.hslLabelComboCQ_Chip2_counter.TextValueBackcolor = System.Drawing.Color.LawnGreen;
this.hslLabelComboCQ_Chip2_counter.TextValueColorTransFun = null; this.hslLabelComboCQ_Chip2_counter.TextValueColorTransFun = null;
// //
// hslLabelComboCQ_Chip1_counter // hslLabelComboCQ_Chip1_counter
@ -615,11 +648,7 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn al;
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 dataGridViewTextBoxColumn2;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
@ -657,5 +686,9 @@
private HslControls.HslLabelCombo hslLabelComboLaminated; private HslControls.HslLabelCombo hslLabelComboLaminated;
private HslControls.HslLabelCombo hslLabelComboReceiving; private HslControls.HslLabelCombo hslLabelComboReceiving;
private HslControls.HslLabelCombo hslLabelComboFelt; private HslControls.HslLabelCombo hslLabelComboFelt;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn al;
private System.Windows.Forms.DataGridViewTextBoxColumn Msg;
} }
} }

@ -11,6 +11,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -20,15 +21,18 @@ using DB.Service;
using HslControls; using HslControls;
using Tool; using Tool;
using Tool.Model; using Tool.Model;
using HslCommunication.LogNet;
namespace RfidWeb.Frm namespace RfidWeb.Frm
{ {
public partial class UserAlarmShow : UserControl public partial class UserAlarmShow : UserControl
{ {
private ICache cache = Cache.Default;
private ILogNet logNet = ILogNetFactory.GetLogNet;
private TimerX _timer; private TimerX _timer;
private HimAlarmManager himAlarmManager = new HimAlarmManager(); private readonly HimAlarmManager himAlarmManager = new HimAlarmManager();
PromptAlarmManager promptAlarmManager = new PromptAlarmManager(); readonly PromptAlarmManager promptAlarmManager = new PromptAlarmManager();
AlarmLogService alarmLogService = new AlarmLogService(); readonly AlarmLogService alarmLogService = new AlarmLogService();
public UserAlarmShow() public UserAlarmShow()
{ {
@ -37,12 +41,18 @@ namespace RfidWeb.Frm
_timer.Async = true; _timer.Async = true;
} }
Stopwatch stopwatc=new Stopwatch();
void TimeState(Object state) void TimeState(Object state)
{ {
stopwatc.Restart();
FillAlarmGrid(); FillAlarmGrid();
FillPromptGrid(); FillPromptGrid();
FillAlartLed(); FillAlartLed();
FillhslLabelCombo(); FillhslLabelCombo();
stopwatc.Stop();
logNet.WriteInfo("运行时间:"+stopwatc.Elapsed.TotalMilliseconds);
} }
/// <summary> /// <summary>
@ -98,14 +108,16 @@ namespace RfidWeb.Frm
}); });
} }
private ICache cache = Cache.Default;
/// <summary>
/// 异常信息
/// </summary>
void FillAlartLed() void FillAlartLed()
{ {
var plcCh = cache.Get<PlcBoolModel>(CacheKeyManager.CH_alarm); var plcCh = cache.Get<PlcBoolModel>(CacheKeyManager.CH_alarm);
var plcCq= cache.Get<PlcBoolModel>(CacheKeyManager.CQ_alarm); var plcCq= cache.Get<PlcBoolModel>(CacheKeyManager.CQ_alarm);
var plcStop = cache.Get<List<bool>>(CacheKeyManager.estop_temporary_storage); var plcStop = cache.Get<List<bool>>(CacheKeyManager.estop_temporary_storage);
var plcAlarm= cache.Get<List<bool>>(CacheKeyManager.Prompt_alarm); var plcAlarm= cache.Get<List<bool>>(CacheKeyManager.Prompt_alarm);
if (plcStop==null || plcCh ==null || plcCq==null ) return; if (plcStop==null || plcCh ==null || plcCq==null ) return;

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
namespace RfidWeb namespace RfidWeb
@ -11,6 +12,19 @@ namespace RfidWeb
[STAThread] [STAThread]
static void Main() static void Main()
{ {
// 获取当前运行的进程名
string currentProcessName = Process.GetCurrentProcess().ProcessName;
// 检查是否存在其他同名进程
var processes = Process.GetProcessesByName(currentProcessName);
if (processes.Length > 1)
{
// 如果有多个同名进程,说明已经有实例在运行
MessageBox.Show("应用程序已在运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true); AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
Application.EnableVisualStyles(); Application.EnableVisualStyles();

@ -48,7 +48,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon> <ApplicationIcon>H.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Chloe"> <PackageReference Include="Chloe">
@ -286,7 +286,7 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\左箭头.png" /> <None Include="Resources\左箭头.png" />
<None Include="Resources\右箭头.png" /> <None Include="Resources\右箭头.png" />
<Content Include="logo.ico" /> <Content Include="H.ico" />
<Content Include="read.txt" /> <Content Include="read.txt" />
<None Include="Resources\海威图标在上.jpg" /> <None Include="Resources\海威图标在上.jpg" />
<None Include="Resources\log.png" /> <None Include="Resources\log.png" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

@ -20,6 +20,6 @@
public static readonly string Prompt_alarmList = "Prompt_alarmList"; public static readonly string Prompt_alarmList = "Prompt_alarmList";
public static readonly string Home = "Home";
} }
} }
Loading…
Cancel
Save