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

303 lines
11 KiB
C#

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