diff --git a/WindowsFormsApp1/MES_PLC_Control.csproj b/WindowsFormsApp1/MES_PLC_Control.csproj index 8569eb6..75b0099 100644 --- a/WindowsFormsApp1/MES_PLC_Control.csproj +++ b/WindowsFormsApp1/MES_PLC_Control.csproj @@ -87,12 +87,6 @@ Line_Insert.cs - - Form - - - LinePLC_Insert.cs - Form @@ -153,12 +147,6 @@ FLow_Insert.cs - - Form - - - LinePLC_Manage.cs - Form @@ -177,6 +165,18 @@ Angleaddress_Manage.cs + + Form + + + ScanForm_DZ.cs + + + Form + + + ScanForm_SSQ.cs + Form @@ -231,10 +231,10 @@ MESUrl.cs + - @@ -265,9 +265,6 @@ Line_Insert.cs - - LinePLC_Insert.cs - MESUrl_Insert.cs @@ -298,9 +295,6 @@ Flow_Manage.cs - - LinePLC_Manage.cs - Line_Manage.cs @@ -310,6 +304,12 @@ Angleaddress_Manage.cs + + ScanForm_DZ.cs + + + ScanForm_SSQ.cs + Torqueaddress_Manage.cs diff --git a/WindowsFormsApp1/MainForm.Designer.cs b/WindowsFormsApp1/MainForm.Designer.cs index 005430f..30ef193 100644 --- a/WindowsFormsApp1/MainForm.Designer.cs +++ b/WindowsFormsApp1/MainForm.Designer.cs @@ -36,7 +36,6 @@ this.用户管理ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.产线管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.产线基础信息管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.产线关联PLC管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pLC管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pLC通讯设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pLC地址设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -46,22 +45,18 @@ this.扫码枪配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.扫码枪配置ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.扭力角度扭矩设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.螺丝枪扭力设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.扭力曲线配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.压力曲线设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.系统参数配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); - this.gropb = new System.Windows.Forms.GroupBox(); - this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); - this.Tray盘 = new System.Windows.Forms.Label(); - this.Tray盘二维码 = new System.Windows.Forms.Label(); - this.原料包装LOT号 = new System.Windows.Forms.GroupBox(); - this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); - this.MES提示信息 = new System.Windows.Forms.Label(); - this.MES提示 = new System.Windows.Forms.Label(); - this.LOT号显示 = new System.Windows.Forms.Label(); - this.LOT号 = new System.Windows.Forms.Label(); - this.胶水上下线 = new System.Windows.Forms.Button(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel(); + this.PLC1状态 = new System.Windows.Forms.Label(); + this.PLC1名称 = new System.Windows.Forms.Label(); + this.PLC1机台状态 = new System.Windows.Forms.Label(); + this.PLC1时间 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel(); this.事件4时间 = new System.Windows.Forms.Label(); @@ -76,19 +71,27 @@ this.事件3 = new System.Windows.Forms.Label(); this.事件4 = new System.Windows.Forms.Label(); this.事件4结果 = new System.Windows.Forms.Label(); + this.gropb = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); + this.MES提示信息 = new System.Windows.Forms.Label(); + this.Tray盘 = new System.Windows.Forms.Label(); + this.原料包装LOT号 = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.Tray盘二维码 = new System.Windows.Forms.Label(); + this.MES提示 = new System.Windows.Forms.Label(); + this.LOT号显示 = new System.Windows.Forms.Label(); + this.LOT号 = new System.Windows.Forms.Label(); + this.胶水上下线 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.机台状态 = new System.Windows.Forms.Label(); - this.PLC通讯时间 = new System.Windows.Forms.Label(); this.MES通讯时间 = new System.Windows.Forms.Label(); - this.PLC链接状态 = new System.Windows.Forms.Label(); this.MES链接状态 = new System.Windows.Forms.Label(); this.当前时间 = new System.Windows.Forms.Label(); this.操作人员ID = new System.Windows.Forms.Label(); - this.机台编号 = new System.Windows.Forms.Label(); - this.段别 = new System.Windows.Forms.Label(); - this.线别 = new System.Windows.Forms.Label(); + this.linetype = new System.Windows.Forms.Label(); + this.linecode = new System.Windows.Forms.Label(); + this.linename = new System.Windows.Forms.Label(); this.开始处理 = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); @@ -99,21 +102,42 @@ this.底部注释4 = new System.Windows.Forms.Label(); this.底部注释5 = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.螺丝枪扭力设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.剩余寿命 = new System.Windows.Forms.Label(); + this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel(); + this.linemode = new System.Windows.Forms.Label(); + this.lineremark1 = new System.Windows.Forms.Label(); + this.lineremark2 = new System.Windows.Forms.Label(); + this.lineremark3 = new System.Windows.Forms.Label(); + this.lineremark4 = new System.Windows.Forms.Label(); + this.lineremark5 = new System.Windows.Forms.Label(); + this.lineremark6 = new System.Windows.Forms.Label(); + this.lineremark7 = new System.Windows.Forms.Label(); + this.barcode1 = new System.Windows.Forms.Label(); + this.barcode2 = new System.Windows.Forms.Label(); + this.barcode3 = new System.Windows.Forms.Label(); + this.barcode4 = new System.Windows.Forms.Label(); + this.barcode5 = new System.Windows.Forms.Label(); + this.barcode6 = new System.Windows.Forms.Label(); + this.barcode7 = new System.Windows.Forms.Label(); + this.barcode8 = new System.Windows.Forms.Label(); + this.barcode9 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.tableLayoutPanel9.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.tableLayoutPanel7.SuspendLayout(); this.gropb.SuspendLayout(); this.tableLayoutPanel6.SuspendLayout(); this.原料包装LOT号.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.tableLayoutPanel7.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.tableLayoutPanel8.SuspendLayout(); + this.tableLayoutPanel10.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -170,8 +194,7 @@ // 产线管理ToolStripMenuItem // this.产线管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.产线基础信息管理ToolStripMenuItem, - this.产线关联PLC管理ToolStripMenuItem}); + this.产线基础信息管理ToolStripMenuItem}); this.产线管理ToolStripMenuItem.Name = "产线管理ToolStripMenuItem"; this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(145, 40); this.产线管理ToolStripMenuItem.Text = "产线管理"; @@ -183,13 +206,6 @@ this.产线基础信息管理ToolStripMenuItem.Text = "产线基础信息管理"; this.产线基础信息管理ToolStripMenuItem.Click += new System.EventHandler(this.产线基础信息管理ToolStripMenuItem_Click); // - // 产线关联PLC管理ToolStripMenuItem - // - this.产线关联PLC管理ToolStripMenuItem.Name = "产线关联PLC管理ToolStripMenuItem"; - this.产线关联PLC管理ToolStripMenuItem.Size = new System.Drawing.Size(359, 44); - this.产线关联PLC管理ToolStripMenuItem.Text = "产线关联PLC管理"; - this.产线关联PLC管理ToolStripMenuItem.Click += new System.EventHandler(this.产线关联PLC管理ToolStripMenuItem_Click); - // // pLC管理ToolStripMenuItem // this.pLC管理ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -249,7 +265,7 @@ // 扫码枪配置ToolStripMenuItem1 // this.扫码枪配置ToolStripMenuItem1.Name = "扫码枪配置ToolStripMenuItem1"; - this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(315, 44); + this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(331, 44); this.扫码枪配置ToolStripMenuItem1.Text = "COM口配置"; this.扫码枪配置ToolStripMenuItem1.Click += new System.EventHandler(this.扫码枪配置ToolStripMenuItem1_Click); // @@ -260,16 +276,23 @@ this.扭力角度扭矩设置ToolStripMenuItem.Text = "螺丝枪角度设置"; this.扭力角度扭矩设置ToolStripMenuItem.Click += new System.EventHandler(this.扭力角度扭矩设置ToolStripMenuItem_Click); // + // 螺丝枪扭力设置ToolStripMenuItem + // + this.螺丝枪扭力设置ToolStripMenuItem.Name = "螺丝枪扭力设置ToolStripMenuItem"; + this.螺丝枪扭力设置ToolStripMenuItem.Size = new System.Drawing.Size(331, 44); + this.螺丝枪扭力设置ToolStripMenuItem.Text = "螺丝枪扭力设置"; + this.螺丝枪扭力设置ToolStripMenuItem.Click += new System.EventHandler(this.螺丝枪扭力设置ToolStripMenuItem_Click); + // // 扭力曲线配置ToolStripMenuItem // this.扭力曲线配置ToolStripMenuItem.Name = "扭力曲线配置ToolStripMenuItem"; - this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(315, 44); + this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(331, 44); this.扭力曲线配置ToolStripMenuItem.Text = "扭力曲线配置"; // // 压力曲线设置ToolStripMenuItem // this.压力曲线设置ToolStripMenuItem.Name = "压力曲线设置ToolStripMenuItem"; - this.压力曲线设置ToolStripMenuItem.Size = new System.Drawing.Size(315, 44); + this.压力曲线设置ToolStripMenuItem.Size = new System.Drawing.Size(331, 44); this.压力曲线设置ToolStripMenuItem.Text = "压力曲线设置"; // // 系统参数配置ToolStripMenuItem @@ -292,10 +315,10 @@ this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(5); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.69908F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 49.35109F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 32.90072F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.049116F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 23.69995F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 49.35099F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 22.89995F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.049108F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1613, 935); this.tableLayoutPanel1.TabIndex = 6; // @@ -304,13 +327,15 @@ this.tableLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel4.ColumnCount = 2; - this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 76.54172F)); - this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 23.45828F)); + this.tableLayoutPanel4.ColumnCount = 3; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel4.Controls.Add(this.groupBox4, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.groupBox2, 2, 0); this.tableLayoutPanel4.Controls.Add(this.gropb, 0, 1); this.tableLayoutPanel4.Controls.Add(this.原料包装LOT号, 0, 0); - this.tableLayoutPanel4.Controls.Add(this.groupBox2, 1, 0); - this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 131); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 224); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60.04619F)); @@ -318,156 +343,93 @@ this.tableLayoutPanel4.Size = new System.Drawing.Size(1607, 455); this.tableLayoutPanel4.TabIndex = 8; // - // gropb + // groupBox4 // - this.gropb.Controls.Add(this.tableLayoutPanel6); - this.gropb.Dock = System.Windows.Forms.DockStyle.Fill; - this.gropb.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.gropb.Location = new System.Drawing.Point(3, 276); - this.gropb.Name = "gropb"; - this.gropb.Size = new System.Drawing.Size(1224, 176); - this.gropb.TabIndex = 1; - this.gropb.TabStop = false; - this.gropb.Text = "Tray盘二维码"; + this.groupBox4.Controls.Add(this.tableLayoutPanel9); + this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.groupBox4.Location = new System.Drawing.Point(1127, 3); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(154, 267); + this.groupBox4.TabIndex = 4; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "PLC链接"; // - // tableLayoutPanel6 + // tableLayoutPanel9 // - this.tableLayoutPanel6.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; - this.tableLayoutPanel6.ColumnCount = 2; - this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.tableLayoutPanel6.Controls.Add(this.Tray盘, 0, 0); - this.tableLayoutPanel6.Controls.Add(this.Tray盘二维码, 1, 0); - this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 35); - this.tableLayoutPanel6.Name = "tableLayoutPanel6"; - this.tableLayoutPanel6.RowCount = 1; - this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel6.Size = new System.Drawing.Size(1218, 138); - this.tableLayoutPanel6.TabIndex = 1; + this.tableLayoutPanel9.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; + this.tableLayoutPanel9.ColumnCount = 1; + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel9.Controls.Add(this.PLC1状态, 0, 0); + this.tableLayoutPanel9.Controls.Add(this.PLC1名称, 0, 1); + this.tableLayoutPanel9.Controls.Add(this.PLC1机台状态, 0, 2); + this.tableLayoutPanel9.Controls.Add(this.PLC1时间, 0, 3); + this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel9.Location = new System.Drawing.Point(3, 35); + this.tableLayoutPanel9.Name = "tableLayoutPanel9"; + this.tableLayoutPanel9.RowCount = 4; + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 52F)); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F)); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F)); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F)); + this.tableLayoutPanel9.Size = new System.Drawing.Size(148, 229); + this.tableLayoutPanel9.TabIndex = 0; // - // Tray盘 + // PLC1状态 // - this.Tray盘.Anchor = System.Windows.Forms.AnchorStyles.None; - this.Tray盘.AutoSize = true; - this.Tray盘.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Tray盘.Location = new System.Drawing.Point(8, 27); - this.Tray盘.Name = "Tray盘"; - this.Tray盘.Size = new System.Drawing.Size(228, 84); - this.Tray盘.TabIndex = 3; - this.Tray盘.Text = "Tray盘二维码:"; + this.PLC1状态.Anchor = System.Windows.Forms.AnchorStyles.None; + this.PLC1状态.AutoSize = true; + this.PLC1状态.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PLC1状态.Location = new System.Drawing.Point(28, 28); + this.PLC1状态.Name = "PLC1状态"; + this.PLC1状态.Size = new System.Drawing.Size(91, 62); + this.PLC1状态.TabIndex = 0; + this.PLC1状态.Text = "OK"; // - // Tray盘二维码 + // PLC1名称 // - this.Tray盘二维码.Anchor = System.Windows.Forms.AnchorStyles.None; - this.Tray盘二维码.AutoSize = true; - this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Tray盘二维码.Location = new System.Drawing.Point(397, 7); - this.Tray盘二维码.Name = "Tray盘二维码"; - this.Tray盘二维码.Size = new System.Drawing.Size(667, 124); - this.Tray盘二维码.TabIndex = 2; - this.Tray盘二维码.Text = "Tray盘二维码:92139129312381928938"; + this.PLC1名称.Anchor = System.Windows.Forms.AnchorStyles.None; + this.PLC1名称.AutoSize = true; + this.PLC1名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PLC1名称.Location = new System.Drawing.Point(26, 121); + this.PLC1名称.Name = "PLC1名称"; + this.PLC1名称.Size = new System.Drawing.Size(96, 28); + this.PLC1名称.TabIndex = 12; + this.PLC1名称.Text = "label6"; // - // 原料包装LOT号 + // PLC1机台状态 // - this.原料包装LOT号.Controls.Add(this.tableLayoutPanel5); - this.原料包装LOT号.Dock = System.Windows.Forms.DockStyle.Fill; - this.原料包装LOT号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.原料包装LOT号.Location = new System.Drawing.Point(3, 3); - this.原料包装LOT号.Name = "原料包装LOT号"; - this.原料包装LOT号.Size = new System.Drawing.Size(1224, 267); - this.原料包装LOT号.TabIndex = 0; - this.原料包装LOT号.TabStop = false; - this.原料包装LOT号.Text = "原料包装LOT号"; + this.PLC1机台状态.Anchor = System.Windows.Forms.AnchorStyles.None; + this.PLC1机台状态.AutoSize = true; + this.PLC1机台状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PLC1机台状态.Location = new System.Drawing.Point(26, 157); + this.PLC1机台状态.Name = "PLC1机台状态"; + this.PLC1机台状态.Size = new System.Drawing.Size(96, 28); + this.PLC1机台状态.TabIndex = 2; + this.PLC1机台状态.Text = "label6"; // - // tableLayoutPanel5 + // PLC1时间 // - this.tableLayoutPanel5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.tableLayoutPanel5.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; - this.tableLayoutPanel5.ColumnCount = 3; - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.22222F)); - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F)); - this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); - this.tableLayoutPanel5.Controls.Add(this.MES提示信息, 1, 1); - this.tableLayoutPanel5.Controls.Add(this.MES提示, 0, 1); - this.tableLayoutPanel5.Controls.Add(this.LOT号显示, 0, 0); - this.tableLayoutPanel5.Controls.Add(this.LOT号, 1, 0); - this.tableLayoutPanel5.Controls.Add(this.胶水上下线, 2, 0); - this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 35); - this.tableLayoutPanel5.Name = "tableLayoutPanel5"; - this.tableLayoutPanel5.RowCount = 2; - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel5.Size = new System.Drawing.Size(1218, 229); - this.tableLayoutPanel5.TabIndex = 0; - // - // MES提示信息 - // - this.MES提示信息.Anchor = System.Windows.Forms.AnchorStyles.None; - this.MES提示信息.AutoSize = true; - this.MES提示信息.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.MES提示信息.Location = new System.Drawing.Point(376, 140); - this.MES提示信息.Name = "MES提示信息"; - this.MES提示信息.Size = new System.Drawing.Size(598, 62); - this.MES提示信息.TabIndex = 5; - this.MES提示信息.Text = "MES提示信息:11111"; - // - // MES提示 - // - this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None; - this.MES提示.AutoSize = true; - this.MES提示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.MES提示.Location = new System.Drawing.Point(32, 150); - this.MES提示.Name = "MES提示"; - this.MES提示.Size = new System.Drawing.Size(207, 42); - this.MES提示.TabIndex = 4; - this.MES提示.Text = "MES提示:"; - // - // LOT号显示 - // - this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None; - this.LOT号显示.AutoSize = true; - this.LOT号显示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LOT号显示.Location = new System.Drawing.Point(11, 36); - this.LOT号显示.Name = "LOT号显示"; - this.LOT号显示.Size = new System.Drawing.Size(249, 42); - this.LOT号显示.TabIndex = 2; - this.LOT号显示.Text = "LOT号显示:"; - // - // LOT号 - // - this.LOT号.Anchor = System.Windows.Forms.AnchorStyles.None; - this.LOT号.AutoSize = true; - this.LOT号.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LOT号.Location = new System.Drawing.Point(327, 26); - this.LOT号.Name = "LOT号"; - this.LOT号.Size = new System.Drawing.Size(697, 62); - this.LOT号.TabIndex = 0; - this.LOT号.Text = "LOT号:23199191919191"; - // - // 胶水上下线 - // - this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill; - this.胶水上下线.Location = new System.Drawing.Point(1084, 4); - this.胶水上下线.Name = "胶水上下线"; - this.tableLayoutPanel5.SetRowSpan(this.胶水上下线, 2); - this.胶水上下线.Size = new System.Drawing.Size(130, 221); - this.胶水上下线.TabIndex = 3; - this.胶水上下线.Text = "胶水/三防漆\r\n上下线"; - this.胶水上下线.UseVisualStyleBackColor = true; - this.胶水上下线.Click += new System.EventHandler(this.胶水上下线_Click); + this.PLC1时间.Anchor = System.Windows.Forms.AnchorStyles.None; + this.PLC1时间.AutoSize = true; + this.PLC1时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PLC1时间.Location = new System.Drawing.Point(26, 195); + this.PLC1时间.Name = "PLC1时间"; + this.PLC1时间.Size = new System.Drawing.Size(96, 28); + this.PLC1时间.TabIndex = 8; + this.PLC1时间.Text = "label4"; // // groupBox2 // this.groupBox2.Controls.Add(this.tableLayoutPanel7); this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.groupBox2.Location = new System.Drawing.Point(1233, 3); + this.groupBox2.Location = new System.Drawing.Point(1287, 3); this.groupBox2.Name = "groupBox2"; this.tableLayoutPanel4.SetRowSpan(this.groupBox2, 2); - this.groupBox2.Size = new System.Drawing.Size(371, 449); - this.groupBox2.TabIndex = 2; + this.groupBox2.Size = new System.Drawing.Size(317, 449); + this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "MES事件结果"; // @@ -499,7 +461,7 @@ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel7.Size = new System.Drawing.Size(365, 411); + this.tableLayoutPanel7.Size = new System.Drawing.Size(311, 411); this.tableLayoutPanel7.TabIndex = 0; // // 事件4时间 @@ -507,9 +469,9 @@ this.事件4时间.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件4时间.AutoSize = true; this.事件4时间.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件4时间.Location = new System.Drawing.Point(189, 372); + this.事件4时间.Location = new System.Drawing.Point(166, 368); this.事件4时间.Name = "事件4时间"; - this.事件4时间.Size = new System.Drawing.Size(168, 34); + this.事件4时间.Size = new System.Drawing.Size(134, 42); this.事件4时间.TabIndex = 11; this.事件4时间.Text = "事件4时间"; // @@ -518,9 +480,9 @@ this.事件3时间.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件3时间.AutoSize = true; this.事件3时间.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件3时间.Location = new System.Drawing.Point(7, 372); + this.事件3时间.Location = new System.Drawing.Point(11, 368); this.事件3时间.Name = "事件3时间"; - this.事件3时间.Size = new System.Drawing.Size(168, 34); + this.事件3时间.Size = new System.Drawing.Size(134, 42); this.事件3时间.TabIndex = 10; this.事件3时间.Text = "事件3时间"; // @@ -529,9 +491,9 @@ this.事件2时间.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件2时间.AutoSize = true; this.事件2时间.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件2时间.Location = new System.Drawing.Point(189, 167); + this.事件2时间.Location = new System.Drawing.Point(166, 164); this.事件2时间.Name = "事件2时间"; - this.事件2时间.Size = new System.Drawing.Size(168, 34); + this.事件2时间.Size = new System.Drawing.Size(134, 40); this.事件2时间.TabIndex = 9; this.事件2时间.Text = "事件2时间"; // @@ -540,9 +502,9 @@ this.事件1时间.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件1时间.AutoSize = true; this.事件1时间.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件1时间.Location = new System.Drawing.Point(7, 167); + this.事件1时间.Location = new System.Drawing.Point(11, 164); this.事件1时间.Name = "事件1时间"; - this.事件1时间.Size = new System.Drawing.Size(168, 34); + this.事件1时间.Size = new System.Drawing.Size(134, 40); this.事件1时间.TabIndex = 8; this.事件1时间.Text = "事件1时间"; // @@ -551,7 +513,7 @@ this.事件2.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件2.AutoSize = true; this.事件2.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件2.Location = new System.Drawing.Point(223, 126); + this.事件2.Location = new System.Drawing.Point(183, 126); this.事件2.Name = "事件2"; this.事件2.Size = new System.Drawing.Size(100, 34); this.事件2.TabIndex = 3; @@ -562,7 +524,7 @@ this.事件1.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件1.AutoSize = true; this.事件1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件1.Location = new System.Drawing.Point(41, 126); + this.事件1.Location = new System.Drawing.Point(28, 126); this.事件1.Name = "事件1"; this.事件1.Size = new System.Drawing.Size(100, 34); this.事件1.TabIndex = 2; @@ -573,7 +535,7 @@ this.事件2结果.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件2结果.AutoSize = true; this.事件2结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件2结果.Location = new System.Drawing.Point(228, 30); + this.事件2结果.Location = new System.Drawing.Point(187, 30); this.事件2结果.Name = "事件2结果"; this.事件2结果.Size = new System.Drawing.Size(91, 62); this.事件2结果.TabIndex = 1; @@ -584,7 +546,7 @@ this.事件1结果.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件1结果.AutoSize = true; this.事件1结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件1结果.Location = new System.Drawing.Point(46, 30); + this.事件1结果.Location = new System.Drawing.Point(32, 30); this.事件1结果.Name = "事件1结果"; this.事件1结果.Size = new System.Drawing.Size(91, 62); this.事件1结果.TabIndex = 0; @@ -595,7 +557,7 @@ this.事件3结果.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件3结果.AutoSize = true; this.事件3结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件3结果.Location = new System.Drawing.Point(46, 234); + this.事件3结果.Location = new System.Drawing.Point(32, 234); this.事件3结果.Name = "事件3结果"; this.事件3结果.Size = new System.Drawing.Size(91, 62); this.事件3结果.TabIndex = 4; @@ -606,7 +568,7 @@ this.事件3.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件3.AutoSize = true; this.事件3.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件3.Location = new System.Drawing.Point(41, 330); + this.事件3.Location = new System.Drawing.Point(28, 330); this.事件3.Name = "事件3"; this.事件3.Size = new System.Drawing.Size(100, 34); this.事件3.TabIndex = 6; @@ -617,7 +579,7 @@ this.事件4.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件4.AutoSize = true; this.事件4.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件4.Location = new System.Drawing.Point(223, 330); + this.事件4.Location = new System.Drawing.Point(183, 330); this.事件4.Name = "事件4"; this.事件4.Size = new System.Drawing.Size(100, 34); this.事件4.TabIndex = 7; @@ -628,12 +590,156 @@ this.事件4结果.Anchor = System.Windows.Forms.AnchorStyles.None; this.事件4结果.AutoSize = true; this.事件4结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.事件4结果.Location = new System.Drawing.Point(228, 234); + this.事件4结果.Location = new System.Drawing.Point(187, 234); this.事件4结果.Name = "事件4结果"; this.事件4结果.Size = new System.Drawing.Size(91, 62); this.事件4结果.TabIndex = 5; this.事件4结果.Text = "OK"; // + // gropb + // + this.tableLayoutPanel4.SetColumnSpan(this.gropb, 2); + this.gropb.Controls.Add(this.tableLayoutPanel6); + this.gropb.Dock = System.Windows.Forms.DockStyle.Fill; + this.gropb.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.gropb.Location = new System.Drawing.Point(3, 276); + this.gropb.Name = "gropb"; + this.gropb.Size = new System.Drawing.Size(1278, 176); + this.gropb.TabIndex = 1; + this.gropb.TabStop = false; + this.gropb.Text = "Tray盘二维码"; + // + // tableLayoutPanel6 + // + this.tableLayoutPanel6.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; + this.tableLayoutPanel6.ColumnCount = 2; + this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); + this.tableLayoutPanel6.Controls.Add(this.MES提示信息, 1, 0); + this.tableLayoutPanel6.Controls.Add(this.Tray盘, 0, 0); + this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 35); + this.tableLayoutPanel6.Name = "tableLayoutPanel6"; + this.tableLayoutPanel6.RowCount = 1; + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel6.Size = new System.Drawing.Size(1272, 138); + this.tableLayoutPanel6.TabIndex = 1; + // + // MES提示信息 + // + this.MES提示信息.Anchor = System.Windows.Forms.AnchorStyles.None; + this.MES提示信息.AutoSize = true; + this.MES提示信息.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.MES提示信息.Location = new System.Drawing.Point(401, 18); + this.MES提示信息.Name = "MES提示信息"; + this.MES提示信息.Size = new System.Drawing.Size(724, 102); + this.MES提示信息.TabIndex = 6; + this.MES提示信息.Text = "MES提示信息:11111333332222222222222222"; + // + // Tray盘 + // + this.Tray盘.Anchor = System.Windows.Forms.AnchorStyles.None; + this.Tray盘.AutoSize = true; + this.Tray盘.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Tray盘.Location = new System.Drawing.Point(24, 48); + this.Tray盘.Name = "Tray盘"; + this.Tray盘.Size = new System.Drawing.Size(207, 42); + this.Tray盘.TabIndex = 3; + this.Tray盘.Text = "MES提示:"; + // + // 原料包装LOT号 + // + this.原料包装LOT号.Controls.Add(this.tableLayoutPanel5); + this.原料包装LOT号.Dock = System.Windows.Forms.DockStyle.Fill; + this.原料包装LOT号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.原料包装LOT号.Location = new System.Drawing.Point(3, 3); + this.原料包装LOT号.Name = "原料包装LOT号"; + this.原料包装LOT号.Size = new System.Drawing.Size(1118, 267); + this.原料包装LOT号.TabIndex = 0; + this.原料包装LOT号.TabStop = false; + this.原料包装LOT号.Text = "原料包装LOT号"; + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.tableLayoutPanel5.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; + this.tableLayoutPanel5.ColumnCount = 3; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.22222F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.tableLayoutPanel5.Controls.Add(this.Tray盘二维码, 1, 1); + this.tableLayoutPanel5.Controls.Add(this.MES提示, 0, 1); + this.tableLayoutPanel5.Controls.Add(this.LOT号显示, 0, 0); + this.tableLayoutPanel5.Controls.Add(this.LOT号, 1, 0); + this.tableLayoutPanel5.Controls.Add(this.胶水上下线, 2, 0); + this.tableLayoutPanel5.Controls.Add(this.剩余寿命, 2, 2); + this.tableLayoutPanel5.Controls.Add(this.tableLayoutPanel10, 0, 2); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 35); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.RowCount = 3; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel5.Size = new System.Drawing.Size(1112, 229); + this.tableLayoutPanel5.TabIndex = 0; + // + // Tray盘二维码 + // + this.Tray盘二维码.Anchor = System.Windows.Forms.AnchorStyles.None; + this.Tray盘二维码.AutoSize = true; + this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Tray盘二维码.Location = new System.Drawing.Point(328, 60); + this.Tray盘二维码.Name = "Tray盘二维码"; + this.Tray盘二维码.Size = new System.Drawing.Size(577, 51); + this.Tray盘二维码.TabIndex = 2; + this.Tray盘二维码.Text = "托盘二维码:921391293"; + // + // MES提示 + // + this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None; + this.MES提示.AutoSize = true; + this.MES提示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.MES提示.Location = new System.Drawing.Point(31, 65); + this.MES提示.Name = "MES提示"; + this.MES提示.Size = new System.Drawing.Size(186, 42); + this.MES提示.TabIndex = 4; + this.MES提示.Text = "托盘码:"; + // + // LOT号显示 + // + this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None; + this.LOT号显示.AutoSize = true; + this.LOT号显示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LOT号显示.Location = new System.Drawing.Point(73, 8); + this.LOT号显示.Name = "LOT号显示"; + this.LOT号显示.Size = new System.Drawing.Size(102, 42); + this.LOT号显示.TabIndex = 2; + this.LOT号显示.Text = "SN:"; + // + // LOT号 + // + this.LOT号.Anchor = System.Windows.Forms.AnchorStyles.None; + this.LOT号.AutoSize = true; + this.LOT号.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LOT号.Location = new System.Drawing.Point(405, 3); + this.LOT号.Name = "LOT号"; + this.LOT号.Size = new System.Drawing.Size(423, 51); + this.LOT号.TabIndex = 0; + this.LOT号.Text = "LOT号:23199191"; + // + // 胶水上下线 + // + this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill; + this.胶水上下线.Location = new System.Drawing.Point(990, 4); + this.胶水上下线.Name = "胶水上下线"; + this.tableLayoutPanel5.SetRowSpan(this.胶水上下线, 2); + this.胶水上下线.Size = new System.Drawing.Size(118, 107); + this.胶水上下线.TabIndex = 3; + this.胶水上下线.Text = "材料\r\n上下线"; + this.胶水上下线.UseVisualStyleBackColor = true; + this.胶水上下线.Click += new System.EventHandler(this.胶水上下线_Click); + // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -645,7 +751,7 @@ this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(4); - this.groupBox1.Size = new System.Drawing.Size(1605, 120); + this.groupBox1.Size = new System.Drawing.Size(1605, 213); this.groupBox1.TabIndex = 4; this.groupBox1.TabStop = false; this.groupBox1.Text = "处理界面"; @@ -669,7 +775,7 @@ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(1577, 68); + this.tableLayoutPanel3.Size = new System.Drawing.Size(1577, 161); this.tableLayoutPanel3.TabIndex = 4; // // tableLayoutPanel2 @@ -678,97 +784,63 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel2.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; - this.tableLayoutPanel2.ColumnCount = 5; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 37F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 37F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 37F)); - this.tableLayoutPanel2.Controls.Add(this.机台状态, 3, 1); - this.tableLayoutPanel2.Controls.Add(this.PLC通讯时间, 4, 1); - this.tableLayoutPanel2.Controls.Add(this.MES通讯时间, 1, 1); - this.tableLayoutPanel2.Controls.Add(this.PLC链接状态, 2, 1); - this.tableLayoutPanel2.Controls.Add(this.MES链接状态, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.当前时间, 4, 0); - this.tableLayoutPanel2.Controls.Add(this.操作人员ID, 3, 0); - this.tableLayoutPanel2.Controls.Add(this.机台编号, 2, 0); - this.tableLayoutPanel2.Controls.Add(this.段别, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.线别, 0, 0); + this.tableLayoutPanel2.ColumnCount = 6; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); + this.tableLayoutPanel2.Controls.Add(this.lineremark7, 2, 2); + this.tableLayoutPanel2.Controls.Add(this.lineremark6, 1, 2); + this.tableLayoutPanel2.Controls.Add(this.lineremark5, 0, 2); + this.tableLayoutPanel2.Controls.Add(this.lineremark4, 3, 1); + this.tableLayoutPanel2.Controls.Add(this.lineremark3, 2, 1); + this.tableLayoutPanel2.Controls.Add(this.lineremark2, 1, 1); + this.tableLayoutPanel2.Controls.Add(this.lineremark1, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.linemode, 3, 0); + this.tableLayoutPanel2.Controls.Add(this.MES通讯时间, 5, 1); + this.tableLayoutPanel2.Controls.Add(this.MES链接状态, 4, 1); + this.tableLayoutPanel2.Controls.Add(this.当前时间, 5, 0); + this.tableLayoutPanel2.Controls.Add(this.操作人员ID, 4, 0); + this.tableLayoutPanel2.Controls.Add(this.linetype, 2, 0); + this.tableLayoutPanel2.Controls.Add(this.linecode, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.linename, 0, 0); this.tableLayoutPanel2.Location = new System.Drawing.Point(161, 5); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(5); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowCount = 3; this.tableLayoutPanel3.SetRowSpan(this.tableLayoutPanel2, 3); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(1411, 58); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(1411, 151); this.tableLayoutPanel2.TabIndex = 3; // - // 机台状态 - // - this.机台状态.AutoSize = true; - this.机台状态.Dock = System.Windows.Forms.DockStyle.Fill; - this.机台状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.机台状态.Location = new System.Drawing.Point(852, 29); - this.机台状态.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.机台状态.Name = "机台状态"; - this.机台状态.Size = new System.Drawing.Size(271, 28); - this.机台状态.TabIndex = 17; - this.机台状态.Text = "机台状态:None"; - this.机台状态.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // PLC通讯时间 - // - this.PLC通讯时间.AutoSize = true; - this.PLC通讯时间.Dock = System.Windows.Forms.DockStyle.Fill; - this.PLC通讯时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.PLC通讯时间.Location = new System.Drawing.Point(1134, 29); - this.PLC通讯时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.PLC通讯时间.Name = "PLC通讯时间"; - this.PLC通讯时间.Size = new System.Drawing.Size(271, 28); - this.PLC通讯时间.TabIndex = 16; - this.PLC通讯时间.Text = "PLC通讯时间:None"; - this.PLC通讯时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // MES通讯时间 // this.MES通讯时间.AutoSize = true; this.MES通讯时间.Dock = System.Windows.Forms.DockStyle.Fill; this.MES通讯时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.MES通讯时间.Location = new System.Drawing.Point(288, 29); + this.MES通讯时间.Location = new System.Drawing.Point(1177, 51); this.MES通讯时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.MES通讯时间.Name = "MES通讯时间"; - this.MES通讯时间.Size = new System.Drawing.Size(271, 28); + this.tableLayoutPanel2.SetRowSpan(this.MES通讯时间, 2); + this.MES通讯时间.Size = new System.Drawing.Size(228, 99); this.MES通讯时间.TabIndex = 15; this.MES通讯时间.Text = "MES通讯时间:None"; this.MES通讯时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // PLC链接状态 - // - this.PLC链接状态.AutoSize = true; - this.PLC链接状态.Dock = System.Windows.Forms.DockStyle.Fill; - this.PLC链接状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.PLC链接状态.Location = new System.Drawing.Point(570, 29); - this.PLC链接状态.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.PLC链接状态.Name = "PLC链接状态"; - this.PLC链接状态.Size = new System.Drawing.Size(271, 28); - this.PLC链接状态.TabIndex = 14; - this.PLC链接状态.Text = "PLC链接状态:None"; - this.PLC链接状态.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // MES链接状态 // this.MES链接状态.AutoSize = true; this.MES链接状态.Dock = System.Windows.Forms.DockStyle.Fill; this.MES链接状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.MES链接状态.Location = new System.Drawing.Point(6, 29); + this.MES链接状态.Location = new System.Drawing.Point(943, 51); this.MES链接状态.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.MES链接状态.Name = "MES链接状态"; - this.MES链接状态.Size = new System.Drawing.Size(271, 28); + this.tableLayoutPanel2.SetRowSpan(this.MES链接状态, 2); + this.MES链接状态.Size = new System.Drawing.Size(223, 99); this.MES链接状态.TabIndex = 12; this.MES链接状态.Text = "MES链接状态:None"; this.MES链接状态.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -778,10 +850,10 @@ this.当前时间.AutoSize = true; this.当前时间.Dock = System.Windows.Forms.DockStyle.Fill; this.当前时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.当前时间.Location = new System.Drawing.Point(1134, 1); + this.当前时间.Location = new System.Drawing.Point(1177, 1); this.当前时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.当前时间.Name = "当前时间"; - this.当前时间.Size = new System.Drawing.Size(271, 27); + this.当前时间.Size = new System.Drawing.Size(228, 49); this.当前时间.TabIndex = 11; this.当前时间.Text = "当前时间:"; this.当前时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -791,62 +863,62 @@ this.操作人员ID.AutoSize = true; this.操作人员ID.Dock = System.Windows.Forms.DockStyle.Fill; this.操作人员ID.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.操作人员ID.Location = new System.Drawing.Point(852, 1); + this.操作人员ID.Location = new System.Drawing.Point(943, 1); this.操作人员ID.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.操作人员ID.Name = "操作人员ID"; - this.操作人员ID.Size = new System.Drawing.Size(271, 27); + this.操作人员ID.Size = new System.Drawing.Size(223, 49); this.操作人员ID.TabIndex = 6; this.操作人员ID.Text = "操作人员ID:"; this.操作人员ID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 机台编号 + // linetype // - this.机台编号.AutoSize = true; - this.机台编号.Dock = System.Windows.Forms.DockStyle.Fill; - this.机台编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.机台编号.Location = new System.Drawing.Point(570, 1); - this.机台编号.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.机台编号.Name = "机台编号"; - this.机台编号.Size = new System.Drawing.Size(271, 27); - this.机台编号.TabIndex = 5; - this.机台编号.Text = "机台编号:"; - this.机台编号.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.linetype.AutoSize = true; + this.linetype.Dock = System.Windows.Forms.DockStyle.Fill; + this.linetype.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.linetype.Location = new System.Drawing.Point(475, 1); + this.linetype.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.linetype.Name = "linetype"; + this.linetype.Size = new System.Drawing.Size(223, 49); + this.linetype.TabIndex = 5; + this.linetype.Text = "机台编号:"; + this.linetype.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 段别 + // linecode // - this.段别.AutoSize = true; - this.段别.Dock = System.Windows.Forms.DockStyle.Fill; - this.段别.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.段别.Location = new System.Drawing.Point(288, 1); - this.段别.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.段别.Name = "段别"; - this.段别.Size = new System.Drawing.Size(271, 27); - this.段别.TabIndex = 4; - this.段别.Text = "段别:"; - this.段别.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.linecode.AutoSize = true; + this.linecode.Dock = System.Windows.Forms.DockStyle.Fill; + this.linecode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.linecode.Location = new System.Drawing.Point(241, 1); + this.linecode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.linecode.Name = "linecode"; + this.linecode.Size = new System.Drawing.Size(223, 49); + this.linecode.TabIndex = 4; + this.linecode.Text = "段别:"; + this.linecode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 线别 + // linename // - this.线别.AutoSize = true; - this.线别.Dock = System.Windows.Forms.DockStyle.Fill; - this.线别.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.线别.Location = new System.Drawing.Point(6, 1); - this.线别.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.线别.Name = "线别"; - this.线别.Size = new System.Drawing.Size(271, 27); - this.线别.TabIndex = 3; - this.线别.Text = "线别:"; - this.线别.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.linename.AutoSize = true; + this.linename.Dock = System.Windows.Forms.DockStyle.Fill; + this.linename.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.linename.Location = new System.Drawing.Point(6, 1); + this.linename.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.linename.Name = "linename"; + this.linename.Size = new System.Drawing.Size(224, 49); + this.linename.TabIndex = 3; + this.linename.Text = "线别:"; + this.linename.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // 开始处理 // this.开始处理.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); this.开始处理.Dock = System.Windows.Forms.DockStyle.Fill; this.开始处理.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.开始处理.Location = new System.Drawing.Point(19, 10); + this.开始处理.Location = new System.Drawing.Point(19, 20); this.开始处理.Margin = new System.Windows.Forms.Padding(4); this.开始处理.Name = "开始处理"; - this.开始处理.Size = new System.Drawing.Size(118, 46); + this.开始处理.Size = new System.Drawing.Size(118, 120); this.开始处理.TabIndex = 1; this.开始处理.Text = "开始处理"; this.开始处理.UseVisualStyleBackColor = false; @@ -859,11 +931,11 @@ | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.richTextBox1); this.groupBox3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.groupBox3.Location = new System.Drawing.Point(4, 593); + this.groupBox3.Location = new System.Drawing.Point(4, 686); this.groupBox3.Margin = new System.Windows.Forms.Padding(4); this.groupBox3.Name = "groupBox3"; this.groupBox3.Padding = new System.Windows.Forms.Padding(4); - this.groupBox3.Size = new System.Drawing.Size(1605, 299); + this.groupBox3.Size = new System.Drawing.Size(1605, 206); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "日志页面"; @@ -877,7 +949,7 @@ this.richTextBox1.Location = new System.Drawing.Point(18, 42); this.richTextBox1.Margin = new System.Windows.Forms.Padding(5); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(1574, 244); + this.richTextBox1.Size = new System.Drawing.Size(1574, 151); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // @@ -963,12 +1035,263 @@ this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // 螺丝枪扭力设置ToolStripMenuItem + // 剩余寿命 // - this.螺丝枪扭力设置ToolStripMenuItem.Name = "螺丝枪扭力设置ToolStripMenuItem"; - this.螺丝枪扭力设置ToolStripMenuItem.Size = new System.Drawing.Size(331, 44); - this.螺丝枪扭力设置ToolStripMenuItem.Text = "螺丝枪扭力设置"; - this.螺丝枪扭力设置ToolStripMenuItem.Click += new System.EventHandler(this.螺丝枪扭力设置ToolStripMenuItem_Click); + this.剩余寿命.Anchor = System.Windows.Forms.AnchorStyles.None; + this.剩余寿命.AutoSize = true; + this.剩余寿命.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.剩余寿命.Location = new System.Drawing.Point(1001, 143); + this.剩余寿命.Name = "剩余寿命"; + this.剩余寿命.Size = new System.Drawing.Size(96, 56); + this.剩余寿命.TabIndex = 5; + this.剩余寿命.Text = "剩余寿命"; + // + // tableLayoutPanel10 + // + this.tableLayoutPanel10.ColumnCount = 3; + this.tableLayoutPanel5.SetColumnSpan(this.tableLayoutPanel10, 2); + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.Controls.Add(this.barcode9, 2, 2); + this.tableLayoutPanel10.Controls.Add(this.barcode8, 1, 2); + this.tableLayoutPanel10.Controls.Add(this.barcode7, 0, 2); + this.tableLayoutPanel10.Controls.Add(this.barcode6, 2, 1); + this.tableLayoutPanel10.Controls.Add(this.barcode5, 1, 1); + this.tableLayoutPanel10.Controls.Add(this.barcode4, 0, 1); + this.tableLayoutPanel10.Controls.Add(this.barcode3, 2, 0); + this.tableLayoutPanel10.Controls.Add(this.barcode2, 1, 0); + this.tableLayoutPanel10.Controls.Add(this.barcode1, 0, 0); + this.tableLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel10.Location = new System.Drawing.Point(4, 118); + this.tableLayoutPanel10.Name = "tableLayoutPanel10"; + this.tableLayoutPanel10.RowCount = 3; + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel10.Size = new System.Drawing.Size(979, 107); + this.tableLayoutPanel10.TabIndex = 6; + // + // linemode + // + this.linemode.AutoSize = true; + this.linemode.Dock = System.Windows.Forms.DockStyle.Fill; + this.linemode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.linemode.Location = new System.Drawing.Point(709, 1); + this.linemode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.linemode.Name = "linemode"; + this.linemode.Size = new System.Drawing.Size(223, 49); + this.linemode.TabIndex = 16; + this.linemode.Text = "机台编号:"; + this.linemode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark1 + // + this.lineremark1.AutoSize = true; + this.lineremark1.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark1.Location = new System.Drawing.Point(6, 51); + this.lineremark1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark1.Name = "lineremark1"; + this.lineremark1.Size = new System.Drawing.Size(224, 49); + this.lineremark1.TabIndex = 17; + this.lineremark1.Text = "机台编号:"; + this.lineremark1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark2 + // + this.lineremark2.AutoSize = true; + this.lineremark2.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark2.Location = new System.Drawing.Point(241, 51); + this.lineremark2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark2.Name = "lineremark2"; + this.lineremark2.Size = new System.Drawing.Size(223, 49); + this.lineremark2.TabIndex = 18; + this.lineremark2.Text = "机台编号:"; + this.lineremark2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark3 + // + this.lineremark3.AutoSize = true; + this.lineremark3.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark3.Location = new System.Drawing.Point(475, 51); + this.lineremark3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark3.Name = "lineremark3"; + this.lineremark3.Size = new System.Drawing.Size(223, 49); + this.lineremark3.TabIndex = 19; + this.lineremark3.Text = "机台编号:"; + this.lineremark3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark4 + // + this.lineremark4.AutoSize = true; + this.lineremark4.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark4.Location = new System.Drawing.Point(709, 51); + this.lineremark4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark4.Name = "lineremark4"; + this.lineremark4.Size = new System.Drawing.Size(223, 49); + this.lineremark4.TabIndex = 20; + this.lineremark4.Text = "机台编号:"; + this.lineremark4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark5 + // + this.lineremark5.AutoSize = true; + this.lineremark5.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark5.Location = new System.Drawing.Point(6, 101); + this.lineremark5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark5.Name = "lineremark5"; + this.lineremark5.Size = new System.Drawing.Size(224, 49); + this.lineremark5.TabIndex = 21; + this.lineremark5.Text = "机台编号:"; + this.lineremark5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark6 + // + this.lineremark6.AutoSize = true; + this.lineremark6.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark6.Location = new System.Drawing.Point(241, 101); + this.lineremark6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark6.Name = "lineremark6"; + this.lineremark6.Size = new System.Drawing.Size(223, 49); + this.lineremark6.TabIndex = 22; + this.lineremark6.Text = "机台编号:"; + this.lineremark6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lineremark7 + // + this.lineremark7.AutoSize = true; + this.lineremark7.Dock = System.Windows.Forms.DockStyle.Fill; + this.lineremark7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lineremark7.Location = new System.Drawing.Point(475, 101); + this.lineremark7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lineremark7.Name = "lineremark7"; + this.lineremark7.Size = new System.Drawing.Size(223, 49); + this.lineremark7.TabIndex = 23; + this.lineremark7.Text = "机台编号:"; + this.lineremark7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode1 + // + this.barcode1.AutoSize = true; + this.barcode1.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode1.Location = new System.Drawing.Point(5, 0); + this.barcode1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode1.Name = "barcode1"; + this.barcode1.Size = new System.Drawing.Size(316, 35); + this.barcode1.TabIndex = 22; + this.barcode1.Text = "机台编号:"; + this.barcode1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode2 + // + this.barcode2.AutoSize = true; + this.barcode2.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode2.Location = new System.Drawing.Point(331, 0); + this.barcode2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode2.Name = "barcode2"; + this.barcode2.Size = new System.Drawing.Size(316, 35); + this.barcode2.TabIndex = 23; + this.barcode2.Text = "机台编号:"; + this.barcode2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode3 + // + this.barcode3.AutoSize = true; + this.barcode3.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode3.Location = new System.Drawing.Point(657, 0); + this.barcode3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode3.Name = "barcode3"; + this.barcode3.Size = new System.Drawing.Size(317, 35); + this.barcode3.TabIndex = 24; + this.barcode3.Text = "机台编号:"; + this.barcode3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode4 + // + this.barcode4.AutoSize = true; + this.barcode4.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode4.Location = new System.Drawing.Point(5, 35); + this.barcode4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode4.Name = "barcode4"; + this.barcode4.Size = new System.Drawing.Size(316, 35); + this.barcode4.TabIndex = 25; + this.barcode4.Text = "机台编号:"; + this.barcode4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode5 + // + this.barcode5.AutoSize = true; + this.barcode5.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode5.Location = new System.Drawing.Point(331, 35); + this.barcode5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode5.Name = "barcode5"; + this.barcode5.Size = new System.Drawing.Size(316, 35); + this.barcode5.TabIndex = 26; + this.barcode5.Text = "机台编号:"; + this.barcode5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode6 + // + this.barcode6.AutoSize = true; + this.barcode6.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode6.Location = new System.Drawing.Point(657, 35); + this.barcode6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode6.Name = "barcode6"; + this.barcode6.Size = new System.Drawing.Size(317, 35); + this.barcode6.TabIndex = 27; + this.barcode6.Text = "机台编号:"; + this.barcode6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode7 + // + this.barcode7.AutoSize = true; + this.barcode7.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode7.Location = new System.Drawing.Point(5, 70); + this.barcode7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode7.Name = "barcode7"; + this.barcode7.Size = new System.Drawing.Size(316, 37); + this.barcode7.TabIndex = 28; + this.barcode7.Text = "机台编号:"; + this.barcode7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode8 + // + this.barcode8.AutoSize = true; + this.barcode8.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode8.Location = new System.Drawing.Point(331, 70); + this.barcode8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode8.Name = "barcode8"; + this.barcode8.Size = new System.Drawing.Size(316, 37); + this.barcode8.TabIndex = 29; + this.barcode8.Text = "机台编号:"; + this.barcode8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // barcode9 + // + this.barcode9.AutoSize = true; + this.barcode9.Dock = System.Windows.Forms.DockStyle.Fill; + this.barcode9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.barcode9.Location = new System.Drawing.Point(657, 70); + this.barcode9.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.barcode9.Name = "barcode9"; + this.barcode9.Size = new System.Drawing.Size(317, 37); + this.barcode9.TabIndex = 30; + this.barcode9.Text = "机台编号:"; + this.barcode9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // MainForm // @@ -988,15 +1311,18 @@ this.menuStrip1.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.tableLayoutPanel9.ResumeLayout(false); + this.tableLayoutPanel9.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.tableLayoutPanel7.ResumeLayout(false); + this.tableLayoutPanel7.PerformLayout(); this.gropb.ResumeLayout(false); this.tableLayoutPanel6.ResumeLayout(false); this.tableLayoutPanel6.PerformLayout(); this.原料包装LOT号.ResumeLayout(false); this.tableLayoutPanel5.ResumeLayout(false); this.tableLayoutPanel5.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.tableLayoutPanel7.ResumeLayout(false); - this.tableLayoutPanel7.PerformLayout(); this.groupBox1.ResumeLayout(false); this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); @@ -1004,6 +1330,8 @@ this.groupBox3.ResumeLayout(false); this.tableLayoutPanel8.ResumeLayout(false); this.tableLayoutPanel8.PerformLayout(); + this.tableLayoutPanel10.ResumeLayout(false); + this.tableLayoutPanel10.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -1029,9 +1357,9 @@ private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.ToolStripMenuItem 扭力曲线配置ToolStripMenuItem; private System.Windows.Forms.Label 操作人员ID; - private System.Windows.Forms.Label 机台编号; - private System.Windows.Forms.Label 段别; - private System.Windows.Forms.Label 线别; + private System.Windows.Forms.Label linetype; + private System.Windows.Forms.Label linecode; + private System.Windows.Forms.Label linename; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.ToolStripMenuItem 产线管理ToolStripMenuItem; private System.Windows.Forms.RichTextBox richTextBox1; @@ -1039,9 +1367,7 @@ private System.Windows.Forms.Button 开始处理; private System.Windows.Forms.Label MES链接状态; private System.Windows.Forms.Label 当前时间; - private System.Windows.Forms.Label PLC通讯时间; private System.Windows.Forms.Label MES通讯时间; - private System.Windows.Forms.Label PLC链接状态; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8; private System.Windows.Forms.Label 底部注释1; private System.Windows.Forms.Label 底部注释2; @@ -1057,31 +1383,54 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; private System.Windows.Forms.Label LOT号显示; private System.Windows.Forms.Label LOT号; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7; - private System.Windows.Forms.Label 事件4; - private System.Windows.Forms.Label 事件3; - private System.Windows.Forms.Label 事件4结果; - private System.Windows.Forms.Label 事件3结果; - private System.Windows.Forms.Label 事件2; - private System.Windows.Forms.Label 事件1; - private System.Windows.Forms.Label 事件2结果; - private System.Windows.Forms.Label 事件1结果; private System.Windows.Forms.Timer timer1; - private System.Windows.Forms.Label 事件4时间; - private System.Windows.Forms.Label 事件3时间; - private System.Windows.Forms.Label 事件2时间; - private System.Windows.Forms.Label 事件1时间; - private System.Windows.Forms.Label 机台状态; private System.Windows.Forms.Button 胶水上下线; - private System.Windows.Forms.Label MES提示信息; private System.Windows.Forms.Label MES提示; private System.Windows.Forms.ToolStripMenuItem 产线基础信息管理ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem 产线关联PLC管理ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem pLC报警设置ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 扭力角度扭矩设置ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 压力曲线设置ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 螺丝枪扭力设置ToolStripMenuItem; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9; + private System.Windows.Forms.Label PLC1时间; + private System.Windows.Forms.Label PLC1机台状态; + private System.Windows.Forms.Label PLC1状态; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7; + private System.Windows.Forms.Label 事件4时间; + private System.Windows.Forms.Label 事件3时间; + private System.Windows.Forms.Label 事件2时间; + private System.Windows.Forms.Label 事件1时间; + private System.Windows.Forms.Label 事件2; + private System.Windows.Forms.Label 事件1; + private System.Windows.Forms.Label 事件2结果; + private System.Windows.Forms.Label 事件1结果; + private System.Windows.Forms.Label 事件3结果; + private System.Windows.Forms.Label 事件3; + private System.Windows.Forms.Label 事件4; + private System.Windows.Forms.Label 事件4结果; + private System.Windows.Forms.Label PLC1名称; + private System.Windows.Forms.Label MES提示信息; + private System.Windows.Forms.Label 剩余寿命; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10; + private System.Windows.Forms.Label lineremark7; + private System.Windows.Forms.Label lineremark6; + private System.Windows.Forms.Label lineremark5; + private System.Windows.Forms.Label lineremark4; + private System.Windows.Forms.Label lineremark3; + private System.Windows.Forms.Label lineremark2; + private System.Windows.Forms.Label lineremark1; + private System.Windows.Forms.Label linemode; + private System.Windows.Forms.Label barcode9; + private System.Windows.Forms.Label barcode8; + private System.Windows.Forms.Label barcode7; + private System.Windows.Forms.Label barcode6; + private System.Windows.Forms.Label barcode5; + private System.Windows.Forms.Label barcode4; + private System.Windows.Forms.Label barcode3; + private System.Windows.Forms.Label barcode2; + private System.Windows.Forms.Label barcode1; } } diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs index 2daab0a..2521d8b 100644 --- a/WindowsFormsApp1/MainForm.cs +++ b/WindowsFormsApp1/MainForm.cs @@ -27,9 +27,6 @@ namespace WindowsFormsApp1 { public partial class MainForm : Form { - //private Thread thread_plc1; - //private Thread thread_plc2; - public MainForm() { InitializeComponent(); @@ -44,10 +41,19 @@ namespace WindowsFormsApp1 FormRecover(); - 线别.Text = "线别:" + Init.t_Line.linename; - 段别.Text = "段别:" + Init.t_Line.linemode; - 机台编号.Text = "机台编号:" + Init.t_Line.linecode; - 操作人员ID.Text = "操作人员ID:" + Init.t_User.username; + linename.Text = Init.t_Line.linename; + linecode.Text = Init.t_Line.linecode; + linetype.Text = Init.t_Line.linetype; + linemode.Text = Init.t_Line.linemode; + lineremark1.Text = Init.t_Line.lineremark1; + lineremark2.Text = Init.t_Line.lineremark2; + lineremark3.Text = Init.t_Line.lineremark3; + lineremark4.Text = Init.t_Line.lineremark4; + lineremark5.Text = Init.t_Line.lineremark5; + lineremark6.Text = Init.t_Line.lineremark6; + lineremark7.Text = Init.t_Line.lineremark7; + + 操作人员ID.Text = Init.t_User.username; } @@ -62,6 +68,7 @@ namespace WindowsFormsApp1 break; } + ChangeBarcode(); if (Plc == null) { @@ -74,8 +81,9 @@ namespace WindowsFormsApp1 var openresult = siemensHelp.OpenConn(); if (!openresult.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}建立S7连接失败"); continue; } @@ -83,15 +91,16 @@ namespace WindowsFormsApp1 List plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id); List angleaddress = Init.t_Angleaddresses.FindAll(a => a.plcid == Plc.id); List torqueaddress = Init.t_Torqueaddresses.FindAll(a => a.plcid == Plc.id); - + List pressurecurveaddress = Init.t_Pressurecurves.FindAll(a => a.plcid == Plc.id); plcdata PlcData = new plcdata(); var resdresult = siemensHelp.ReadAddress(plcaddress, PlcData); if (!resdresult.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}读取全部地址处理错误:处理停止"); continue; } @@ -101,17 +110,19 @@ namespace WindowsFormsApp1 var haertresult = siemensHelp.WriteAddress(plcaddress, PlcData); if (!haertresult.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}写入心跳错误:处理停止"); continue; } DateTime Plc_Time = DateTime.Now; - PLC链接状态.Text = "PLC链接状态:OK"; - PLC链接状态.BackColor = SystemColors.Control; - PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss"); + //PLC链接状态.Text = "PLC链接状态:OK"; + //PLC链接状态.BackColor = SystemColors.Control; + //PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss"); + PLC_Form(Plc, plcstate.OK, Plc_Time); #endregion ApiClient apiClient = new ApiClient(); @@ -119,7 +130,7 @@ namespace WindowsFormsApp1 #region 机台状态及报警 //机台状态 - 机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus); + //机台状态.Text = "机台状态:" + Enum.GetName(typeof(plcstatus), Init.Plcstatus); int oldstatus = Init.Plcstatus; if (PlcData.Read_Status != 0) { @@ -159,7 +170,7 @@ namespace WindowsFormsApp1 //机台报警 if (PlcData.Read_Status == (short)plcstatus.停机) { - 机台状态.BackColor = Color.Red; + //机台状态.BackColor = Color.Red; if (oldstatus != (short)plcstatus.停机) { //反馈报警 @@ -196,7 +207,7 @@ namespace WindowsFormsApp1 } else { - 机台状态.BackColor = SystemColors.Control; + //机台状态.BackColor = SystemColors.Control; } #endregion #region 判断及查找流程 @@ -214,8 +225,9 @@ namespace WindowsFormsApp1 var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData); if (!writeresult.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); } continue; @@ -254,9 +266,36 @@ namespace WindowsFormsApp1 continue; } } + if (nowflow.dzscan) + { + //扫码 + ScanForm_DZ scanForm = new ScanForm_DZ(); + DialogResult scan_result = scanForm.ShowDialog(); + if (scan_result == DialogResult.OK) + { + string returnValue = scanForm.ReturnValue; + otherdata.JS_SN = returnValue; + + Init.ScanString = returnValue; + } + else + { + continue; + } + } if (nowflow.finalpressurecurve) { //压力曲线 + var pressurecurveaddress_result = siemensHelp.ReadAddress(pressurecurveaddress); + if (!pressurecurveaddress_result.Success) + { + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); + LogExecute.logNet.WriteError($"{Plc.plcip}压力曲线数据地址处理错误:处理停止"); + continue; + } + otherdata.FinalPressureCurve = pressurecurveaddress_result.Data; } //if (nowflow.finaltorquecurve) //{ @@ -268,8 +307,9 @@ namespace WindowsFormsApp1 var finaltorquevalue_result = siemensHelp.ReadAddress(torqueaddress); if (!finaltorquevalue_result.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止"); continue; } @@ -286,8 +326,9 @@ namespace WindowsFormsApp1 var finalanglevaluue_result = siemensHelp.ReadAddress(angleaddress); if (!finalanglevaluue_result.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止"); continue; } @@ -301,13 +342,20 @@ namespace WindowsFormsApp1 #region 调用后端接口 var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata); + if (result.IsShow) + { + MES提示信息.Visible = true; + MES提示信息.Text = DateTime.Now.ToString("HH:mm:ss") + ":" + result.Msg; + } + if (result.Success) { var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData); if (!writeresult.Success) { - PLC链接状态.Text = "PLC链接状态:NG"; - PLC链接状态.BackColor = Color.Red; + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); continue; } @@ -347,20 +395,27 @@ namespace WindowsFormsApp1 } #region 开始及结束处理按钮 + private void 开始处理_Click(object sender, EventArgs e) { if (开始处理.Text == "开始处理") { SQLiteHelper sQLiteHelper_plc = new db.SQLiteHelper(); - var plc_sqlresult = sQLiteHelper_plc.QueryAll(); + var plc_sqlresult = sQLiteHelper_plc.QuerySingle(a=>a.id == Init.t_Line.plcid); if (!plc_sqlresult.Success) { MessageBox.Show("无法初始化PLC信息,无法开始处理!"); return; } - var plc_result = plc_sqlresult.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id)); + SQLiteHelper sQLiteHelper_key = new db.SQLiteHelper(); + var key_sqlresult = sQLiteHelper_key.QueryAll(); + if (!key_sqlresult.Success) + { + MessageBox.Show("无法初始化信息信息,无法开始处理!"); + return; + } SQLiteHelper sQLiteHelper_flow = new db.SQLiteHelper(); var flow_result = sQLiteHelper_flow.Query(a => a.flowid == Init.t_Line.flowid); @@ -394,6 +449,14 @@ namespace WindowsFormsApp1 return; } + SQLiteHelper sQLiteHelper_pressurecurve = new db.SQLiteHelper(); + var pressurecurve_result = sQLiteHelper_pressurecurve.QueryAll(); + if (!pressurecurve_result.Success) + { + MessageBox.Show("无法初始化压力曲线信息,无法开始处理!"); + return; + } + SQLiteHelper sQLiteHelper_interface = new db.SQLiteHelper(); var interface_result = sQLiteHelper_interface.QueryAll(); if (!interface_result.Success) @@ -418,7 +481,9 @@ namespace WindowsFormsApp1 Init.t_Plcaddresses = address_result.Data; Init.t_Angleaddresses = angleaddress_result.Data; Init.t_Torqueaddresses = torqueaddress_result.Data; + Init.t_Pressurecurves = pressurecurve_result.Data; Init.t_Interfaces = interface_result.Data; + Init.t_Keyvalues = key_sqlresult.Data; #endregion #region 初始化COM口服务 try @@ -463,6 +528,8 @@ namespace WindowsFormsApp1 底部注释2.Text = "气密仪COM-Ready"; 底部注释2.Visible = true; } + + 胶水上下线.Enabled = true; } } } @@ -474,19 +541,17 @@ namespace WindowsFormsApp1 #endregion Init.threadHelps = new List(); - foreach (var plc in plc_result) + var plc = plc_sqlresult.Data; + plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout); + ThreadHelp threadHelp = new ThreadHelp(); + if (!threadHelp.isrunning1) { - plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout); - ThreadHelp threadHelp = new ThreadHelp(); - if (!threadHelp.isrunning1) - { - threadHelp.cancellationTokenSource1 = new CancellationTokenSource(); - threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token)); - threadHelp.Thread.Start(); - threadHelp.isrunning1 = true; - } - Init.threadHelps.Add(threadHelp); + threadHelp.cancellationTokenSource1 = new CancellationTokenSource(); + threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token)); + threadHelp.Thread.Start(); + threadHelp.isrunning1 = true; } + Init.threadHelps.Add(threadHelp); 开始处理.Text = "停止处理"; 开始处理.BackColor = Color.Red; @@ -546,12 +611,6 @@ namespace WindowsFormsApp1 lINE_Manage.ShowDialog(); } - private void 产线关联PLC管理ToolStripMenuItem_Click(object sender, EventArgs e) - { - LinePLC_Manage lINEPLC_Manage = new LinePLC_Manage(); - lINEPLC_Manage.ShowDialog(); - } - private void 系统参数配置ToolStripMenuItem_Click(object sender, EventArgs e) { KeyValue keyValue = new KeyValue(); @@ -656,16 +715,15 @@ namespace WindowsFormsApp1 MES通讯时间.Text = "MES通讯时间:None"; MES通讯时间.BackColor = SystemColors.Control; - PLC链接状态.Text = "PLC链接状态:None"; - PLC链接状态.BackColor = SystemColors.Control; + PLC1名称.Visible = false; - PLC通讯时间.Text = "PLC通讯时间:None"; - PLC通讯时间.BackColor = SystemColors.Control; + PLC1状态.Visible = false; - 机台状态.Text = "机台状态:None"; - 机台状态.BackColor = SystemColors.Control; + PLC1机台状态.Visible = false; - 胶水上下线.Enabled = false; + PLC1时间.Visible = false; + + //胶水上下线.Enabled = false; MES提示信息.Visible = false; LOT号.Visible = false; @@ -693,6 +751,83 @@ namespace WindowsFormsApp1 底部注释4.Visible = false; 底部注释5.Visible = false; + 剩余寿命.Visible = false; + barcode1.Visible = false; + barcode2.Visible = false; + barcode3.Visible = false; + barcode4.Visible = false; + barcode5.Visible = false; + barcode6.Visible = false; + barcode7.Visible = false; + barcode8.Visible = false; + barcode9.Visible = false; + + } + + public void ChangeBarcode() + { + 剩余寿命.Visible = true; + barcode1.Visible = true; + barcode2.Visible = true; + barcode3.Visible = true; + barcode4.Visible = true; + barcode5.Visible = true; + barcode6.Visible = true; + barcode7.Visible = true; + barcode8.Visible = true; + barcode9.Visible = true; + + var power = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Power"); + var i_barcode1 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1"); + var i_barcode2 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode2"); + var i_barcode3 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode3"); + var i_barcode4 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode4"); + var i_barcode5 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode5"); + var i_barcode6 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode6"); + var i_barcode7 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode7"); + var i_barcode8 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode8"); + var i_barcode9 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode9"); + + 剩余寿命.Text = power == null ? "": power.value; + barcode1.Text = i_barcode1 == null ? "":i_barcode1.value; + barcode2.Text = i_barcode2 == null ? "":i_barcode2.value; + barcode3.Text = i_barcode3 == null ? "":i_barcode3.value; + barcode4.Text = i_barcode4 == null ? "":i_barcode4.value; + barcode5.Text = i_barcode5 == null ? "":i_barcode5.value; + barcode6.Text = i_barcode6 == null ? "":i_barcode6.value; + barcode7.Text = i_barcode7 == null ? "":i_barcode7.value; + barcode8.Text = i_barcode8 == null ? "":i_barcode8.value; + barcode9.Text = i_barcode9 == null ? "":i_barcode9.value; + } + + public void PLC_Form(t_plc plc, plcstate state, DateTime time) + { + string plcname = plc.plcname + ":" + plc.plcip; + string datetime = time.ToString("HH:mm:ss"); + PLC1名称.Visible = true; + PLC1状态.Visible = true; + PLC1机台状态.Visible = true; + PLC1时间.Visible = true; + PLC1名称.Text = plcname; + PLC1状态.Text = state.ToString(); + PLC1机台状态.Text = Enum.GetName(typeof(plcstatus), Init.Plcstatus); + PLC1时间.Text = datetime; + if (PLC1状态.Text == plcstate.NG.ToString()) + { + PLC1状态.BackColor = Color.Red; + } + else + { + PLC1状态.BackColor = SystemColors.Control; + } + if (PLC1机台状态.Text == plcstatus.停机.ToString()) + { + PLC1机台状态.BackColor = Color.Red; + } + else + { + PLC1机台状态.BackColor = SystemColors.Control; + } } public void MES_MsgfORM(string name, mesresult result, DateTime dateTime) @@ -808,14 +943,8 @@ namespace WindowsFormsApp1 #region 其他业务处理 private void 胶水上下线_Click(object sender, EventArgs e) { - ScanForm scanForm = new ScanForm(); + ScanForm_SSQ scanForm = new ScanForm_SSQ(); DialogResult result = scanForm.ShowDialog(); - if (result == DialogResult.OK) - { - string returnValue = scanForm.ReturnValue; - MessageBox.Show($"返回值是:{returnValue}"); - //调用三防漆之类的接口 - } } public void AirtightPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { @@ -896,8 +1025,6 @@ namespace WindowsFormsApp1 LogExecute.logNet.WriteError($"通过气密仪获取到压力参数失败,错误原因{ex.Message}"); } } - - #endregion diff --git a/WindowsFormsApp1/Program.cs b/WindowsFormsApp1/Program.cs index 54a1787..bf5ae90 100644 --- a/WindowsFormsApp1/Program.cs +++ b/WindowsFormsApp1/Program.cs @@ -46,9 +46,11 @@ namespace WindowsFormsApp1 public static List t_Angleaddresses; public static List t_Torqueaddresses; + public static List t_Pressurecurves; + + public static List t_Keyvalues; public static t_line t_Line; - public static List t_Lineplcs; public static List threadHelps; public static string ScanString; diff --git a/WindowsFormsApp1/form/Angleaddress_Manage.Designer.cs b/WindowsFormsApp1/form/Angleaddress_Manage.Designer.cs index 85ec473..e4a7bb2 100644 --- a/WindowsFormsApp1/form/Angleaddress_Manage.Designer.cs +++ b/WindowsFormsApp1/form/Angleaddress_Manage.Designer.cs @@ -34,10 +34,6 @@ this.关闭 = new System.Windows.Forms.Button(); this.查询 = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.label1 = new System.Windows.Forms.Label(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.code = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -47,6 +43,8 @@ this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -83,8 +81,8 @@ this.dataGridView1.AllowUserToDeleteRows = false; dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; @@ -114,77 +112,16 @@ dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3; - this.dataGridView1.Location = new System.Drawing.Point(6, 127); + this.dataGridView1.Location = new System.Drawing.Point(6, 5); this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersWidth = 72; - this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3); + this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4); this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1624, 682); + this.dataGridView1.Size = new System.Drawing.Size(1624, 804); this.dataGridView1.TabIndex = 8; // - // label1 - // - this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(4, 27); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(253, 68); - this.label1.TabIndex = 12; - this.label1.Text = "选择需要编辑的PLC编号:"; - // - // comboBox1 - // - this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(278, 40); - this.comboBox1.Margin = new System.Windows.Forms.Padding(4); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(409, 41); - this.comboBox1.TabIndex = 13; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); - this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); - this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); - this.tableLayoutPanel1.TabIndex = 14; - // - // button1 - // - this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; - this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(1650, 541); - this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(153, 56); - this.button1.TabIndex = 15; - this.button1.Text = "新增"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // // id // this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -270,7 +207,42 @@ this.remark.Name = "remark"; this.remark.ReadOnly = true; // - // PlcAddress_Manage + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); + this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); + this.tableLayoutPanel1.TabIndex = 14; + // + // button1 + // + this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1650, 541); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(153, 56); + this.button1.TabIndex = 15; + this.button1.Text = "新增"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Angleaddress_Manage // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -278,14 +250,13 @@ this.Controls.Add(this.tableLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "PlcAddress_Manage"; + this.Name = "Angleaddress_Manage"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "PLCADDRESS_Manage"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -295,8 +266,6 @@ private System.Windows.Forms.Button 关闭; private System.Windows.Forms.Button 查询; private System.Windows.Forms.DataGridView dataGridView1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Button button1; private System.Windows.Forms.DataGridViewTextBoxColumn id; diff --git a/WindowsFormsApp1/form/Angleaddress_Manage.cs b/WindowsFormsApp1/form/Angleaddress_Manage.cs index 9a75b35..a2210ea 100644 --- a/WindowsFormsApp1/form/Angleaddress_Manage.cs +++ b/WindowsFormsApp1/form/Angleaddress_Manage.cs @@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form private void 查询_Click(object sender, EventArgs e) { - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } private void 保存_Click(object sender, EventArgs e) @@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form if (result.Success) { MessageBox.Show("更新成功"); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else { @@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form return; } - var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id)); - - // 绑定数据源到 ComboBox - comboBox1.DataSource = list; - comboBox1.DisplayMember = "plcname"; - comboBox1.ValueMember = "id"; - var result1 = new List { new {name = "read",value = "read"}, @@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form fLOW_Insert.dataid = selectid; fLOW_Insert.Operation = OperationType.Edit; fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else if (e.ColumnIndex == 10) @@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form { MessageBox.Show("删除失败"); } - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } } - public void GetInfo(int plcid) + public void GetInfo() { try { @@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); var result_plc = sQLiteHelper1.QueryAll(); - var result = sQLiteHelper.Query(a=>a.plcid == plcid); + var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid); if (result.Success) { List list = new List(); @@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form { Angleaddress_Insert fLOW_Insert = new Angleaddress_Insert(); fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } diff --git a/WindowsFormsApp1/form/LINE_Manage.Designer.cs b/WindowsFormsApp1/form/LINE_Manage.Designer.cs index b50b3ed..e110bcb 100644 --- a/WindowsFormsApp1/form/LINE_Manage.Designer.cs +++ b/WindowsFormsApp1/form/LINE_Manage.Designer.cs @@ -34,14 +34,18 @@ this.关闭 = new System.Windows.Forms.Button(); this.查询 = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.新增 = new System.Windows.Forms.Button(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lineremark1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lineremark2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lineremark3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.新增 = new System.Windows.Forms.Button(); + this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -96,7 +100,11 @@ this.linecode, this.linetype, this.linemode, - this.flowname}); + this.lineremark1, + this.lineremark2, + this.lineremark3, + this.flowname, + this.plcname}); dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -115,6 +123,40 @@ this.dataGridView1.Size = new System.Drawing.Size(1584, 819); this.dataGridView1.TabIndex = 7; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829); + this.tableLayoutPanel1.TabIndex = 11; + // + // 新增 + // + this.新增.Anchor = System.Windows.Forms.AnchorStyles.None; + this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.新增.Location = new System.Drawing.Point(1604, 542); + this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.新增.Name = "新增"; + this.新增.Size = new System.Drawing.Size(162, 72); + this.新增.TabIndex = 11; + this.新增.Text = "新增"; + this.新增.UseVisualStyleBackColor = true; + this.新增.Click += new System.EventHandler(this.新增_Click); + // // id // this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -160,6 +202,39 @@ this.linemode.Name = "linemode"; this.linemode.ReadOnly = true; // + // lineremark1 + // + this.lineremark1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.lineremark1.DataPropertyName = "lineremark1"; + this.lineremark1.HeaderText = "备用显示1"; + this.lineremark1.MinimumWidth = 9; + this.lineremark1.Name = "lineremark1"; + this.lineremark1.ReadOnly = true; + this.lineremark1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.lineremark1.ToolTipText = "lineremark1"; + // + // lineremark2 + // + this.lineremark2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.lineremark2.DataPropertyName = "lineremark2"; + this.lineremark2.HeaderText = "备用显示2"; + this.lineremark2.MinimumWidth = 9; + this.lineremark2.Name = "lineremark2"; + this.lineremark2.ReadOnly = true; + this.lineremark2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.lineremark2.ToolTipText = "lineremark2"; + // + // lineremark3 + // + this.lineremark3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.lineremark3.DataPropertyName = "lineremark3"; + this.lineremark3.HeaderText = "备用显示3"; + this.lineremark3.MinimumWidth = 9; + this.lineremark3.Name = "lineremark3"; + this.lineremark3.ReadOnly = true; + this.lineremark3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.lineremark3.ToolTipText = "lineremark3"; + // // flowname // this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -172,41 +247,18 @@ this.flowname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.flowname.ToolTipText = "flowname"; // - // tableLayoutPanel1 + // plcname // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829); - this.tableLayoutPanel1.TabIndex = 11; + this.plcname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.plcname.DataPropertyName = "plcname"; + this.plcname.HeaderText = "关联PLC"; + this.plcname.MinimumWidth = 9; + this.plcname.Name = "plcname"; + this.plcname.ReadOnly = true; + this.plcname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.plcname.ToolTipText = "plcname"; // - // 新增 - // - this.新增.Anchor = System.Windows.Forms.AnchorStyles.None; - this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.新增.Location = new System.Drawing.Point(1604, 542); - this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.新增.Name = "新增"; - this.新增.Size = new System.Drawing.Size(162, 72); - this.新增.TabIndex = 11; - this.新增.Text = "新增"; - this.新增.UseVisualStyleBackColor = true; - this.新增.Click += new System.EventHandler(this.新增_Click); - // - // LINE_Manage + // Line_Manage // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -214,7 +266,7 @@ this.Controls.Add(this.tableLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "LINE_Manage"; + this.Name = "Line_Manage"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "LINE_Mange"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; @@ -237,6 +289,10 @@ private System.Windows.Forms.DataGridViewTextBoxColumn linecode; private System.Windows.Forms.DataGridViewTextBoxColumn linetype; private System.Windows.Forms.DataGridViewTextBoxColumn linemode; + private System.Windows.Forms.DataGridViewTextBoxColumn lineremark1; + private System.Windows.Forms.DataGridViewTextBoxColumn lineremark2; + private System.Windows.Forms.DataGridViewTextBoxColumn lineremark3; private System.Windows.Forms.DataGridViewTextBoxColumn flowname; + private System.Windows.Forms.DataGridViewTextBoxColumn plcname; } } \ No newline at end of file diff --git a/WindowsFormsApp1/form/LINE_Manage.cs b/WindowsFormsApp1/form/LINE_Manage.cs index 04c20ec..4f88208 100644 --- a/WindowsFormsApp1/form/LINE_Manage.cs +++ b/WindowsFormsApp1/form/LINE_Manage.cs @@ -55,7 +55,7 @@ namespace WindowsFormsApp1.form DataGridViewRow row = dataGridView.Rows[e.RowIndex]; int selectid = int.Parse(row.Cells[0].Value.ToString()); - if (e.ColumnIndex == 6) + if (e.ColumnIndex == 10) { Line_Insert fLOW_Insert = new Line_Insert(); fLOW_Insert.dataid = selectid; @@ -72,9 +72,11 @@ namespace WindowsFormsApp1.form { SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); - var result_flow = sQLiteHelper1.QueryAll(); + SQLiteHelper sQLiteHelper2 = new db.SQLiteHelper(); + var result_flow = sQLiteHelper1.Query(a=>a.flowid == Init.t_Line.flowid); var result_line = sQLiteHelper.Query(a=>a.id == Init.t_Line.id); - if (!result_line.Success || !result_flow.Success) + var result_plc = sQLiteHelper2.Query(a=>a.id == Init.t_Line.plcid); + if (!result_line.Success || !result_flow.Success || !result_plc.Success) { MessageBox.Show("查询失败!"); return; @@ -85,6 +87,7 @@ namespace WindowsFormsApp1.form foreach (var line in result_line.Data) { var flowname = result_flow.Data.FirstOrDefault(a=>a.flowid == line.flowid); + var plcname = result_plc.Data.FirstOrDefault(a=>a.id == line.plcid); list.Add( new { id = line.id, @@ -94,6 +97,10 @@ namespace WindowsFormsApp1.form linetype = line.linetype, linemode = line.linemode, flowname = flowname.flowname, + plcname = plcname.plcname, + lineremark1 = line.lineremark1, + lineremark2 = line.lineremark2, + lineremark3 = line.lineremark3, }); } diff --git a/WindowsFormsApp1/form/LINE_Manage.resx b/WindowsFormsApp1/form/LINE_Manage.resx index 17100db..ff21c28 100644 --- a/WindowsFormsApp1/form/LINE_Manage.resx +++ b/WindowsFormsApp1/form/LINE_Manage.resx @@ -132,7 +132,19 @@ True + + True + + + True + + + True + True + + True + \ No newline at end of file diff --git a/WindowsFormsApp1/form/LinePLC_Manage.Designer.cs b/WindowsFormsApp1/form/LinePLC_Manage.Designer.cs deleted file mode 100644 index 02091d3..0000000 --- a/WindowsFormsApp1/form/LinePLC_Manage.Designer.cs +++ /dev/null @@ -1,206 +0,0 @@ -namespace WindowsFormsApp1.form -{ - partial class LinePLC_Manage - { - /// - /// 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() - { - 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.关闭 = new System.Windows.Forms.Button(); - this.查询 = new System.Windows.Forms.Button(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.新增 = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // 关闭 - // - this.关闭.Anchor = System.Windows.Forms.AnchorStyles.None; - this.关闭.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.关闭.Location = new System.Drawing.Point(1604, 709); - this.关闭.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.关闭.Name = "关闭"; - this.关闭.Size = new System.Drawing.Size(162, 72); - this.关闭.TabIndex = 10; - this.关闭.Text = "关闭"; - this.关闭.UseVisualStyleBackColor = true; - this.关闭.Click += new System.EventHandler(this.关闭_Click); - // - // 查询 - // - this.查询.Anchor = System.Windows.Forms.AnchorStyles.None; - this.查询.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.查询.Location = new System.Drawing.Point(1604, 46); - this.查询.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.查询.Name = "查询"; - this.查询.Size = new System.Drawing.Size(162, 72); - this.查询.TabIndex = 8; - this.查询.Text = "查询"; - this.查询.UseVisualStyleBackColor = true; - this.查询.Click += new System.EventHandler(this.查询_Click); - // - // dataGridView1 - // - this.dataGridView1.AllowUserToAddRows = false; - this.dataGridView1.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.id, - this.linename, - this.flowname}); - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3; - this.dataGridView1.Location = new System.Drawing.Point(6, 5); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.ReadOnly = true; - this.dataGridView1.RowHeadersWidth = 72; - this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4); - this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1584, 819); - this.dataGridView1.TabIndex = 7; - // - // id - // - this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.id.DataPropertyName = "id"; - this.id.HeaderText = "序号"; - this.id.MinimumWidth = 9; - this.id.Name = "id"; - this.id.ReadOnly = true; - // - // linename - // - this.linename.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.linename.DataPropertyName = "linename"; - this.linename.HeaderText = "产线名称"; - this.linename.MinimumWidth = 9; - this.linename.Name = "linename"; - this.linename.ReadOnly = true; - // - // flowname - // - this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.flowname.DataPropertyName = "plcname"; - this.flowname.HeaderText = "关联PLC"; - this.flowname.MinimumWidth = 9; - this.flowname.Name = "flowname"; - this.flowname.ReadOnly = true; - this.flowname.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.flowname.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.flowname.ToolTipText = "plcname"; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.Controls.Add(this.关闭, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.查询, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.新增, 1, 2); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1774, 829); - this.tableLayoutPanel1.TabIndex = 11; - // - // 新增 - // - this.新增.Anchor = System.Windows.Forms.AnchorStyles.None; - this.新增.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.新增.Location = new System.Drawing.Point(1604, 542); - this.新增.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.新增.Name = "新增"; - this.新增.Size = new System.Drawing.Size(162, 72); - this.新增.TabIndex = 11; - this.新增.Text = "新增"; - this.新增.UseVisualStyleBackColor = true; - this.新增.Click += new System.EventHandler(this.新增_Click); - // - // LINEPLC_Manage - // - this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1774, 829); - this.Controls.Add(this.tableLayoutPanel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "LINEPLC_Manage"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "LINE_Mange"; - this.WindowState = System.Windows.Forms.FormWindowState.Maximized; - this.Load += new System.EventHandler(this.LINE_Manage_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); - this.tableLayoutPanel1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button 关闭; - private System.Windows.Forms.Button 查询; - private System.Windows.Forms.DataGridView dataGridView1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Button 新增; - private System.Windows.Forms.DataGridViewTextBoxColumn id; - private System.Windows.Forms.DataGridViewTextBoxColumn linename; - private System.Windows.Forms.DataGridViewTextBoxColumn flowname; - } -} \ No newline at end of file diff --git a/WindowsFormsApp1/form/LinePLC_Manage.cs b/WindowsFormsApp1/form/LinePLC_Manage.cs deleted file mode 100644 index 709b14a..0000000 --- a/WindowsFormsApp1/form/LinePLC_Manage.cs +++ /dev/null @@ -1,148 +0,0 @@ -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 WindowsFormsApp1.db; -using WindowsFormsApp1.mod; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; - -namespace WindowsFormsApp1.form -{ - public partial class LinePLC_Manage : Form - { - public LinePLC_Manage() - { - InitializeComponent(); - } - - private void 查询_Click(object sender, EventArgs e) - { - GetInfo(); - } - - private void 关闭_Click(object sender, EventArgs e) - { - this.Close(); - } - - private void LINE_Manage_Load(object sender, EventArgs e) - { - dataGridView1.AutoGenerateColumns = false; - - // 添加修改按钮列 - DataGridViewButtonColumn modifyColumn = new DataGridViewButtonColumn(); - modifyColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - modifyColumn.Name = "ModifyColumn"; - modifyColumn.HeaderText = "修改"; - modifyColumn.Text = "修改"; - modifyColumn.UseColumnTextForButtonValue = true; - dataGridView1.Columns.Add(modifyColumn); - - // 添加删除按钮列 - DataGridViewButtonColumn deleteColumn = new DataGridViewButtonColumn(); - deleteColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - deleteColumn.Name = "DeleteColumn"; - deleteColumn.HeaderText = "删除"; - deleteColumn.Text = "删除"; - deleteColumn.UseColumnTextForButtonValue = true; - dataGridView1.Columns.Add(deleteColumn); - - dataGridView1.CellContentClick += DataGridView1_CellContentClick; - GetInfo(); - } - private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) - { - // 检查点击的是否为按钮列 - if (e.RowIndex >= 0) - { - DataGridView dataGridView = (DataGridView)sender; - DataGridViewRow row = dataGridView.Rows[e.RowIndex]; - - int selectid = int.Parse(row.Cells[0].Value.ToString()); - if (e.ColumnIndex == 3) - { - LinePLC_Insert fLOW_Insert = new LinePLC_Insert(); - fLOW_Insert.dataid = selectid; - fLOW_Insert.Operation = OperationType.Edit; - fLOW_Insert.ShowDialog(); - GetInfo(); - - } - else if (e.ColumnIndex == 4) - { - DialogResult result = MessageBox.Show("你确定要删除数据吗?", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); - - if (result == DialogResult.OK) - { - SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); - var delresult = sQLiteHelper.Delete(selectid); - if (delresult.Success) - { - MessageBox.Show("删除成功"); - } - else - { - MessageBox.Show("删除失败"); - } - GetInfo(); - } - } - } - } - public void GetInfo() - { - try - { - SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); - SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); - SQLiteHelper sQLiteHelper2 = new db.SQLiteHelper(); - var result_plc = sQLiteHelper.QueryAll(); - var result_line = sQLiteHelper1.QueryAll(); - var result_lineplc = sQLiteHelper2.QueryAll(); - - - if (!result_line.Success || !result_plc.Success || !result_lineplc.Success) - { - MessageBox.Show("查询失败!"); - return; - } - else - { - List list = new List(); - foreach (var line in result_lineplc.Data) - { - var linename = result_line.Data.FirstOrDefault(a=>a.id == line.lineid); - var plcname = result_plc.Data.FirstOrDefault(a => a.id == line.plcid); - list.Add( new - { - id = line.id, - lineid = line.lineid, - plcid = line.plcid, - linename = linename.linename, - plcname = plcname.plcname, - }); - } - - dataGridView1.DataSource = null; - dataGridView1.DataSource = list; - dataGridView1.Refresh(); - } - } - catch (Exception ex) - { - } - } - - private void 新增_Click(object sender, EventArgs e) - { - LinePLC_Insert fLOW_Insert = new LinePLC_Insert(); - fLOW_Insert.ShowDialog(); - GetInfo(); - } - } -} diff --git a/WindowsFormsApp1/form/LoginForm.cs b/WindowsFormsApp1/form/LoginForm.cs index 1119101..b1c7283 100644 --- a/WindowsFormsApp1/form/LoginForm.cs +++ b/WindowsFormsApp1/form/LoginForm.cs @@ -42,17 +42,8 @@ namespace WindowsFormsApp1 } else { - SQLiteHelper sQLiteHelper_lineplc = new db.SQLiteHelper(); - var lineplc_result = sQLiteHelper_lineplc.Query(a => a.lineid == result_combox.Data.id); - if (!lineplc_result.Success) - { - MessageBox.Show("无法初始化PLC-产线关联信息!"); - return; - } - Init.t_User = result.Data; Init.t_Line = result_combox.Data; - Init.t_Lineplcs = lineplc_result.Data; DialogResult = DialogResult.OK; this.Close(); } diff --git a/WindowsFormsApp1/form/PLCADDRESS_Manage.Designer.cs b/WindowsFormsApp1/form/PLCADDRESS_Manage.Designer.cs index df64993..d2d8dcd 100644 --- a/WindowsFormsApp1/form/PLCADDRESS_Manage.Designer.cs +++ b/WindowsFormsApp1/form/PLCADDRESS_Manage.Designer.cs @@ -34,10 +34,6 @@ this.关闭 = new System.Windows.Forms.Button(); this.查询 = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.label1 = new System.Windows.Forms.Label(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.code = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -47,6 +43,8 @@ this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -114,77 +112,16 @@ dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3; - this.dataGridView1.Location = new System.Drawing.Point(6, 127); + this.dataGridView1.Location = new System.Drawing.Point(6, 5); this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersWidth = 72; - this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3); + this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4); this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1624, 682); + this.dataGridView1.Size = new System.Drawing.Size(1624, 804); this.dataGridView1.TabIndex = 8; // - // label1 - // - this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(4, 27); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(253, 68); - this.label1.TabIndex = 12; - this.label1.Text = "选择需要编辑的PLC编号:"; - // - // comboBox1 - // - this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(278, 40); - this.comboBox1.Margin = new System.Windows.Forms.Padding(4); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(409, 41); - this.comboBox1.TabIndex = 13; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); - this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); - this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); - this.tableLayoutPanel1.TabIndex = 14; - // - // button1 - // - this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; - this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(1650, 541); - this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(153, 56); - this.button1.TabIndex = 15; - this.button1.Text = "新增"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // // id // this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -270,6 +207,41 @@ this.remark.Name = "remark"; this.remark.ReadOnly = true; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); + this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); + this.tableLayoutPanel1.TabIndex = 14; + // + // button1 + // + this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1650, 541); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(153, 56); + this.button1.TabIndex = 15; + this.button1.Text = "新增"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // PlcAddress_Manage // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); @@ -285,7 +257,6 @@ this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -295,8 +266,6 @@ private System.Windows.Forms.Button 关闭; private System.Windows.Forms.Button 查询; private System.Windows.Forms.DataGridView dataGridView1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Button button1; private System.Windows.Forms.DataGridViewTextBoxColumn id; diff --git a/WindowsFormsApp1/form/PLCADDRESS_Manage.cs b/WindowsFormsApp1/form/PLCADDRESS_Manage.cs index 20c997b..e8e733d 100644 --- a/WindowsFormsApp1/form/PLCADDRESS_Manage.cs +++ b/WindowsFormsApp1/form/PLCADDRESS_Manage.cs @@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form private void 查询_Click(object sender, EventArgs e) { - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } private void 保存_Click(object sender, EventArgs e) @@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form if (result.Success) { MessageBox.Show("更新成功"); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else { @@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form return; } - var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id)); - - // 绑定数据源到 ComboBox - comboBox1.DataSource = list; - comboBox1.DisplayMember = "plcname"; - comboBox1.ValueMember = "id"; - var result1 = new List { new {name = "read",value = "read"}, @@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form fLOW_Insert.dataid = selectid; fLOW_Insert.Operation = OperationType.Edit; fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else if (e.ColumnIndex == 10) @@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form { MessageBox.Show("删除失败"); } - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } } - public void GetInfo(int plcid) + public void GetInfo() { try { @@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); var result_plc = sQLiteHelper1.QueryAll(); - var result = sQLiteHelper.Query(a=>a.plcid == plcid); + var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid); if (result.Success) { List list = new List(); @@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form { PlcAddress_Insert fLOW_Insert = new PlcAddress_Insert(); fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } diff --git a/WindowsFormsApp1/form/PLC_Manage.cs b/WindowsFormsApp1/form/PLC_Manage.cs index af97e9f..db9a4a0 100644 --- a/WindowsFormsApp1/form/PLC_Manage.cs +++ b/WindowsFormsApp1/form/PLC_Manage.cs @@ -118,13 +118,11 @@ namespace WindowsFormsApp1.form try { SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); - var result = sQLiteHelper.QueryAll(); + var result = sQLiteHelper.Query(a=>a.id == Init.t_Line.plcid); if (result.Success) { - var list = result.Data.FindAll(a=>Init.t_Lineplcs.Select(p=>p.plcid).Contains(a.id)); - dataGridView1.DataSource = null; - dataGridView1.DataSource = list; + dataGridView1.DataSource = result.Data; dataGridView1.Refresh(); } } diff --git a/WindowsFormsApp1/form/ScanForm_DZ.Designer.cs b/WindowsFormsApp1/form/ScanForm_DZ.Designer.cs new file mode 100644 index 0000000..24286eb --- /dev/null +++ b/WindowsFormsApp1/form/ScanForm_DZ.Designer.cs @@ -0,0 +1,382 @@ +using System; +using System.Windows.Forms; +using WindowsFormsApp1.server; + +namespace WindowsFormsApp1 +{ + partial class ScanForm_DZ + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.确认 = new System.Windows.Forms.Button(); + this.取消 = new System.Windows.Forms.Button(); + this.端子2结果 = new System.Windows.Forms.Label(); + this.端子3结果 = new System.Windows.Forms.Label(); + this.端子1 = new System.Windows.Forms.Label(); + this.端子2 = new System.Windows.Forms.Label(); + this.端子3 = new System.Windows.Forms.Label(); + this.端子1结果 = new System.Windows.Forms.Label(); + this.请扫描条码 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.端子1校验 = new System.Windows.Forms.Label(); + this.端子2校验 = new System.Windows.Forms.Label(); + this.端子3校验 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.groupBox1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.tableLayoutPanel1); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.groupBox1.Size = new System.Drawing.Size(1647, 704); + this.groupBox1.TabIndex = 5; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "端子扫码"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 9; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.Controls.Add(this.button3, 7, 4); + this.tableLayoutPanel1.Controls.Add(this.button2, 7, 3); + this.tableLayoutPanel1.Controls.Add(this.button1, 7, 2); + this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.取消, 6, 6); + this.tableLayoutPanel1.Controls.Add(this.端子2结果, 6, 3); + this.tableLayoutPanel1.Controls.Add(this.端子3结果, 6, 4); + this.tableLayoutPanel1.Controls.Add(this.端子1, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.端子2, 3, 3); + this.tableLayoutPanel1.Controls.Add(this.端子3, 3, 4); + this.tableLayoutPanel1.Controls.Add(this.端子1结果, 6, 2); + this.tableLayoutPanel1.Controls.Add(this.请扫描条码, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.label6, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.label7, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.label8, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.端子1校验, 5, 2); + this.tableLayoutPanel1.Controls.Add(this.端子2校验, 5, 3); + this.tableLayoutPanel1.Controls.Add(this.端子3校验, 5, 4); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 8; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662); + this.tableLayoutPanel1.TabIndex = 0; + // + // button3 + // + this.button3.Dock = System.Windows.Forms.DockStyle.Fill; + this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.Location = new System.Drawing.Point(1390, 372); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(157, 106); + this.button3.TabIndex = 14; + this.button3.Text = "清空条码"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button2 + // + this.button2.Dock = System.Windows.Forms.DockStyle.Fill; + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(1390, 260); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(157, 106); + this.button2.TabIndex = 13; + this.button2.Text = "清空条码"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click_1); + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Fill; + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1390, 148); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(157, 106); + this.button1.TabIndex = 12; + this.button1.Text = "清空条码"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click_1); + // + // 确认 + // + this.确认.Dock = System.Windows.Forms.DockStyle.Fill; + this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.确认.Location = new System.Drawing.Point(84, 517); + this.确认.Name = "确认"; + this.确认.Size = new System.Drawing.Size(321, 106); + this.确认.TabIndex = 2; + this.确认.Text = "确认"; + this.确认.UseVisualStyleBackColor = true; + this.确认.Click += new System.EventHandler(this.button1_Click); + // + // 取消 + // + this.tableLayoutPanel1.SetColumnSpan(this.取消, 2); + this.取消.Dock = System.Windows.Forms.DockStyle.Fill; + this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.取消.Location = new System.Drawing.Point(1227, 517); + this.取消.Name = "取消"; + this.取消.Size = new System.Drawing.Size(320, 106); + this.取消.TabIndex = 3; + this.取消.Text = "取消"; + this.取消.UseVisualStyleBackColor = true; + this.取消.Click += new System.EventHandler(this.button2_Click); + // + // 端子2结果 + // + this.端子2结果.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子2结果.AutoSize = true; + this.端子2结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子2结果.Location = new System.Drawing.Point(1274, 292); + this.端子2结果.Name = "端子2结果"; + this.端子2结果.Size = new System.Drawing.Size(62, 42); + this.端子2结果.TabIndex = 7; + this.端子2结果.Text = "NG"; + // + // 端子3结果 + // + this.端子3结果.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子3结果.AutoSize = true; + this.端子3结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子3结果.Location = new System.Drawing.Point(1274, 404); + this.端子3结果.Name = "端子3结果"; + this.端子3结果.Size = new System.Drawing.Size(62, 42); + this.端子3结果.TabIndex = 8; + this.端子3结果.Text = "OK"; + // + // 端子1 + // + this.端子1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子1.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.端子1, 2); + this.端子1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子1.Location = new System.Drawing.Point(645, 180); + this.端子1.Name = "端子1"; + this.端子1.Size = new System.Drawing.Size(260, 42); + this.端子1.TabIndex = 1; + this.端子1.Text = "12112312312"; + // + // 端子2 + // + this.端子2.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子2.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.端子2, 2); + this.端子2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子2.Location = new System.Drawing.Point(645, 292); + this.端子2.Name = "端子2"; + this.端子2.Size = new System.Drawing.Size(260, 42); + this.端子2.TabIndex = 6; + this.端子2.Text = "12112312312"; + // + // 端子3 + // + this.端子3.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子3.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.端子3, 2); + this.端子3.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子3.Location = new System.Drawing.Point(645, 404); + this.端子3.Name = "端子3"; + this.端子3.Size = new System.Drawing.Size(260, 42); + this.端子3.TabIndex = 5; + this.端子3.Text = "12112312312"; + // + // 端子1结果 + // + this.端子1结果.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子1结果.AutoSize = true; + this.端子1结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子1结果.Location = new System.Drawing.Point(1274, 180); + this.端子1结果.Name = "端子1结果"; + this.端子1结果.Size = new System.Drawing.Size(62, 42); + this.端子1结果.TabIndex = 4; + this.端子1结果.Text = "OK"; + // + // 请扫描条码 + // + this.请扫描条码.Anchor = System.Windows.Forms.AnchorStyles.None; + this.请扫描条码.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3); + this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.请扫描条码.ForeColor = System.Drawing.Color.Red; + this.请扫描条码.Location = new System.Drawing.Point(508, 61); + this.请扫描条码.Name = "请扫描条码"; + this.请扫描条码.Size = new System.Drawing.Size(452, 56); + this.请扫描条码.TabIndex = 0; + this.请扫描条码.Text = "请扫描端子条码:"; + // + // label6 + // + this.label6.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(160, 180); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(169, 42); + this.label6.TabIndex = 9; + this.label6.Text = "端子1:"; + // + // label7 + // + this.label7.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.Location = new System.Drawing.Point(160, 292); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(169, 42); + this.label7.TabIndex = 10; + this.label7.Text = "端子2:"; + // + // label8 + // + this.label8.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(160, 404); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(169, 42); + this.label8.TabIndex = 11; + this.label8.Text = "端子3:"; + // + // 端子1校验 + // + this.端子1校验.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子1校验.AutoSize = true; + this.端子1校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子1校验.Location = new System.Drawing.Point(1111, 180); + this.端子1校验.Name = "端子1校验"; + this.端子1校验.Size = new System.Drawing.Size(62, 42); + this.端子1校验.TabIndex = 15; + this.端子1校验.Text = "OK"; + // + // 端子2校验 + // + this.端子2校验.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子2校验.AutoSize = true; + this.端子2校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子2校验.Location = new System.Drawing.Point(1111, 292); + this.端子2校验.Name = "端子2校验"; + this.端子2校验.Size = new System.Drawing.Size(62, 42); + this.端子2校验.TabIndex = 16; + this.端子2校验.Text = "NG"; + // + // 端子3校验 + // + this.端子3校验.Anchor = System.Windows.Forms.AnchorStyles.None; + this.端子3校验.AutoSize = true; + this.端子3校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.端子3校验.Location = new System.Drawing.Point(1111, 404); + this.端子3校验.Name = "端子3校验"; + this.端子3校验.Size = new System.Drawing.Size(62, 42); + this.端子3校验.TabIndex = 17; + this.端子3校验.Text = "OK"; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 800; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // ScanForm_DZ + // + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1647, 704); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(4); + this.Name = "ScanForm_DZ"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "扫码界面"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScanForm_FormClosing); + this.groupBox1.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + private void ScanForm_FormClosing(object sender, FormClosingEventArgs e) + { + FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived"); + } + + #endregion + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label 请扫描条码; + private System.Windows.Forms.Label 端子1; + private System.Windows.Forms.Button 确认; + private System.Windows.Forms.Button 取消; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Label 端子2结果; + private System.Windows.Forms.Label 端子3结果; + private System.Windows.Forms.Label 端子2; + private System.Windows.Forms.Label 端子3; + private System.Windows.Forms.Label 端子1结果; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label 端子1校验; + private System.Windows.Forms.Label 端子2校验; + private System.Windows.Forms.Label 端子3校验; + } +} \ No newline at end of file diff --git a/WindowsFormsApp1/form/ScanForm_DZ.cs b/WindowsFormsApp1/form/ScanForm_DZ.cs new file mode 100644 index 0000000..931b503 --- /dev/null +++ b/WindowsFormsApp1/form/ScanForm_DZ.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO.Ports; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WindowsFormsApp1.db; +using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.database; +using WindowsFormsApp1.mod.server; +using WindowsFormsApp1.server; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace WindowsFormsApp1 +{ + public partial class ScanForm_DZ : Form + { + public ApiClient ApiClient = new ApiClient(); + public ScanForm_DZ() + { + InitializeComponent(); + Init.ScanPort.DataReceived += SerialPort_DataReceived; + 端子1.Text = ""; + 端子2.Text = ""; + 端子3.Text = ""; + + } + private void button1_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void timer1_Tick(object sender, EventArgs e) + { + if (请扫描条码.ForeColor == Color.Red) + { + 请扫描条码.ForeColor = Color.RosyBrown; + } + else + { + 请扫描条码.ForeColor = Color.Red; + } + } + + public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) + { + try + { + if (!Init.ScanPort.IsOpen) + { + Init.ScanPort?.Open(); + } + // 读取串口接收到的数据 + var dataBuilder = new StringBuilder(); + while(Init.ScanPort.BytesToRead > 0) + { + System.Threading.Thread.Sleep(100); + dataBuilder.Append(Init.ScanPort.ReadExisting()); + } + var barcode = dataBuilder.ToString(); + if (端子1.Text == barcode || 端子2.Text == barcode || 端子3.Text == barcode) + { + return; + } + + + if (string.IsNullOrWhiteSpace(端子1.Text)) + { + this.Invoke(new Action(() => + { + 端子1.Text = barcode; + })); + var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode }); + if (result.Success) + { + this.Invoke(new Action(() => + { + 端子1校验.Text = "校验OK"; + })); + //继续调用接口 + + this.Invoke(new Action(() => + { + button1.Visible = false; + })); + } + else + { + this.Invoke(new Action(() => + { + 端子1校验.Text = "校验NG"; + })); + } + } + else if (string.IsNullOrWhiteSpace(端子2.Text)) + { + this.Invoke(new Action(() => + { + 端子2.Text = barcode; + })); + var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode }); + if (result.Success) + { + this.Invoke(new Action(() => + { + 端子2校验.Text = "校验OK"; + })); + //继续调用接口 + + this.Invoke(new Action(() => + { + button2.Visible = false; + })); + } + else + { + this.Invoke(new Action(() => + { + 端子2校验.Text = "校验NG"; + })); + } + } + else if (string.IsNullOrWhiteSpace(端子3.Text)) + { + this.Invoke(new Action(() => + { + 端子3.Text = barcode; + })); + var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode }); + if (result.Success) + { + this.Invoke(new Action(() => + { + 端子3校验.Text = "校验OK"; + })); + + //继续调用接口 + this.Invoke(new Action(() => + { + button3.Visible = false; + })); + } + else + { + this.Invoke(new Action(() => + { + 端子3校验.Text = "校验NG"; + })); + + } + } + + + + //if (this.InvokeRequired) + //{ + // this.Invoke(new Action(() => + // { + // 端子1.Text = ReturnValue; + // 端子1.Visible = true; + // })); + //} + //else + //{ + // 端子1.Text = ReturnValue; + // 端子1.Visible = true; + //} + } + catch (Exception ex) + { + MessageBox.Show($"读取数据时出错: {ex.Message}"); + } + } + + private void button1_Click_1(object sender, EventArgs e) + { + 端子1.Text = ""; + } + + private void button2_Click_1(object sender, EventArgs e) + { + 端子2.Text = ""; + } + + private void button3_Click(object sender, EventArgs e) + { + 端子3.Text = ""; + } + } +} diff --git a/WindowsFormsApp1/form/editForm/LinePLC_Insert.resx b/WindowsFormsApp1/form/ScanForm_DZ.resx similarity index 96% rename from WindowsFormsApp1/form/editForm/LinePLC_Insert.resx rename to WindowsFormsApp1/form/ScanForm_DZ.resx index 1af7de1..1f666f2 100644 --- a/WindowsFormsApp1/form/editForm/LinePLC_Insert.resx +++ b/WindowsFormsApp1/form/ScanForm_DZ.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/WindowsFormsApp1/form/ScanForm_SSQ.Designer.cs b/WindowsFormsApp1/form/ScanForm_SSQ.Designer.cs new file mode 100644 index 0000000..66b98a0 --- /dev/null +++ b/WindowsFormsApp1/form/ScanForm_SSQ.Designer.cs @@ -0,0 +1,196 @@ +namespace WindowsFormsApp1 +{ + partial class ScanForm_SSQ + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.请扫描条码 = new System.Windows.Forms.Label(); + this.LOt号 = new System.Windows.Forms.Label(); + this.确认 = new System.Windows.Forms.Button(); + this.取消 = new System.Windows.Forms.Button(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.groupBox1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.tableLayoutPanel1); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.groupBox1.Size = new System.Drawing.Size(1647, 704); + this.groupBox1.TabIndex = 5; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "物料扫码"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 5; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.tableLayoutPanel1.Controls.Add(this.button1, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.button2, 3, 4); + this.tableLayoutPanel1.Controls.Add(this.请扫描条码, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.LOt号, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.取消, 3, 6); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 8; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.588645F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 18.35458F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.06084F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.50806F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.19009F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662); + this.tableLayoutPanel1.TabIndex = 0; + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Fill; + this.button1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(184, 304); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(539, 85); + this.button1.TabIndex = 4; + this.button1.Text = "位置1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click_1); + // + // button2 + // + this.button2.Dock = System.Windows.Forms.DockStyle.Fill; + this.button2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(910, 304); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(539, 85); + this.button2.TabIndex = 5; + this.button2.Text = "位置2"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click_1); + // + // 请扫描条码 + // + this.请扫描条码.Anchor = System.Windows.Forms.AnchorStyles.None; + this.请扫描条码.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3); + this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.请扫描条码.ForeColor = System.Drawing.Color.Red; + this.请扫描条码.Location = new System.Drawing.Point(647, 47); + this.请扫描条码.Name = "请扫描条码"; + this.请扫描条码.Size = new System.Drawing.Size(338, 56); + this.请扫描条码.TabIndex = 0; + this.请扫描条码.Text = "请扫描条码:"; + // + // LOt号 + // + this.LOt号.Anchor = System.Windows.Forms.AnchorStyles.None; + this.LOt号.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.LOt号, 3); + this.LOt号.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LOt号.Location = new System.Drawing.Point(544, 153); + this.LOt号.Name = "LOt号"; + this.LOt号.Size = new System.Drawing.Size(544, 56); + this.LOt号.TabIndex = 1; + this.LOt号.Text = "LOt号:12112312312"; + // + // 确认 + // + this.确认.Dock = System.Windows.Forms.DockStyle.Fill; + this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.确认.Location = new System.Drawing.Point(184, 457); + this.确认.Name = "确认"; + this.确认.Size = new System.Drawing.Size(539, 85); + this.确认.TabIndex = 2; + this.确认.Text = "上线"; + this.确认.UseVisualStyleBackColor = true; + this.确认.Click += new System.EventHandler(this.button1_Click); + // + // 取消 + // + this.取消.Dock = System.Windows.Forms.DockStyle.Fill; + this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.取消.Location = new System.Drawing.Point(910, 457); + this.取消.Name = "取消"; + this.取消.Size = new System.Drawing.Size(539, 85); + this.取消.TabIndex = 3; + this.取消.Text = "下线"; + this.取消.UseVisualStyleBackColor = true; + this.取消.Click += new System.EventHandler(this.button2_Click); + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 800; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // ScanForm_SSQ + // + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1647, 704); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(4); + this.Name = "ScanForm_SSQ"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "扫码界面"; + this.groupBox1.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label 请扫描条码; + private System.Windows.Forms.Label LOt号; + private System.Windows.Forms.Button 确认; + private System.Windows.Forms.Button 取消; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/WindowsFormsApp1/form/ScanForm_SSQ.cs b/WindowsFormsApp1/form/ScanForm_SSQ.cs new file mode 100644 index 0000000..f6ed083 --- /dev/null +++ b/WindowsFormsApp1/form/ScanForm_SSQ.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO.Ports; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WindowsFormsApp1.db; +using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.database; +using WindowsFormsApp1.server; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace WindowsFormsApp1 +{ + public partial class ScanForm_SSQ : Form + { + // 自定义属性,用于存储返回值 + /// + /// 0代表无位置 + /// + int index = 0; + public string ReturnValue { get; set; } + public ScanForm_SSQ() + { + InitializeComponent(); + //Init.ScanPort.DataReceived += SerialPort_DataReceived; + LOt号.Visible = false; + + } + private void button1_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(ReturnValue)) + { + MessageBox.Show("扫码为空,请确认!"); + return; + } + + //请求后端接口,index代表位置 + //更新下数据库和init里面的keyvalue值 + } + + private void button2_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(ReturnValue)) + { + MessageBox.Show("扫码为空,请确认!"); + return; + } + //请求后端接口,index代表位置 + //更新下数据库和init里面的keyvalue值 + } + + private void timer1_Tick(object sender, EventArgs e) + { + if (请扫描条码.ForeColor == Color.Red) + { + 请扫描条码.ForeColor = Color.RosyBrown; + } + else + { + 请扫描条码.ForeColor = Color.Red; + } + } + + public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) + { + try + { + if (!Init.ScanPort.IsOpen) + { + Init.ScanPort?.Open(); + } + // 读取串口接收到的数据 + var dataBuilder = new StringBuilder(); + while(Init.ScanPort.BytesToRead > 0) + { + System.Threading.Thread.Sleep(100); + dataBuilder.Append(Init.ScanPort.ReadExisting()); + } + ReturnValue = dataBuilder.ToString(); + + if (this.InvokeRequired) + { + this.Invoke(new Action(() => + { + LOt号.Text = ReturnValue; + LOt号.Visible = true; + })); + } + else + { + LOt号.Text = ReturnValue; + LOt号.Visible = true; + } + } + catch (Exception ex) + { + MessageBox.Show($"读取数据时出错: {ex.Message}"); + } + } + + private void button1_Click_1(object sender, EventArgs e) + { + if (button1.BackColor == Color.Red) + { + index = 0; + button1.BackColor = SystemColors.Control; + button2.BackColor = SystemColors.Control; + } + else + { + index = 1; + button1.BackColor = Color.Red; + button2.BackColor = SystemColors.Control; + } + } + + private void button2_Click_1(object sender, EventArgs e) + { + if (button2.BackColor == Color.Red) + { + index = 0; + button2.BackColor = SystemColors.Control; + button1.BackColor = SystemColors.Control; + } + else + { + index = 2; + button2.BackColor = Color.Red; + button1.BackColor = SystemColors.Control; + } + } + } +} diff --git a/WindowsFormsApp1/form/LinePLC_Manage.resx b/WindowsFormsApp1/form/ScanForm_SSQ.resx similarity index 91% rename from WindowsFormsApp1/form/LinePLC_Manage.resx rename to WindowsFormsApp1/form/ScanForm_SSQ.resx index 03c7fe3..1f666f2 100644 --- a/WindowsFormsApp1/form/LinePLC_Manage.resx +++ b/WindowsFormsApp1/form/ScanForm_SSQ.resx @@ -117,13 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True + + 17, 17 \ No newline at end of file diff --git a/WindowsFormsApp1/form/Torqueaddress_Manage.Designer.cs b/WindowsFormsApp1/form/Torqueaddress_Manage.Designer.cs index 70dbc52..5f51045 100644 --- a/WindowsFormsApp1/form/Torqueaddress_Manage.Designer.cs +++ b/WindowsFormsApp1/form/Torqueaddress_Manage.Designer.cs @@ -34,10 +34,6 @@ this.关闭 = new System.Windows.Forms.Button(); this.查询 = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.label1 = new System.Windows.Forms.Label(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); this.id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.code = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -47,6 +43,8 @@ this.addresstype = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.addresstypelegth = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -83,8 +81,8 @@ this.dataGridView1.AllowUserToDeleteRows = false; dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; @@ -114,77 +112,16 @@ dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3; - this.dataGridView1.Location = new System.Drawing.Point(6, 127); + this.dataGridView1.Location = new System.Drawing.Point(6, 5); this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersWidth = 72; - this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 3); + this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4); this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1624, 682); + this.dataGridView1.Size = new System.Drawing.Size(1624, 804); this.dataGridView1.TabIndex = 8; // - // label1 - // - this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("宋体", 14.14286F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(4, 27); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(253, 68); - this.label1.TabIndex = 12; - this.label1.Text = "选择需要编辑的PLC编号:"; - // - // comboBox1 - // - this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(278, 40); - this.comboBox1.Margin = new System.Windows.Forms.Padding(4); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(409, 41); - this.comboBox1.TabIndex = 13; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); - this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); - this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); - this.tableLayoutPanel1.TabIndex = 14; - // - // button1 - // - this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; - this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(1650, 541); - this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(153, 56); - this.button1.TabIndex = 15; - this.button1.Text = "新增"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // // id // this.id.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -270,7 +207,43 @@ this.remark.Name = "remark"; this.remark.ReadOnly = true; // - // PlcAddress_Manage + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.07911F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.9177F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.00319F)); + this.tableLayoutPanel1.Controls.Add(this.button1, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.关闭, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.查询, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1818, 814); + this.tableLayoutPanel1.TabIndex = 14; + // + // button1 + // + this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1650, 541); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(153, 56); + this.button1.TabIndex = 15; + this.button1.Text = "新增"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Torqueaddress_Manage // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -278,14 +251,13 @@ this.Controls.Add(this.tableLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "PlcAddress_Manage"; + this.Name = "Torqueaddress_Manage"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "PLCADDRESS_Manage"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.PLCADDRESS_Manage_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -295,8 +267,6 @@ private System.Windows.Forms.Button 关闭; private System.Windows.Forms.Button 查询; private System.Windows.Forms.DataGridView dataGridView1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Button button1; private System.Windows.Forms.DataGridViewTextBoxColumn id; diff --git a/WindowsFormsApp1/form/Torqueaddress_Manage.cs b/WindowsFormsApp1/form/Torqueaddress_Manage.cs index e7eb8a3..b856c3b 100644 --- a/WindowsFormsApp1/form/Torqueaddress_Manage.cs +++ b/WindowsFormsApp1/form/Torqueaddress_Manage.cs @@ -21,7 +21,7 @@ namespace WindowsFormsApp1.form private void 查询_Click(object sender, EventArgs e) { - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } private void 保存_Click(object sender, EventArgs e) @@ -33,7 +33,7 @@ namespace WindowsFormsApp1.form if (result.Success) { MessageBox.Show("更新成功"); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else { @@ -62,13 +62,6 @@ namespace WindowsFormsApp1.form return; } - var list = result_combox.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id)); - - // 绑定数据源到 ComboBox - comboBox1.DataSource = list; - comboBox1.DisplayMember = "plcname"; - comboBox1.ValueMember = "id"; - var result1 = new List { new {name = "read",value = "read"}, @@ -134,7 +127,7 @@ namespace WindowsFormsApp1.form fLOW_Insert.dataid = selectid; fLOW_Insert.Operation = OperationType.Edit; fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } else if (e.ColumnIndex == 10) @@ -153,12 +146,12 @@ namespace WindowsFormsApp1.form { MessageBox.Show("删除失败"); } - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } } - public void GetInfo(int plcid) + public void GetInfo() { try { @@ -166,7 +159,7 @@ namespace WindowsFormsApp1.form SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); var result_plc = sQLiteHelper1.QueryAll(); - var result = sQLiteHelper.Query(a=>a.plcid == plcid); + var result = sQLiteHelper.Query(a=>a.plcid == Init.t_Line.plcid); if (result.Success) { List list = new List(); @@ -203,7 +196,7 @@ namespace WindowsFormsApp1.form { Torqueaddress_Insert fLOW_Insert = new Torqueaddress_Insert(); fLOW_Insert.ShowDialog(); - GetInfo((int)comboBox1.SelectedValue); + GetInfo(); } } } diff --git a/WindowsFormsApp1/form/editForm/LinePLC_Insert.Designer.cs b/WindowsFormsApp1/form/editForm/LinePLC_Insert.Designer.cs deleted file mode 100644 index fcc143f..0000000 --- a/WindowsFormsApp1/form/editForm/LinePLC_Insert.Designer.cs +++ /dev/null @@ -1,170 +0,0 @@ -namespace WindowsFormsApp1.form -{ - partial class LinePLC_Insert - { - /// - /// 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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.产线 = new System.Windows.Forms.ComboBox(); - this.PLC = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 6; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.Controls.Add(this.button1, 1, 8); - this.tableLayoutPanel1.Controls.Add(this.button2, 3, 8); - this.tableLayoutPanel1.Controls.Add(this.label4, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.label6, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.产线, 2, 1); - this.tableLayoutPanel1.Controls.Add(this.PLC, 2, 3); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 10; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854); - this.tableLayoutPanel1.TabIndex = 0; - // - // button1 - // - this.button1.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.button1, 2); - this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(228, 683); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(194, 79); - this.button1.TabIndex = 14; - this.button1.Text = "保存"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.button2, 2); - this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button2.Location = new System.Drawing.Point(664, 683); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(190, 79); - this.button2.TabIndex = 15; - this.button2.Text = "取消"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // label4 - // - this.label4.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(154, 113); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(124, 28); - this.label4.TabIndex = 3; - this.label4.Text = "产线名称"; - // - // label6 - // - this.label6.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label6.Location = new System.Drawing.Point(161, 283); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(110, 28); - this.label6.TabIndex = 5; - this.label6.Text = "关联PLC"; - // - // 产线 - // - this.产线.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.产线, 3); - this.产线.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.产线.FormattingEnabled = true; - this.产线.Location = new System.Drawing.Point(341, 113); - this.产线.Name = "产线"; - this.产线.Size = new System.Drawing.Size(619, 36); - this.产线.TabIndex = 31; - // - // PLC - // - this.PLC.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.PLC, 3); - this.PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.PLC.FormattingEnabled = true; - this.PLC.Location = new System.Drawing.Point(341, 283); - this.PLC.Name = "PLC"; - this.PLC.Size = new System.Drawing.Size(619, 36); - this.PLC.TabIndex = 32; - // - // LinePLC_Insert - // - this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1087, 854); - this.Controls.Add(this.tableLayoutPanel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Name = "LinePLC_Insert"; - this.Text = "Form_Insert"; - this.Load += new System.EventHandler(this.FLOW_Insert_Load); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.ComboBox 产线; - private System.Windows.Forms.ComboBox PLC; - } -} \ No newline at end of file diff --git a/WindowsFormsApp1/form/editForm/LinePLC_Insert.cs b/WindowsFormsApp1/form/editForm/LinePLC_Insert.cs deleted file mode 100644 index a920a84..0000000 --- a/WindowsFormsApp1/form/editForm/LinePLC_Insert.cs +++ /dev/null @@ -1,130 +0,0 @@ -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 WindowsFormsApp1.db; -using WindowsFormsApp1.mod; - -namespace WindowsFormsApp1.form -{ - public partial class LinePLC_Insert : Form - { - public OperationType Operation { get; set; } - public int dataid { get; set; } - - public LinePLC_Insert() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - //保存 - if (产线.SelectedValue == null) - { - MessageBox.Show("产线不可为空"); - } - if (PLC.SelectedValue == null) - { - MessageBox.Show("PLC不可为空"); - } - - t_lineplc t_Flow = new t_lineplc(); - t_Flow.lineid = (int)产线.SelectedValue; - t_Flow.plcid = (int)PLC.SelectedValue; - - - SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); - if (Operation == OperationType.Edit) - { - t_Flow.id = dataid; - sQLiteHelper1.Update(t_Flow); - } - else - { - sQLiteHelper1.Insert(t_Flow); - } - MessageBox.Show("保存成功"); - this.Close(); - } - - private void button2_Click(object sender, EventArgs e) - { - //取消 - this.Close(); - } - - private void FLOW_Insert_Load(object sender, EventArgs e) - { - SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); - var result_combox1 = sQLiteHelper1.QueryAll(); - if (!result_combox1.Success) - { - MessageBox.Show("查询失败"); - return; - } - - - // 绑定数据源到 ComboBox - 产线.DataSource = result_combox1.Data; - 产线.DisplayMember = "linename"; - 产线.ValueMember = "id"; - - - SQLiteHelper sQLiteHelper2 = new db.SQLiteHelper(); - var result_combox2 = sQLiteHelper2.QueryAll(); - if (!result_combox2.Success) - { - MessageBox.Show("查询失败"); - return; - } - - PLC.DataSource = result_combox2.Data; - PLC.DisplayMember = "plcname"; - PLC.ValueMember = "id"; - - if (Operation == OperationType.Edit) - { - SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); - var result = sQLiteHelper.QuerySingle(a=>a.id == dataid); - if (!result.Success) - { - MessageBox.Show("查询失败"); - return; - } - var DataToEdit = result.Data; - SelectItemByValue1(产线, DataToEdit.lineid.ToString()); - SelectItemByValue2(PLC, DataToEdit.plcid.ToString()); - } - } - - private void SelectItemByValue1(ComboBox comboBox1, string value) - { - foreach (t_line item in comboBox1.Items) - { - if (item.id.ToString() == value) - { - comboBox1.SelectedItem = item; - break; - } - } - } - - private void SelectItemByValue2(ComboBox comboBox1, string value) - { - foreach (t_plc item in comboBox1.Items) - { - if (item.id.ToString() == value) - { - comboBox1.SelectedItem = item; - break; - } - } - } - } -} diff --git a/WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs b/WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs index 74c653d..0ed85ff 100644 --- a/WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs +++ b/WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs @@ -41,6 +41,14 @@ this.label7 = new System.Windows.Forms.Label(); this.产线编号 = new System.Windows.Forms.TextBox(); this.关联流程 = new System.Windows.Forms.ComboBox(); + this.备用显示1 = new System.Windows.Forms.TextBox(); + this.备用显示2 = new System.Windows.Forms.TextBox(); + this.备用显示3 = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.关联PLC = new System.Windows.Forms.ComboBox(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -65,6 +73,14 @@ this.tableLayoutPanel1.Controls.Add(this.label7, 1, 2); this.tableLayoutPanel1.Controls.Add(this.产线编号, 2, 2); this.tableLayoutPanel1.Controls.Add(this.关联流程, 2, 5); + this.tableLayoutPanel1.Controls.Add(this.备用显示1, 4, 1); + this.tableLayoutPanel1.Controls.Add(this.备用显示2, 4, 2); + this.tableLayoutPanel1.Controls.Add(this.备用显示3, 4, 3); + this.tableLayoutPanel1.Controls.Add(this.label5, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.label6, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.label8, 3, 3); + this.tableLayoutPanel1.Controls.Add(this.label9, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.关联PLC, 2, 6); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); @@ -123,11 +139,10 @@ // 名称 // this.名称.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.名称, 3); this.名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.名称.Location = new System.Drawing.Point(364, 108); + this.名称.Location = new System.Drawing.Point(328, 108); this.名称.Name = "名称"; - this.名称.Size = new System.Drawing.Size(573, 39); + this.名称.Size = new System.Drawing.Size(211, 39); this.名称.TabIndex = 16; // // label4 @@ -166,21 +181,19 @@ // 模组 // this.模组.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.模组, 3); this.模组.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.模组.Location = new System.Drawing.Point(364, 363); + this.模组.Location = new System.Drawing.Point(328, 363); this.模组.Name = "模组"; - this.模组.Size = new System.Drawing.Size(573, 39); + this.模组.Size = new System.Drawing.Size(211, 39); this.模组.TabIndex = 20; // // 产线类型 // this.产线类型.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.产线类型, 3); this.产线类型.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.产线类型.Location = new System.Drawing.Point(364, 278); + this.产线类型.Location = new System.Drawing.Point(328, 278); this.产线类型.Name = "产线类型"; - this.产线类型.Size = new System.Drawing.Size(573, 39); + this.产线类型.Size = new System.Drawing.Size(211, 39); this.产线类型.TabIndex = 17; // // label7 @@ -197,11 +210,10 @@ // 产线编号 // this.产线编号.Anchor = System.Windows.Forms.AnchorStyles.None; - this.tableLayoutPanel1.SetColumnSpan(this.产线编号, 3); this.产线编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.产线编号.Location = new System.Drawing.Point(364, 193); + this.产线编号.Location = new System.Drawing.Point(328, 193); this.产线编号.Name = "产线编号"; - this.产线编号.Size = new System.Drawing.Size(573, 39); + this.产线编号.Size = new System.Drawing.Size(211, 39); this.产线编号.TabIndex = 30; // // 关联流程 @@ -215,6 +227,88 @@ this.关联流程.Size = new System.Drawing.Size(573, 36); this.关联流程.TabIndex = 31; // + // 备用显示1 + // + this.备用显示1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.备用显示1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.备用显示1.Location = new System.Drawing.Point(762, 108); + this.备用显示1.Name = "备用显示1"; + this.备用显示1.Size = new System.Drawing.Size(211, 39); + this.备用显示1.TabIndex = 32; + // + // 备用显示2 + // + this.备用显示2.Anchor = System.Windows.Forms.AnchorStyles.None; + this.备用显示2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.备用显示2.Location = new System.Drawing.Point(762, 193); + this.备用显示2.Name = "备用显示2"; + this.备用显示2.Size = new System.Drawing.Size(211, 39); + this.备用显示2.TabIndex = 33; + // + // 备用显示3 + // + this.备用显示3.Anchor = System.Windows.Forms.AnchorStyles.None; + this.备用显示3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.备用显示3.Location = new System.Drawing.Point(762, 278); + this.备用显示3.Name = "备用显示3"; + this.备用显示3.Size = new System.Drawing.Size(211, 39); + this.备用显示3.TabIndex = 34; + // + // label5 + // + this.label5.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(581, 113); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(138, 28); + this.label5.TabIndex = 35; + this.label5.Text = "备用显示1"; + // + // label6 + // + this.label6.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(581, 198); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(138, 28); + this.label6.TabIndex = 36; + this.label6.Text = "备用显示2"; + // + // label8 + // + this.label8.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(581, 283); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(138, 28); + this.label8.TabIndex = 37; + this.label8.Text = "备用显示3"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(161, 538); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(110, 28); + this.label9.TabIndex = 38; + this.label9.Text = "关联PLC"; + // + // 关联PLC + // + this.关联PLC.Anchor = System.Windows.Forms.AnchorStyles.None; + this.tableLayoutPanel1.SetColumnSpan(this.关联PLC, 3); + this.关联PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.关联PLC.FormattingEnabled = true; + this.关联PLC.Location = new System.Drawing.Point(364, 538); + this.关联PLC.Name = "关联PLC"; + this.关联PLC.Size = new System.Drawing.Size(573, 36); + this.关联PLC.TabIndex = 39; + // // Line_Insert // this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); @@ -246,5 +340,13 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox 产线编号; private System.Windows.Forms.ComboBox 关联流程; + private System.Windows.Forms.TextBox 备用显示1; + private System.Windows.Forms.TextBox 备用显示2; + private System.Windows.Forms.TextBox 备用显示3; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.ComboBox 关联PLC; } } \ No newline at end of file diff --git a/WindowsFormsApp1/form/editForm/Line_Insert.cs b/WindowsFormsApp1/form/editForm/Line_Insert.cs index aeba319..83b3125 100644 --- a/WindowsFormsApp1/form/editForm/Line_Insert.cs +++ b/WindowsFormsApp1/form/editForm/Line_Insert.cs @@ -46,11 +46,31 @@ namespace WindowsFormsApp1.form MessageBox.Show("模组不能为空"); return; } + if (string.IsNullOrWhiteSpace(备用显示1.Text)) + { + MessageBox.Show("备用显示1不能为空"); + return; + } + if (string.IsNullOrWhiteSpace(备用显示2.Text)) + { + MessageBox.Show("备用显示2不能为空"); + return; + } + if (string.IsNullOrWhiteSpace(备用显示3.Text)) + { + MessageBox.Show("备用显示3不能为空"); + return; + } if (关联流程.SelectedValue == null || (int)关联流程.SelectedValue == 0) { MessageBox.Show("关联流程不能为空"); return; } + if (关联PLC.SelectedValue == null || (int)关联PLC.SelectedValue == 0) + { + MessageBox.Show("关联PLC不能为空"); + return; + } t_line t_Flow = new t_line(); t_Flow.linename = 名称.Text; @@ -58,6 +78,11 @@ namespace WindowsFormsApp1.form t_Flow.linecode = 产线编号.Text; t_Flow.linemode = 模组.Text; t_Flow.flowid = (int)关联流程.SelectedValue; + t_Flow.plcid = (int)关联PLC.SelectedValue; + t_Flow.lineremark1 = 备用显示1.Text; + t_Flow.lineremark2 = 备用显示2.Text; + t_Flow.lineremark3 = 备用显示3.Text; + SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); if (Operation == OperationType.Edit) @@ -82,8 +107,10 @@ namespace WindowsFormsApp1.form private void FLOW_Insert_Load(object sender, EventArgs e) { SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper(); + SQLiteHelper sQLiteHelper2 = new db.SQLiteHelper(); var result_combox1 = sQLiteHelper1.QueryAll(); - if (!result_combox1.Success) + var result_combox2 = sQLiteHelper2.QueryAll(); + if (!result_combox1.Success || !result_combox2.Success) { MessageBox.Show("查询失败"); return; @@ -103,6 +130,23 @@ namespace WindowsFormsApp1.form 关联流程.DisplayMember = "flowname"; 关联流程.ValueMember = "id"; + + List list2 = new List(); + var plcresult = result_combox2.Data; + foreach (var group in plcresult) + { + list2.Add(new plc_combox + { + id = group.id, + plcname = group.plcname + }); + } + + // 绑定数据源到 ComboBox + 关联PLC.DataSource = list2; + 关联PLC.DisplayMember = "plcname"; + 关联PLC.ValueMember = "id"; + if (Operation == OperationType.Edit) { SQLiteHelper sQLiteHelper = new db.SQLiteHelper(); @@ -117,7 +161,11 @@ namespace WindowsFormsApp1.form 产线编号.Text = DataToEdit.linecode; 产线类型.Text = DataToEdit.linetype; 模组.Text = DataToEdit.linemode; + 备用显示1.Text = DataToEdit.lineremark1; + 备用显示2.Text = DataToEdit.lineremark2; + 备用显示3.Text = DataToEdit.lineremark3; SelectItemByValue(关联流程, DataToEdit.flowid.ToString()); + SelectItemByValue2(关联PLC, DataToEdit.plcid.ToString()); } } @@ -132,11 +180,29 @@ namespace WindowsFormsApp1.form } } } + + private void SelectItemByValue2(ComboBox comboBox1, string value) + { + foreach (plc_combox item in comboBox1.Items) + { + if (item.id.ToString() == value) + { + comboBox1.SelectedItem = item; + break; + } + } + } } public class flow_combox { public int id { get; set; } public string flowname{ get; set; } - } + } + + public class plc_combox + { + public int id { get; set; } + public string plcname { get; set; } + } } diff --git a/WindowsFormsApp1/mod/database/t_flow.cs b/WindowsFormsApp1/mod/database/t_flow.cs index 72aa6b3..a399b59 100644 --- a/WindowsFormsApp1/mod/database/t_flow.cs +++ b/WindowsFormsApp1/mod/database/t_flow.cs @@ -71,5 +71,9 @@ namespace WindowsFormsApp1.mod /// 气密参数 /// public bool airtight { get; set; } + /// + /// 端子是否扫码 + /// + public bool dzscan { get; set; } } } diff --git a/WindowsFormsApp1/mod/database/t_line.cs b/WindowsFormsApp1/mod/database/t_line.cs index 3f793b7..4d48c66 100644 --- a/WindowsFormsApp1/mod/database/t_line.cs +++ b/WindowsFormsApp1/mod/database/t_line.cs @@ -16,6 +16,15 @@ namespace WindowsFormsApp1.mod public string linecode { get; set; } public string linetype { get; set; } public string linemode { get; set; } + public string lineremark1 { get; set; } + public string lineremark2 { get; set; } + public string lineremark3 { get; set; } + public string lineremark4 { get; set; } + public string lineremark5 { get; set; } + public string lineremark6 { get; set; } + public string lineremark7 { get; set; } + public int flowid { get; set; } + public int plcid { get; set; } } } diff --git a/WindowsFormsApp1/mod/database/t_lineplc.cs b/WindowsFormsApp1/mod/database/t_lineplc.cs deleted file mode 100644 index 0539961..0000000 --- a/WindowsFormsApp1/mod/database/t_lineplc.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SQLite; - -namespace WindowsFormsApp1.mod -{ - [Table("lineplc")] - public class t_lineplc - { - [PrimaryKey, AutoIncrement] - public int id { get; set; } - public int lineid { get; set; } - public int plcid { get; set; } - } -} diff --git a/WindowsFormsApp1/mod/database/t_pressurecurve.cs b/WindowsFormsApp1/mod/database/t_pressurecurve.cs new file mode 100644 index 0000000..4215ca3 --- /dev/null +++ b/WindowsFormsApp1/mod/database/t_pressurecurve.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SQLite; + +namespace WindowsFormsApp1.mod +{ + /// + /// 压力曲线 实体类 + /// + [Table("pressurecurve")] + public class t_pressurecurve + { + [PrimaryKey, AutoIncrement] + public int id { get; set; } + public int plcid { get; set; } + + public string code { get; set; } + public string type { get; set; } + public string dbaddress { get; set; } + public string addresstype { get; set; } + public int addresstypelegth { get; set; } + public int addressoffset { get; set; } + public string remark { get; set; } + public string value { get; set; } + } +} diff --git a/WindowsFormsApp1/mod/enum/plc_emum.cs b/WindowsFormsApp1/mod/enum/plc_emum.cs index ed3ad18..7221fdd 100644 --- a/WindowsFormsApp1/mod/enum/plc_emum.cs +++ b/WindowsFormsApp1/mod/enum/plc_emum.cs @@ -13,6 +13,12 @@ namespace WindowsFormsApp1.mod NONE }; + public enum plcstate + { + NG, + OK + }; + public enum plcstatus { 运行 = (short)1, diff --git a/WindowsFormsApp1/server/LogExecute.cs b/WindowsFormsApp1/server/LogExecute.cs index 6ac7425..72fa19c 100644 --- a/WindowsFormsApp1/server/LogExecute.cs +++ b/WindowsFormsApp1/server/LogExecute.cs @@ -12,6 +12,7 @@ namespace WindowsFormsApp1.server public static ILogNet logNet = new LogNetDateTime("C:\\Log\\Logs", GenerateMode.ByEveryDay); public static ILogNet PlclogNet = new LogNetDateTime("C:\\Log\\PlcLogs", GenerateMode.ByEveryDay); public static ILogNet ApilogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryHour); + public static ILogNet QMlogNet = new LogNetDateTime("C:\\Log\\QMlogs", GenerateMode.ByEveryHour); public static HslCommunication.BasicFramework.SoftNumericalOrder softNumericalOrder = new HslCommunication.BasicFramework.SoftNumericalOrder("", "yyyyMMdd", 4, @"\numericalOrder.txt"); public LogExecute() diff --git a/WindowsFormsApp1/server/SiemensHelp.cs b/WindowsFormsApp1/server/SiemensHelp.cs index c071f09..f39de63 100644 --- a/WindowsFormsApp1/server/SiemensHelp.cs +++ b/WindowsFormsApp1/server/SiemensHelp.cs @@ -19,7 +19,7 @@ namespace WindowsFormsApp1.server private SiemensS7Net siemensS7Net; private string ip; private int timeout; - private static bool ConnectB = false; + private bool ConnectB = false; public SiemensHelp(string ip,int timeout) { this.ip = ip; @@ -580,5 +580,110 @@ namespace WindowsFormsApp1.server } } #endregion + + #region 读取压力 + public BllResult> ReadAddress(List address) + { + var ulist = address.GroupBy(a => a.dbaddress).ToList(); + foreach (var u in ulist) + { + var readresult = ReadOneDB(u.ToList()); + if (!readresult.Success) + { + return BllResult>.Error(readresult.Msg); + } + } + List list = new List(); + foreach (var add in address.OrderBy(a => a.addressoffset)) + { + list.Add(float.Parse(add.value)); + } + return BllResult>.Sucess(list, "成功"); + } + private BllResult ReadOneDB(List address) + { + address = address.OrderBy(a => a.addressoffset).ToList(); + OperateResult read; + if (address.Count == 1) + { + string startaddress = address[0].dbaddress + "." + address[0].addressoffset.ToString(); + read = siemensS7Net.Read(startaddress, Convert.ToUInt16(address[0].addresstypelegth)); + } + else + { + double admax = address.Select(a => a.addressoffset).Max(); + double admin = address.Select(a => a.addressoffset).Min(); + ushort length = (ushort)(Math.Floor(admax - admin) + address.Last().addresstypelegth); + string startaddress = address[0].dbaddress + "." + admin.ToString(); + read = siemensS7Net.Read(startaddress, length); + } + if (read.IsSuccess) + { + if (TransforWCSDataToAddressData(address, read).Success) + { + return BllResult.Sucess(address, "成功"); + } + else + { + return BllResult.Error(address, "成功"); + } + } + else + { + return BllResult.Error(read.Message); + } + } + private BllResult TransforWCSDataToAddressData(List address, OperateResult read) + { + try + { + //按偏移量排序 + address = address.OrderBy(a => a.addressoffset).ToList(); + int startindex = address[0].addressoffset; + for (int i = 0; i < address.Count; i++) + { + int index = address[i].addressoffset - startindex; + switch (address[i].addresstype) + { + case "byte": + address[i].value = ByteTransform.TransByte(read.Content, index).ToString(); + break; + + case "real": + address[i].value = ByteTransform.TransSingle(read.Content, index).ToString(); + break; + + case "lword": + address[i].value = Convert.ToString(ByteTransform.TransInt64(read.Content, index), 16); ; + break; + + case "int": + address[i].value = ByteTransform.TransInt16(read.Content, index).ToString(); + break; + + case "uint": + address[i].value = ByteTransform.TransInt16(read.Content, index).ToString(); + break; + + case "dint": + address[i].value = Convert.ToString(ByteTransform.TransInt32(read.Content, index), 10); + break; + + case "string": + address[i].value = Encoding.ASCII.GetString(read.Content, index, address[i].addresstypelegth); + break; + + default: + return BllResult.Error("找不到未知的数据类型"); + } + } + return BllResult.Sucess(address); + } + catch (Exception ex) + { + return BllResult.Error($"转换WCS数据失败{ex.Message}"); + } + } + #endregion } }