From f9129f0bff8193c5ac30cacc00ad8770a9b2027b Mon Sep 17 00:00:00 2001 From: bnala Date: Thu, 13 Feb 2025 08:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86=E9=80=9A?= =?UTF-8?q?=E8=AE=AF=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WindowsFormsApp1/MainForm.Designer.cs | 152 +++++++++++++++---------- WindowsFormsApp1/MainForm.cs | 64 +++++++++-- WindowsFormsApp1/db/MES_PLC.db | Bin 139264 -> 139264 bytes WindowsFormsApp1/server/SiemensHelp.cs | 25 ++-- 4 files changed, 166 insertions(+), 75 deletions(-) diff --git a/WindowsFormsApp1/MainForm.Designer.cs b/WindowsFormsApp1/MainForm.Designer.cs index b9167da..9982c3f 100644 --- a/WindowsFormsApp1/MainForm.Designer.cs +++ b/WindowsFormsApp1/MainForm.Designer.cs @@ -59,12 +59,15 @@ this.groupBox3 = new System.Windows.Forms.GroupBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.操作页面 = new System.Windows.Forms.GroupBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.groupBox3.SuspendLayout(); + this.操作页面.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -81,8 +84,7 @@ this.系统参数配置ToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1); - this.menuStrip1.Size = new System.Drawing.Size(1826, 27); + this.menuStrip1.Size = new System.Drawing.Size(2739, 39); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -93,34 +95,34 @@ this.切换用户ToolStripMenuItem, this.用户管理ToolStripMenuItem1}); this.用户管理ToolStripMenuItem.Name = "用户管理ToolStripMenuItem"; - this.用户管理ToolStripMenuItem.Size = new System.Drawing.Size(86, 25); + this.用户管理ToolStripMenuItem.Size = new System.Drawing.Size(126, 35); this.用户管理ToolStripMenuItem.Text = "用户管理"; // // 修改密码ToolStripMenuItem // this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem"; - this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); + this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(214, 40); this.修改密码ToolStripMenuItem.Text = "修改密码"; this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click); // // 切换用户ToolStripMenuItem // this.切换用户ToolStripMenuItem.Name = "切换用户ToolStripMenuItem"; - this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); + this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(214, 40); this.切换用户ToolStripMenuItem.Text = "切换用户"; this.切换用户ToolStripMenuItem.Click += new System.EventHandler(this.切换用户ToolStripMenuItem_Click); // // 用户管理ToolStripMenuItem1 // this.用户管理ToolStripMenuItem1.Name = "用户管理ToolStripMenuItem1"; - this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(144, 26); + this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(214, 40); this.用户管理ToolStripMenuItem1.Text = "用户管理"; this.用户管理ToolStripMenuItem1.Click += new System.EventHandler(this.用户管理ToolStripMenuItem1_Click); // // 产线管理ToolStripMenuItem // this.产线管理ToolStripMenuItem.Name = "产线管理ToolStripMenuItem"; - this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(86, 25); + this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(126, 35); this.产线管理ToolStripMenuItem.Text = "产线管理"; this.产线管理ToolStripMenuItem.Click += new System.EventHandler(this.产线管理ToolStripMenuItem_Click); // @@ -130,34 +132,34 @@ this.pLC通讯设置ToolStripMenuItem, this.pLC地址设置ToolStripMenuItem}); this.pLC管理ToolStripMenuItem.Name = "pLC管理ToolStripMenuItem"; - this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(83, 25); + this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(121, 35); this.pLC管理ToolStripMenuItem.Text = "PLC管理"; // // pLC通讯设置ToolStripMenuItem // this.pLC通讯设置ToolStripMenuItem.Name = "pLC通讯设置ToolStripMenuItem"; - this.pLC通讯设置ToolStripMenuItem.Size = new System.Drawing.Size(173, 26); + this.pLC通讯设置ToolStripMenuItem.Size = new System.Drawing.Size(257, 40); this.pLC通讯设置ToolStripMenuItem.Text = "PLC通讯设置"; this.pLC通讯设置ToolStripMenuItem.Click += new System.EventHandler(this.pLC通讯设置ToolStripMenuItem_Click); // // pLC地址设置ToolStripMenuItem // this.pLC地址设置ToolStripMenuItem.Name = "pLC地址设置ToolStripMenuItem"; - this.pLC地址设置ToolStripMenuItem.Size = new System.Drawing.Size(173, 26); + this.pLC地址设置ToolStripMenuItem.Size = new System.Drawing.Size(257, 40); this.pLC地址设置ToolStripMenuItem.Text = "PLC地址设置"; this.pLC地址设置ToolStripMenuItem.Click += new System.EventHandler(this.pLC地址设置ToolStripMenuItem_Click); // // 流程管理ToolStripMenuItem // this.流程管理ToolStripMenuItem.Name = "流程管理ToolStripMenuItem"; - this.流程管理ToolStripMenuItem.Size = new System.Drawing.Size(86, 25); + this.流程管理ToolStripMenuItem.Size = new System.Drawing.Size(126, 35); this.流程管理ToolStripMenuItem.Text = "流程管理"; this.流程管理ToolStripMenuItem.Click += new System.EventHandler(this.流程管理ToolStripMenuItem_Click); // // mES接口配置ToolStripMenuItem // this.mES接口配置ToolStripMenuItem.Name = "mES接口配置ToolStripMenuItem"; - this.mES接口配置ToolStripMenuItem.Size = new System.Drawing.Size(120, 25); + this.mES接口配置ToolStripMenuItem.Size = new System.Drawing.Size(176, 35); this.mES接口配置ToolStripMenuItem.Text = "MES接口配置"; this.mES接口配置ToolStripMenuItem.Click += new System.EventHandler(this.mES接口配置ToolStripMenuItem_Click); // @@ -167,25 +169,25 @@ this.扫码枪配置ToolStripMenuItem1, this.扭力曲线配置ToolStripMenuItem}); this.扫码枪配置ToolStripMenuItem.Name = "扫码枪配置ToolStripMenuItem"; - this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(118, 25); + this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(174, 35); this.扫码枪配置ToolStripMenuItem.Text = "外围设备配置"; // // 扫码枪配置ToolStripMenuItem1 // this.扫码枪配置ToolStripMenuItem1.Name = "扫码枪配置ToolStripMenuItem1"; - this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(176, 26); + this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(262, 40); this.扫码枪配置ToolStripMenuItem1.Text = "扫码枪配置"; // // 扭力曲线配置ToolStripMenuItem // this.扭力曲线配置ToolStripMenuItem.Name = "扭力曲线配置ToolStripMenuItem"; - this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(176, 26); + this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(262, 40); this.扭力曲线配置ToolStripMenuItem.Text = "扭力曲线配置"; // // 系统参数配置ToolStripMenuItem // this.系统参数配置ToolStripMenuItem.Name = "系统参数配置ToolStripMenuItem"; - this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(118, 25); + this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(174, 35); this.系统参数配置ToolStripMenuItem.Text = "系统参数配置"; // // tableLayoutPanel1 @@ -198,13 +200,14 @@ this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.groupBox3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.操作页面, 0, 1); - this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 30); + this.tableLayoutPanel1.Location = new System.Drawing.Point(18, 45); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 42.85714F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 42.85714F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1802, 996); + this.tableLayoutPanel1.Size = new System.Drawing.Size(2703, 1494); this.tableLayoutPanel1.TabIndex = 6; // // groupBox1 @@ -214,11 +217,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.tableLayoutPanel3); 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(2, 2); - this.groupBox1.Margin = new System.Windows.Forms.Padding(2); + this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(2); - this.groupBox1.Size = new System.Drawing.Size(1798, 138); + this.groupBox1.Size = new System.Drawing.Size(2697, 207); this.groupBox1.TabIndex = 4; this.groupBox1.TabStop = false; this.groupBox1.Text = "处理界面"; @@ -235,13 +236,14 @@ this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 90F)); this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel2, 3, 0); this.tableLayoutPanel3.Controls.Add(this.开始处理, 1, 1); - this.tableLayoutPanel3.Location = new System.Drawing.Point(10, 24); + this.tableLayoutPanel3.Location = new System.Drawing.Point(15, 36); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 3; 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(1783, 108); + this.tableLayoutPanel3.Size = new System.Drawing.Size(2674, 162); this.tableLayoutPanel3.TabIndex = 4; // // tableLayoutPanel2 @@ -256,9 +258,9 @@ 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, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel2.Controls.Add(this.label4, 3, 0); this.tableLayoutPanel2.Controls.Add(this.label3, 2, 0); this.tableLayoutPanel2.Controls.Add(this.label2, 1, 0); @@ -267,13 +269,14 @@ this.tableLayoutPanel2.Controls.Add(this.label6, 1, 1); this.tableLayoutPanel2.Controls.Add(this.label7, 2, 1); this.tableLayoutPanel2.Controls.Add(this.label8, 3, 1); - this.tableLayoutPanel2.Location = new System.Drawing.Point(179, 3); + this.tableLayoutPanel2.Location = new System.Drawing.Point(269, 4); + this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 2; 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.Size = new System.Drawing.Size(1601, 102); + this.tableLayoutPanel2.Size = new System.Drawing.Size(2401, 154); this.tableLayoutPanel2.TabIndex = 3; // // label4 @@ -281,9 +284,10 @@ this.label4.AutoSize = true; this.label4.Dock = System.Windows.Forms.DockStyle.Fill; this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(964, 1); + this.label4.Location = new System.Drawing.Point(1445, 1); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(313, 49); + this.label4.Size = new System.Drawing.Size(471, 75); this.label4.TabIndex = 6; this.label4.Text = "label4"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -293,9 +297,10 @@ this.label3.AutoSize = true; this.label3.Dock = System.Windows.Forms.DockStyle.Fill; this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label3.Location = new System.Drawing.Point(644, 1); + this.label3.Location = new System.Drawing.Point(965, 1); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(313, 49); + this.label3.Size = new System.Drawing.Size(471, 75); this.label3.TabIndex = 5; this.label3.Text = "label3"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -305,9 +310,10 @@ this.label2.AutoSize = true; this.label2.Dock = System.Windows.Forms.DockStyle.Fill; this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(324, 1); + this.label2.Location = new System.Drawing.Point(485, 1); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(313, 49); + this.label2.Size = new System.Drawing.Size(471, 75); this.label2.TabIndex = 4; this.label2.Text = "label2"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -317,9 +323,10 @@ this.label1.AutoSize = true; this.label1.Dock = System.Windows.Forms.DockStyle.Fill; this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(4, 1); + this.label1.Location = new System.Drawing.Point(5, 1); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(313, 49); + this.label1.Size = new System.Drawing.Size(471, 75); this.label1.TabIndex = 3; this.label1.Text = "label1"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -329,9 +336,10 @@ this.label5.AutoSize = true; this.label5.Dock = System.Windows.Forms.DockStyle.Fill; this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(4, 51); + this.label5.Location = new System.Drawing.Point(5, 77); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(313, 50); + this.label5.Size = new System.Drawing.Size(471, 76); this.label5.TabIndex = 7; this.label5.Text = "label5"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -341,9 +349,10 @@ this.label6.AutoSize = true; this.label6.Dock = System.Windows.Forms.DockStyle.Fill; this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label6.Location = new System.Drawing.Point(324, 51); + this.label6.Location = new System.Drawing.Point(485, 77); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(313, 50); + this.label6.Size = new System.Drawing.Size(471, 76); this.label6.TabIndex = 8; this.label6.Text = "label6"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -353,9 +362,10 @@ this.label7.AutoSize = true; this.label7.Dock = System.Windows.Forms.DockStyle.Fill; this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.Location = new System.Drawing.Point(644, 51); + this.label7.Location = new System.Drawing.Point(965, 77); + this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(313, 50); + this.label7.Size = new System.Drawing.Size(471, 76); this.label7.TabIndex = 9; this.label7.Text = "label7"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -365,9 +375,10 @@ this.label8.AutoSize = true; this.label8.Dock = System.Windows.Forms.DockStyle.Fill; this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label8.Location = new System.Drawing.Point(964, 51); + this.label8.Location = new System.Drawing.Point(1445, 77); + this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(313, 50); + this.label8.Size = new System.Drawing.Size(471, 76); this.label8.TabIndex = 10; this.label8.Text = "label8"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -377,10 +388,9 @@ 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, 12); - this.开始处理.Margin = new System.Windows.Forms.Padding(2); + this.开始处理.Location = new System.Drawing.Point(29, 19); this.开始处理.Name = "开始处理"; - this.开始处理.Size = new System.Drawing.Size(138, 82); + this.开始处理.Size = new System.Drawing.Size(207, 123); this.开始处理.TabIndex = 1; this.开始处理.Text = "开始处理"; this.开始处理.UseVisualStyleBackColor = false; @@ -393,11 +403,9 @@ | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.richTextBox1); this.groupBox3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.groupBox3.Location = new System.Drawing.Point(2, 570); - this.groupBox3.Margin = new System.Windows.Forms.Padding(2); + this.groupBox3.Location = new System.Drawing.Point(3, 856); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(2); - this.groupBox3.Size = new System.Drawing.Size(1798, 424); + this.groupBox3.Size = new System.Drawing.Size(2697, 635); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "日志页面"; @@ -408,9 +416,10 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.richTextBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.richTextBox1.Location = new System.Drawing.Point(10, 24); + this.richTextBox1.Location = new System.Drawing.Point(15, 36); + this.richTextBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(1783, 395); + this.richTextBox1.Size = new System.Drawing.Size(2672, 589); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // @@ -419,25 +428,42 @@ this.操作页面.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.操作页面.Controls.Add(this.label9); + this.操作页面.Controls.Add(this.textBox1); this.操作页面.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.操作页面.Location = new System.Drawing.Point(2, 144); - this.操作页面.Margin = new System.Windows.Forms.Padding(2); + this.操作页面.Location = new System.Drawing.Point(3, 216); this.操作页面.Name = "操作页面"; - this.操作页面.Padding = new System.Windows.Forms.Padding(2); - this.操作页面.Size = new System.Drawing.Size(1798, 422); + this.操作页面.Size = new System.Drawing.Size(2697, 634); this.操作页面.TabIndex = 5; this.操作页面.TabStop = false; this.操作页面.Text = "操作页面"; // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 26F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(44, 160); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(1002, 67); + this.textBox1.TabIndex = 0; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(36, 75); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(356, 48); + this.label9.TabIndex = 1; + this.label9.Text = "请扫描二维码:"; + // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1826, 1038); + this.ClientSize = new System.Drawing.Size(2739, 1557); this.Controls.Add(this.menuStrip1); this.Controls.Add(this.tableLayoutPanel1); this.MainMenuStrip = this.menuStrip1; - this.Margin = new System.Windows.Forms.Padding(2); this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; @@ -451,6 +477,8 @@ this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); this.groupBox3.ResumeLayout(false); + this.操作页面.ResumeLayout(false); + this.操作页面.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -489,6 +517,8 @@ private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.Button 开始处理; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.TextBox textBox1; } } diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs index f87a332..28a8cf0 100644 --- a/WindowsFormsApp1/MainForm.cs +++ b/WindowsFormsApp1/MainForm.cs @@ -85,7 +85,29 @@ namespace WindowsFormsApp1 continue; } + //写入心跳 + var heartaddress = writelist.FirstOrDefault(a=>a.remark == "心跳"); + var haert = int.Parse(heartaddress.value); + if (haert == 0) + { + haert = 1; + } + else + { + haert = 0; + } + heartaddress.value = haert.ToString(); + var haertresult = siemensHelp.WriteHaert(writelist); + if (!haertresult.Success) + { + label8.Text = $"PLC:{Plc.id}:{Plc.plcip}写入心跳错误"; + //LogExecute.logNet.WriteError($"{Plc.plcip}读取地址处理错误:处理停止"); + continue; + } + Plc.dateTime = DateTime.Now; + + //判断触发字 var status = readlist.FirstOrDefault(a=>a.remark == "触发字"); if (status == null) { @@ -94,21 +116,46 @@ namespace WindowsFormsApp1 continue; } var nowstatus = int.Parse(status.value); - + label8.Text = Plc.dateTime.ToString(); + + //测试用 - nowstatus = 3; + + //var writestatus = writelist.FirstOrDefault(a => a.remark == "状态字"); + //writestatus.value = nowstatus.ToString(); + + //var write1 = writelist.FirstOrDefault(a => a.remark == "反馈工艺参数10"); + //write1.value = readlist.FirstOrDefault(a => a.remark == "写入工艺参数10").value; + + //var write2 = writelist.FirstOrDefault(a => a.remark == "反馈SN/二维码"); + //write2.value = readlist.FirstOrDefault(a => a.remark == "产品SN").value; + + //var write3 = writelist.FirstOrDefault(a => a.remark == "触发备用5"); + //write3.value = readlist.FirstOrDefault(a => a.remark == "触发备用5").value; + + //var writeresult = siemensHelp.WriteAddress(writelist); + //if (!writeresult.Success) + //{ + // label8.Text = $"PLC:{Plc.id}:{Plc.plcip}写入地址处理错误"; + // //LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); + // continue; + //} + //continue; + //nowstatus = 3; + + if (nowstatus == 0) { continue; } - var nowflow = Init.t_Flows.FirstOrDefault(a=>a.hopestatus == nowstatus); + var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == nowstatus); if (nowflow == null) { label8.Text = $"PLC:{Plc.id}:未找到当前触发字{nowstatus},对应的流程"; //LogExecute.logNet.WriteError($"未找到当前触发字{nowstatus},对应的流程!"); continue; } - var nowinterface = Init.t_Interfaces.FirstOrDefault(a=>a.id == nowflow.hopeinterfaceid); + var nowinterface = Init.t_Interfaces.FirstOrDefault(a => a.id == nowflow.hopeinterfaceid); if (nowinterface == null) { label8.Text = $"PLC:{Plc.id}:未找到当前期望接口ID {nowflow.hopeinterfaceid},对应的接口"; @@ -120,6 +167,9 @@ namespace WindowsFormsApp1 var result = apiClient.CallFunctionByName(nowinterface.code); if (result.Success) { + var writestatus = writelist.FirstOrDefault(a => a.remark == "状态字"); + writestatus.value = nowstatus.ToString(); + var writeresult = siemensHelp.WriteAddress(writelist); if (!writeresult.Success) { @@ -236,9 +286,9 @@ namespace WindowsFormsApp1 label2.Visible = true; label3.Visible = true; label4.Visible = true; - label5.Visible = true; - label6.Visible = true; - label7.Visible = true; + label5.Visible = false; + label6.Visible = false; + label7.Visible = false; label8.Visible = true; LogExecute.logNet.WriteInfo($"用户{Init.t_User.username},开始处理!"); } diff --git a/WindowsFormsApp1/db/MES_PLC.db b/WindowsFormsApp1/db/MES_PLC.db index b9f1c56b04975ba90b4ab1feb530a2351169c5d2..b87f88f968a5cc25a7d9fb111d8c6468bdd30d15 100644 GIT binary patch delta 2192 zcmbW%ZA@EL7y#gN&b_xEw;va!Ei3ZTG6@Wj-rEo87#r+^%_43l1{3+AV#W+g5Rt_n z$|!L?8)ng6Hg`ren{zs*Q(V)H8e9T1n~9krYhq?JG0LEHn?y3*{Go|>T3UA_ZGYJ2 zBsY1V``-JW^WN7#rSVT`4nAPG0{|$YOG}p^m)F8O!Dr^GxgElBP$SFE(5sFiTLCXz zreRPb{3YBK7KNL_tnj1ooe&YO2$w@J=d_@;<5d)>1FeT5Pdn5GdfmiW-&UiqSpbkP zC^sR-5ojfT2IUjm$IudPVbD2!2#V?)&PcUBr1#%l)C!9r-)IL$dzkNmc}COykOiek zTI;NqYP{8+YOj>LKkV59C!m$ybRS*!eg^h9@PKiKZ1uwz){TSz{SS}%;cbTH+@MjG z>&Z`hVJpjj1-!EC4tE7$8%Jy6>S*0H-0&1T${vJ01)G^3!0qE&xz+4#c9K27?qb)o zTIL#alIbCu9Mt_F<7HTQ2JVGz&_S#E9*m(73ZN%Z6qy zikcC^tBB1)x9sOjbjudZ$ixpAxZgo7*8uo$_)~m8@8d1nS?yVEzqVPMr3w>OZdP|z*RN~VS^nMT5T7%}4piVxJkaJ@%@CCduk?2Ib!^!r z)rjKm&h9=0>u!vmioPXBKiC&LeA+2i;Eh?ZSBWLjfjtzP!e+V z<^k+VrlfV)k!Wv^vb_^s2zL?tI5gQr5pPc^*Gly)Y5x+M zi}0ga%u{6QSlqN^F>S)3`6UYe8gIO>EnYOvgW&KJrAdk z`{}sNchUH^^zq0iH14GFt?A=0jXy)ojUvHz={2 z;>}rb{W4y&JeORegc}pu3X!BdzvR~rjl_Ndn!0d9Drd1$Esr{V?2Ykx|6r81*=oEY z1+6O~pX@Xducs<8-#m(DT<$CtIdK763UPgktQdh1k(o=-T!`0YB;aq-6O5C(%;ZmU p0wGG)W+s1-$U;1eH#7N-T-+ZgwVBDUBw|69f||_Y7KzM2(?1Y-cIE&8 delta 1251 zcmZwGUr19?90%}o&b@c;&%O6p?(YBEw6vwP-DztI8mu-h%Tdts5VL| zLGpH~ON7}|LKL)C-Y_JE2*MZl5CtJLa%o^m57I+H-8)=a+;;Xi`+-ff zm)TaHt{P6N9juv4u7jn>Lj- zl~Y}ATgXcyB{>B(^AIijNH;gp`tRuGB3e$?%}KP>xNZ)j^=EanlT1#Z(a1(3C6(98 zM4@0#h{9zzSE^~`iPc(*b-pqyOcA1`;mI$_RQ|Cd)>IW^&i`UyecYjqT1MZ8wzYrz zP~Zym2*C|SYATToPrHR+B|(&23TlK&6rR?JCsFRMP8^BCOFFScda9F!M6Wu}_M!vOlVI?~Q?LvJ8f#e@?yRgl$F0j0)eGJ-!2Bt_2rG9d%)3JLC zT@-Ig&JHBvy{7_(#i@zBoI2Dh)=`C&0AXz@rKD$JRqbX}BwvXN4*)GsJjmaW^!-nc zLb{JS2 @@ -112,7 +112,7 @@ namespace WindowsFormsApp1.server } else { - return BllResult.Sucess(address, "成功"); + return BllResult.Error(address, "成功"); } } else @@ -160,7 +160,7 @@ namespace WindowsFormsApp1.server public BllResult WriteAddress(List address) { - var ulist = address.GroupBy(a => a.dbaddress).ToList(); + var ulist = address.FindAll(a=>a.remark != "心跳").GroupBy(a => a.dbaddress).ToList(); foreach (var u in ulist) { var readresult = WriteOneDB(u.ToList()); @@ -172,6 +172,17 @@ namespace WindowsFormsApp1.server return BllResult.Sucess(address, "成功"); } + public BllResult WriteHaert(List address) + { + var ulist = address.FindAll(a => a.remark == "心跳"); + var readresult = WriteOneDB(ulist); + if (!readresult.Success) + { + return BllResult.Error(readresult.Msg); + } + return BllResult.Sucess(address, "成功"); + } + private BllResult TransforWCSDataToAddressData(List address, OperateResult read) { try @@ -182,7 +193,7 @@ namespace WindowsFormsApp1.server for (int i = 0; i < address.Count; i++) { int index = address[i].addressoffset - startindex; - switch (address[i].type) + switch (address[i].addresstype) { case "byte": address[i].value = ByteTransform.TransByte(read.Content, index).ToString(); @@ -201,7 +212,7 @@ namespace WindowsFormsApp1.server break; case "uint": - address[i].value = BitConverter.ToUInt16(read.Content, index).ToString(); + address[i].value = ByteTransform.TransInt16(read.Content, index).ToString(); break; case "dint": @@ -209,7 +220,7 @@ namespace WindowsFormsApp1.server break; case "string": - address[i].value = Encoding.ASCII.GetString(read.Content, index, address[i].addresstypelegth).Replace(" ", "").Replace("\0", "").Replace("\u0003", ""); + address[i].value = Encoding.ASCII.GetString(read.Content, index, address[i].addresstypelegth); break; default: @@ -266,7 +277,7 @@ namespace WindowsFormsApp1.server ByteTransform.TransByte(todint).CopyTo(writebyte, index); break; - case "read": + case "real": float todreal = Convert.ToSingle(value); ByteTransform.TransByte(todreal).CopyTo(writebyte, index); break;