From c322de2dd7a7a7c5a66d5f7837876b28220f2839 Mon Sep 17 00:00:00 2001 From: bnala Date: Tue, 18 Feb 2025 14:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WindowsFormsApp1/MES_PLC_Control.csproj | 4 + WindowsFormsApp1/MainForm.Designer.cs | 162 ++++++++------- WindowsFormsApp1/MainForm.cs | 113 +++++------ WindowsFormsApp1/db/MES_PLC.db | Bin 139264 -> 139264 bytes WindowsFormsApp1/mod/database/t_plcaddress.cs | 2 + WindowsFormsApp1/mod/enum/plc_emum.cs | 15 ++ WindowsFormsApp1/mod/server/otherdata.cs | 75 +++++++ WindowsFormsApp1/mod/server/plcdata.cs | 191 ++++++++++++++++++ WindowsFormsApp1/server/ApiClient.cs | 82 ++++---- WindowsFormsApp1/server/ApiFormResult.cs | 43 ++++ WindowsFormsApp1/server/SiemensHelp.cs | 71 +++++-- 11 files changed, 560 insertions(+), 198 deletions(-) create mode 100644 WindowsFormsApp1/mod/enum/plc_emum.cs create mode 100644 WindowsFormsApp1/mod/server/otherdata.cs create mode 100644 WindowsFormsApp1/mod/server/plcdata.cs create mode 100644 WindowsFormsApp1/server/ApiFormResult.cs diff --git a/WindowsFormsApp1/MES_PLC_Control.csproj b/WindowsFormsApp1/MES_PLC_Control.csproj index 2ccf3c2..1b2463a 100644 --- a/WindowsFormsApp1/MES_PLC_Control.csproj +++ b/WindowsFormsApp1/MES_PLC_Control.csproj @@ -111,6 +111,9 @@ + + + @@ -122,6 +125,7 @@ USER_Manage.cs + diff --git a/WindowsFormsApp1/MainForm.Designer.cs b/WindowsFormsApp1/MainForm.Designer.cs index 9982c3f..e384b47 100644 --- a/WindowsFormsApp1/MainForm.Designer.cs +++ b/WindowsFormsApp1/MainForm.Designer.cs @@ -59,8 +59,8 @@ 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.textBox1 = new System.Windows.Forms.TextBox(); this.menuStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -73,6 +73,7 @@ // menuStrip1 // this.menuStrip1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.menuStrip1.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.用户管理ToolStripMenuItem, @@ -84,7 +85,8 @@ this.系统参数配置ToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(2739, 39); + this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); + this.menuStrip1.Size = new System.Drawing.Size(2884, 44); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -95,34 +97,34 @@ this.切换用户ToolStripMenuItem, this.用户管理ToolStripMenuItem1}); this.用户管理ToolStripMenuItem.Name = "用户管理ToolStripMenuItem"; - this.用户管理ToolStripMenuItem.Size = new System.Drawing.Size(126, 35); + this.用户管理ToolStripMenuItem.Size = new System.Drawing.Size(145, 40); this.用户管理ToolStripMenuItem.Text = "用户管理"; // // 修改密码ToolStripMenuItem // this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem"; - this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(214, 40); + this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(247, 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(214, 40); + this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(247, 44); this.切换用户ToolStripMenuItem.Text = "切换用户"; this.切换用户ToolStripMenuItem.Click += new System.EventHandler(this.切换用户ToolStripMenuItem_Click); // // 用户管理ToolStripMenuItem1 // this.用户管理ToolStripMenuItem1.Name = "用户管理ToolStripMenuItem1"; - this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(214, 40); + this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(247, 44); this.用户管理ToolStripMenuItem1.Text = "用户管理"; this.用户管理ToolStripMenuItem1.Click += new System.EventHandler(this.用户管理ToolStripMenuItem1_Click); // // 产线管理ToolStripMenuItem // this.产线管理ToolStripMenuItem.Name = "产线管理ToolStripMenuItem"; - this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(126, 35); + this.产线管理ToolStripMenuItem.Size = new System.Drawing.Size(145, 40); this.产线管理ToolStripMenuItem.Text = "产线管理"; this.产线管理ToolStripMenuItem.Click += new System.EventHandler(this.产线管理ToolStripMenuItem_Click); // @@ -132,34 +134,34 @@ this.pLC通讯设置ToolStripMenuItem, this.pLC地址设置ToolStripMenuItem}); this.pLC管理ToolStripMenuItem.Name = "pLC管理ToolStripMenuItem"; - this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(121, 35); + this.pLC管理ToolStripMenuItem.Size = new System.Drawing.Size(139, 40); this.pLC管理ToolStripMenuItem.Text = "PLC管理"; // // pLC通讯设置ToolStripMenuItem // this.pLC通讯设置ToolStripMenuItem.Name = "pLC通讯设置ToolStripMenuItem"; - this.pLC通讯设置ToolStripMenuItem.Size = new System.Drawing.Size(257, 40); + this.pLC通讯设置ToolStripMenuItem.Size = new System.Drawing.Size(297, 44); 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(257, 40); + this.pLC地址设置ToolStripMenuItem.Size = new System.Drawing.Size(297, 44); 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(126, 35); + this.流程管理ToolStripMenuItem.Size = new System.Drawing.Size(145, 40); 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(176, 35); + this.mES接口配置ToolStripMenuItem.Size = new System.Drawing.Size(203, 40); this.mES接口配置ToolStripMenuItem.Text = "MES接口配置"; this.mES接口配置ToolStripMenuItem.Click += new System.EventHandler(this.mES接口配置ToolStripMenuItem_Click); // @@ -169,25 +171,25 @@ this.扫码枪配置ToolStripMenuItem1, this.扭力曲线配置ToolStripMenuItem}); this.扫码枪配置ToolStripMenuItem.Name = "扫码枪配置ToolStripMenuItem"; - this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(174, 35); + this.扫码枪配置ToolStripMenuItem.Size = new System.Drawing.Size(201, 40); this.扫码枪配置ToolStripMenuItem.Text = "外围设备配置"; // // 扫码枪配置ToolStripMenuItem1 // this.扫码枪配置ToolStripMenuItem1.Name = "扫码枪配置ToolStripMenuItem1"; - this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(262, 40); + this.扫码枪配置ToolStripMenuItem1.Size = new System.Drawing.Size(303, 44); this.扫码枪配置ToolStripMenuItem1.Text = "扫码枪配置"; // // 扭力曲线配置ToolStripMenuItem // this.扭力曲线配置ToolStripMenuItem.Name = "扭力曲线配置ToolStripMenuItem"; - this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(262, 40); + this.扭力曲线配置ToolStripMenuItem.Size = new System.Drawing.Size(303, 44); this.扭力曲线配置ToolStripMenuItem.Text = "扭力曲线配置"; // // 系统参数配置ToolStripMenuItem // this.系统参数配置ToolStripMenuItem.Name = "系统参数配置ToolStripMenuItem"; - this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(174, 35); + this.系统参数配置ToolStripMenuItem.Size = new System.Drawing.Size(201, 40); this.系统参数配置ToolStripMenuItem.Text = "系统参数配置"; // // tableLayoutPanel1 @@ -200,14 +202,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(18, 45); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel1.Location = new System.Drawing.Point(22, 52); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); 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(2703, 1494); + this.tableLayoutPanel1.Size = new System.Drawing.Size(3304, 1743); this.tableLayoutPanel1.TabIndex = 6; // // groupBox1 @@ -217,9 +219,11 @@ | 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(3, 3); + this.groupBox1.Location = new System.Drawing.Point(4, 4); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(2697, 207); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Size = new System.Drawing.Size(3296, 240); this.groupBox1.TabIndex = 4; this.groupBox1.TabStop = false; this.groupBox1.Text = "处理界面"; @@ -236,14 +240,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(15, 36); - this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel3.Location = new System.Drawing.Point(18, 42); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); 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(2674, 162); + this.tableLayoutPanel3.Size = new System.Drawing.Size(3268, 188); this.tableLayoutPanel3.TabIndex = 4; // // tableLayoutPanel2 @@ -258,9 +262,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, 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.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.label4, 3, 0); this.tableLayoutPanel2.Controls.Add(this.label3, 2, 0); this.tableLayoutPanel2.Controls.Add(this.label2, 1, 0); @@ -269,14 +273,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(269, 4); - this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel2.Location = new System.Drawing.Point(330, 5); + this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); 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(2401, 154); + this.tableLayoutPanel2.Size = new System.Drawing.Size(2933, 178); this.tableLayoutPanel2.TabIndex = 3; // // label4 @@ -284,10 +288,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(1445, 1); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(1764, 1); + this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(471, 75); + this.label4.Size = new System.Drawing.Size(575, 87); this.label4.TabIndex = 6; this.label4.Text = "label4"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -297,10 +301,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(965, 1); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(1178, 1); + this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(471, 75); + this.label3.Size = new System.Drawing.Size(575, 87); this.label3.TabIndex = 5; this.label3.Text = "label3"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -310,10 +314,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(485, 1); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(592, 1); + this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(471, 75); + this.label2.Size = new System.Drawing.Size(575, 87); this.label2.TabIndex = 4; this.label2.Text = "label2"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -323,10 +327,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(5, 1); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(6, 1); + this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(471, 75); + this.label1.Size = new System.Drawing.Size(575, 87); this.label1.TabIndex = 3; this.label1.Text = "label1"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -336,10 +340,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(5, 77); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(6, 89); + this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(471, 76); + this.label5.Size = new System.Drawing.Size(575, 88); this.label5.TabIndex = 7; this.label5.Text = "label5"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -349,10 +353,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(485, 77); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label6.Location = new System.Drawing.Point(592, 89); + this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(471, 76); + this.label6.Size = new System.Drawing.Size(575, 88); this.label6.TabIndex = 8; this.label6.Text = "label6"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -362,10 +366,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(965, 77); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label7.Location = new System.Drawing.Point(1178, 89); + this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(471, 76); + this.label7.Size = new System.Drawing.Size(575, 88); this.label7.TabIndex = 9; this.label7.Text = "label7"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -375,10 +379,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(1445, 77); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label8.Location = new System.Drawing.Point(1764, 89); + this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(471, 76); + this.label8.Size = new System.Drawing.Size(575, 88); this.label8.TabIndex = 10; this.label8.Text = "label8"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -388,9 +392,10 @@ 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(29, 19); + this.开始处理.Location = new System.Drawing.Point(36, 22); + this.开始处理.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.开始处理.Name = "开始处理"; - this.开始处理.Size = new System.Drawing.Size(207, 123); + this.开始处理.Size = new System.Drawing.Size(253, 142); this.开始处理.TabIndex = 1; this.开始处理.Text = "开始处理"; this.开始处理.UseVisualStyleBackColor = false; @@ -403,9 +408,11 @@ | 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(3, 856); + this.groupBox3.Location = new System.Drawing.Point(4, 999); + this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(2697, 635); + this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox3.Size = new System.Drawing.Size(3296, 740); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "日志页面"; @@ -416,10 +423,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(15, 36); - this.richTextBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.richTextBox1.Location = new System.Drawing.Point(18, 42); + this.richTextBox1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(2672, 589); + this.richTextBox1.Size = new System.Drawing.Size(3265, 685); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // @@ -431,39 +438,44 @@ 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(3, 216); + this.操作页面.Location = new System.Drawing.Point(4, 252); + this.操作页面.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.操作页面.Name = "操作页面"; - this.操作页面.Size = new System.Drawing.Size(2697, 634); + this.操作页面.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.操作页面.Size = new System.Drawing.Size(3296, 739); 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.Location = new System.Drawing.Point(44, 64); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(356, 48); + this.label9.Size = new System.Drawing.Size(416, 56); this.label9.TabIndex = 1; this.label9.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(54, 383); + this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(1224, 77); + this.textBox1.TabIndex = 0; + // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(2739, 1557); + this.ClientSize = new System.Drawing.Size(2884, 1764); this.Controls.Add(this.menuStrip1); this.Controls.Add(this.tableLayoutPanel1); this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs index 28a8cf0..46860e5 100644 --- a/WindowsFormsApp1/MainForm.cs +++ b/WindowsFormsApp1/MainForm.cs @@ -17,6 +17,7 @@ using HslCommunication.LogNet; using WindowsFormsApp1.db; using WindowsFormsApp1.form; using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.server; using WindowsFormsApp1.server; using static SQLite.SQLite3; @@ -67,9 +68,6 @@ namespace WindowsFormsApp1 SiemensHelp siemensHelp = Plc.plchelp; - var readlist = Init.t_Plcaddresses.FindAll(a=>a.plcid == Plc.id && a.type == "read"); - var writelist = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id && a.type == "write"); - var openresult = siemensHelp.OpenConn(); if (!openresult.Success) { @@ -77,113 +75,92 @@ namespace WindowsFormsApp1 //LogExecute.logNet.WriteError($"{Plc.plcip}建立S7连接失败"); continue; } - var resdresult = siemensHelp.ReadAddress(readlist); + + List plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id); + plcdata PlcData = new plcdata(); + + var resdresult = siemensHelp.ReadAddress(plcaddress, PlcData); if (!resdresult.Success) { - label8.Text = $"PLC:{Plc.id}:{Plc.plcip}读取地址处理错误"; - //LogExecute.logNet.WriteError($"{Plc.plcip}读取地址处理错误:处理停止"); + label8.Text = $"PLC:{Plc.id}:{Plc.plcip}读取全部地址处理错误"; + LogExecute.logNet.WriteError($"{Plc.plcip}读取全部地址处理错误:处理停止"); 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); + PlcData.Write_Heartbeat = PlcData.Write_Heartbeat == 0 ? (short)1 : (short)0; + var haertresult = siemensHelp.WriteAddress(plcaddress, PlcData); if (!haertresult.Success) { label8.Text = $"PLC:{Plc.id}:{Plc.plcip}写入心跳错误"; - //LogExecute.logNet.WriteError($"{Plc.plcip}读取地址处理错误:处理停止"); + LogExecute.logNet.WriteError($"{Plc.plcip}写入心跳错误:处理停止"); continue; } Plc.dateTime = DateTime.Now; - //判断触发字 - var status = readlist.FirstOrDefault(a=>a.remark == "触发字"); - if (status == null) - { - label8.Text = $"PLC:{Plc.id}:未找到触发字对应的字段"; - //LogExecute.logNet.WriteError($"未找到触发字对应的字段!"); - continue; - } - var nowstatus = int.Parse(status.value); + label8.Text = Plc.dateTime.ToString(); - - //测试用 - - //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) + if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0) { continue; } - var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == nowstatus); + else if (PlcData.Read_Trigger != 0 && PlcData.Write_Status != 0) + { + continue; + } + else if (PlcData.Read_Trigger == 0 && PlcData.Write_Status != 0) + { + PlcData.Write_Status = 0; + var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData); + if (!writeresult.Success) + { + label8.Text = $"PLC:{Plc.id}:{Plc.plcip}写入地址处理错误"; + LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); + } + continue; + } + + //状态+报警 + + var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == PlcData.Read_Trigger); if (nowflow == null) { - label8.Text = $"PLC:{Plc.id}:未找到当前触发字{nowstatus},对应的流程"; - //LogExecute.logNet.WriteError($"未找到当前触发字{nowstatus},对应的流程!"); + label8.Text = $"PLC:{Plc.id}:未找到当前触发字{PlcData.Read_Trigger},对应的流程"; + LogExecute.logNet.WriteError($"未找到当前触发字{PlcData.Read_Trigger},对应的流程!"); continue; } var nowinterface = Init.t_Interfaces.FirstOrDefault(a => a.id == nowflow.hopeinterfaceid); if (nowinterface == null) { label8.Text = $"PLC:{Plc.id}:未找到当前期望接口ID {nowflow.hopeinterfaceid},对应的接口"; - //LogExecute.logNet.WriteError($"未找到当前期望接口ID {nowflow.hopeinterfaceid},对应的接口!"); + LogExecute.logNet.WriteError($"未找到当前期望接口ID {nowflow.hopeinterfaceid},对应的接口!"); continue; } + otherdata otherdata = new otherdata(); + otherdata.JS_SN = "12345"; + + + ApiClient apiClient = new ApiClient(); - var result = apiClient.CallFunctionByName(nowinterface.code); + var result = apiClient.CallFunctionByName(nowinterface.code,PlcData, otherdata); if (result.Success) { - var writestatus = writelist.FirstOrDefault(a => a.remark == "状态字"); - writestatus.value = nowstatus.ToString(); - - var writeresult = siemensHelp.WriteAddress(writelist); + var writeresult = siemensHelp.WriteAddress(Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id),PlcData); if (!writeresult.Success) { label8.Text = $"PLC:{Plc.id}:{Plc.plcip}写入地址处理错误"; - //LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); + LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); continue; } } else { - + label8.Text = $"MES通讯异常!"; + LogExecute.logNet.WriteError($"MES通讯异常!"); } - - } catch (Exception e) { diff --git a/WindowsFormsApp1/db/MES_PLC.db b/WindowsFormsApp1/db/MES_PLC.db index b87f88f968a5cc25a7d9fb111d8c6468bdd30d15..8ac556cdd97962eeabe25ceb9e8cfd2d1cc381c0 100644 GIT binary patch delta 4442 zcma)A|4$p|8Nc^@w(tDyT!R7g)lQnwLIZa;7|22b0g{xY1QE7%QYObOPC!D18Iwtc z#E>Rj(xoDvQ?6a3ELGPp*;ew!8%U6@G}<4q>`SFe%eG1wlPX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&sHRRVO(k%cqtg2(moG(MkY<2RL7@p6+62(a zC^SYxvjD9}p%EI|2+&C=G(V(qSHgp`N0qf9hST^`P*l-lek$g*-5$E~V$xyEMW+46OT9F2CuXzMehD zx^LCW&wgGVQyOjqVdcjSbf(^=8bBG73V7{9WqruBO#ak6StV6-yf9OO$H=BrH`BIG zb|tSzmXY9@vdPJ^oNHLl3{@?`GiH=>HA|Te6nMmpQm$Yr(|`hxm{H1QECr0a1do_e z3TGLu87T0G8KrP;x%60tFs1qZH1qoKc}7mU61%FWxk% z1dpuEA#l2c3uy0dhPZ==)hKut4Q>K3Jf=p$=h5J-nkm5pWdM^~)V_%-DJ`eWQdr*F zPzlKKC3vE29w1FuwRwvs=v#D_4Xj~-F)Jk0(o8^+uBMsF5%azZ@j44=gwC@mOd}-w zSjr4woQpD~|701{fpHGb_;;2u4Hz?U#vfQl3oxeRjNh<~W?)Ri8UM;Mnt;)QGk(c3 Hvg&^UCO{ + /// MES返回的SN + /// + public string MES_SN { get; set; } + + /// + /// 文件上传地址 + /// + public string FileUploadAddress { get; set; } + + /// + /// 胶水码 + /// + public string JS_SN { get; set; } + + /// + /// 螺丝枪扭力角度 + /// + public List FinalTorqueValue { get; set; } + + /// + /// 螺丝枪扭力曲线 + /// + public List FinalTorqueCurve { get; set; } + + /// + /// 压力曲线 + /// + public List FinalPressureCurve { get; set; } + + /// + /// 气密仪参数 + /// + public Airtight FinalAirtightValue { get; set; } + } + + + public class Airtight + { + /// + /// 压力值 + /// + public string Airtight_Value { get; set; } + /// + /// 压力单位 + /// + public string Airtight_Unit { get; set; } + /// + /// 泄露值 + /// + public string Leak_Value { get; set; } + /// + /// 泄露单位 + /// + public string Leak_Unit { get; set; } + /// + /// 小泄露值 + /// + public string LLeak_Value { get; set; } + /// + /// 小泄露单位 + /// + public string LLeak_Unit { get; set; } + } +} diff --git a/WindowsFormsApp1/mod/server/plcdata.cs b/WindowsFormsApp1/mod/server/plcdata.cs new file mode 100644 index 0000000..53df93a --- /dev/null +++ b/WindowsFormsApp1/mod/server/plcdata.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static SQLite.SQLite3; + +namespace WindowsFormsApp1.mod.server +{ + public class plcdata + { + /// + /// 读取_心跳 + /// + public short Read_Heartbeat { get; set; } + /// + /// 读取_触发字 + /// + public short Read_Trigger { get; set; } + /// + /// 读取_测试结果1OK,2NG + /// + public short Read_Result { get; set; } + /// + /// 读取_设备状态字 + /// + public short Read_Status { get; set; } + /// + /// 读取_其他状态字 + /// + public short Read_Other0 { get; set; } + /// + /// 读取_其他状态字 + /// + public short Read_Other1 { get; set; } + /// + /// 读取_其他状态字 + /// + public short Read_Other2 { get; set; } + /// + /// 读取_其他状态字 + /// + public short Read_Other3 { get; set; } + /// + /// 读取_其他状态字 + /// + public short Read_Other4 { get; set; } + /// + /// 读取_产品SN/追溯码 + /// + public string Read_MaterialCode0 { get; set; } + /// + /// 读取_托盘二维码 + /// + public string Read_MaterialCode1 { get; set; } + /// + /// 读取_关键物料1 + /// + public string Read_MaterialCode2 { get; set; } + /// + /// 读取_关键物料2 + /// + public string Read_MaterialCode3 { get; set; } + /// + /// 读取_关键物料3 + /// + public string Read_MaterialCode4 { get; set; } + /// + /// 读取_写入工艺参数1 + /// + public float Read_UploadData0 { get; set; } + /// + /// 读取_写入工艺参数2 + /// + public float Read_UploadData1 { get; set; } + /// + /// 读取_写入工艺参数3 + /// + public float Read_UploadData2 { get; set; } + /// + /// 读取_写入工艺参数4 + /// + public float Read_UploadData3 { get; set; } + /// + /// 读取_写入工艺参数5 + /// + public float Read_UploadData4 { get; set; } + /// + /// 读取_写入工艺参数6 + /// + public float Read_UploadData5 { get; set; } + /// + /// 读取_写入工艺参数7 + /// + public float Read_UploadData6 { get; set; } + /// + /// 读取_写入工艺参数8 + /// + public float Read_UploadData7 { get; set; } + /// + /// 读取_写入工艺参数9 + /// + public float Read_UploadData8 { get; set; } + /// + /// 读取_写入工艺参数10 + /// + public float Read_UploadData9 { get; set; } + /// + /// 写入_心跳 + /// + public short Write_Heartbeat { get; set; } + /// + /// 写入_状态字 + /// + public short Write_Status { get; set; } + /// + /// 写入_反馈SN号/二维码 + /// + public string Write_stSN { get; set; } + /// + /// 写入_其他状态字 + /// + public short Write_Other0 { get; set; } + /// + /// 写入_其他状态字 + /// + public short Write_Other1 { get; set; } + /// + /// 写入_其他状态字 + /// + public short Write_Other2 { get; set; } + /// + /// 写入_其他状态字 + /// + public short Write_Other3 { get; set; } + /// + /// 写入_其他状态字 + /// + public short Write_Other4 { get; set; } + /// + /// 写入_反馈工艺参数1 + /// + public float Write_ReceiveData0 { get; set; } + /// + /// 写入_反馈工艺参数2 + /// + public float Write_ReceiveData1 { get; set; } + /// + /// 写入_反馈工艺参数3 + /// + public float Write_ReceiveData2 { get; set; } + /// + /// 写入_反馈工艺参数4 + /// + public float Write_ReceiveData3 { get; set; } + /// + /// 写入_反馈工艺参数5 + /// + public float Write_ReceiveData4 { get; set; } + /// + /// 写入_反馈工艺参数6 + /// + public float Write_ReceiveData5 { get; set; } + /// + /// 写入_反馈工艺参数7 + /// + public float Write_ReceiveData6 { get; set; } + /// + /// 写入_反馈工艺参数8 + /// + public float Write_ReceiveData7 { get; set; } + /// + /// 写入_反馈工艺参数9 + /// + public float Write_ReceiveData8 { get; set; } + /// + /// 写入_反馈工艺参数10 + /// + public float Write_ReceiveData9 { get; set; } + + /// + /// 读取PLC的时间 + /// + public DateTime Read_Time { get; set; } + + /// + /// 写入PLC的时间 + /// + public DateTime Write_Time2 { get; set; } + } +} diff --git a/WindowsFormsApp1/server/ApiClient.cs b/WindowsFormsApp1/server/ApiClient.cs index 8c1a9dc..a943ec7 100644 --- a/WindowsFormsApp1/server/ApiClient.cs +++ b/WindowsFormsApp1/server/ApiClient.cs @@ -5,83 +5,81 @@ using System.Reflection; using System.Security.Claims; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; +using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.server; namespace WindowsFormsApp1.server { public class ApiClient { - public BllResult SN_CheckIN() + public ApiFormResult SN_CheckIN(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Carrier_Check() + public ApiFormResult Carrier_Check(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult SN_FeedingCheck() + public ApiFormResult SN_FeedingCheck(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Link_Comp() + public ApiFormResult Link_Comp(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult SN_Release() + public ApiFormResult SN_Release(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Glue_CheckOut() + public ApiFormResult Glue_CheckOut(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Get_Para() + public ApiFormResult Get_Para(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult DispatchPara() + public ApiFormResult DispatchPara(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Data_Collection() + public ApiFormResult Data_Collection(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Status() + public ApiFormResult Status(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult Alarm() + public ApiFormResult Alarm(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult OEEDataCollection() + public ApiFormResult OEEDataCollection(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass, false, "", PlcData); } - public BllResult SN_FileUpload() + public ApiFormResult SN_FileUpload(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass, false, "", PlcData); } - public BllResult Test() + public ApiFormResult Test(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass, false, "", PlcData); } - public BllResult SN_Checkout() + public ApiFormResult SN_Checkout(plcdata PlcData, otherdata OtherData) { - return BllResult.Sucess(); + return ApiFormResult.Sucess(mesresult.pass, false, "", PlcData); } - public BllResult Initialization() + public ApiFormResult Initialization(plcdata PlcData, otherdata OtherData) { - //1.获取PLC参数,扫码器参数 - - //2、调用接口 - - //3.给PLC的 writeaddress赋值 - - return BllResult.Sucess("Initialization"); + PlcData.Write_Status = 3; + return ApiFormResult.Sucess(mesresult.pass,false,"", PlcData); } - public BllResult CallFunctionByName(string functionName) + public ApiFormResult CallFunctionByName(string functionName, plcdata plcdata,otherdata otherdata) { // 获取当前类的类型 Type type = this.GetType(); @@ -92,12 +90,12 @@ namespace WindowsFormsApp1.server if (methodInfo != null) { // 调用该方法 - return (BllResult)methodInfo.Invoke(this, null); + return (ApiFormResult)methodInfo.Invoke(this, new object[] { plcdata, otherdata }); } else { - Console.WriteLine($"Method '{functionName}' not found."); - return BllResult.Error(); + LogExecute.logNet.WriteError($"未找到对应的函数{functionName}"); + return ApiFormResult.Error(mesresult.none, false, $"未找到对应的函数{functionName}", null); } } } diff --git a/WindowsFormsApp1/server/ApiFormResult.cs b/WindowsFormsApp1/server/ApiFormResult.cs new file mode 100644 index 0000000..1fc996f --- /dev/null +++ b/WindowsFormsApp1/server/ApiFormResult.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.server; + +namespace WindowsFormsApp1.server +{ + public class ApiFormResult + { + private ApiFormResult(bool success, mesresult mesresult, bool isShow, string msg, plcdata data) + { + Success = success; + Msg = msg; + Data = data; + Mesresult = mesresult; + IsShow = isShow; + } + + public bool Success { get; set; } + public string Msg { get; set; } + public plcdata Data { get; set; } + + public mesresult Mesresult { get; set; } + + public bool IsShow { get; set; } + + public static ApiFormResult Sucess(mesresult mesresult, bool isShow, string msg, plcdata data) + { + return new ApiFormResult(true, mesresult, isShow, msg, data); + } + + + public static ApiFormResult Error(mesresult mesresult, bool isShow, string msg, plcdata data) + { + return new ApiFormResult(false, mesresult, isShow, msg, data); + } + + } +} diff --git a/WindowsFormsApp1/server/SiemensHelp.cs b/WindowsFormsApp1/server/SiemensHelp.cs index fc38794..a214768 100644 --- a/WindowsFormsApp1/server/SiemensHelp.cs +++ b/WindowsFormsApp1/server/SiemensHelp.cs @@ -6,6 +6,9 @@ using System.Threading.Tasks; using HslCommunication.Profinet.Siemens; using HslCommunication; using WindowsFormsApp1.mod; +using WindowsFormsApp1.mod.server; +using System.Collections; +using System.Xml.Linq; namespace WindowsFormsApp1.server { @@ -121,7 +124,7 @@ namespace WindowsFormsApp1.server } } - public BllResult ReadAddress(List address) + public BllResult ReadAddress(List address,plcdata PlcData) { var ulist = address.GroupBy(a => a.dbaddress).ToList(); foreach (var u in ulist) @@ -132,6 +135,17 @@ namespace WindowsFormsApp1.server return BllResult.Error(readresult.Msg); } } + + foreach (var p in PlcData.GetType().GetProperties()) + { + var vlaue = address.FirstOrDefault(a => a.code == p.Name); + if (vlaue != null) + { + var per = PlcData.GetType().GetProperty(p.Name); + per.SetValue(PlcData, Convert.ChangeType(vlaue.value, per.PropertyType), null); + } + } + PlcData.Read_Time = DateTime.Now; return BllResult.Sucess(address, "成功"); } @@ -158,9 +172,23 @@ namespace WindowsFormsApp1.server } } - public BllResult WriteAddress(List address) + public BllResult WriteAddress(List address, plcdata PlcData) { - var ulist = address.FindAll(a=>a.remark != "心跳").GroupBy(a => a.dbaddress).ToList(); + List writeaddress = new List(); + + //address = address.FindAll(a => a.code != "Write_Heartbeat"); + foreach (var add in address) + { + foreach (var p in PlcData.GetType().GetProperties()) + { + if (add.code == p.Name) + { + add.value = PlcData.GetType().GetProperty(p.Name).GetValue(PlcData).ToString(); + writeaddress.Add(add); + } + } + } + var ulist = writeaddress.GroupBy(a => a.dbaddress).ToList(); foreach (var u in ulist) { var readresult = WriteOneDB(u.ToList()); @@ -172,16 +200,33 @@ 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, "成功"); - } + //public BllResult WriteHaert(List address, plcdata PlcData) + //{ + // List writeaddress = new List(); + + // address = address.FindAll(a=>a.code == "Write_Heartbeat"); + // foreach (var add in address) + // { + // foreach (var p in PlcData.GetType().GetProperties()) + // { + // if(add.code == p.Name) + // { + // add.value = PlcData.GetType().GetProperty(p.Name).GetValue(PlcData).ToString(); + // writeaddress.Add(add); + // } + // } + // } + // var ulist = writeaddress.GroupBy(a => a.dbaddress).ToList(); + // foreach (var u in ulist) + // { + // var readresult = WriteOneDB(u.ToList()); + // if (!readresult.Success) + // { + // return BllResult.Error(readresult.Msg); + // } + // } + // return BllResult.Sucess(address, "成功"); + //} private BllResult TransforWCSDataToAddressData(List address, OperateResult read) {