From 65538a10080a13e2a7f407a48d8fd8b921b985a0 Mon Sep 17 00:00:00 2001 From: "nodyang@aliyun.com" Date: Thu, 21 Nov 2024 12:52:55 +0800 Subject: [PATCH] 23 --- DB/DB.csproj | 2 + DB/Entity/ReadBufLog.cs | 35 ++ DB/Service/ReadBufLogService.cs | 64 +++ DB/Service/UserService.cs | 71 +++- .../DateTime/UCDatePickerExt.Designer.cs | 101 +++-- RfidWeb/FormMain.Designer.cs | 22 +- RfidWeb/FormMain.cs | 79 +++- RfidWeb/Frm/FormAccount.cs | 17 +- RfidWeb/Frm/FormPar.Designer.cs | 53 +-- RfidWeb/Frm/FormPar.cs | 23 ++ RfidWeb/Frm/FormPersionCent.Designer.cs | 378 ++++++++++++++++++ RfidWeb/Frm/FormPersionCent.cs | 93 +++++ RfidWeb/Frm/FormPersionCent.resx | 120 ++++++ RfidWeb/Frm/FormPlanAdd.Designer.cs | 92 ++--- RfidWeb/Frm/FormPlanAdd.cs | 2 +- RfidWeb/Frm/FormRegister.cs | 19 +- RfidWeb/Frm/FrmBarCodeGridView.Designer.cs | 295 ++++++++++++++ RfidWeb/Frm/FrmBarCodeGridView.cs | 75 ++++ RfidWeb/Frm/FrmBarCodeGridView.resx | 138 +++++++ RfidWeb/Frm/UserAlarmShow.cs | 37 +- RfidWeb/FromSQl.cs | 89 +++-- RfidWeb/Program.cs | 2 +- RfidWeb/RfidWeb.csproj | 18 + Tool/Model/CacheKeyManager.cs | 5 + Tool/Model/HmiPoint.cs | 139 ++++++- Tool/PlcConnect.cs | 3 +- 26 files changed, 1761 insertions(+), 211 deletions(-) create mode 100644 DB/Entity/ReadBufLog.cs create mode 100644 DB/Service/ReadBufLogService.cs create mode 100644 RfidWeb/Frm/FormPersionCent.Designer.cs create mode 100644 RfidWeb/Frm/FormPersionCent.cs create mode 100644 RfidWeb/Frm/FormPersionCent.resx create mode 100644 RfidWeb/Frm/FrmBarCodeGridView.Designer.cs create mode 100644 RfidWeb/Frm/FrmBarCodeGridView.cs create mode 100644 RfidWeb/Frm/FrmBarCodeGridView.resx diff --git a/DB/DB.csproj b/DB/DB.csproj index f8d9931..1b2f063 100644 --- a/DB/DB.csproj +++ b/DB/DB.csproj @@ -110,6 +110,7 @@ + @@ -120,6 +121,7 @@ + diff --git a/DB/Entity/ReadBufLog.cs b/DB/Entity/ReadBufLog.cs new file mode 100644 index 0000000..e0bd484 --- /dev/null +++ b/DB/Entity/ReadBufLog.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DB.Entity +{ + public class ReadBufLog: BaseChimsDb + { + + public DateTime CreateTime { get; set; } + + /// + /// 类别 + /// + public string Category { get; set; } + + + + /// + /// 条码 + /// + public string BarCode { get; set; } + } + + + public class ReadBufLogMapper : SystemEntityTypeBuilder + { + public ReadBufLogMapper() : base("ReadBufLog") + { + this.Property(x => x.Category).HasSize(4); + } + } +} diff --git a/DB/Service/ReadBufLogService.cs b/DB/Service/ReadBufLogService.cs new file mode 100644 index 0000000..ec61ecf --- /dev/null +++ b/DB/Service/ReadBufLogService.cs @@ -0,0 +1,64 @@ +using Chloe; +using DB.Entity; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Tool; + +namespace DB.Service +{ + public class ReadBufLogService + { + + public PagedList GetPagedList(int pageIndex, int pageSize, string category,DateTime beDateTime,DateTime endTime) + { + + + PagingResult pagePagingResult; + using (var dbContext = DbFactory.GetContext) + { + pagePagingResult = dbContext.Query() + //.Where(x=>x.CreateTime>=beDateTime) + //.Where(x=>x.CreateTime<=endTime) + .Where(x=>x.Category==category) + .OrderByDesc(x => x.ID) + .Paging(pageIndex, pageSize); + + } + + + PagedList paged = + new PagedList(pagePagingResult.DataList, + pagePagingResult.Totals.ToInt(), pageIndex, pageSize); + + return paged; + + } + + public void Insert(string category, string barCode) + { + using (var dbContext = DbFactory.GetContext) + { + var entity= dbContext.Query() + .Where(x => x.Category == category) + .Where(x => x.BarCode == barCode) + + .OrderBy(x => x.ID) + .Select(x => x.BarCode).FirstOrDefault(); + if (string.IsNullOrEmpty(entity)) + { + ReadBufLog log = new ReadBufLog(); + log.CreateTime=DateTime.Now; + log.ID = SnowflakeFactory.NewId; + log.Category = category; + log.BarCode = barCode; + dbContext.Insert(log); + } + } + } + } +} diff --git a/DB/Service/UserService.cs b/DB/Service/UserService.cs index cb4a137..8d9412d 100644 --- a/DB/Service/UserService.cs +++ b/DB/Service/UserService.cs @@ -97,25 +97,68 @@ namespace DB.Service } - public PagedList GetPagedList(int pageIndex, int pageSize, string key, List lsLevel) + public PagedList GetPagedList(int pageIndex, int pageSize, string key, List lsLevel,long userId) { var roleList = roleService.GetList(); List ls = new List(); - PagingResult userInfoPage; + PagingResult userInfoPage=new PagingResult(); using (var dbContext = DbFactory.GetContext) { - userInfoPage = dbContext.Query() - .LeftJoin(((userinfo, role) => userinfo.RoleId == role.ID)) - .Select((userinfo, role) => new - { - UserInfo = userinfo, - Role = role - }).WhereIf(!string.IsNullOrEmpty(key), x => x.UserInfo.UserName.Contains(key)) - .Where(x=>lsLevel.Contains(x.Role.RoleLevel)) - .OrderBy(x => x.Role.RoleLevel) - .Select(x => x.UserInfo) - .Paging(pageIndex, pageSize); - + + //操作工 + if (lsLevel.Count == 1) + { + userInfoPage = dbContext.Query() + .LeftJoin(((userinfo, role) => userinfo.RoleId == role.ID)) + .Select((userinfo, role) => new + { + UserInfo = userinfo, + Role = role + }).WhereIf(!string.IsNullOrEmpty(key), x => x.UserInfo.UserName.Contains(key)) + .Where(x=>x.UserInfo.ID==userId) + .Where(x => x.Role.RoleLevel==1) + .OrderBy(x => x.Role.RoleLevel) + .Select(x => x.UserInfo) + .Paging(pageIndex, pageSize); + + } + + + if (lsLevel.Count == 2) + { + userInfoPage = dbContext.Query() + .LeftJoin(((userinfo, role) => userinfo.RoleId == role.ID)) + .Select((userinfo, role) => new + { + UserInfo = userinfo, + Role = role + }).WhereIf(!string.IsNullOrEmpty(key), x => x.UserInfo.UserName.Contains(key)) + .Where(x =>x.Role.RoleLevel==1) + .OrderBy(x => x.Role.RoleLevel) + .Select(x => x.UserInfo) + .Paging(pageIndex, pageSize); + + } + + if (lsLevel.Count == 3) + { + userInfoPage = dbContext.Query() + .LeftJoin(((userinfo, role) => userinfo.RoleId == role.ID)) + .Select((userinfo, role) => new + { + UserInfo = userinfo, + Role = role + }).WhereIf(!string.IsNullOrEmpty(key), x => x.UserInfo.UserName.Contains(key)) + .Where(x => (x.Role.RoleLevel == 1) || (x.Role.RoleLevel == 2)) + .OrderBy(x => x.Role.RoleLevel) + .Select(x => x.UserInfo) + .Paging(pageIndex, pageSize); + + } + + + + foreach (var userInfo in userInfoPage.DataList) { var first = roleList.First(x => x.ID == userInfo.RoleId); diff --git a/HZH_Controls/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs b/HZH_Controls/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs index 8a1b7c2..b869273 100644 --- a/HZH_Controls/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs +++ b/HZH_Controls/HZH_Controls/Controls/DateTime/UCDatePickerExt.Designer.cs @@ -53,12 +53,12 @@ namespace HZH_Controls.Controls this.txtMinute = new HZH_Controls.Controls.TextBoxEx(); this.label4 = new System.Windows.Forms.Label(); this.txtHour = new HZH_Controls.Controls.TextBoxEx(); - this.label3 = new System.Windows.Forms.Label(); this.txtDay = new HZH_Controls.Controls.TextBoxEx(); - this.label2 = new System.Windows.Forms.Label(); this.txtMonth = new HZH_Controls.Controls.TextBoxEx(); - this.label1 = new System.Windows.Forms.Label(); this.txtYear = new HZH_Controls.Controls.TextBoxEx(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // @@ -174,19 +174,6 @@ namespace HZH_Controls.Controls this.txtHour.TextChanged += new System.EventHandler(this.txtHour_TextChanged); this.txtHour.Leave += new System.EventHandler(this.txtHour_Leave); // - // label3 - // - this.label3.AutoSize = true; - this.label3.Dock = System.Windows.Forms.DockStyle.Left; - this.label3.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.label3.Location = new System.Drawing.Point(173, 0); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(38, 27); - this.label3.TabIndex = 14; - this.label3.Text = " 日"; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // txtDay // this.txtDay.BorderStyle = System.Windows.Forms.BorderStyle.None; @@ -221,19 +208,6 @@ namespace HZH_Controls.Controls this.txtDay.TextChanged += new System.EventHandler(this.txtDay_TextChanged); this.txtDay.Leave += new System.EventHandler(this.txtDay_Leave); // - // label2 - // - this.label2.AutoSize = true; - this.label2.Dock = System.Windows.Forms.DockStyle.Left; - this.label2.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); - this.label2.Location = new System.Drawing.Point(112, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(32, 27); - this.label2.TabIndex = 12; - this.label2.Text = "月"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // txtMonth // this.txtMonth.BorderStyle = System.Windows.Forms.BorderStyle.None; @@ -268,20 +242,6 @@ namespace HZH_Controls.Controls this.txtMonth.TextChanged += new System.EventHandler(this.txtMonth_TextChanged); this.txtMonth.Leave += new System.EventHandler(this.txtMonth_Leave); // - // label1 - // - this.label1.AutoSize = true; - this.label1.Dock = System.Windows.Forms.DockStyle.Left; - this.label1.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); - this.label1.Location = new System.Drawing.Point(51, 0); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(32, 27); - this.label1.TabIndex = 10; - this.label1.Text = "年"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // txtYear // this.txtYear.BorderStyle = System.Windows.Forms.BorderStyle.None; @@ -316,6 +276,46 @@ namespace HZH_Controls.Controls this.txtYear.TextChanged += new System.EventHandler(this.txtYear_TextChanged); this.txtYear.Leave += new System.EventHandler(this.txtYear_Leave); // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Left; + this.label2.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); + this.label2.Location = new System.Drawing.Point(112, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 27); + this.label2.TabIndex = 12; + this.label2.Text = "月"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Left; + this.label1.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); + this.label1.Location = new System.Drawing.Point(51, 0); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 27); + this.label1.TabIndex = 10; + this.label1.Text = "年"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Left; + this.label3.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.label3.Location = new System.Drawing.Point(173, 0); + this.label3.Margin = new System.Windows.Forms.Padding(0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(38, 27); + this.label3.TabIndex = 14; + this.label3.Text = " 日"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // UCDatePickerExt // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -346,18 +346,6 @@ namespace HZH_Controls.Controls /// private System.Windows.Forms.Label label4; /// - /// The label3 - /// - private System.Windows.Forms.Label label3; - /// - /// The label2 - /// - private System.Windows.Forms.Label label2; - /// - /// The label1 - /// - private System.Windows.Forms.Label label1; - /// /// The text minute /// private TextBoxEx txtMinute; @@ -381,5 +369,8 @@ namespace HZH_Controls.Controls /// The label5 /// private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; } } diff --git a/RfidWeb/FormMain.Designer.cs b/RfidWeb/FormMain.Designer.cs index d15b20c..a1163ec 100644 --- a/RfidWeb/FormMain.Designer.cs +++ b/RfidWeb/FormMain.Designer.cs @@ -50,6 +50,7 @@ this.labTime = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); + this.btnBarCode = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.panel6.SuspendLayout(); this.panel7.SuspendLayout(); @@ -111,6 +112,7 @@ // panel8 // this.panel8.BackColor = System.Drawing.Color.Transparent; + this.panel8.Controls.Add(this.btnBarCode); this.panel8.Controls.Add(this.buttonUpdateLog); this.panel8.Controls.Add(this.hslLanternSimplePlc); this.panel8.Controls.Add(this.button2); @@ -145,7 +147,7 @@ // // hslLanternSimplePlc // - this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 641); + this.hslLanternSimplePlc.Location = new System.Drawing.Point(162, 812); this.hslLanternSimplePlc.Name = "hslLanternSimplePlc"; this.hslLanternSimplePlc.Size = new System.Drawing.Size(78, 94); this.hslLanternSimplePlc.TabIndex = 10; @@ -164,6 +166,7 @@ this.button2.TabIndex = 9; this.button2.Text = "扫码设置"; this.button2.UseVisualStyleBackColor = false; + this.button2.Click += new System.EventHandler(this.button2_Click); // // button1 // @@ -178,6 +181,7 @@ this.button1.TabIndex = 8; this.button1.Text = "打印设置"; this.button1.UseVisualStyleBackColor = false; + this.button1.Click += new System.EventHandler(this.button1_Click); // // btnShow // @@ -340,6 +344,21 @@ this.label1.TabIndex = 0; this.label1.Text = "佳通RFID层合裁切设备"; // + // btnBarCode + // + this.btnBarCode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173))))); + this.btnBarCode.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnBarCode.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnBarCode.ForeColor = System.Drawing.SystemColors.Window; + this.btnBarCode.Location = new System.Drawing.Point(22, 595); + this.btnBarCode.Margin = new System.Windows.Forms.Padding(4); + this.btnBarCode.Name = "btnBarCode"; + this.btnBarCode.Size = new System.Drawing.Size(300, 65); + this.btnBarCode.TabIndex = 12; + this.btnBarCode.Text = "收料条码"; + this.btnBarCode.UseVisualStyleBackColor = false; + this.btnBarCode.Click += new System.EventHandler(this.btnBarCode_Click); + // // FormMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -380,5 +399,6 @@ private System.Windows.Forms.Label labUser; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button buttonUpdateLog; + private System.Windows.Forms.Button btnBarCode; } } \ No newline at end of file diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs index 3d5c0a9..169d511 100644 --- a/RfidWeb/FormMain.cs +++ b/RfidWeb/FormMain.cs @@ -29,8 +29,8 @@ namespace RfidWeb private ICache cache; TimerX _timer; List