You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CaiQie/RfidWeb/Frm/FormPar.cs

280 lines
10 KiB
C#

2 weeks ago
using HslCommunication.LogNet;
using HZH_Controls.Forms;
using NewLife.Caching;
using NewLife.Threading;
using System;
1 month ago
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
2 weeks ago
using System.Diagnostics;
1 month ago
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
2 weeks ago
using Tool;
using Tool.Model;
1 month ago
namespace RfidWeb.Frm
{
public partial class FormPar : UserControl
{
2 weeks ago
private ICache cache = Cache.Default;
private ILogNet logNet = ILogNetFactory.GetLogNet;
private TimerX _timer;
1 month ago
public FormPar()
{
InitializeComponent();
2 weeks ago
FillA();
FillB();
//_timer = new TimerX(TimeState, null, 2000, 1000);
//_timer.Async = true;
}
private Dictionary<string, string> dicA = new Dictionary<string, string>();
private Dictionary<string, string> dicB = new Dictionary<string, string>();
private void FillA()
{
dicA.Clear();
textBoxExFeedingMotorSpeed.Text=HmiPoint.GetFeedingMotorSpeed.ToString();
textBoxExLaminatedMotorSpeed.Text= HmiPoint.GetLaminatedMotorSpeed.ToString();
double result = HmiPoint.GetSWSS / 10.0;
textBoxExSWSD.Text = result.ToString();
textBoxExFelt.Text = HmiPoint.GetFeltBeltMotorSpeed.ToString();
textBoxReceiving.Text = HmiPoint.GeReceivingMotorSpeed.ToString();
dicA["A"] = textBoxExFeedingMotorSpeed.Text;
dicA["B"] = textBoxExLaminatedMotorSpeed.Text;
dicA["C"] = HmiPoint.GetSWSS.ToString();
dicA["D"] = textBoxExFelt.Text;
dicA["E"] = textBoxReceiving.Text;
}
private void button8_Click(object sender, EventArgs e)
{
var plc = PlcConnect.Instance;
var a = textBoxExFeedingMotorSpeed.Text;
if (a != dicA["A"])
{
plc.Write(HmiPoint.feeding_motor_speed, uint.Parse(a));
}
var b = textBoxExLaminatedMotorSpeed.Text;
if (b != dicA["B"])
{
plc.Write(HmiPoint.Laminated_motor_speed, uint.Parse(b));
}
var c = UInt32.Parse((Convert.ToDouble(textBoxExSWSD.Text) * 10).ToString()).ToString();
if (c != dicA["C"])
{
plc.Write(HmiPoint.SWSS, uint.Parse(c));
}
var d = textBoxExFelt.Text;
if (d != dicA["D"])
{
plc.Write(HmiPoint.Felt_belt_motor_speed, uint.Parse(d));
}
var ee = textBoxExFelt.Text;
if (ee != dicA["E"])
{
plc.Write(HmiPoint.Receiving_Electric_motor_speed, uint.Parse(ee));
}
MessageBox.Show("保存成功");
}
private void FillB()
{
dicB.Clear();
txtCUTTING_SET_TEMPERATURE1_1.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_1.ToString();
dicB["CUTTING_SET_TEMPERATURE1_1"] = txtCUTTING_SET_TEMPERATURE1_1.Text;
txtCUTTING_SET_TEMPERATURE1_2.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_2.ToString();
dicB["CUTTING_SET_TEMPERATURE1_2"] = txtCUTTING_SET_TEMPERATURE1_2.Text;
txtCUTTING_SET_TEMPERATURE1_3.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_3.ToString();
dicB["CUTTING_SET_TEMPERATURE1_3"] = txtCUTTING_SET_TEMPERATURE1_3.Text;
txtCUTTING_SET_TEMPERATURE1_4.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE1_4.ToString();
dicB["CUTTING_SET_TEMPERATURE1_4"] = txtCUTTING_SET_TEMPERATURE1_4.Text;
txtCUTTING_SET_TEMPERATURE2_1.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_1.ToString();
dicB["CUTTING_SET_TEMPERATURE2_1"] = txtCUTTING_SET_TEMPERATURE2_1.Text;
txtCUTTING_SET_TEMPERATURE2_2.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_2.ToString();
dicB["CUTTING_SET_TEMPERATURE2_2"] = txtCUTTING_SET_TEMPERATURE2_2.Text;
txtCUTTING_SET_TEMPERATURE2_3.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_3.ToString();
dicB["CUTTING_SET_TEMPERATURE2_3"] = txtCUTTING_SET_TEMPERATURE2_3.Text;
txtCUTTING_SET_TEMPERATURE2_4.Text = HmiPoint.GetCUTTING_SET_TEMPERATURE2_4.ToString();
dicB["CUTTING_SET_TEMPERATURE2_4"] = txtCUTTING_SET_TEMPERATURE2_4.Text;
txtCUTTING_SET_TIME1_1.Text = HmiPoint.GetCUTTING_SET_TIME1_1.ToString();
dicB["CUTTING_SET_TIME1_1"] = txtCUTTING_SET_TIME1_1.Text;
txtCUTTING_SET_TIME1_2.Text = HmiPoint.GetCUTTING_SET_TIME1_2.ToString();
dicB["CUTTING_SET_TIME1_2"] = txtCUTTING_SET_TIME1_2.Text;
txtCUTTING_SET_TIME1_3.Text = HmiPoint.GetCUTTING_SET_TIME1_3.ToString();
dicB["CUTTING_SET_TIME1_3"] = txtCUTTING_SET_TIME1_3.Text;
txtCUTTING_SET_TIME1_4.Text = HmiPoint.GetCUTTING_SET_TIME1_4.ToString();
dicB["CUTTING_SET_TIME1_4"] = txtCUTTING_SET_TIME1_4.Text;
txtCUTTING_SET_TIME2_1.Text = HmiPoint.GetCUTTING_SET_TIME2_1.ToString();
dicB["CUTTING_SET_TIME2_1"] = txtCUTTING_SET_TIME2_1.Text;
txtCUTTING_SET_TIME2_2.Text = HmiPoint.GetCUTTING_SET_TIME2_2.ToString();
dicB["CUTTING_SET_TIME2_2"] = txtCUTTING_SET_TIME2_2.Text;
txtCUTTING_SET_TIME2_3.Text = HmiPoint.GetCUTTING_SET_TIME2_3.ToString();
dicB["CUTTING_SET_TIME2_3"] = txtCUTTING_SET_TIME2_3.Text;
txtCUTTING_SET_TIME2_4.Text = HmiPoint.GetCUTTING_SET_TIME2_4.ToString();
dicB["CUTTING_SET_TIME2_4"] = txtCUTTING_SET_TIME2_4.Text;
}
private void button7_Click(object sender, EventArgs e)
{
var plc = PlcConnect.Instance;
var CUTTING_SET_TEMPERATURE1_1= HmiPoint.GetCUTTING_SET_TEMPERATURE1_1.ToString();
if (CUTTING_SET_TEMPERATURE1_1 != dicB["CUTTING_SET_TEMPERATURE1_1"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_1, uint.Parse(CUTTING_SET_TEMPERATURE1_1));
}
var CUTTING_SET_TEMPERATURE1_2 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_2.ToString();
if (CUTTING_SET_TEMPERATURE1_2 != dicB["CUTTING_SET_TEMPERATURE1_2"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_2, uint.Parse(CUTTING_SET_TEMPERATURE1_2));
}
var CUTTING_SET_TEMPERATURE1_3 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_3.ToString();
if (CUTTING_SET_TEMPERATURE1_3 != dicB["CUTTING_SET_TEMPERATURE1_3"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_3, uint.Parse(CUTTING_SET_TEMPERATURE1_3));
}
var CUTTING_SET_TEMPERATURE1_4 = HmiPoint.GetCUTTING_SET_TEMPERATURE1_4.ToString();
if (CUTTING_SET_TEMPERATURE1_4 != dicB["CUTTING_SET_TEMPERATURE1_4"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE1_4, uint.Parse(CUTTING_SET_TEMPERATURE1_4));
}
var CUTTING_SET_TEMPERATURE2_1 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_1.ToString();
if (CUTTING_SET_TEMPERATURE2_1 != dicB["CUTTING_SET_TEMPERATURE2_1"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_1, uint.Parse(CUTTING_SET_TEMPERATURE2_1));
}
var CUTTING_SET_TEMPERATURE2_2 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_2.ToString();
if (CUTTING_SET_TEMPERATURE2_2 != dicB["CUTTING_SET_TEMPERATURE2_2"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_2, uint.Parse(CUTTING_SET_TEMPERATURE2_2));
}
var CUTTING_SET_TEMPERATURE2_3 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_3.ToString();
if (CUTTING_SET_TEMPERATURE2_3 != dicB["CUTTING_SET_TEMPERATURE2_3"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_3, uint.Parse(CUTTING_SET_TEMPERATURE2_3));
}
var CUTTING_SET_TEMPERATURE2_4 = HmiPoint.GetCUTTING_SET_TEMPERATURE2_4.ToString();
if (CUTTING_SET_TEMPERATURE2_4 != dicB["CUTTING_SET_TEMPERATURE2_4"])
{
plc.Write(HmiPoint.CUTTING_SET_TEMPERATURE2_4, uint.Parse(CUTTING_SET_TEMPERATURE2_4));
}
var CUTTING_SET_TIME1_1 = HmiPoint.GetCUTTING_SET_TIME1_1.ToString();
if (CUTTING_SET_TIME1_1 != dicB["CUTTING_SET_TIME1_1"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME1_1, uint.Parse(CUTTING_SET_TIME1_1));
}
var CUTTING_SET_TIME1_2 = HmiPoint.GetCUTTING_SET_TIME1_2.ToString();
if (CUTTING_SET_TIME1_2 != dicB["CUTTING_SET_TIME1_2"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME1_2, uint.Parse(CUTTING_SET_TIME1_2));
}
var CUTTING_SET_TIME1_3 = HmiPoint.GetCUTTING_SET_TIME1_3.ToString();
if (CUTTING_SET_TIME1_3 != dicB["CUTTING_SET_TIME1_3"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME1_3, uint.Parse(CUTTING_SET_TIME1_3));
}
var CUTTING_SET_TIME1_4 = HmiPoint.GetCUTTING_SET_TIME1_4.ToString();
if (CUTTING_SET_TIME1_4 != dicB["CUTTING_SET_TIME1_4"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME1_4, uint.Parse(CUTTING_SET_TIME1_4));
}
var CUTTING_SET_TIME2_1 = HmiPoint.GetCUTTING_SET_TIME2_1.ToString();
if (CUTTING_SET_TIME2_1 != dicB["CUTTING_SET_TIME2_1"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME2_1, uint.Parse(CUTTING_SET_TIME2_1));
}
var CUTTING_SET_TIME2_2 = HmiPoint.GetCUTTING_SET_TIME2_2.ToString();
if (CUTTING_SET_TIME2_2 != dicB["CUTTING_SET_TIME2_2"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME2_2, uint.Parse(CUTTING_SET_TIME2_2));
}
var CUTTING_SET_TIME2_3 = HmiPoint.GetCUTTING_SET_TIME2_3.ToString();
if (CUTTING_SET_TIME2_3 != dicB["CUTTING_SET_TIME2_3"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME2_3, uint.Parse(CUTTING_SET_TIME2_3));
}
var CUTTING_SET_TIME2_4 = HmiPoint.GetCUTTING_SET_TIME2_4.ToString();
if (CUTTING_SET_TIME2_4 != dicB["CUTTING_SET_TIME2_4"])
{
plc.Write(HmiPoint.CUTTING_SET_TIME2_4, uint.Parse(CUTTING_SET_TIME2_4));
}
MessageBox.Show("保存成功");
1 month ago
}
}
}