diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs index f3de485..87e1c23 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs @@ -19,6 +19,7 @@ using DataBlockHelper; using System.Diagnostics; using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity; using Mesnac.Action.ChemicalWeighing.InterfaceDocking; +using Mesnac.Action.ChemicalWeighing.SetValueInfo; namespace Mesnac.Action.ChemicalWeighing.AutoControl { @@ -364,38 +365,42 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl if(ButtonE.GelSetWeight == runtime.Sender) { - var singE = ControlsHelper.SingleSelect(RadioE); - if (singE == 0) - { - MessageBox.Show("请选择湿混机"); - } - else - { - float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString()); - float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString()); - int no = (singE + 1) / 2; - string message = $"确认设置螺旋{no} 现场重量 {w}"; - if (MessageBox.Show($"{message}?", "现场参数确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - if (t < 0.1) - { - MessageBox.Show("公差不能小于0.1!"); - return; - } - - - SetValue value = new SetValue() - { - Value = w, - Toterance = t - }; - - PlcAutoWriteHelper.WetSetWeight(value, RadioE); - } - - + + FormEnqPar formEnqPar = new FormEnqPar(); + formEnqPar.ShowDialog(); + + //var singE = ControlsHelper.SingleSelect(RadioE); + //if (singE == 0) + //{ + // MessageBox.Show("请选择湿混机"); + //} + //else + //{ + // float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString()); + // float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString()); + // int no = (singE + 1) / 2; + // string message = $"确认设置螺旋{no} 现场重量 {w}"; + // if (MessageBox.Show($"{message}?", "现场参数确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + // { + // return; + // } + // if (t < 0.1) + // { + // MessageBox.Show("公差不能小于0.1!"); + // return; + // } + + + // SetValue value = new SetValue() + // { + // Value = w, + // Toterance = t + // }; + + // PlcAutoWriteHelper.WetSetWeight(value, RadioE); + //} + + } #endregion diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index b013889..1c03991 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -649,6 +649,12 @@ + + Form + + + FormEnqPar.cs + @@ -847,6 +853,9 @@ FrmRole.cs + + FormEnqPar.cs + FrmRecipe.cs Designer diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.Designer.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.Designer.cs new file mode 100644 index 0000000..2b81de0 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.Designer.cs @@ -0,0 +1,264 @@ +namespace Mesnac.Action.ChemicalWeighing.SetValueInfo +{ + partial class FormEnqPar + { + /// + /// 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.groupBox2 = new System.Windows.Forms.GroupBox(); + this.txtValue8 = new System.Windows.Forms.TextBox(); + this.txtValue7 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.txtValue6 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtValue3 = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.txtValue4 = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.txtValue5 = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.txtValue2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtValue1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.txtValue8); + this.groupBox2.Controls.Add(this.txtValue7); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.txtValue6); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.txtValue3); + this.groupBox2.Controls.Add(this.label10); + this.groupBox2.Controls.Add(this.txtValue4); + this.groupBox2.Controls.Add(this.label9); + this.groupBox2.Controls.Add(this.txtValue5); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.txtValue2); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.txtValue1); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Location = new System.Drawing.Point(26, 31); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(275, 312); + this.groupBox2.TabIndex = 0; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "参数"; + // + // txtValue8 + // + this.txtValue8.Location = new System.Drawing.Point(80, 249); + this.txtValue8.Name = "txtValue8"; + this.txtValue8.Size = new System.Drawing.Size(100, 21); + this.txtValue8.TabIndex = 19; + // + // txtValue7 + // + this.txtValue7.Location = new System.Drawing.Point(80, 216); + this.txtValue7.Name = "txtValue7"; + this.txtValue7.Size = new System.Drawing.Size(100, 21); + this.txtValue7.TabIndex = 19; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(35, 249); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(23, 12); + this.label6.TabIndex = 18; + this.label6.Text = "8号"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(34, 219); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(23, 12); + this.label5.TabIndex = 18; + this.label5.Text = "7号"; + // + // txtValue6 + // + this.txtValue6.Location = new System.Drawing.Point(80, 189); + this.txtValue6.Name = "txtValue6"; + this.txtValue6.Size = new System.Drawing.Size(100, 21); + this.txtValue6.TabIndex = 17; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(34, 194); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(23, 12); + this.label4.TabIndex = 16; + this.label4.Text = "6号"; + // + // txtValue3 + // + this.txtValue3.Location = new System.Drawing.Point(81, 95); + this.txtValue3.Name = "txtValue3"; + this.txtValue3.Size = new System.Drawing.Size(100, 21); + this.txtValue3.TabIndex = 15; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(34, 98); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(23, 12); + this.label10.TabIndex = 14; + this.label10.Text = "3号"; + // + // txtValue4 + // + this.txtValue4.Location = new System.Drawing.Point(81, 124); + this.txtValue4.Name = "txtValue4"; + this.txtValue4.Size = new System.Drawing.Size(100, 21); + this.txtValue4.TabIndex = 13; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(34, 127); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(23, 12); + this.label9.TabIndex = 12; + this.label9.Text = "4号"; + // + // txtValue5 + // + this.txtValue5.Location = new System.Drawing.Point(81, 154); + this.txtValue5.Name = "txtValue5"; + this.txtValue5.Size = new System.Drawing.Size(100, 21); + this.txtValue5.TabIndex = 11; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(35, 159); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(23, 12); + this.label8.TabIndex = 10; + this.label8.Text = "5号"; + // + // txtValue2 + // + this.txtValue2.Location = new System.Drawing.Point(81, 68); + this.txtValue2.Name = "txtValue2"; + this.txtValue2.Size = new System.Drawing.Size(100, 21); + this.txtValue2.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(34, 71); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(23, 12); + this.label3.TabIndex = 0; + this.label3.Text = "2号"; + // + // txtValue1 + // + this.txtValue1.Location = new System.Drawing.Point(81, 41); + this.txtValue1.Name = "txtValue1"; + this.txtValue1.Size = new System.Drawing.Size(100, 21); + this.txtValue1.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(34, 44); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(23, 12); + this.label2.TabIndex = 0; + this.label2.Text = "1号"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(26, 383); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(116, 57); + this.button1.TabIndex = 1; + this.button1.Text = "保存"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(176, 383); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(118, 57); + this.button2.TabIndex = 1; + this.button2.Text = "关闭"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // FormEnqPar + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(349, 483); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.groupBox2); + this.Name = "FormEnqPar"; + this.Text = "现场按钮设备参数"; + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox txtValue8; + private System.Windows.Forms.TextBox txtValue7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox txtValue6; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtValue3; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox txtValue4; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.TextBox txtValue5; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox txtValue2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtValue1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.cs new file mode 100644 index 0000000..841e45e --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.cs @@ -0,0 +1,80 @@ +using DataBlockHelper; + +using HslCommunication.Profinet.Siemens; + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesnac.Action.ChemicalWeighing.SetValueInfo +{ + public partial class FormEnqPar : Form + { + public FormEnqPar() + { + InitializeComponent(); + this.FormBorderStyle = FormBorderStyle.FixedDialog;//设置边框为不可调节 + this.MaximizeBox = false;//取消最大化按键 + this.MinimizeBox = false;//取消最小化按键 + Init(); + } + + private void Init() + { + ///临时着急用 直接访问plc + + string db = "DB2105.222.0"; + var siemensS7Net = PlcConnect.Instance; + var byts = siemensS7Net.Read(db, 32).Content; + txtValue1.Text = siemensS7Net.ByteTransform.TransSingle(byts, 0).ToString(); + txtValue2.Text = siemensS7Net.ByteTransform.TransSingle(byts, 4).ToString(); + txtValue3.Text = siemensS7Net.ByteTransform.TransSingle(byts, 8).ToString(); + txtValue4.Text = siemensS7Net.ByteTransform.TransSingle(byts, 12).ToString(); + + txtValue5.Text = siemensS7Net.ByteTransform.TransSingle(byts, 16).ToString(); + txtValue6.Text = siemensS7Net.ByteTransform.TransSingle(byts, 20).ToString(); + txtValue7.Text = siemensS7Net.ByteTransform.TransSingle(byts, 24).ToString(); + txtValue8.Text = siemensS7Net.ByteTransform.TransSingle(byts, 28).ToString(); + } + + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button1_Click(object sender, EventArgs e) + { + var s7 = PlcConnect.Instance; + int start = 222; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue1.Text)); + + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue2.Text)); + + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue3.Text)); + + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue4.Text)); + + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue5.Text)); + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue6.Text)); + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue7.Text)); + + start += 4; + s7.Write($"DB2105.{start}.0", Convert.ToSingle(txtValue8.Text)); + + MessageBox.Show("现场按钮下发成功"); + } + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.resx b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/SetFromValue/FormEnqPar.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index 00b4ee8..1f09c27 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -21,6 +21,7 @@ using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor; using Mesnac.Action.ChemicalWeighing.MinAn; using Mesnac.Action.ChemicalWeighing.Report; using Mesnac.Action.ChemicalWeighing.RgvPlc; +using Mesnac.Action.ChemicalWeighing.SetValueInfo; using Mesnac.Basic; using Mesnac.Codd.Session; using Mesnac.Controls.Base; @@ -43,8 +44,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test public void theout(object source, EventArgs e) { - LoggingService.InfoFormatted("定时器开始运行"); - ReportReadDb.ReadReport(); + } public void Run(RuntimeParameter runtime) @@ -55,18 +55,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test hslMove = allDb.FirstOrDefault(x => x.Name == "HslMoveText1") as HslMoveText; - this.hslMove.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); - this.hslMove.BackColor = Color.FromArgb(128, 128, 255); - this.hslMove.Font = new Font("楷体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134); - this.hslMove.ForeColor = Color.Yellow; - - this.hslMove.Margin = new Padding(5, 6, 5, 6); - this.hslMove.MoveSpeed = 2f; - - this.hslMove.Size = new Size(726, 49); - this.hslMove.TabIndex = 8; - this.hslMove.Text = @"公告:这是一条测试的公告信息"; - + mCButton.Click += MCButton_Click; @@ -79,9 +68,8 @@ namespace Mesnac.Action.ChemicalWeighing.Test private void MCButton_Click(object sender, EventArgs e) { - ReportReadDb.ReadFeededDry(); - - var list= DB2105WriteHelper.GetWaterStatus(); + FormEnqPar formEnqPar = new FormEnqPar(); + formEnqPar.ShowDialog(); } } } diff --git a/DataBlockHelper/PlcConnect.cs b/DataBlockHelper/PlcConnect.cs index bb8d6e7..9f7bf82 100644 --- a/DataBlockHelper/PlcConnect.cs +++ b/DataBlockHelper/PlcConnect.cs @@ -20,14 +20,9 @@ namespace DataBlockHelper { SiemensPLCS siemensPLCS = SiemensPLCS.S1500; SiemensS7Net s7 = new SiemensS7Net(siemensPLCS); - s7.SetPersistentConnection(); - - //输送IP - //s7.IpAddress = "192.168.1.110"; - + //配料IP - s7.IpAddress = "127.18.4.100"; - + s7.IpAddress = "172.18.4.100"; s7.Port = 102; var su = s7.ConnectServer();