diff --git a/DB/DB.csproj b/DB/DB.csproj index 5bb51d0..ac85ca3 100644 --- a/DB/DB.csproj +++ b/DB/DB.csproj @@ -103,6 +103,7 @@ + @@ -113,6 +114,7 @@ + diff --git a/DB/Entity/AlarmLog.cs b/DB/Entity/AlarmLog.cs new file mode 100644 index 0000000..5339dd9 --- /dev/null +++ b/DB/Entity/AlarmLog.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DB.Entity +{ + public class AlarmLog: BaseChimsDb + { + public string ShowTime { get; set; } + public string Msg { get; set; } + public int Alarm { get; set; } + public int Count { get; set; } = 0; + + + } + + public class AlarmLogView + { + public long ID { get; set; } + public string ShowTime { get; set; } + public string Msg { get; set; } + public string Alarm { get; set; } + public int Count { get; set; } = 0; + } + + public class AlarmLogMapper : SystemEntityTypeBuilder + { + public AlarmLogMapper() : base("AlarmLog") + { + this.Property(x => x.Msg).HasSize(100); + this.Property(x => x.ShowTime).HasSize(100); + } + } +} diff --git a/DB/Service/AlarmLogService.cs b/DB/Service/AlarmLogService.cs new file mode 100644 index 0000000..f9f27a6 --- /dev/null +++ b/DB/Service/AlarmLogService.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Chloe; + +using DB.Dto; +using DB.Entity; + +using Tool; + +namespace DB.Service +{ + public class AlarmLogService + { + + public void Insert(string msg, string showTime) + { + using (var dbContext = DbFactory.GetContext) + { + + var entity= dbContext.Query() + .Where(x => x.Msg == msg) + .Where(x => x.ShowTime == showTime) + .OrderByDesc(x => x.ID).FirstOrDefault(); + + if (entity == null) + { + var count = dbContext.Query() + .Where(x => x.Msg == msg).Count(); + + AlarmLog log = new AlarmLog + { + Msg = msg, + ShowTime = showTime, + ID = SnowflakeFactory.NewId, + Count = count+1 + }; + dbContext.Insert(log); + + } + } + } + + + public void Insert(Dictionary dic,int alarm) + { + using (var dbContext = DbFactory.GetContext) + { + + foreach (KeyValuePair keyValuePair in dic) + { + string msg = keyValuePair.Key; + var showTime = keyValuePair.Value.ToFullString(); + + + var entity = dbContext.Query() + .Where(x => x.Msg == msg) + .Where(x=>x.Alarm == alarm) + .Where(x => x.ShowTime == showTime) + .OrderByDesc(x => x.ID).FirstOrDefault(); + + if (entity == null) + { + var count = dbContext.Query() + .Where(x => x.Msg == msg && x.Alarm==alarm).Count(); + + AlarmLog log = new AlarmLog + { + Alarm = alarm, + Msg = msg, + ShowTime = showTime, + ID = SnowflakeFactory.NewId, + Count = count + 1 + }; + dbContext.Insert(log); + + } + } + } + + } + + + public PagedList GetPagedList(int pageIndex, int pageSize, string key,int alarm) + { + + + PagingResult pagePagingResult; + using (var dbContext = DbFactory.GetContext) + { + pagePagingResult = dbContext.Query() + .WhereIf(alarm>0,x=>x.Alarm==alarm) + .WhereIf(!string.IsNullOrEmpty(key), x => x.Msg.Contains(key)) + .OrderByDesc(x => x.ID) + .Paging(pageIndex, pageSize); + + + } + + var ls = new List(pagePagingResult.DataList.Count); + foreach (var alarmLog in pagePagingResult.DataList) + { + ls.Add(new AlarmLogView() + { + Alarm = alarmLog.Alarm==1?"警告":"提醒", + ID = alarmLog.ID, + Count = alarmLog.Count, + Msg = alarmLog.Msg, + ShowTime = alarmLog.ShowTime + }); + } + + + PagedList paged = new PagedList(ls, pagePagingResult.Totals.ToInt(), pageIndex, pageSize); + + return paged; + + } + } +} diff --git a/DB/Service/UserService.cs b/DB/Service/UserService.cs index 0b0fa6c..cb4a137 100644 --- a/DB/Service/UserService.cs +++ b/DB/Service/UserService.cs @@ -232,7 +232,17 @@ namespace DB.Service } - + public List GetAllNameByRoleId(long rId) + { + using (var dbContext = DbFactory.GetContext) + { + return dbContext.Query() + .Where(x=>x.RoleId==rId) + .Select(x => x.UserName).ToList(); + } + } + + } diff --git a/RfidWeb/FormLogin.Designer.cs b/RfidWeb/FormLogin.Designer.cs index 891c521..6bf9081 100644 --- a/RfidWeb/FormLogin.Designer.cs +++ b/RfidWeb/FormLogin.Designer.cs @@ -37,6 +37,8 @@ this.comboPwd = new HZH_Controls.Controls.TextBoxEx(); this.comboUser = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -47,14 +49,15 @@ this.panel1.Controls.Add(this.panel2); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(878, 428); + this.panel1.Size = new System.Drawing.Size(585, 285); this.panel1.TabIndex = 0; // // panel2 // this.panel2.BackColor = System.Drawing.Color.White; + this.panel2.Controls.Add(this.label3); + this.panel2.Controls.Add(this.comboBox1); this.panel2.Controls.Add(this.pictureBox1); this.panel2.Controls.Add(this.button2); this.panel2.Controls.Add(this.button1); @@ -64,29 +67,26 @@ this.panel2.Controls.Add(this.label2); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(0, 0); - this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(878, 428); + this.panel2.Size = new System.Drawing.Size(585, 285); this.panel2.TabIndex = 2; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // pictureBox1 // this.pictureBox1.Image = global::RfidWeb.Properties.Resources.海威图标在上; - this.pictureBox1.Location = new System.Drawing.Point(40, 39); - this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.pictureBox1.Location = new System.Drawing.Point(12, 12); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(404, 350); + this.pictureBox1.Size = new System.Drawing.Size(306, 247); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 6; this.pictureBox1.TabStop = false; // // button2 // - this.button2.Location = new System.Drawing.Point(688, 274); - this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button2.Location = new System.Drawing.Point(459, 183); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(134, 66); + this.button2.Size = new System.Drawing.Size(89, 44); this.button2.TabIndex = 5; this.button2.Text = "取消"; this.button2.UseVisualStyleBackColor = true; @@ -94,10 +94,9 @@ // // button1 // - this.button1.Location = new System.Drawing.Point(501, 274); - this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button1.Location = new System.Drawing.Point(334, 183); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(136, 66); + this.button1.Size = new System.Drawing.Size(91, 44); this.button1.TabIndex = 4; this.button1.Text = "登录"; this.button1.UseVisualStyleBackColor = true; @@ -107,10 +106,9 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(486, 104); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(324, 72); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(118, 24); + this.label1.Size = new System.Drawing.Size(79, 16); this.label1.TabIndex = 0; this.label1.Text = "登录用户:"; // @@ -118,8 +116,7 @@ // this.comboPwd.DecLength = 2; this.comboPwd.InputType = HZH_Controls.TextInputType.NotControl; - this.comboPwd.Location = new System.Drawing.Point(614, 189); - this.comboPwd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.comboPwd.Location = new System.Drawing.Point(409, 120); this.comboPwd.MaxValue = new decimal(new int[] { 20, 0, @@ -138,7 +135,7 @@ this.comboPwd.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.comboPwd.PromptText = ""; this.comboPwd.RegexPattern = ""; - this.comboPwd.Size = new System.Drawing.Size(206, 28); + this.comboPwd.Size = new System.Drawing.Size(139, 21); this.comboPwd.TabIndex = 3; this.comboPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboPwd_KeyDown); // @@ -146,30 +143,47 @@ // this.comboUser.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.comboUser.FormattingEnabled = true; - this.comboUser.Location = new System.Drawing.Point(614, 99); - this.comboUser.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.comboUser.Location = new System.Drawing.Point(409, 69); this.comboUser.Name = "comboUser"; - this.comboUser.Size = new System.Drawing.Size(206, 32); + this.comboUser.Size = new System.Drawing.Size(139, 24); this.comboUser.TabIndex = 1; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(486, 189); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(324, 120); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(118, 24); + this.label2.Size = new System.Drawing.Size(79, 16); this.label2.TabIndex = 2; this.label2.Text = "登录密码:"; // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(324, 26); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(79, 16); + this.label3.TabIndex = 7; + this.label3.Text = "登录级别:"; + // + // comboBox1 + // + this.comboBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(409, 23); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(139, 24); + this.comboBox1.TabIndex = 8; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // // FormLogin // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(878, 428); + this.ClientSize = new System.Drawing.Size(585, 285); this.Controls.Add(this.panel1); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "FormLogin"; this.Text = "登录窗口"; this.panel1.ResumeLayout(false); @@ -191,5 +205,7 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox comboBox1; } } \ No newline at end of file diff --git a/RfidWeb/FormLogin.cs b/RfidWeb/FormLogin.cs index 423739c..8fef9c9 100644 --- a/RfidWeb/FormLogin.cs +++ b/RfidWeb/FormLogin.cs @@ -13,8 +13,10 @@ using DB.Service; using HZH_Controls.Forms; using NewLife; using NewLife.Caching; +using Tool; using Tool.Model; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace RfidWeb @@ -22,12 +24,34 @@ namespace RfidWeb public partial class FormLogin : Form { private UserService userService = new UserService(); - + + private RoleService roleService = new RoleService(); + + public FormLogin() { InitializeComponent(); - comboUser.Items.AddRange(userService.GetAllName().ToArray()); + + var readOnlyCollection = roleService.GetList(); + List lsList = readOnlyCollection.Select(x => new Item() + { + Id = x.ID, + Name = x.RoleName + }).ToList(); + + comboBox1.DataSource=lsList; + comboBox1.DisplayMember = "Name"; + comboBox1.ValueMember = "Id"; + + comboBox1.SelectedIndex = 0; + + var obj= comboBox1.SelectedValue; + + var allName = userService.GetAllNameByRoleId(obj.ToLong()); + comboUser.Items.Clear(); + + comboUser.Items.AddRange(allName.ToArray()); if (comboUser.Items.Count > 0) { comboUser.SelectedIndex = 0; @@ -50,7 +74,7 @@ namespace RfidWeb var pwd=this.comboPwd.Text; if (pwd.Trim().Length == 0) { - FrmDialog.ShowDialog(this, "请输入密码?", "警告窗体", false); + FrmDialog.ShowDialog(this, "请输入密码", "警告窗体", false); return; } @@ -58,7 +82,7 @@ namespace RfidWeb var one= userService.GetOne(userName, pwd); if (one == null) { - FrmDialog.ShowDialog(this, "用户和密码错误 请核对?", "警告窗体", false); + FrmDialog.ShowDialog(this, "用户和密码错误 请核对", "警告窗体", false); this.comboPwd.Text = ""; return; } @@ -84,5 +108,16 @@ namespace RfidWeb { } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + + var obj = comboBox1.SelectedValue; + + var allName = userService.GetAllNameByRoleId(obj.ToLong()); + comboUser.Items.Clear(); + comboUser.Items.AddRange(allName.ToArray()); + comboUser.SelectedIndex = 0; + } } } diff --git a/RfidWeb/FormMain.Designer.cs b/RfidWeb/FormMain.Designer.cs index 52cac54..7288997 100644 --- a/RfidWeb/FormMain.Designer.cs +++ b/RfidWeb/FormMain.Designer.cs @@ -34,6 +34,7 @@ this.panContent = new System.Windows.Forms.Panel(); this.panel9 = new System.Windows.Forms.Panel(); this.panel8 = new System.Windows.Forms.Panel(); + this.hslLanternSimplePlc = new HslControls.HslLanternSimple(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.btnShow = new System.Windows.Forms.Button(); @@ -43,10 +44,12 @@ this.btnAlarm = new System.Windows.Forms.Button(); this.btnExit = new System.Windows.Forms.Button(); this.btnArgument = new System.Windows.Forms.Button(); - this.btnMain = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); + this.label3 = new System.Windows.Forms.Label(); + this.labUser = new System.Windows.Forms.Label(); + this.labTime = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.hslLanternSimplePlc = new HslControls.HslLanternSimple(); this.panel1.SuspendLayout(); this.panel6.SuspendLayout(); this.panel7.SuspendLayout(); @@ -118,7 +121,6 @@ this.panel8.Controls.Add(this.btnAlarm); this.panel8.Controls.Add(this.btnExit); this.panel8.Controls.Add(this.btnArgument); - this.panel8.Controls.Add(this.btnMain); this.panel8.Dock = System.Windows.Forms.DockStyle.Left; this.panel8.Location = new System.Drawing.Point(0, 0); this.panel8.Margin = new System.Windows.Forms.Padding(4); @@ -126,16 +128,24 @@ this.panel8.Size = new System.Drawing.Size(370, 954); this.panel8.TabIndex = 3; // + // hslLanternSimplePlc + // + this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 536); + this.hslLanternSimplePlc.Name = "hslLanternSimplePlc"; + this.hslLanternSimplePlc.Size = new System.Drawing.Size(78, 94); + this.hslLanternSimplePlc.TabIndex = 10; + this.hslLanternSimplePlc.Text = "Plc指示灯"; + // // button2 // this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173))))); this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.button2.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button2.ForeColor = System.Drawing.SystemColors.Window; - this.button2.Location = new System.Drawing.Point(22, 420); + this.button2.Location = new System.Drawing.Point(22, 449); this.button2.Margin = new System.Windows.Forms.Padding(4); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(300, 50); + this.button2.Size = new System.Drawing.Size(300, 65); this.button2.TabIndex = 9; this.button2.Text = "扫码设置"; this.button2.UseVisualStyleBackColor = false; @@ -146,10 +156,10 @@ this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.button1.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.ForeColor = System.Drawing.SystemColors.Window; - this.button1.Location = new System.Drawing.Point(22, 362); + this.button1.Location = new System.Drawing.Point(22, 376); this.button1.Margin = new System.Windows.Forms.Padding(4); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(300, 50); + this.button1.Size = new System.Drawing.Size(300, 65); this.button1.TabIndex = 8; this.button1.Text = "打印设置"; this.button1.UseVisualStyleBackColor = false; @@ -163,7 +173,7 @@ this.btnShow.Location = new System.Drawing.Point(22, 14); this.btnShow.Margin = new System.Windows.Forms.Padding(4); this.btnShow.Name = "btnShow"; - this.btnShow.Size = new System.Drawing.Size(300, 50); + this.btnShow.Size = new System.Drawing.Size(300, 65); this.btnShow.TabIndex = 7; this.btnShow.Text = "总览图"; this.btnShow.UseVisualStyleBackColor = false; @@ -190,7 +200,7 @@ this.btnMes.Location = new System.Drawing.Point(22, 304); this.btnMes.Margin = new System.Windows.Forms.Padding(4); this.btnMes.Name = "btnMes"; - this.btnMes.Size = new System.Drawing.Size(300, 50); + this.btnMes.Size = new System.Drawing.Size(300, 65); this.btnMes.TabIndex = 4; this.btnMes.Text = "生产计划"; this.btnMes.UseVisualStyleBackColor = false; @@ -201,10 +211,10 @@ this.btnAccount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btnAccount.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnAccount.ForeColor = System.Drawing.SystemColors.Window; - this.btnAccount.Location = new System.Drawing.Point(22, 246); + this.btnAccount.Location = new System.Drawing.Point(22, 231); this.btnAccount.Margin = new System.Windows.Forms.Padding(4); this.btnAccount.Name = "btnAccount"; - this.btnAccount.Size = new System.Drawing.Size(300, 50); + this.btnAccount.Size = new System.Drawing.Size(300, 65); this.btnAccount.TabIndex = 3; this.btnAccount.Text = "账户管理"; this.btnAccount.UseVisualStyleBackColor = false; @@ -216,10 +226,10 @@ this.btnAlarm.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btnAlarm.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnAlarm.ForeColor = System.Drawing.SystemColors.Window; - this.btnAlarm.Location = new System.Drawing.Point(22, 188); + this.btnAlarm.Location = new System.Drawing.Point(22, 160); this.btnAlarm.Margin = new System.Windows.Forms.Padding(4); this.btnAlarm.Name = "btnAlarm"; - this.btnAlarm.Size = new System.Drawing.Size(300, 50); + this.btnAlarm.Size = new System.Drawing.Size(300, 65); this.btnAlarm.TabIndex = 3; this.btnAlarm.Text = "报警记录"; this.btnAlarm.UseVisualStyleBackColor = false; @@ -244,35 +254,24 @@ this.btnArgument.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.btnArgument.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnArgument.ForeColor = System.Drawing.SystemColors.Window; - this.btnArgument.Location = new System.Drawing.Point(22, 130); + this.btnArgument.Location = new System.Drawing.Point(22, 87); this.btnArgument.Margin = new System.Windows.Forms.Padding(4); this.btnArgument.Name = "btnArgument"; - this.btnArgument.Size = new System.Drawing.Size(300, 50); + this.btnArgument.Size = new System.Drawing.Size(300, 65); this.btnArgument.TabIndex = 1; this.btnArgument.Text = "参数界面"; this.btnArgument.UseVisualStyleBackColor = false; this.btnArgument.Click += new System.EventHandler(this.btnArgument_Click); // - // btnMain - // - this.btnMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173))))); - this.btnMain.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnMain.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnMain.ForeColor = System.Drawing.SystemColors.Window; - this.btnMain.Location = new System.Drawing.Point(22, 72); - this.btnMain.Margin = new System.Windows.Forms.Padding(4); - this.btnMain.Name = "btnMain"; - this.btnMain.Size = new System.Drawing.Size(300, 50); - this.btnMain.TabIndex = 0; - this.btnMain.Text = "首页"; - this.btnMain.UseVisualStyleBackColor = false; - this.btnMain.Click += new System.EventHandler(this.btnMain_Click); - // // panel2 // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.BackgroundImage = global::RfidWeb.Properties.Resources._2024_11_12_170754_114; this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.panel2.Controls.Add(this.label3); + this.panel2.Controls.Add(this.labUser); + this.panel2.Controls.Add(this.labTime); + this.panel2.Controls.Add(this.label2); this.panel2.Controls.Add(this.label1); this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -281,6 +280,51 @@ this.panel2.Size = new System.Drawing.Size(1280, 70); this.panel2.TabIndex = 0; // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.ForeColor = System.Drawing.SystemColors.Window; + this.label3.Location = new System.Drawing.Point(884, 44); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(139, 20); + this.label3.TabIndex = 4; + this.label3.Text = "当前运行时间:"; + // + // labUser + // + this.labUser.AutoSize = true; + this.labUser.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.labUser.ForeColor = System.Drawing.SystemColors.Window; + this.labUser.Location = new System.Drawing.Point(1053, 19); + this.labUser.Name = "labUser"; + this.labUser.Size = new System.Drawing.Size(149, 20); + this.labUser.TabIndex = 3; + this.labUser.Text = "未登录(未授权)"; + this.labUser.Click += new System.EventHandler(this.labUser_Click); + // + // labTime + // + this.labTime.AutoSize = true; + this.labTime.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.labTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173))))); + this.labTime.Location = new System.Drawing.Point(1053, 44); + this.labTime.Name = "labTime"; + this.labTime.Size = new System.Drawing.Size(199, 20); + this.labTime.TabIndex = 2; + this.labTime.Text = "2024/11/12 09:30:23"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.ForeColor = System.Drawing.SystemColors.Window; + this.label2.Location = new System.Drawing.Point(884, 19); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(139, 20); + this.label2.TabIndex = 1; + this.label2.Text = "当前登录用户:"; + // // label1 // this.label1.AutoSize = true; @@ -292,14 +336,6 @@ this.label1.TabIndex = 0; this.label1.Text = "佳通RFID层合裁切设备"; // - // hslLanternSimplePlc - // - this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 515); - this.hslLanternSimplePlc.Name = "hslLanternSimplePlc"; - this.hslLanternSimplePlc.Size = new System.Drawing.Size(78, 94); - this.hslLanternSimplePlc.TabIndex = 10; - this.hslLanternSimplePlc.Text = "Plc指示灯"; - // // FormMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -326,7 +362,6 @@ private System.Windows.Forms.Button btnAlarm; private System.Windows.Forms.Button btnExit; private System.Windows.Forms.Button btnArgument; - private System.Windows.Forms.Button btnMain; private System.Windows.Forms.Panel panel7; private System.Windows.Forms.Panel panContent; private System.Windows.Forms.Panel panel9; @@ -337,5 +372,9 @@ private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; private HslControls.HslLanternSimple hslLanternSimplePlc; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label labTime; + private System.Windows.Forms.Label labUser; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs index 1c506f0..6069f33 100644 --- a/RfidWeb/FormMain.cs +++ b/RfidWeb/FormMain.cs @@ -1,25 +1,22 @@ -using HslCommunication.LogNet; +using DB; +using DB.Entity; +using DB.Service; + +using HslCommunication.LogNet; + using HZH_Controls.Forms; +using NewLife.Caching; using NewLife.Threading; +using RfidWeb.Frm; + using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -using RfidWeb.Frm; + using Tool; -using System.Security.Principal; -using DB.Entity; -using DB; -using System.Threading; -using DB.Service; -using NewLife.Caching; using Tool.Model; namespace RfidWeb @@ -61,10 +58,10 @@ namespace RfidWeb Console.WriteLine(e.HslMessage.ToString()); }; logNet.ConsoleOutput = true; - logNet.WriteInfo("nihao"); + buttons.Clear(); buttons.Add(btnShow); - buttons.Add(btnMain); + buttons.Add(btnArgument); buttons.Add(btnAlarm); buttons.Add(btnAccount); @@ -79,9 +76,29 @@ namespace RfidWeb /// 移除过期的缓存项 void TimeState(Object state) { - var dataTime = DateTime.Now; + bool isExit = UserManager.IsExit(); this.Invoke(() => { + + labTime.Text = DateTime.Now.ToFullString(); + + + this.Invoke(() => + { + //不存在 + if (!isExit) + { + labUser.ForeColor= System.Drawing.SystemColors.Window; + labUser.Text = "未登录(未授权)"; + } + else + { + var dto = UserManager.GetUser(); + labUser.Text = $"{dto.UserName}({dto.RoleName})"; + labUser.ForeColor = Color.FromArgb(21, 182, 173); + } + }); + }); ThreadPoolX.QueueUserWorkItem(UpdateLog); @@ -92,25 +109,29 @@ namespace RfidWeb private void UpdateLog() { - if(cache.ContainsKey(CacheKeyManager.UpdateLog)) return; - cache.Set(CacheKeyManager.UpdateLog, DateTime.Now, TimeSpan.FromSeconds(5)); - var plc = PlcConnect.Instance; - var userDto = TestFactory.TestUser(); + if (UserManager.IsExit()) + { - var strings = HmiPoint.GetValue(); + if (cache.ContainsKey(CacheKeyManager.UpdateLog)) return; + cache.Set(CacheKeyManager.UpdateLog, DateTime.Now, TimeSpan.FromSeconds(5)); + var plc = PlcConnect.Instance; + var userDto = TestFactory.TestUser(); - foreach (var se in strings) - { - var res = plc.ReadUInt32(se); - if (res.IsSuccess) + var strings = HmiPoint.GetValue(); + + foreach (var se in strings) { - updateLogService.AddOrUpdateLog(userDto, se, res.Content); + var res = plc.ReadUInt32(se); + if (res.IsSuccess) + { + updateLogService.AddOrUpdateLog(userDto, se, res.Content); + } } - } - cache.Remove(CacheKeyManager.UpdateLog); + cache.Remove(CacheKeyManager.UpdateLog); + } } @@ -140,15 +161,9 @@ namespace RfidWeb { //FormPar - bool isLogin = UserManager.IsExit(); - if (!isLogin) - { - FormLogin loigLogin = new FormLogin(); - loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 - loigLogin.ShowDialog(); - } - isLogin = UserManager.IsExit(); + CheckLogin(); + var isLogin = UserManager.IsExit(); if (isLogin) { panContent.Controls.Clear(); @@ -157,7 +172,8 @@ namespace RfidWeb } } - private void btnAlarm_Click(object sender, EventArgs e) + + private void CheckLogin() { bool isLogin = UserManager.IsExit(); if (!isLogin) @@ -166,13 +182,18 @@ namespace RfidWeb loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 loigLogin.ShowDialog(); } + } + + private void btnAlarm_Click(object sender, EventArgs e) + { + CheckLogin(); - isLogin = UserManager.IsExit(); + var isLogin = UserManager.IsExit(); if (isLogin) { panContent.Controls.Clear(); - panContent.Controls.Add(new FormAlarm()); - + panContent.Controls.Add(new FromAlarmLog()); + CheckButton(btnAlarm); } } @@ -183,20 +204,13 @@ namespace RfidWeb /// private void btnAccount_Click(object sender, EventArgs e) { - bool isLogin = UserManager.IsExit(); - if (!isLogin) - { - FormLogin loigLogin = new FormLogin(); - loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 - loigLogin.ShowDialog(); - } - - isLogin = UserManager.IsExit(); + CheckLogin(); + var isLogin = UserManager.IsExit(); if (isLogin) { panContent.Controls.Clear(); panContent.Controls.Add(new FormAccount()); - + CheckButton(btnAccount); } @@ -217,6 +231,7 @@ namespace RfidWeb } } + btn.Focus(); btn.BackColor = checkColor; } @@ -225,8 +240,20 @@ namespace RfidWeb panContent.Controls.Clear(); panContent.Controls.Add(new UserAlarmShow()); CheckButton(btnShow); + } - + private void labUser_Click(object sender, EventArgs e) + { + if (labUser.Text != "未登录(未授权)") + { + if (FrmDialog.ShowDialog(this, "退出登录", "提示窗体", true) + == System.Windows.Forms.DialogResult.OK) + { + cache.Remove(CacheKeyManager.User); + btnShow_Click(new object(), EventArgs.Empty); + } + } + } } } diff --git a/RfidWeb/Frm/FormAccount.Designer.cs b/RfidWeb/Frm/FormAccount.Designer.cs index 210355e..c277209 100644 --- a/RfidWeb/Frm/FormAccount.Designer.cs +++ b/RfidWeb/Frm/FormAccount.Designer.cs @@ -29,6 +29,9 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAccount)); + 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(); this.panelTop = new System.Windows.Forms.Panel(); this.ucBtnDel = new HZH_Controls.Controls.UCBtnExt(); this.ucBtnUpdate = new HZH_Controls.Controls.UCBtnExt(); @@ -38,10 +41,14 @@ this.panelBottom = new System.Windows.Forms.Panel(); this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2(); this.panel1 = new System.Windows.Forms.Panel(); - this.ucDataGridViewContent = new HZH_Controls.Controls.UCDataGridView(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.UserName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RoleName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panelTop.SuspendLayout(); this.panelBottom.SuspendLayout(); this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); // // panelTop @@ -72,12 +79,12 @@ this.ucBtnDel.IsRadius = true; this.ucBtnDel.IsShowRect = true; this.ucBtnDel.IsShowTips = false; - this.ucBtnDel.Location = new System.Drawing.Point(654, 26); + this.ucBtnDel.Location = new System.Drawing.Point(654, 18); this.ucBtnDel.Margin = new System.Windows.Forms.Padding(0); this.ucBtnDel.Name = "ucBtnDel"; this.ucBtnDel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); this.ucBtnDel.RectWidth = 1; - this.ucBtnDel.Size = new System.Drawing.Size(121, 28); + this.ucBtnDel.Size = new System.Drawing.Size(121, 35); this.ucBtnDel.TabIndex = 5; this.ucBtnDel.TabStop = false; this.ucBtnDel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); @@ -99,12 +106,12 @@ this.ucBtnUpdate.IsRadius = true; this.ucBtnUpdate.IsShowRect = true; this.ucBtnUpdate.IsShowTips = false; - this.ucBtnUpdate.Location = new System.Drawing.Point(514, 26); + this.ucBtnUpdate.Location = new System.Drawing.Point(515, 18); this.ucBtnUpdate.Margin = new System.Windows.Forms.Padding(0); this.ucBtnUpdate.Name = "ucBtnUpdate"; this.ucBtnUpdate.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); this.ucBtnUpdate.RectWidth = 1; - this.ucBtnUpdate.Size = new System.Drawing.Size(121, 28); + this.ucBtnUpdate.Size = new System.Drawing.Size(121, 35); this.ucBtnUpdate.TabIndex = 4; this.ucBtnUpdate.TabStop = false; this.ucBtnUpdate.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); @@ -126,12 +133,12 @@ this.ucBtnAdd.IsRadius = true; this.ucBtnAdd.IsShowRect = true; this.ucBtnAdd.IsShowTips = false; - this.ucBtnAdd.Location = new System.Drawing.Point(375, 26); + this.ucBtnAdd.Location = new System.Drawing.Point(374, 18); this.ucBtnAdd.Margin = new System.Windows.Forms.Padding(0); this.ucBtnAdd.Name = "ucBtnAdd"; this.ucBtnAdd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); this.ucBtnAdd.RectWidth = 1; - this.ucBtnAdd.Size = new System.Drawing.Size(121, 28); + this.ucBtnAdd.Size = new System.Drawing.Size(121, 35); this.ucBtnAdd.TabIndex = 3; this.ucBtnAdd.TabStop = false; this.ucBtnAdd.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); @@ -153,12 +160,12 @@ this.ucBtnSelect.IsRadius = true; this.ucBtnSelect.IsShowRect = true; this.ucBtnSelect.IsShowTips = false; - this.ucBtnSelect.Location = new System.Drawing.Point(226, 26); + this.ucBtnSelect.Location = new System.Drawing.Point(226, 18); this.ucBtnSelect.Margin = new System.Windows.Forms.Padding(0); this.ucBtnSelect.Name = "ucBtnSelect"; this.ucBtnSelect.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); this.ucBtnSelect.RectWidth = 1; - this.ucBtnSelect.Size = new System.Drawing.Size(121, 28); + this.ucBtnSelect.Size = new System.Drawing.Size(121, 35); this.ucBtnSelect.TabIndex = 2; this.ucBtnSelect.TabStop = false; this.ucBtnSelect.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); @@ -168,8 +175,9 @@ // textBoxSel // this.textBoxSel.DecLength = 2; + this.textBoxSel.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBoxSel.InputType = HZH_Controls.TextInputType.NotControl; - this.textBoxSel.Location = new System.Drawing.Point(33, 26); + this.textBoxSel.Location = new System.Drawing.Point(32, 18); this.textBoxSel.MaxValue = new decimal(new int[] { 1000000, 0, @@ -187,7 +195,7 @@ this.textBoxSel.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.textBoxSel.PromptText = ""; this.textBoxSel.RegexPattern = ""; - this.textBoxSel.Size = new System.Drawing.Size(158, 28); + this.textBoxSel.Size = new System.Drawing.Size(158, 30); this.textBoxSel.TabIndex = 0; // // panelBottom @@ -217,32 +225,77 @@ // // panel1 // - this.panel1.Controls.Add(this.ucDataGridViewContent); + this.panel1.Controls.Add(this.dataGridView1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 80); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(910, 814); this.panel1.TabIndex = 4; // - // ucDataGridViewContent + // dataGridView1 // - this.ucDataGridViewContent.BackColor = System.Drawing.Color.White; - this.ucDataGridViewContent.Columns = null; - this.ucDataGridViewContent.DataSource = null; - this.ucDataGridViewContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.ucDataGridViewContent.HeadFont = new System.Drawing.Font("微软雅黑", 12F); - this.ucDataGridViewContent.HeadHeight = 40; - this.ucDataGridViewContent.HeadPadingLeft = 0; - this.ucDataGridViewContent.HeadTextColor = System.Drawing.Color.Black; - this.ucDataGridViewContent.IsShowCheckBox = false; - this.ucDataGridViewContent.IsShowHead = true; - this.ucDataGridViewContent.Location = new System.Drawing.Point(0, 0); - this.ucDataGridViewContent.Name = "ucDataGridViewContent"; - this.ucDataGridViewContent.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0); - this.ucDataGridViewContent.RowHeight = 40; - this.ucDataGridViewContent.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow); - this.ucDataGridViewContent.Size = new System.Drawing.Size(910, 814); - this.ucDataGridViewContent.TabIndex = 0; + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, 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.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.UserName, + this.RoleName}); + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2; + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 0); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(910, 814); + this.dataGridView1.TabIndex = 0; + // + // ID + // + this.ID.DataPropertyName = "ID"; + this.ID.HeaderText = "ID"; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Visible = false; + // + // UserName + // + this.UserName.DataPropertyName = "UserName"; + this.UserName.HeaderText = "用户姓名"; + this.UserName.Name = "UserName"; + this.UserName.ReadOnly = true; + this.UserName.Width = 200; + // + // RoleName + // + this.RoleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RoleName.DataPropertyName = "RoleName"; + this.RoleName.HeaderText = "权限"; + this.RoleName.Name = "RoleName"; + this.RoleName.ReadOnly = true; // // FormAccount // @@ -257,6 +310,7 @@ this.panelTop.PerformLayout(); this.panelBottom.ResumeLayout(false); this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.ResumeLayout(false); } @@ -272,6 +326,9 @@ private HZH_Controls.Controls.UCBtnExt ucBtnDel; private System.Windows.Forms.Panel panel1; private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21; - private HZH_Controls.Controls.UCDataGridView ucDataGridViewContent; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn UserName; + private System.Windows.Forms.DataGridViewTextBoxColumn RoleName; } } diff --git a/RfidWeb/Frm/FormAccount.cs b/RfidWeb/Frm/FormAccount.cs index fecc9e1..445fc6b 100644 --- a/RfidWeb/Frm/FormAccount.cs +++ b/RfidWeb/Frm/FormAccount.cs @@ -30,15 +30,9 @@ namespace RfidWeb.Frm private void Init() { - List lstCulumns = new List - { - new DataGridViewColumnEntity() { DataField = "Id", HeadText = "编号", Width = 100, WidthType = SizeType.Absolute }, - new DataGridViewColumnEntity() { DataField = "UserName", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent }, - new DataGridViewColumnEntity() { DataField = "RoleName", HeadText = "权限名称", Width = 50, WidthType = SizeType.Percent } - }; - this.ucDataGridViewContent.Columns = lstCulumns; - this.ucDataGridViewContent.IsShowCheckBox = true; + this.dataGridView1.AutoGenerateColumns = false; + ucPagerControl21.PageModel = PageModel.PageCount; ucPagerControl21.PageIndex = 1; ucPagerControl21.PageSize = 20; @@ -70,16 +64,7 @@ namespace RfidWeb.Frm } var page = userService.GetPagedList(index, ucPagerControl21.PageSize, key,lsInts); ucPagerControl21.PageCount = page.TotalPages; - this.ucDataGridViewContent.DataSource = page.Items; - - var dataGridViewRows = ucDataGridViewContent.SelectRows; - foreach (var row in dataGridViewRows) - { - if (row.IsChecked) - { - row.IsChecked = false; - } - } + this.dataGridView1.DataSource = page.Items; } private void ucBtnSelect_BtnClick(object sender, EventArgs e) @@ -106,7 +91,7 @@ namespace RfidWeb.Frm private void ucBtnDel_BtnClick(object sender, EventArgs e) { - var dataGridViewRows = ucDataGridViewContent.SelectRows; + var dataGridViewRows = this.dataGridView1.SelectedRows; if (dataGridViewRows.Count == 0) { FrmDialog.ShowDialog(this, "请勾选相关信息", "警告窗体"); @@ -114,12 +99,10 @@ namespace RfidWeb.Frm } List ls = new List(); - foreach (var dr in dataGridViewRows) + foreach (DataGridViewRow dataGridViewRow in dataGridViewRows) { - if (dr.DataSource is UserDto dto) - { - ls.Add(dto.Id); - } + var obj = dataGridViewRow.DataBoundItem as UserDto; + ls.Add(obj.Id); } if (ls.Any()) @@ -128,7 +111,7 @@ namespace RfidWeb.Frm Replace(); } - + } @@ -136,21 +119,21 @@ namespace RfidWeb.Frm private void ucBtnUpdate_BtnClick(object sender, EventArgs e) { - var dataGridViewRows = ucDataGridViewContent.SelectRows; - if (dataGridViewRows.Count!=1) + var dataGridViewRows = this.dataGridView1.SelectedRows; + if (dataGridViewRows.Count != 1) { FrmDialog.ShowDialog(this, "只能修改一条", "警告窗体"); return; } - var dto = dataGridViewRows.First().DataSource as UserDto; - FormRegister formRegis = new FormRegister(dto.Id, OlduserDto); - formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 - formRegis.ShowDialog(); + var dto = dataGridViewRows[0].DataBoundItem as UserDto; + FormRegister formRegis = new FormRegister(dto.Id, OlduserDto); + formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 + formRegis.ShowDialog(); - - Replace(); + + Replace(); } diff --git a/RfidWeb/Frm/FormAccount.resx b/RfidWeb/Frm/FormAccount.resx index 2411c48..08f3468 100644 --- a/RfidWeb/Frm/FormAccount.resx +++ b/RfidWeb/Frm/FormAccount.resx @@ -126,4 +126,13 @@ ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs= + + True + + + True + + + True + \ No newline at end of file diff --git a/RfidWeb/Frm/FormAlarm.Designer.cs b/RfidWeb/Frm/FormAlarm.Designer.cs deleted file mode 100644 index 08e426a..0000000 --- a/RfidWeb/Frm/FormAlarm.Designer.cs +++ /dev/null @@ -1,215 +0,0 @@ -namespace RfidWeb.Frm -{ - partial class FormAlarm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要修改 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAlarm)); - this.panel1 = new System.Windows.Forms.Panel(); - this.panelTop = new System.Windows.Forms.Panel(); - this.ucBtnDel = new HZH_Controls.Controls.UCBtnExt(); - this.ucBtnSelect = new HZH_Controls.Controls.UCBtnExt(); - this.textBoxSel = new HZH_Controls.Controls.TextBoxEx(); - this.panel2 = new System.Windows.Forms.Panel(); - this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2(); - this.ucDataGridViewContent = new HZH_Controls.Controls.UCDataGridView(); - this.panel1.SuspendLayout(); - this.panelTop.SuspendLayout(); - this.panel2.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Controls.Add(this.panelTop); - 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, 80); - this.panel1.TabIndex = 0; - // - // panelTop - // - this.panelTop.Controls.Add(this.ucBtnDel); - this.panelTop.Controls.Add(this.ucBtnSelect); - this.panelTop.Controls.Add(this.textBoxSel); - this.panelTop.Dock = System.Windows.Forms.DockStyle.Top; - this.panelTop.Location = new System.Drawing.Point(0, 0); - this.panelTop.Name = "panelTop"; - this.panelTop.Size = new System.Drawing.Size(910, 80); - this.panelTop.TabIndex = 1; - // - // ucBtnDel - // - this.ucBtnDel.BackColor = System.Drawing.Color.White; - this.ucBtnDel.BtnBackColor = System.Drawing.Color.White; - this.ucBtnDel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ucBtnDel.BtnForeColor = System.Drawing.Color.White; - this.ucBtnDel.BtnText = "删除 "; - this.ucBtnDel.ConerRadius = 5; - this.ucBtnDel.Cursor = System.Windows.Forms.Cursors.Hand; - this.ucBtnDel.EnabledMouseEffect = false; - this.ucBtnDel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); - this.ucBtnDel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.ucBtnDel.IsRadius = true; - this.ucBtnDel.IsShowRect = true; - this.ucBtnDel.IsShowTips = false; - this.ucBtnDel.Location = new System.Drawing.Point(382, 26); - this.ucBtnDel.Margin = new System.Windows.Forms.Padding(0); - this.ucBtnDel.Name = "ucBtnDel"; - this.ucBtnDel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); - this.ucBtnDel.RectWidth = 1; - this.ucBtnDel.Size = new System.Drawing.Size(121, 28); - this.ucBtnDel.TabIndex = 5; - this.ucBtnDel.TabStop = false; - this.ucBtnDel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); - this.ucBtnDel.TipsText = ""; - // - // ucBtnSelect - // - this.ucBtnSelect.BackColor = System.Drawing.Color.White; - this.ucBtnSelect.BtnBackColor = System.Drawing.Color.White; - this.ucBtnSelect.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ucBtnSelect.BtnForeColor = System.Drawing.Color.White; - this.ucBtnSelect.BtnText = "查询"; - this.ucBtnSelect.ConerRadius = 5; - this.ucBtnSelect.Cursor = System.Windows.Forms.Cursors.Hand; - this.ucBtnSelect.EnabledMouseEffect = false; - this.ucBtnSelect.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); - this.ucBtnSelect.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.ucBtnSelect.IsRadius = true; - this.ucBtnSelect.IsShowRect = true; - this.ucBtnSelect.IsShowTips = false; - this.ucBtnSelect.Location = new System.Drawing.Point(226, 26); - this.ucBtnSelect.Margin = new System.Windows.Forms.Padding(0); - this.ucBtnSelect.Name = "ucBtnSelect"; - this.ucBtnSelect.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); - this.ucBtnSelect.RectWidth = 1; - this.ucBtnSelect.Size = new System.Drawing.Size(121, 28); - this.ucBtnSelect.TabIndex = 2; - this.ucBtnSelect.TabStop = false; - this.ucBtnSelect.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); - this.ucBtnSelect.TipsText = ""; - this.ucBtnSelect.BtnClick += new System.EventHandler(this.ucBtnSelect_BtnClick); - // - // textBoxSel - // - this.textBoxSel.DecLength = 2; - this.textBoxSel.InputType = HZH_Controls.TextInputType.NotControl; - this.textBoxSel.Location = new System.Drawing.Point(33, 26); - this.textBoxSel.MaxValue = new decimal(new int[] { - 1000000, - 0, - 0, - 0}); - this.textBoxSel.MinValue = new decimal(new int[] { - 1000000, - 0, - 0, - -2147483648}); - this.textBoxSel.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0); - this.textBoxSel.Name = "textBoxSel"; - this.textBoxSel.OldText = null; - this.textBoxSel.PromptColor = System.Drawing.Color.Gray; - this.textBoxSel.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.textBoxSel.PromptText = ""; - this.textBoxSel.RegexPattern = ""; - this.textBoxSel.Size = new System.Drawing.Size(158, 28); - this.textBoxSel.TabIndex = 0; - // - // panel2 - // - this.panel2.Controls.Add(this.ucPagerControl21); - this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 894); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(910, 41); - this.panel2.TabIndex = 1; - // - // ucPagerControl21 - // - this.ucPagerControl21.BackColor = System.Drawing.Color.White; - this.ucPagerControl21.DataSource = ((System.Collections.Generic.List)(resources.GetObject("ucPagerControl21.DataSource"))); - this.ucPagerControl21.Dock = System.Windows.Forms.DockStyle.Fill; - this.ucPagerControl21.Location = new System.Drawing.Point(0, 0); - this.ucPagerControl21.Name = "ucPagerControl21"; - this.ucPagerControl21.PageCount = 0; - this.ucPagerControl21.PageIndex = 1; - this.ucPagerControl21.PageModel = HZH_Controls.Controls.PageModel.Soure; - this.ucPagerControl21.PageSize = 10; - this.ucPagerControl21.Size = new System.Drawing.Size(910, 41); - this.ucPagerControl21.StartIndex = 0; - this.ucPagerControl21.TabIndex = 1; - this.ucPagerControl21.ShowSourceChanged += new HZH_Controls.Controls.PageControlEventHandler(this.ucPagerControl21_ShowSourceChanged); - // - // ucDataGridViewContent - // - this.ucDataGridViewContent.BackColor = System.Drawing.Color.White; - this.ucDataGridViewContent.Columns = null; - this.ucDataGridViewContent.DataSource = null; - this.ucDataGridViewContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.ucDataGridViewContent.HeadFont = new System.Drawing.Font("微软雅黑", 12F); - this.ucDataGridViewContent.HeadHeight = 40; - this.ucDataGridViewContent.HeadPadingLeft = 0; - this.ucDataGridViewContent.HeadTextColor = System.Drawing.Color.Black; - this.ucDataGridViewContent.IsShowCheckBox = false; - this.ucDataGridViewContent.IsShowHead = true; - this.ucDataGridViewContent.Location = new System.Drawing.Point(0, 80); - this.ucDataGridViewContent.Name = "ucDataGridViewContent"; - this.ucDataGridViewContent.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0); - this.ucDataGridViewContent.RowHeight = 40; - this.ucDataGridViewContent.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow); - this.ucDataGridViewContent.Size = new System.Drawing.Size(910, 814); - this.ucDataGridViewContent.TabIndex = 2; - // - // FormAlarm - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.Controls.Add(this.ucDataGridViewContent); - this.Controls.Add(this.panel2); - this.Controls.Add(this.panel1); - this.Name = "FormAlarm"; - this.Size = new System.Drawing.Size(910, 935); - this.panel1.ResumeLayout(false); - this.panelTop.ResumeLayout(false); - this.panelTop.PerformLayout(); - this.panel2.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Panel panelTop; - private HZH_Controls.Controls.UCBtnExt ucBtnDel; - private HZH_Controls.Controls.UCBtnExt ucBtnSelect; - private HZH_Controls.Controls.TextBoxEx textBoxSel; - private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21; - private HZH_Controls.Controls.UCDataGridView ucDataGridViewContent; - } -} diff --git a/RfidWeb/Frm/FormAlarm.cs b/RfidWeb/Frm/FormAlarm.cs deleted file mode 100644 index c679f62..0000000 --- a/RfidWeb/Frm/FormAlarm.cs +++ /dev/null @@ -1,78 +0,0 @@ -using DB.Dto; -using DB.Service; - -using HZH_Controls.Controls; - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace RfidWeb.Frm -{ - public partial class FormAlarm : UserControl - { - private UserDto OlduserDto; - private PointLogService PointLogService = new PointLogService(); - public FormAlarm() - { - InitializeComponent(); - OlduserDto = UserManager.GetUser(); - Init(); - } - - - private void Init() - { - List lstCulumns = new List - { - new DataGridViewColumnEntity() { DataField = "PointName", HeadText = "名称", Width = 90, WidthType = SizeType.Absolute }, - new DataGridViewColumnEntity() { DataField = "Msg", HeadText = "异常内容", Width = 700, WidthType = SizeType.Absolute }, - - }; - - ucDataGridViewContent.AutoScroll = false; - - - this.ucDataGridViewContent.Columns = lstCulumns; - this.ucDataGridViewContent.IsShowCheckBox = true; - ucPagerControl21.PageModel = PageModel.PageCount; - ucPagerControl21.PageIndex = 1; - ucPagerControl21.PageSize = 20; - - } - - - - private void ucPagerControl21_ShowSourceChanged(object currentSource) - { - string key = this.textBoxSel.Text.Trim(); - var index = ucPagerControl21.PageIndex; - - var page = PointLogService.GetPagedList(index, ucPagerControl21.PageSize,key); - ucPagerControl21.PageCount = page.Totals.ToInt(); - this.ucDataGridViewContent.DataSource = page.DataList; - - - var dataGridViewRows = ucDataGridViewContent.SelectRows; - foreach (var row in dataGridViewRows) - { - if (row.IsChecked) - { - row.IsChecked = false; - } - } - } - - private void ucBtnSelect_BtnClick(object sender, EventArgs e) - { - ucPagerControl21.PageIndex = 1; - ucPagerControl21_ShowSourceChanged(new object()); - } - } -} diff --git a/RfidWeb/Frm/FromAlarmLog.Designer.cs b/RfidWeb/Frm/FromAlarmLog.Designer.cs new file mode 100644 index 0000000..7eb1355 --- /dev/null +++ b/RfidWeb/Frm/FromAlarmLog.Designer.cs @@ -0,0 +1,232 @@ +namespace RfidWeb.Frm +{ + partial class FromAlarmLog + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FromAlarmLog)); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + this.panelTop = new System.Windows.Forms.Panel(); + this.ucBtnSelect = new HZH_Controls.Controls.UCBtnExt(); + this.textBoxSel = new HZH_Controls.Controls.TextBoxEx(); + this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.UserName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RoleName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Alarm = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.panelTop.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // panelTop + // + this.panelTop.Controls.Add(this.ucBtnSelect); + this.panelTop.Controls.Add(this.textBoxSel); + this.panelTop.Dock = System.Windows.Forms.DockStyle.Top; + this.panelTop.Location = new System.Drawing.Point(0, 0); + this.panelTop.Name = "panelTop"; + this.panelTop.Size = new System.Drawing.Size(910, 80); + this.panelTop.TabIndex = 1; + // + // ucBtnSelect + // + this.ucBtnSelect.BackColor = System.Drawing.Color.White; + this.ucBtnSelect.BtnBackColor = System.Drawing.Color.White; + this.ucBtnSelect.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucBtnSelect.BtnForeColor = System.Drawing.Color.White; + this.ucBtnSelect.BtnText = "查询"; + this.ucBtnSelect.ConerRadius = 5; + this.ucBtnSelect.Cursor = System.Windows.Forms.Cursors.Hand; + this.ucBtnSelect.EnabledMouseEffect = false; + this.ucBtnSelect.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); + this.ucBtnSelect.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucBtnSelect.IsRadius = true; + this.ucBtnSelect.IsShowRect = true; + this.ucBtnSelect.IsShowTips = false; + this.ucBtnSelect.Location = new System.Drawing.Point(226, 18); + this.ucBtnSelect.Margin = new System.Windows.Forms.Padding(0); + this.ucBtnSelect.Name = "ucBtnSelect"; + this.ucBtnSelect.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171))))); + this.ucBtnSelect.RectWidth = 1; + this.ucBtnSelect.Size = new System.Drawing.Size(121, 35); + this.ucBtnSelect.TabIndex = 2; + this.ucBtnSelect.TabStop = false; + this.ucBtnSelect.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); + this.ucBtnSelect.TipsText = ""; + this.ucBtnSelect.BtnClick += new System.EventHandler(this.ucBtnSelect_BtnClick); + // + // textBoxSel + // + this.textBoxSel.DecLength = 2; + this.textBoxSel.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBoxSel.InputType = HZH_Controls.TextInputType.NotControl; + this.textBoxSel.Location = new System.Drawing.Point(32, 18); + this.textBoxSel.MaxValue = new decimal(new int[] { + 1000000, + 0, + 0, + 0}); + this.textBoxSel.MinValue = new decimal(new int[] { + 1000000, + 0, + 0, + -2147483648}); + this.textBoxSel.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0); + this.textBoxSel.Name = "textBoxSel"; + this.textBoxSel.OldText = null; + this.textBoxSel.PromptColor = System.Drawing.Color.Gray; + this.textBoxSel.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.textBoxSel.PromptText = ""; + this.textBoxSel.RegexPattern = ""; + this.textBoxSel.Size = new System.Drawing.Size(158, 30); + this.textBoxSel.TabIndex = 0; + // + // ucPagerControl21 + // + this.ucPagerControl21.BackColor = System.Drawing.Color.White; + this.ucPagerControl21.DataSource = ((System.Collections.Generic.List)(resources.GetObject("ucPagerControl21.DataSource"))); + this.ucPagerControl21.Dock = System.Windows.Forms.DockStyle.Bottom; + this.ucPagerControl21.Location = new System.Drawing.Point(0, 773); + this.ucPagerControl21.Name = "ucPagerControl21"; + this.ucPagerControl21.PageCount = 0; + this.ucPagerControl21.PageIndex = 1; + this.ucPagerControl21.PageModel = HZH_Controls.Controls.PageModel.Soure; + this.ucPagerControl21.PageSize = 10; + this.ucPagerControl21.Size = new System.Drawing.Size(910, 41); + this.ucPagerControl21.StartIndex = 1; + this.ucPagerControl21.TabIndex = 2; + this.ucPagerControl21.ShowSourceChanged += new HZH_Controls.Controls.PageControlEventHandler(this.ucPagerControl21_ShowSourceChanged); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.UserName, + this.RoleName, + this.Alarm}); + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 80); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(910, 693); + this.dataGridView1.TabIndex = 3; + // + // ID + // + this.ID.DataPropertyName = "ID"; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.ID.DefaultCellStyle = dataGridViewCellStyle6; + this.ID.HeaderText = "ID"; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Visible = false; + // + // UserName + // + this.UserName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.UserName.DataPropertyName = "Msg"; + this.UserName.HeaderText = "警告信息"; + this.UserName.Name = "UserName"; + this.UserName.ReadOnly = true; + // + // RoleName + // + this.RoleName.DataPropertyName = "ShowTime"; + this.RoleName.HeaderText = "时间"; + this.RoleName.Name = "RoleName"; + this.RoleName.ReadOnly = true; + this.RoleName.Width = 150; + // + // Alarm + // + this.Alarm.DataPropertyName = "Alarm"; + this.Alarm.HeaderText = "警告/提示"; + this.Alarm.Name = "Alarm"; + this.Alarm.ReadOnly = true; + this.Alarm.Width = 150; + // + // FromAlarmLog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.ucPagerControl21); + this.Controls.Add(this.panelTop); + this.Name = "FromAlarmLog"; + this.Size = new System.Drawing.Size(910, 814); + this.panelTop.ResumeLayout(false); + this.panelTop.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panelTop; + private HZH_Controls.Controls.UCBtnExt ucBtnSelect; + private HZH_Controls.Controls.TextBoxEx textBoxSel; + private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn UserName; + private System.Windows.Forms.DataGridViewTextBoxColumn RoleName; + private System.Windows.Forms.DataGridViewTextBoxColumn Alarm; + } +} diff --git a/RfidWeb/Frm/FromAlarmLog.cs b/RfidWeb/Frm/FromAlarmLog.cs new file mode 100644 index 0000000..a05c59f --- /dev/null +++ b/RfidWeb/Frm/FromAlarmLog.cs @@ -0,0 +1,59 @@ +using DB.Service; + +using HZH_Controls.Controls; + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RfidWeb.Frm +{ + public partial class FromAlarmLog : UserControl + { + private AlarmLogService logService = new AlarmLogService(); + public FromAlarmLog() + { + InitializeComponent(); + Init(); + } + + private void Init() + { + + this.dataGridView1.AutoGenerateColumns = false; + + ucPagerControl21.PageModel = PageModel.PageCount; + ucPagerControl21.PageIndex = 1; + ucPagerControl21.PageSize = 20; + + } + + private void Replace() + { + ucPagerControl21.PageIndex = 1; + ucPagerControl21_ShowSourceChanged(new object()); + + } + + private void ucPagerControl21_ShowSourceChanged(object currentSource) + { + string key = textBoxSel.Text; + int index = ucPagerControl21.PageIndex; + var page = logService.GetPagedList(index, ucPagerControl21.PageSize, key, -1); + ucPagerControl21.PageCount = page.TotalPages; + this.dataGridView1.DataSource = page.Items; + } + + private void ucBtnSelect_BtnClick(object sender, EventArgs e) + { + Replace(); + } + } +} diff --git a/RfidWeb/Frm/FormAlarm.resx b/RfidWeb/Frm/FromAlarmLog.resx similarity index 89% rename from RfidWeb/Frm/FormAlarm.resx rename to RfidWeb/Frm/FromAlarmLog.resx index 2411c48..6b9c039 100644 --- a/RfidWeb/Frm/FormAlarm.resx +++ b/RfidWeb/Frm/FromAlarmLog.resx @@ -126,4 +126,16 @@ ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs= + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/RfidWeb/Frm/UserAlarmShow.Designer.cs b/RfidWeb/Frm/UserAlarmShow.Designer.cs index 40d9440..b436492 100644 --- a/RfidWeb/Frm/UserAlarmShow.Designer.cs +++ b/RfidWeb/Frm/UserAlarmShow.Designer.cs @@ -38,7 +38,14 @@ this.Msg = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.hslLabelComboSWSS = new HslControls.HslLabelCombo(); + this.hslLabelComboQDWD2SS = new HslControls.HslLabelCombo(); + this.hslLabelComboQDWD1SS = new HslControls.HslLabelCombo(); + this.hslLabelComboCQ_Chip2_counter = new HslControls.HslLabelCombo(); + this.hslLabelComboCQ_Chip1_counter = new HslControls.HslLabelCombo(); + this.hslLabelComboProduct_counter2 = new HslControls.HslLabelCombo(); this.hslA12 = new HslControls.HslLanternSimple(); + this.hsl0 = new HslControls.HslLanternSimple(); this.hslA11 = new HslControls.HslLanternSimple(); this.hslA10 = new HslControls.HslLanternSimple(); this.hslA9 = new HslControls.HslLanternSimple(); @@ -51,9 +58,12 @@ this.hslA3 = new HslControls.HslLanternSimple(); this.hslA2 = new HslControls.HslLanternSimple(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.hslLabelComboReceiving = new HslControls.HslLabelCombo(); + this.hslLabelComboFelt = new HslControls.HslLabelCombo(); + this.hslLabelComboLaminated = new HslControls.HslLabelCombo(); + this.hslLabelCombofeedingMotorSpeed = new HslControls.HslLabelCombo(); this.hslB14 = new HslControls.HslLanternSimple(); this.hslB13 = new HslControls.HslLanternSimple(); - this.hsl0 = new HslControls.HslLanternSimple(); this.hslB2 = new HslControls.HslLanternSimple(); this.hslB3 = new HslControls.HslLanternSimple(); this.hslB1 = new HslControls.HslLanternSimple(); @@ -170,7 +180,14 @@ // 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.hslLabelComboSWSS); + this.groupBox1.Controls.Add(this.hslLabelComboQDWD2SS); + this.groupBox1.Controls.Add(this.hslLabelComboQDWD1SS); + this.groupBox1.Controls.Add(this.hslLabelComboCQ_Chip2_counter); + this.groupBox1.Controls.Add(this.hslLabelComboCQ_Chip1_counter); + this.groupBox1.Controls.Add(this.hslLabelComboProduct_counter2); this.groupBox1.Controls.Add(this.hslA12); + this.groupBox1.Controls.Add(this.hsl0); this.groupBox1.Controls.Add(this.hslA11); this.groupBox1.Controls.Add(this.hslA10); this.groupBox1.Controls.Add(this.hslA9); @@ -190,6 +207,92 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "卷料侧(收料1)"; // + // hslLabelComboSWSS + // + this.hslLabelComboSWSS.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboSWSS.Location = new System.Drawing.Point(756, 156); + this.hslLabelComboSWSS.LocationUnit = 0.82F; + this.hslLabelComboSWSS.LocationValue = 0.5F; + this.hslLabelComboSWSS.Name = "hslLabelComboSWSS"; + this.hslLabelComboSWSS.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboSWSS.TabIndex = 26; + this.hslLabelComboSWSS.TextInfo = "内部 温度:"; + this.hslLabelComboSWSS.TextUnit = "°C"; + this.hslLabelComboSWSS.TextValue = "00"; + this.hslLabelComboSWSS.TextValueColorTransFun = null; + // + // hslLabelComboQDWD2SS + // + this.hslLabelComboQDWD2SS.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboQDWD2SS.Location = new System.Drawing.Point(756, 131); + this.hslLabelComboQDWD2SS.LocationUnit = 0.82F; + this.hslLabelComboQDWD2SS.LocationValue = 0.5F; + this.hslLabelComboQDWD2SS.Name = "hslLabelComboQDWD2SS"; + this.hslLabelComboQDWD2SS.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboQDWD2SS.TabIndex = 25; + this.hslLabelComboQDWD2SS.TextInfo = "裁刀2温度:"; + this.hslLabelComboQDWD2SS.TextUnit = "°C"; + this.hslLabelComboQDWD2SS.TextValue = "00"; + this.hslLabelComboQDWD2SS.TextValueBackcolor = System.Drawing.Color.IndianRed; + this.hslLabelComboQDWD2SS.TextValueColorTransFun = null; + // + // hslLabelComboQDWD1SS + // + this.hslLabelComboQDWD1SS.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboQDWD1SS.Location = new System.Drawing.Point(756, 105); + this.hslLabelComboQDWD1SS.LocationUnit = 0.82F; + this.hslLabelComboQDWD1SS.LocationValue = 0.5F; + this.hslLabelComboQDWD1SS.Name = "hslLabelComboQDWD1SS"; + this.hslLabelComboQDWD1SS.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboQDWD1SS.TabIndex = 24; + this.hslLabelComboQDWD1SS.TextInfo = "裁刀1温度:"; + this.hslLabelComboQDWD1SS.TextUnit = "°C"; + this.hslLabelComboQDWD1SS.TextValue = "00"; + this.hslLabelComboQDWD1SS.TextValueColorTransFun = null; + // + // hslLabelComboCQ_Chip2_counter + // + this.hslLabelComboCQ_Chip2_counter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboCQ_Chip2_counter.Location = new System.Drawing.Point(756, 81); + this.hslLabelComboCQ_Chip2_counter.LocationUnit = 0.82F; + this.hslLabelComboCQ_Chip2_counter.LocationValue = 0.5F; + this.hslLabelComboCQ_Chip2_counter.Name = "hslLabelComboCQ_Chip2_counter"; + this.hslLabelComboCQ_Chip2_counter.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboCQ_Chip2_counter.TabIndex = 23; + this.hslLabelComboCQ_Chip2_counter.TextInfo = "裁刀2数量:"; + this.hslLabelComboCQ_Chip2_counter.TextUnit = "Pcs"; + this.hslLabelComboCQ_Chip2_counter.TextValue = "00"; + this.hslLabelComboCQ_Chip2_counter.TextValueBackcolor = System.Drawing.Color.LawnGreen; + this.hslLabelComboCQ_Chip2_counter.TextValueColorTransFun = null; + // + // hslLabelComboCQ_Chip1_counter + // + this.hslLabelComboCQ_Chip1_counter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboCQ_Chip1_counter.Location = new System.Drawing.Point(756, 58); + this.hslLabelComboCQ_Chip1_counter.LocationUnit = 0.82F; + this.hslLabelComboCQ_Chip1_counter.LocationValue = 0.5F; + this.hslLabelComboCQ_Chip1_counter.Name = "hslLabelComboCQ_Chip1_counter"; + this.hslLabelComboCQ_Chip1_counter.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboCQ_Chip1_counter.TabIndex = 22; + this.hslLabelComboCQ_Chip1_counter.TextInfo = "裁刀1数量:"; + this.hslLabelComboCQ_Chip1_counter.TextUnit = "Pcs"; + this.hslLabelComboCQ_Chip1_counter.TextValue = "00"; + this.hslLabelComboCQ_Chip1_counter.TextValueColorTransFun = null; + // + // hslLabelComboProduct_counter2 + // + this.hslLabelComboProduct_counter2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboProduct_counter2.Location = new System.Drawing.Point(756, 36); + this.hslLabelComboProduct_counter2.LocationUnit = 0.82F; + this.hslLabelComboProduct_counter2.LocationValue = 0.5F; + this.hslLabelComboProduct_counter2.Name = "hslLabelComboProduct_counter2"; + this.hslLabelComboProduct_counter2.Size = new System.Drawing.Size(136, 20); + this.hslLabelComboProduct_counter2.TabIndex = 13; + this.hslLabelComboProduct_counter2.TextInfo = "层合 数量:"; + this.hslLabelComboProduct_counter2.TextUnit = "Pcs"; + this.hslLabelComboProduct_counter2.TextValue = "00"; + this.hslLabelComboProduct_counter2.TextValueColorTransFun = null; + // // hslA12 // this.hslA12.LanternBackground = System.Drawing.Color.Chartreuse; @@ -199,6 +302,15 @@ this.hslA12.TabIndex = 12; this.hslA12.Text = "hslLanternSimple1"; // + // hsl0 + // + this.hsl0.LanternBackground = System.Drawing.Color.Chartreuse; + this.hsl0.Location = new System.Drawing.Point(12, 36); + this.hsl0.Name = "hsl0"; + this.hsl0.Size = new System.Drawing.Size(40, 75); + this.hsl0.TabIndex = 21; + this.hsl0.Text = "系统异常"; + // // hslA11 // this.hslA11.LanternBackground = System.Drawing.Color.Chartreuse; @@ -302,9 +414,12 @@ // this.groupBox2.BackgroundImage = global::RfidWeb.Properties.Resources.Snipaste_2024_11_14_10_33_44; this.groupBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.groupBox2.Controls.Add(this.hslLabelComboReceiving); + this.groupBox2.Controls.Add(this.hslLabelComboFelt); + this.groupBox2.Controls.Add(this.hslLabelComboLaminated); + this.groupBox2.Controls.Add(this.hslLabelCombofeedingMotorSpeed); this.groupBox2.Controls.Add(this.hslB14); this.groupBox2.Controls.Add(this.hslB13); - this.groupBox2.Controls.Add(this.hsl0); this.groupBox2.Controls.Add(this.hslB2); this.groupBox2.Controls.Add(this.hslB3); this.groupBox2.Controls.Add(this.hslB1); @@ -322,6 +437,62 @@ this.groupBox2.TabStop = false; this.groupBox2.Text = "料盘侧(收料2)"; // + // hslLabelComboReceiving + // + this.hslLabelComboReceiving.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboReceiving.Location = new System.Drawing.Point(3, 154); + this.hslLabelComboReceiving.LocationUnit = 0.8F; + this.hslLabelComboReceiving.LocationValue = 0.5F; + this.hslLabelComboReceiving.Name = "hslLabelComboReceiving"; + this.hslLabelComboReceiving.Size = new System.Drawing.Size(222, 20); + this.hslLabelComboReceiving.TabIndex = 30; + this.hslLabelComboReceiving.TextInfo = "收料电机1&2速度:"; + this.hslLabelComboReceiving.TextUnit = "mm/s"; + this.hslLabelComboReceiving.TextValue = "00"; + this.hslLabelComboReceiving.TextValueColorTransFun = null; + // + // hslLabelComboFelt + // + this.hslLabelComboFelt.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboFelt.Location = new System.Drawing.Point(3, 128); + this.hslLabelComboFelt.LocationUnit = 0.8F; + this.hslLabelComboFelt.LocationValue = 0.5F; + this.hslLabelComboFelt.Name = "hslLabelComboFelt"; + this.hslLabelComboFelt.Size = new System.Drawing.Size(222, 20); + this.hslLabelComboFelt.TabIndex = 29; + this.hslLabelComboFelt.TextInfo = "毛毡带电机速度:"; + this.hslLabelComboFelt.TextUnit = "mm/s"; + this.hslLabelComboFelt.TextValue = "00"; + this.hslLabelComboFelt.TextValueColorTransFun = null; + // + // hslLabelComboLaminated + // + this.hslLabelComboLaminated.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelComboLaminated.Location = new System.Drawing.Point(3, 102); + this.hslLabelComboLaminated.LocationUnit = 0.8F; + this.hslLabelComboLaminated.LocationValue = 0.5F; + this.hslLabelComboLaminated.Name = "hslLabelComboLaminated"; + this.hslLabelComboLaminated.Size = new System.Drawing.Size(222, 20); + this.hslLabelComboLaminated.TabIndex = 28; + this.hslLabelComboLaminated.TextInfo = "层合电机速度:"; + this.hslLabelComboLaminated.TextUnit = "mm/s"; + this.hslLabelComboLaminated.TextValue = "00"; + this.hslLabelComboLaminated.TextValueColorTransFun = null; + // + // hslLabelCombofeedingMotorSpeed + // + this.hslLabelCombofeedingMotorSpeed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.hslLabelCombofeedingMotorSpeed.Location = new System.Drawing.Point(3, 76); + this.hslLabelCombofeedingMotorSpeed.LocationUnit = 0.8F; + this.hslLabelCombofeedingMotorSpeed.LocationValue = 0.5F; + this.hslLabelCombofeedingMotorSpeed.Name = "hslLabelCombofeedingMotorSpeed"; + this.hslLabelCombofeedingMotorSpeed.Size = new System.Drawing.Size(222, 20); + this.hslLabelCombofeedingMotorSpeed.TabIndex = 27; + this.hslLabelCombofeedingMotorSpeed.TextInfo = "供料电机速度:"; + this.hslLabelCombofeedingMotorSpeed.TextUnit = "mm/s"; + this.hslLabelCombofeedingMotorSpeed.TextValue = "00"; + this.hslLabelCombofeedingMotorSpeed.TextValueColorTransFun = null; + // // hslB14 // this.hslB14.LanternBackground = System.Drawing.Color.Chartreuse; @@ -340,15 +511,6 @@ this.hslB13.TabIndex = 22; this.hslB13.Text = "hslLanternSimple1"; // - // hsl0 - // - this.hsl0.LanternBackground = System.Drawing.Color.Chartreuse; - this.hsl0.Location = new System.Drawing.Point(32, 63); - this.hsl0.Name = "hsl0"; - this.hsl0.Size = new System.Drawing.Size(40, 75); - this.hsl0.TabIndex = 21; - this.hsl0.Text = "系统异常"; - // // hslB2 // this.hslB2.LanternBackground = System.Drawing.Color.Chartreuse; @@ -485,5 +647,15 @@ private HslControls.HslLanternSimple hsl0; private HslControls.HslLanternSimple hslB14; private HslControls.HslLanternSimple hslB13; + private HslControls.HslLabelCombo hslLabelComboProduct_counter2; + private HslControls.HslLabelCombo hslLabelComboSWSS; + private HslControls.HslLabelCombo hslLabelComboQDWD2SS; + private HslControls.HslLabelCombo hslLabelComboQDWD1SS; + private HslControls.HslLabelCombo hslLabelComboCQ_Chip2_counter; + private HslControls.HslLabelCombo hslLabelComboCQ_Chip1_counter; + private HslControls.HslLabelCombo hslLabelCombofeedingMotorSpeed; + private HslControls.HslLabelCombo hslLabelComboLaminated; + private HslControls.HslLabelCombo hslLabelComboReceiving; + private HslControls.HslLabelCombo hslLabelComboFelt; } } diff --git a/RfidWeb/Frm/UserAlarmShow.cs b/RfidWeb/Frm/UserAlarmShow.cs index bcd4a6a..381bf88 100644 --- a/RfidWeb/Frm/UserAlarmShow.cs +++ b/RfidWeb/Frm/UserAlarmShow.cs @@ -27,6 +27,8 @@ namespace RfidWeb.Frm { private TimerX _timer; private HimAlarmManager himAlarmManager = new HimAlarmManager(); + PromptAlarmManager promptAlarmManager = new PromptAlarmManager(); + AlarmLogService alarmLogService = new AlarmLogService(); public UserAlarmShow() { @@ -40,6 +42,7 @@ namespace RfidWeb.Frm FillAlarmGrid(); FillPromptGrid(); FillAlartLed(); + FillhslLabelCombo(); } /// @@ -50,6 +53,7 @@ namespace RfidWeb.Frm { List lsList = new List(); var list = himAlarmManager.GetList(); + alarmLogService.Insert(list,1); foreach (var keyValuePair in list) { lsList.Add(new GridViewData() @@ -69,11 +73,12 @@ namespace RfidWeb.Frm }); } - PromptAlarmManager promptAlarmManager=new PromptAlarmManager(); + void FillPromptGrid() { List lsList = new List(); var list = promptAlarmManager.GetList(); + alarmLogService.Insert(list,2); foreach (var keyValuePair in list) { lsList.Add(new GridViewData() @@ -95,8 +100,6 @@ namespace RfidWeb.Frm private ICache cache = Cache.Default; - private Color defaColor = Color.Chartreuse; - void FillAlartLed() { var plcCh = cache.Get(CacheKeyManager.CH_alarm); @@ -249,7 +252,28 @@ namespace RfidWeb.Frm } + void FillhslLabelCombo() + { + //HmiPoint + + hslLabelCombofeedingMotorSpeed.TextValue = HmiPoint.GetFeedingMotorSpeed.ToString(); + hslLabelComboLaminated.TextValue = HmiPoint.GetLaminatedMotorSpeed.ToString(); + hslLabelComboFelt.TextValue = HmiPoint.GetFeltBeltMotorSpeed.ToString(); + hslLabelComboReceiving.TextValue = HmiPoint.GeReceivingMotorSpeed.ToString(); + + hslLabelComboProduct_counter2.TextValue = HmiPoint.GetProduct_counter2.ToString(); + + hslLabelComboCQ_Chip1_counter.TextValue = HmiPoint.GetCQ_Chip1_counter.ToString(); + hslLabelComboCQ_Chip2_counter.TextValue = HmiPoint.GetCQ_Chip2_counter.ToString(); + hslLabelComboQDWD1SS.TextValue = HmiPoint.GetQDWD1SS.ToString(); + hslLabelComboQDWD2SS.TextValue = HmiPoint.GetQDWD2SS.ToString(); + + double result = HmiPoint.GetSWSS / 10.0; + + hslLabelComboSWSS.TextValue = result.ToString(); + + } private void SetTrueLed(params HslLanternSimple[] simples) { SetLed(true,simples); diff --git a/RfidWeb/FromSQl.cs b/RfidWeb/FromSQl.cs index dd0c458..5005cdb 100644 --- a/RfidWeb/FromSQl.cs +++ b/RfidWeb/FromSQl.cs @@ -27,25 +27,11 @@ namespace RfidWeb DbInfo.Init(typeof(UserInfo).Assembly); var rfidSetting = RfidSetting.Current; var dbContext = DbFactory.GetContext; - //new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); - - AlarmData data = new AlarmData(); - data.LastModifyDate=DateTime.Now; - data.CreateDate=DateTime.Now; - data.LastModifyUserId = ""; - data.LastModifyUserName = ""; - data.CreateUserId = ""; - data.CreateUserName = ""; - - for (int i = 0; i < 31; i++) - { - data.ID = GetId; - data.Address = "Prompt_alarm"; - data.No = i; - data.PlcAb = ""; - data.Msg = ""; - dbContext.Insert(data); - } + + new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); + + + diff --git a/RfidWeb/Program.cs b/RfidWeb/Program.cs index 335e250..113c7ec 100644 --- a/RfidWeb/Program.cs +++ b/RfidWeb/Program.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace RfidWeb @@ -19,7 +16,6 @@ namespace RfidWeb Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - // Application.Run(new FromSQl()); Application.Run(new FormMain()); } } diff --git a/RfidWeb/RfidWeb.csproj b/RfidWeb/RfidWeb.csproj index 0d9b127..54dc947 100644 --- a/RfidWeb/RfidWeb.csproj +++ b/RfidWeb/RfidWeb.csproj @@ -154,12 +154,6 @@ FormAccount.cs - - UserControl - - - FormAlarm.cs - UserControl @@ -172,6 +166,12 @@ FormRegister.cs + + UserControl + + + FromAlarmLog.cs + UserControl @@ -206,15 +206,15 @@ FormAccount.cs - - FormAlarm.cs - FormPar.cs FormRegister.cs + + FromAlarmLog.cs + UserAlarmShow.cs Designer diff --git a/Tool/Item.cs b/Tool/Item.cs new file mode 100644 index 0000000..9b141b2 --- /dev/null +++ b/Tool/Item.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tool +{ + public class Item + { + public long Id { get; set; } + public string Name { get; set; } + } +} diff --git a/Tool/Model/HmiPoint.cs b/Tool/Model/HmiPoint.cs index 1bd4083..5db076f 100644 --- a/Tool/Model/HmiPoint.cs +++ b/Tool/Model/HmiPoint.cs @@ -14,6 +14,8 @@ namespace Tool.Model /// public static readonly string feeding_motor_speed = "feeding_motor_speed"; + public static UInt32 GetFeedingMotorSpeed => GetValue(feeding_motor_speed); + /// /// DInt 层合电机速度 @@ -21,24 +23,77 @@ namespace Tool.Model public static readonly string Laminated_motor_speed = "Laminated_motor_speed"; + public static UInt32 GetLaminatedMotorSpeed => GetValue(Laminated_motor_speed); + + /// /// DInt 毛毡带电机速度 /// public static readonly string Felt_belt_motor_speed = "Felt_belt_motor_speed"; + public static UInt32 GetFeltBeltMotorSpeed => GetValue(Felt_belt_motor_speed); + + /// /// DInt 收料电机1速度 /// - public static readonly string Receiving_Electric_motor_speed_1 = "Receiving_Electric_motor_speed_1"; + public static readonly string Receiving_Electric_motor_speed = "Receiving_Electric_motor_speed"; + + public static UInt32 GeReceivingMotorSpeed => GetValue(Receiving_Electric_motor_speed); + + + /// + /// 层合生产数量 + /// + public static readonly string Product_counter2 = "Product_counter2"; + + public static UInt32 GetProduct_counter2 => GetValue(Product_counter2); + /// + /// 裁切1生产数量 + /// + public static readonly string CQ_Chip1_counter = "CQ_Chip1_counter"; + public static UInt32 GetCQ_Chip1_counter => GetValue(CQ_Chip1_counter); /// - /// DInt 收料电机2速度 + /// 裁切2生产数量 /// - public static readonly string Receiving_Electric_motor_speed_2 = "Receiving_Electric_motor_speed_2"; + public static readonly string CQ_Chip2_counter = "CQ_Chip2_counter"; + + public static UInt32 GetCQ_Chip2_counter => GetValue(CQ_Chip2_counter); + /// + /// 裁刀1温度 + /// + public static readonly string QDWD1SS = "QDWD1SS"; + + public static UInt32 GetQDWD1SS => GetValue(QDWD1SS); + + /// + /// 裁刀1温度 + /// + public static readonly string QDWD2SS = "QDWD2SS"; + + public static UInt32 GetQDWD2SS => GetValue(QDWD2SS); + + /// + /// 设备内部温度 + /// + public static readonly string SWSS = "SWSS"; + + public static UInt32 GetSWSS => GetValue(SWSS); + + + private static UInt32 GetValue(string key) + { + var plc = PlcConnect.Instance; + var result = plc.ReadUInt32(key); + + return result.IsSuccess ? result.Content : (uint)0; + } + public static string[] GetValue() { @@ -47,8 +102,8 @@ namespace Tool.Model feeding_motor_speed, Laminated_motor_speed, Felt_belt_motor_speed, - Receiving_Electric_motor_speed_1, - Receiving_Electric_motor_speed_2 + Receiving_Electric_motor_speed, + }; return ls.ToArray(); diff --git a/Tool/Tool.csproj b/Tool/Tool.csproj index ec0a1ba..1e922fe 100644 --- a/Tool/Tool.csproj +++ b/Tool/Tool.csproj @@ -67,6 +67,7 @@ +