diff --git a/DB/DB.csproj b/DB/DB.csproj index ac85ca3..f8d9931 100644 --- a/DB/DB.csproj +++ b/DB/DB.csproj @@ -104,6 +104,8 @@ + + @@ -115,6 +117,7 @@ + diff --git a/DB/Entity/FromPlan.cs b/DB/Entity/FromPlan.cs index db38e31..e98df2c 100644 --- a/DB/Entity/FromPlan.cs +++ b/DB/Entity/FromPlan.cs @@ -1,7 +1,17 @@ namespace DB.Entity { - public class FromPlan + public class FromPlan:BaseChimsDb { - + /// + /// 数量 + /// + public int Num { get; set; } + + /// + /// 编号 + /// + public string Code { get; set; } + + public string Status { get; set; } } } \ No newline at end of file diff --git a/DB/Service/FromPlanService.cs b/DB/Service/FromPlanService.cs new file mode 100644 index 0000000..ccfe70f --- /dev/null +++ b/DB/Service/FromPlanService.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using Chloe; + +using DB.Entity; + +using Tool; + +namespace DB.Service +{ + public class FromPlanService + { + public void Insert(FromPlan plan) + { + using (var dbContext = DbFactory.GetContext) + { + dbContext.Insert(plan); + } + } + + public FromPlan Query(long id) + { + using (var dbContext = DbFactory.GetContext) + { + return dbContext.QueryByKey(id); + } + } + + public void Update(FromPlan plan) + { + using (var dbContext = DbFactory.GetContext) + { + dbContext.Update(plan); + } + } + + public void Del(long id) + { + using (var dbContext = DbFactory.GetContext) + { + dbContext.DeleteByKey(id); + } + } + + public string GetMaxCode() + { + using (var dbContext = DbFactory.GetContext) + { + string dt = DateTime.Now.ToString("yyyyMMdd"); + string code = dbContext.Query() + .Where(x => x.Code.StartsWith(dt)).OrderByDesc(x => x.ID) + .Select(x => x.Code).FirstOrDefault(); + + if (string.IsNullOrEmpty(code)) + { + return dt + "001"; + } + + int s = code.Substring(8).ToInt() + 1; + + return dt + s.ToString().PadLeft(3, '0'); + } + } + + + public PagedList GetPagedList(int pageIndex, int pageSize) + { + + using (var dbContext = DbFactory.GetContext) + { + var dao = dbContext.Query() + .OrderByDesc(x => x.ID) + .Paging(pageIndex, pageSize); + + + PagedList paged = + new PagedList(dao.DataList, dao.Totals.ToInt(), pageIndex, pageSize); + return paged; + + } + + } + } +} diff --git a/RfidWeb/FormMain.Designer.cs b/RfidWeb/FormMain.Designer.cs index 6fa9f7d..d15b20c 100644 --- a/RfidWeb/FormMain.Designer.cs +++ b/RfidWeb/FormMain.Designer.cs @@ -207,6 +207,7 @@ this.btnMes.TabIndex = 4; this.btnMes.Text = "生产计划"; this.btnMes.UseVisualStyleBackColor = false; + this.btnMes.Click += new System.EventHandler(this.btnMes_Click); // // btnAccount // diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs index 744ca08..64831a8 100644 --- a/RfidWeb/FormMain.cs +++ b/RfidWeb/FormMain.cs @@ -274,5 +274,19 @@ namespace RfidWeb panContent.Controls.Add(new FromUploadLog()); CheckButton(buttonUpdateLog); } + + private void btnMes_Click(object sender, EventArgs e) + { + // + CheckLogin(); + + var isLogin = UserManager.IsExit(); + if (isLogin) + { + panContent.Controls.Clear(); + panContent.Controls.Add(new FrmPlan()); + CheckButton(btnMes); + } + } } } diff --git a/RfidWeb/Frm/FormAccount.Designer.cs b/RfidWeb/Frm/FormAccount.Designer.cs index 9f85feb..3c7fe06 100644 --- a/RfidWeb/Frm/FormAccount.Designer.cs +++ b/RfidWeb/Frm/FormAccount.Designer.cs @@ -306,6 +306,7 @@ this.Controls.Add(this.panelTop); this.Name = "FormAccount"; this.Size = new System.Drawing.Size(910, 935); + this.Load += new System.EventHandler(this.FormAccount_Load); this.panelTop.ResumeLayout(false); this.panelTop.PerformLayout(); this.panelBottom.ResumeLayout(false); diff --git a/RfidWeb/Frm/FormAccount.cs b/RfidWeb/Frm/FormAccount.cs index 445fc6b..7795ec1 100644 --- a/RfidWeb/Frm/FormAccount.cs +++ b/RfidWeb/Frm/FormAccount.cs @@ -143,5 +143,10 @@ namespace RfidWeb.Frm ucPagerControl21_ShowSourceChanged(new object()); } + + private void FormAccount_Load(object sender, EventArgs e) + { + + } } } diff --git a/RfidWeb/Frm/FormPlanAdd.Designer.cs b/RfidWeb/Frm/FormPlanAdd.Designer.cs new file mode 100644 index 0000000..55e6e8e --- /dev/null +++ b/RfidWeb/Frm/FormPlanAdd.Designer.cs @@ -0,0 +1,282 @@ +namespace RfidWeb.Frm +{ + partial class FormPlanAdd + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblTitle = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.btnCancel = new HZH_Controls.Controls.UCBtnExt(); + this.btnOK = new HZH_Controls.Controls.UCBtnExt(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.ucCode = new HZH_Controls.Controls.UCTextBoxEx(); + this.ucNo = new HZH_Controls.Controls.UCTextBoxEx(); + this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // lblTitle + // + this.lblTitle.BackColor = System.Drawing.Color.Transparent; + this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 17F); + this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(541, 40); + this.lblTitle.TabIndex = 7; + this.lblTitle.Text = "计划"; + this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.btnCancel, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.btnOK, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 292); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 67F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(541, 67); + this.tableLayoutPanel1.TabIndex = 8; + // + // btnCancel + // + this.btnCancel.BackColor = System.Drawing.Color.Transparent; + this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent; + this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(119)))), ((int)(((byte)(232))))); + this.btnCancel.BtnText = "取消"; + this.btnCancel.ConerRadius = 5; + this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnCancel.EnabledMouseEffect = false; + this.btnCancel.FillColor = System.Drawing.SystemColors.Control; + this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.btnCancel.IsRadius = false; + this.btnCancel.IsShowRect = false; + this.btnCancel.IsShowTips = false; + this.btnCancel.Location = new System.Drawing.Point(270, 0); + this.btnCancel.Margin = new System.Windows.Forms.Padding(0); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); + this.btnCancel.RectWidth = 1; + this.btnCancel.Size = new System.Drawing.Size(271, 67); + this.btnCancel.TabIndex = 2; + this.btnCancel.TabStop = false; + this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99))))); + this.btnCancel.TipsText = ""; + this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick); + // + // btnOK + // + this.btnOK.BackColor = System.Drawing.Color.Transparent; + this.btnOK.BtnBackColor = System.Drawing.Color.Transparent; + this.btnOK.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOK.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(85)))), ((int)(((byte)(51))))); + this.btnOK.BtnText = "确定"; + this.btnOK.ConerRadius = 5; + this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOK.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnOK.EnabledMouseEffect = false; + this.btnOK.FillColor = System.Drawing.SystemColors.Control; + this.btnOK.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.btnOK.IsRadius = false; + this.btnOK.IsShowRect = false; + this.btnOK.IsShowTips = false; + this.btnOK.Location = new System.Drawing.Point(0, 0); + this.btnOK.Margin = new System.Windows.Forms.Padding(0); + this.btnOK.Name = "btnOK"; + this.btnOK.RectColor = System.Drawing.SystemColors.Control; + this.btnOK.RectWidth = 1; + this.btnOK.Size = new System.Drawing.Size(270, 67); + this.btnOK.TabIndex = 1; + this.btnOK.TabStop = false; + this.btnOK.TipsColor = System.Drawing.SystemColors.Control; + this.btnOK.TipsText = ""; + this.btnOK.BtnClick += new System.EventHandler(this.btnOK_BtnClick); + // + // panel1 + // + this.panel1.Controls.Add(this.ucNo); + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.ucCode); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 40); + this.panel1.Margin = new System.Windows.Forms.Padding(2); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(541, 252); + this.panel1.TabIndex = 9; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(133, 89); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(106, 30); + this.label2.TabIndex = 9; + this.label2.Text = "计划数量:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(133, 39); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(106, 30); + this.label1.TabIndex = 8; + this.label1.Text = "计划编号:"; + // + // ucCode + // + this.ucCode.BackColor = System.Drawing.Color.Transparent; + this.ucCode.ConerRadius = 5; + this.ucCode.Cursor = System.Windows.Forms.Cursors.IBeam; + this.ucCode.DecLength = 2; + this.ucCode.FillColor = System.Drawing.Color.Empty; + this.ucCode.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59))))); + this.ucCode.Font = new System.Drawing.Font("微软雅黑", 12F); + this.ucCode.InputText = ""; + this.ucCode.InputType = HZH_Controls.TextInputType.NotControl; + this.ucCode.IsFocusColor = true; + this.ucCode.IsFouceShowKey = false; + this.ucCode.IsRadius = true; + this.ucCode.IsShowClearBtn = true; + this.ucCode.IsShowKeyboard = false; + this.ucCode.IsShowRect = true; + this.ucCode.IsShowSearchBtn = false; + this.ucCode.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN; + this.ucCode.Location = new System.Drawing.Point(235, 39); + this.ucCode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ucCode.MaxValue = new decimal(new int[] { + 1000000, + 0, + 0, + 0}); + this.ucCode.MinValue = new decimal(new int[] { + 1000000, + 0, + 0, + -2147483648}); + this.ucCode.Name = "ucCode"; + this.ucCode.Padding = new System.Windows.Forms.Padding(3); + this.ucCode.PasswordChar = '\0'; + this.ucCode.PromptColor = System.Drawing.Color.Gray; + this.ucCode.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucCode.PromptText = ""; + this.ucCode.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.ucCode.RectWidth = 1; + this.ucCode.RegexPattern = ""; + this.ucCode.Size = new System.Drawing.Size(215, 28); + this.ucCode.TabIndex = 5; + this.ucCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + // + // ucNo + // + this.ucNo.BackColor = System.Drawing.Color.Transparent; + this.ucNo.ConerRadius = 5; + this.ucNo.Cursor = System.Windows.Forms.Cursors.IBeam; + this.ucNo.DecLength = 2; + this.ucNo.FillColor = System.Drawing.Color.Empty; + this.ucNo.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59))))); + this.ucNo.Font = new System.Drawing.Font("微软雅黑", 12F); + this.ucNo.InputText = ""; + this.ucNo.InputType = HZH_Controls.TextInputType.NotControl; + this.ucNo.IsFocusColor = true; + this.ucNo.IsFouceShowKey = false; + this.ucNo.IsRadius = true; + this.ucNo.IsShowClearBtn = true; + this.ucNo.IsShowKeyboard = false; + this.ucNo.IsShowRect = true; + this.ucNo.IsShowSearchBtn = false; + this.ucNo.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN; + this.ucNo.Location = new System.Drawing.Point(235, 91); + this.ucNo.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ucNo.MaxValue = new decimal(new int[] { + 1000000, + 0, + 0, + 0}); + this.ucNo.MinValue = new decimal(new int[] { + 1000000, + 0, + 0, + -2147483648}); + this.ucNo.Name = "ucNo"; + this.ucNo.Padding = new System.Windows.Forms.Padding(3); + this.ucNo.PasswordChar = '\0'; + this.ucNo.PromptColor = System.Drawing.Color.Gray; + this.ucNo.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucNo.PromptText = ""; + this.ucNo.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.ucNo.RectWidth = 1; + this.ucNo.RegexPattern = ""; + this.ucNo.Size = new System.Drawing.Size(215, 28); + this.ucNo.TabIndex = 10; + this.ucNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + // + // FormPlanAdd + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(541, 359); + this.Controls.Add(this.panel1); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.lblTitle); + this.Name = "FormPlanAdd"; + this.Text = "FormPlanAdd"; + this.tableLayoutPanel1.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private HZH_Controls.Controls.UCBtnExt btnCancel; + private HZH_Controls.Controls.UCBtnExt btnOK; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private HZH_Controls.Controls.UCTextBoxEx ucCode; + private HZH_Controls.Controls.UCTextBoxEx ucNo; + } +} \ No newline at end of file diff --git a/RfidWeb/Frm/FormPlanAdd.cs b/RfidWeb/Frm/FormPlanAdd.cs new file mode 100644 index 0000000..cf8c49c --- /dev/null +++ b/RfidWeb/Frm/FormPlanAdd.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using DB.Entity; +using DB.Service; +using Tool; + +namespace RfidWeb.Frm +{ + public partial class FormPlanAdd : Form + { + private FromPlanService fromPlanService = new FromPlanService(); + private FromPlan fromPlan = null; + + private long id = default; + public FormPlanAdd() + { + InitializeComponent(); + + this.ucCode.InputText = fromPlanService.GetMaxCode(); + this.ucNo.InputText = "50"; + fromPlan = new FromPlan(); + fromPlan.ID = SnowflakeFactory.NewId; + } + + public FormPlanAdd(long id) + { + InitializeComponent(); + this.id = id; + fromPlan = fromPlanService.Query(id); + this.ucNo.InputText = fromPlan.Num.ToString(); + this.ucCode.InputText=fromPlan.Code; + } + + private void btnCancel_BtnClick(object sender, EventArgs e) + { + this.Close(); + } + + private void btnOK_BtnClick(object sender, EventArgs e) + { + + fromPlan.Num = ucNo.InputText.ToInt(); + fromPlan.Code=ucCode.InputText.ToString(); + + if (id == 0) + { + + fromPlanService.Insert(fromPlan); + } + else + { + fromPlanService.Update(fromPlan); + } + + this.Close(); + } + } +} diff --git a/RfidWeb/Frm/FormPlanAdd.resx b/RfidWeb/Frm/FormPlanAdd.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RfidWeb/Frm/FormPlanAdd.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RfidWeb/Frm/FrmPlan.Designer.cs b/RfidWeb/Frm/FrmPlan.Designer.cs new file mode 100644 index 0000000..8e0f133 --- /dev/null +++ b/RfidWeb/Frm/FrmPlan.Designer.cs @@ -0,0 +1,270 @@ +namespace RfidWeb.Frm +{ + partial class FrmPlan + { + /// + /// 必需的设计器变量。 + /// + 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(FrmPlan)); + 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(); + this.ucBtnAdd = new HZH_Controls.Controls.UCBtnExt(); + 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.Status = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.CreateDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.panelTop.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // panelTop + // + this.panelTop.Controls.Add(this.ucBtnDel); + this.panelTop.Controls.Add(this.ucBtnUpdate); + this.panelTop.Controls.Add(this.ucBtnAdd); + 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(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, 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))))); + this.ucBtnDel.TipsText = ""; + this.ucBtnDel.BtnClick += new System.EventHandler(this.ucBtnDel_BtnClick); + // + // ucBtnUpdate + // + this.ucBtnUpdate.BackColor = System.Drawing.Color.White; + this.ucBtnUpdate.BtnBackColor = System.Drawing.Color.White; + this.ucBtnUpdate.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucBtnUpdate.BtnForeColor = System.Drawing.Color.White; + this.ucBtnUpdate.BtnText = "修改"; + this.ucBtnUpdate.ConerRadius = 5; + this.ucBtnUpdate.Cursor = System.Windows.Forms.Cursors.Hand; + this.ucBtnUpdate.EnabledMouseEffect = false; + this.ucBtnUpdate.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); + this.ucBtnUpdate.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucBtnUpdate.IsRadius = true; + this.ucBtnUpdate.IsShowRect = true; + this.ucBtnUpdate.IsShowTips = false; + 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, 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))))); + this.ucBtnUpdate.TipsText = ""; + this.ucBtnUpdate.BtnClick += new System.EventHandler(this.ucBtnUpdate_BtnClick); + // + // ucBtnAdd + // + this.ucBtnAdd.BackColor = System.Drawing.Color.White; + this.ucBtnAdd.BtnBackColor = System.Drawing.Color.White; + this.ucBtnAdd.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucBtnAdd.BtnForeColor = System.Drawing.Color.White; + this.ucBtnAdd.BtnText = "添加"; + this.ucBtnAdd.ConerRadius = 5; + this.ucBtnAdd.Cursor = System.Windows.Forms.Cursors.Hand; + this.ucBtnAdd.EnabledMouseEffect = false; + this.ucBtnAdd.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204))))); + this.ucBtnAdd.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucBtnAdd.IsRadius = true; + this.ucBtnAdd.IsShowRect = true; + this.ucBtnAdd.IsShowTips = false; + 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, 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))))); + this.ucBtnAdd.TipsText = ""; + this.ucBtnAdd.BtnClick += new System.EventHandler(this.ucBtnAdd_BtnClick); + // + // 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, 894); + 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 = 2; + this.ucPagerControl21.ShowSourceChanged += new HZH_Controls.Controls.PageControlEventHandler(this.ucPagerControl21_ShowSourceChanged); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.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, + this.Status, + this.CreateDate}); + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + 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, 80); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + 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 = 3; + // + // 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 = "Code"; + this.UserName.HeaderText = "计划编号"; + this.UserName.Name = "UserName"; + this.UserName.ReadOnly = true; + this.UserName.Width = 150; + // + // RoleName + // + this.RoleName.DataPropertyName = "Num"; + this.RoleName.HeaderText = "计划数量"; + this.RoleName.Name = "RoleName"; + this.RoleName.ReadOnly = true; + this.RoleName.Width = 150; + // + // Status + // + this.Status.DataPropertyName = "Status"; + this.Status.HeaderText = "计划状态"; + this.Status.Name = "Status"; + this.Status.ReadOnly = true; + this.Status.Width = 150; + // + // CreateDate + // + this.CreateDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.CreateDate.DataPropertyName = "CreateDate"; + this.CreateDate.HeaderText = "计划时间"; + this.CreateDate.Name = "CreateDate"; + this.CreateDate.ReadOnly = true; + // + // FrmPlan + // + 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 = "FrmPlan"; + this.Size = new System.Drawing.Size(910, 935); + this.panelTop.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panelTop; + private HZH_Controls.Controls.UCBtnExt ucBtnDel; + private HZH_Controls.Controls.UCBtnExt ucBtnUpdate; + private HZH_Controls.Controls.UCBtnExt ucBtnAdd; + 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 Status; + private System.Windows.Forms.DataGridViewTextBoxColumn CreateDate; + } +} diff --git a/RfidWeb/Frm/FrmPlan.cs b/RfidWeb/Frm/FrmPlan.cs new file mode 100644 index 0000000..bdba710 --- /dev/null +++ b/RfidWeb/Frm/FrmPlan.cs @@ -0,0 +1,99 @@ +using DB.Dto; +using DB.Entity; +using DB.Service; + +using HZH_Controls.Controls; +using HZH_Controls.Forms; + +using Microsoft.VisualBasic.ApplicationServices; + +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 FrmPlan : UserControl + { + private FromPlanService fromPlanService = new FromPlanService(); + public FrmPlan() + { + InitializeComponent(); + + this.dataGridView1.Columns["CreateDate"].DefaultCellStyle.Format = "yyyy-MM-dd"; + + this.dataGridView1.AutoGenerateColumns = false; + + ucPagerControl21.PageModel = PageModel.PageCount; + ucPagerControl21.PageIndex = 1; + ucPagerControl21.PageSize = 20; + + } + + private void ucBtnAdd_BtnClick(object sender, EventArgs e) + { + FormPlanAdd formRegis = new FormPlanAdd(); + formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 + formRegis.ShowDialog(); + + Replace(); + } + + private void Replace() + { + ucPagerControl21.PageIndex = 1; + ucPagerControl21_ShowSourceChanged(new object()); + + } + + private void ucPagerControl21_ShowSourceChanged(object currentSource) + { + + int index = ucPagerControl21.PageIndex; + var page = fromPlanService.GetPagedList(ucPagerControl21.PageIndex, + ucPagerControl21.PageSize); + ucPagerControl21.PageCount = page.TotalPages; + this.dataGridView1.DataSource = page.Items; + } + + private void ucBtnUpdate_BtnClick(object sender, EventArgs e) + { + var dataGridViewRows = this.dataGridView1.SelectedRows; + if (dataGridViewRows.Count != 1) + { + FrmDialog.ShowDialog(this, "只能修改一条", "警告窗体"); + return; + } + + + var dto = dataGridViewRows[0].DataBoundItem as FromPlan; + FormPlanAdd formRegis = new FormPlanAdd(dto.ID); + formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 + formRegis.ShowDialog(); + + + Replace(); + + } + + private void ucBtnDel_BtnClick(object sender, EventArgs e) + { + var dataGridViewRows = this.dataGridView1.SelectedRows; + if (dataGridViewRows.Count != 1) + { + FrmDialog.ShowDialog(this, "只能修改一条", "警告窗体"); + return; + } + var dto = dataGridViewRows[0].DataBoundItem as FromPlan; + fromPlanService.Del(dto.ID); + + Replace(); + } + } +} diff --git a/RfidWeb/Frm/FrmPlan.resx b/RfidWeb/Frm/FrmPlan.resx new file mode 100644 index 0000000..43f944a --- /dev/null +++ b/RfidWeb/Frm/FrmPlan.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLk9iamVjdAMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs= + + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/RfidWeb/FromSQl.cs b/RfidWeb/FromSQl.cs index 15914fb..8706491 100644 --- a/RfidWeb/FromSQl.cs +++ b/RfidWeb/FromSQl.cs @@ -28,34 +28,9 @@ namespace RfidWeb var rfidSetting = RfidSetting.Current; var dbContext = DbFactory.GetContext; - // new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); + new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); - Dictionary dic = new Dictionary(); - dic["feeding_motor_speed"] = "供料电机速度"; - dic["Laminated_motor_speed"] = "层合电机速度"; - dic["Felt_belt_motor_speed"] = "毛毡带电机速度"; - dic["Receiving_Electric_motor_speed"] = "收料电机1&2速度"; - - dic["Product_counter2"] = "层合生产数量"; - dic["CQ_Chip1_counter"] = "裁切1生产数量"; - dic["CQ_Chip2_counter"] = "裁切2生产数量"; - - dic["QDWD1SS"] = "裁刀1温度"; - dic["QDWD2SS"] = "裁刀2温度"; - - dic["QDWD2SS"] = "裁刀2温度"; - - foreach (var ee in dic) - { - Point point = new Point(); - point.DataType = "Uint32"; - point.FromType = "参数"; - point.PointAddress = ee.Key; - point.PointName=ee.Value; - point.ID = GetId; - dbContext.Insert(point); - } } diff --git a/RfidWeb/Program.cs b/RfidWeb/Program.cs index abcc881..db07c7c 100644 --- a/RfidWeb/Program.cs +++ b/RfidWeb/Program.cs @@ -29,8 +29,7 @@ namespace RfidWeb AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - - Application.Run(new FormMain()); + Application.Run(new FormMain()); //Application.Run(new FromSQl()); } diff --git a/RfidWeb/RfidWeb.csproj b/RfidWeb/RfidWeb.csproj index 07b01a1..bf8a8f4 100644 --- a/RfidWeb/RfidWeb.csproj +++ b/RfidWeb/RfidWeb.csproj @@ -160,12 +160,24 @@ FormPar.cs + + Form + + + FormPlanAdd.cs + Form FormRegister.cs + + UserControl + + + FrmPlan.cs + UserControl @@ -215,9 +227,15 @@ FormPar.cs + + FormPlanAdd.cs + FormRegister.cs + + FrmPlan.cs + FromAlarmLog.cs