修改现场设置

dep
我叫锄头 1 year ago
parent 728593abec
commit 1aa778ecf8

@ -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

@ -649,6 +649,12 @@
</Compile>
<Compile Include="RoleManage\initRoleFormAction.cs" />
<Compile Include="RoleManage\RoleHelper.cs" />
<Compile Include="SetFromValue\FormEnqPar.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SetFromValue\FormEnqPar.Designer.cs">
<DependentUpon>FormEnqPar.cs</DependentUpon>
</Compile>
<Compile Include="ShiftManage\InitFormAction.cs" />
<Compile Include="ShiftManage\ModifyShiftTimeAction.cs" />
<Compile Include="Sys\TimerRunService.cs" />
@ -847,6 +853,9 @@
<EmbeddedResource Include="RoleManage\FrmRole.resx">
<DependentUpon>FrmRole.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SetFromValue\FormEnqPar.resx">
<DependentUpon>FormEnqPar.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Technical\PmtRecipe\FrmRecipe.resx">
<DependentUpon>FrmRecipe.cs</DependentUpon>
<SubType>Designer</SubType>

@ -0,0 +1,264 @@
namespace Mesnac.Action.ChemicalWeighing.SetValueInfo
{
partial class FormEnqPar
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

@ -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("现场按钮下发成功");
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -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<TestAction>.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();
}
}
}

@ -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();

Loading…
Cancel
Save