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.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs

1571 lines
52 KiB
C#

6 months ago
using Mesnac.Action.Base;
using Mesnac.Controls.Default;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataBlockHelper.DBHelpers;
6 months ago
using Mesnac.Controls.ChemicalWeighing;
using DataBlockHelper;
4 months ago
using System.Threading;
using Timer = System.Windows.Forms.Timer;
6 months ago
namespace Mesnac.Action.ChemicalWeighing.Qu
{
internal class InitAction : ChemicalWeighingAction, IAction
{
MCLabel MCLabelA;
MCLabel MCLabelB;
MCButton BtnA;
MCButton BtnB;
Timer timer;
MCTextBox vibSilo_On;
MCTextBox vibSilo_Off;
MCTextBox vibDaybin_On;
MCTextBox vibDaybin_Off;
MCTextBox vibHopper_On;
MCTextBox vibHopper_Off;
MCTextBox plsSilo_On;
MCTextBox plsSilo_Off;
MCTextBox plsDaybin_On;
MCTextBox plsDaybin_Off;
MCTextBox plsHopper_On;
MCTextBox plsHopper_Off;
MCButton btnUpdate;
MCButton MCButton2147483646;
6 months ago
HslLanternSimple HslEnable;
HslLanternSimple HslPuase;
MCButton BtnEnable;
MCButton BtnPuase;
HslLanternSimple CoolWaterA;
HslLanternSimple CoolWaterB;
HslLanternSimple HotWaterA;
HslLanternSimple HotWaterB;
MCButton BtnCoolWaterA;
MCButton BtnCoolWaterB;
MCButton BtnHotWaterA;
MCButton BtnHotWaterB;
HslLanternSimple HslDa;
HslLanternSimple HslDb;
HslLanternSimple HslDc;
HslLanternSimple HslDd;
MCButton BtnDa;
MCButton BtnDb;
MCButton BtnDc;
MCButton BtnDd;
MCTextBox txtAOpen;
MCTextBox txtBOpen;
MCTextBox txtCOpen;
MCTextBox txtDOpen;
MCTextBox txtEOpen;
MCTextBox txtFOpen;
MCTextBox txtGOpen;
MCTextBox txtHOpen;
MCTextBox txtIOpen;
MCTextBox txtJOpen;
MCTextBox txtKOpen;
MCTextBox txtLOpen;
MCTextBox txtMOpen;
MCTextBox txtNOpen;
MCTextBox txtOOpen;
MCTextBox txtAClose;
MCTextBox txtBClose;
MCTextBox txtCClose;
MCTextBox txtDClose;
MCTextBox txtEClose;
MCTextBox txtFClose;
MCTextBox txtGClose;
MCTextBox txtHClose;
MCTextBox txtIClose;
MCTextBox txtJClose;
MCTextBox txtKClose;
MCTextBox txtLClose;
MCTextBox txtMClose;
MCTextBox txtNClose;
MCTextBox txtOClose;
MCButton MCButton2147483645;//同步
MCButton MCButton2147483644;
5 months ago
HslLanternSimple HA;
HslLanternSimple HB;
HslLanternSimple HC;
HslLanternSimple HD;
MCButton McA;
MCButton McB;
MCButton McC;
MCButton McD;
4 months ago
MCButton MCButtonA1;
MCButton MCButtonA2;
MCButton MCButtonB1;
MCButton MCButtonB2;
HslSwitch HslSwitch1;
HslSwitch HslSwitch2;
HslSwitch HslSwitch3;
HslSwitch HslSwitch4;
HslSwitch HslSwitch5;
HslSwitch HslSwitch6;
HslSwitch HslSwitch7;
HslSwitch HslSwitch8;
HslSwitch HslSwitch9;
HslSwitch HslSwitch10;
HslSwitch HslSwitch11;
HslSwitch HslSwitch12;
HslSwitch HslSwitch13;
HslSwitch HslSwitch14;
HslSwitch HslSwitch15;
4 months ago
HslSwitch HslSwitchz1;
HslSwitch HslSwitchz2;
HslSwitch HslSwitchz3;
HslSwitch HslSwitchz4;
HslSwitch HslSwitchz5;
HslSwitch HslSwitchz6;
HslSwitch HslSwitchz7;
HslSwitch HslSwitchz8;
HslSwitch HslSwitchz9;
HslSwitch HslSwitchz10;
HslSwitch HslSwitchz11;
HslSwitch HslSwitchz12;
HslSwitch HslSwitchz13;
HslSwitch HslSwitchz14;
HslSwitch HslSwitchz15;
4 months ago
HslSwitch HslSwitch16;
4 months ago
HslSwitch HslSwitch17;
4 months ago
4 months ago
HslLanternSimple Hsldq1;
HslLanternSimple Hsldq2;
HslLanternSimple HslKq1;
HslLanternSimple HslKq2;
4 months ago
HslLanternSimple H1;
HslLanternSimple H2;
HslLanternSimple H3;
HslLanternSimple H4;
HslLanternSimple H5;
HslLanternSimple H6;
HslLanternSimple H7;
HslLanternSimple H8;
HslLanternSimple H9;
HslLanternSimple H10;
HslLanternSimple H11;
HslLanternSimple H12;
HslLanternSimple H13;
HslLanternSimple H14;
HslLanternSimple H15;
4 months ago
6 months ago
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
var controls = GetAllControls();
5 months ago
HA = controls.FirstOrDefault(x => x.Name == "HA") as HslLanternSimple;
HB = controls.FirstOrDefault(x => x.Name == "HB") as HslLanternSimple;
HC = controls.FirstOrDefault(x => x.Name == "HC") as HslLanternSimple;
HD = controls.FirstOrDefault(x => x.Name == "HD") as HslLanternSimple;
4 months ago
Hsldq1 = controls.FirstOrDefault(x => x.Name == "Hsldq1") as HslLanternSimple;
Hsldq2 = controls.FirstOrDefault(x => x.Name == "Hsldq2") as HslLanternSimple;
HslKq1 = controls.FirstOrDefault(x => x.Name == "Hslkq1") as HslLanternSimple;
HslKq2 = controls.FirstOrDefault(x => x.Name == "Hslkq2") as HslLanternSimple;
5 months ago
McA = controls.FirstOrDefault(x => x.Name == "McA") as MCButton;
McB = controls.FirstOrDefault(x => x.Name == "McB") as MCButton;
McC = controls.FirstOrDefault(x => x.Name == "McC") as MCButton;
McD = controls.FirstOrDefault(x => x.Name == "McD") as MCButton;
4 months ago
MCButtonA1 = controls.FirstOrDefault(x => x.Name == "MCButtonA1") as MCButton;
MCButtonA2 = controls.FirstOrDefault(x => x.Name == "MCButtonA2") as MCButton;
MCButtonB1 = controls.FirstOrDefault(x => x.Name == "MCButtonB1") as MCButton;
MCButtonB2 = controls.FirstOrDefault(x => x.Name == "MCButtonB2") as MCButton;
MCButtonA1.Click += MCButtonA1_Click;
MCButtonA2.Click += MCButtonA2_Click;
MCButtonB1.Click += MCButtonB1_Click;
MCButtonB2.Click += MCButtonB2_Click;
5 months ago
MCButton2147483645 = controls.FirstOrDefault(x => x.Name == "MCButton2147483645") as MCButton;
MCButton2147483645.Click += MCButton2147483644_Click;
MCButton2147483644 = controls.FirstOrDefault(x => x.Name == "MCButton2147483644") as MCButton;
MCButton2147483644.Click += MCButton2147483644_Click1;
5 months ago
HslDa = controls.FirstOrDefault(x => x.Name == "HslDa") as HslLanternSimple;
HslDb = controls.FirstOrDefault(x => x.Name == "HslDb") as HslLanternSimple;
HslDc = controls.FirstOrDefault(x => x.Name == "HslDc") as HslLanternSimple;
HslDd = controls.FirstOrDefault(x => x.Name == "HslDd") as HslLanternSimple;
5 months ago
BtnDa = controls.FirstOrDefault(x => x.Name == "BtnDa") as MCButton;
BtnDb = controls.FirstOrDefault(x => x.Name == "BtnDb") as MCButton;
BtnDc = controls.FirstOrDefault(x => x.Name == "BtnDc") as MCButton;
BtnDd = controls.FirstOrDefault(x => x.Name == "BtnDd") as MCButton;
5 months ago
McA.Text = "缓存仓A启停";
McB.Text = "缓存仓B启停";
McC.Text = "缓存仓C启停";
McD.Text = "缓存仓D启停";
McA.Click += McA_Click;
McB.Click += McB_Click;
McC.Click += McC_Click;
McD.Click += McD_Click;
BtnDa.Click += BtnDa_Click;
BtnDb.Click += BtnDb_Click;
BtnDc.Click += BtnDc_Click;
BtnDd.Click += BtnDd_Click;
6 months ago
BtnCoolWaterA = controls.FirstOrDefault(x => x.Name == "BtnCoolWaterA") as MCButton;
BtnCoolWaterA.Click += BtnCoolWaterA_Click;
BtnCoolWaterB = controls.FirstOrDefault(x => x.Name == "BtnCoolWaterB") as MCButton;
BtnCoolWaterB.Click += BtnCoolWaterB_Click;
BtnHotWaterA = controls.FirstOrDefault(x => x.Name == "BtnCoolHotWaterA") as MCButton;
BtnHotWaterA.Click += BtnHotWaterA_Click;
BtnHotWaterB = controls.FirstOrDefault(x => x.Name == "BtnCoolHotWaterB") as MCButton;
BtnHotWaterB.Click += BtnHotWaterB_Click;
CoolWaterA = controls.FirstOrDefault(x => x.Name == "CoolWaterA") as HslLanternSimple;
CoolWaterB = controls.FirstOrDefault(x => x.Name == "CoolWaterB") as HslLanternSimple;
HotWaterA = controls.FirstOrDefault(x => x.Name == "HotWaterA") as HslLanternSimple;
HotWaterB = controls.FirstOrDefault(x => x.Name == "HotWaterB") as HslLanternSimple;
HslEnable = controls.FirstOrDefault(x => x.Name == "HslEnable") as HslLanternSimple;
HslPuase = controls.FirstOrDefault(x => x.Name == "HslPuase") as HslLanternSimple;
BtnEnable = controls.FirstOrDefault(x => x.Name == "BtnEnable") as MCButton;
BtnEnable.Click += BtnEnable_Click;
5 months ago
6 months ago
BtnPuase = controls.FirstOrDefault(x => x.Name == "BtnPuase") as MCButton;
BtnPuase.Click += BtnPuase_Click;
6 months ago
MCLabelA = controls.FirstOrDefault(x => x.Name == "MCLabelA") as MCLabel;
MCLabelA.MCValue = "";
MCLabelB = controls.FirstOrDefault(x => x.Name == "MCLabelB") as MCLabel;
MCLabelB.MCValue = "";
BtnA = controls.FirstOrDefault(x => x.Name == "BtnA") as MCButton;
BtnB = controls.FirstOrDefault(x => x.Name == "BtnB") as MCButton;
5 months ago
vibSilo_On = controls.FirstOrDefault(x => x.Name == "vibSilo_On") as MCTextBox;
vibSilo_Off = controls.FirstOrDefault(x => x.Name == "vibSilo_Off") as MCTextBox;
6 months ago
vibDaybin_On = controls.FirstOrDefault(x => x.Name == "vibDaybin_On") as MCTextBox;
vibDaybin_Off = controls.FirstOrDefault(x => x.Name == "vibDaybin_Off") as MCTextBox;
vibHopper_On = controls.FirstOrDefault(x => x.Name == "vibHopper_On") as MCTextBox;
vibHopper_Off = controls.FirstOrDefault(x => x.Name == "vibHopper_Off") as MCTextBox;
plsSilo_On = controls.FirstOrDefault(x => x.Name == "plsSilo_On") as MCTextBox;
plsSilo_Off = controls.FirstOrDefault(x => x.Name == "plsSilo_Off") as MCTextBox;
plsDaybin_On = controls.FirstOrDefault(x => x.Name == "plsDaybin_On") as MCTextBox;
plsDaybin_Off = controls.FirstOrDefault(x => x.Name == "plsDaybin_Off") as MCTextBox;
plsHopper_On = controls.FirstOrDefault(x => x.Name == "plsHopper_On") as MCTextBox;
plsHopper_Off = controls.FirstOrDefault(x => x.Name == "plsHopper_Off") as MCTextBox;
//BtnUpdate
5 months ago
btnUpdate = controls.FirstOrDefault(x => x.Name == "BtnUpdate") as MCButton;
6 months ago
MCButton2147483646 = controls.FirstOrDefault(x => x.Name == "MCButton2147483646") as MCButton;
MCButton2147483646.Click += MCButton2147483646_Click;
5 months ago
MCButton2147483646_Click(new object(), new EventArgs());
6 months ago
BtnA.Click += BtnA_Click;
BtnB.Click += BtnB_Click;
btnUpdate.Click += BtnBc_Click;
timer = new Timer();
timer.Interval = 1000;
timer.Enabled = true;
timer.Tick += new EventHandler(StateRefresh);//添加事件
txtAOpen = controls.FirstOrDefault(x => x.Name == "txtAOpen") as MCTextBox;
txtBOpen = controls.FirstOrDefault(x => x.Name == "txtBOpen") as MCTextBox;
txtCOpen = controls.FirstOrDefault(x => x.Name == "txtCOpen") as MCTextBox;
txtDOpen = controls.FirstOrDefault(x => x.Name == "txtDOpen") as MCTextBox;
txtEOpen = controls.FirstOrDefault(x => x.Name == "txtEOpen") as MCTextBox;
txtFOpen = controls.FirstOrDefault(x => x.Name == "txtFOpen") as MCTextBox;
txtGOpen = controls.FirstOrDefault(x => x.Name == "txtGOpen") as MCTextBox;
txtHOpen = controls.FirstOrDefault(x => x.Name == "txtHOpen") as MCTextBox;
txtIOpen = controls.FirstOrDefault(x => x.Name == "txtIOpen") as MCTextBox;
txtJOpen = controls.FirstOrDefault(x => x.Name == "txtJOpen") as MCTextBox;
txtKOpen = controls.FirstOrDefault(x => x.Name == "txtKOpen") as MCTextBox;
txtLOpen = controls.FirstOrDefault(x => x.Name == "txtLOpen") as MCTextBox;
txtMOpen = controls.FirstOrDefault(x => x.Name == "txtMOpen") as MCTextBox;
txtNOpen = controls.FirstOrDefault(x => x.Name == "txtNOpen") as MCTextBox;
txtOOpen = controls.FirstOrDefault(x => x.Name == "txtOOpen") as MCTextBox;
txtAClose = controls.FirstOrDefault(x => x.Name == "txtAClose") as MCTextBox;
txtBClose = controls.FirstOrDefault(x => x.Name == "txtBClose") as MCTextBox;
txtCClose = controls.FirstOrDefault(x => x.Name == "txtCClose") as MCTextBox;
txtDClose = controls.FirstOrDefault(x => x.Name == "txtDClose") as MCTextBox;
txtEClose = controls.FirstOrDefault(x => x.Name == "txtEClose") as MCTextBox;
txtFClose = controls.FirstOrDefault(x => x.Name == "txtFClose") as MCTextBox;
txtGClose = controls.FirstOrDefault(x => x.Name == "txtGClose") as MCTextBox;
txtHClose = controls.FirstOrDefault(x => x.Name == "txtHClose") as MCTextBox;
txtIClose = controls.FirstOrDefault(x => x.Name == "txtIClose") as MCTextBox;
txtJClose = controls.FirstOrDefault(x => x.Name == "txtJClose") as MCTextBox;
txtKClose = controls.FirstOrDefault(x => x.Name == "txtKClose") as MCTextBox;
txtLClose = controls.FirstOrDefault(x => x.Name == "txtLClose") as MCTextBox;
txtMClose = controls.FirstOrDefault(x => x.Name == "txtMClose") as MCTextBox;
txtNClose = controls.FirstOrDefault(x => x.Name == "txtNClose") as MCTextBox;
txtOClose = controls.FirstOrDefault(x => x.Name == "txtOClose") as MCTextBox;
4 months ago
HslSwitch1 = controls.FirstOrDefault(x => x.Name == "HslSwitch1") as HslSwitch;
HslSwitch1.Text = "大仓A";
HslSwitch2 = controls.FirstOrDefault(x => x.Name == "HslSwitch2") as HslSwitch;
HslSwitch2.Text = "大仓B";
HslSwitch3 = controls.FirstOrDefault(x => x.Name == "HslSwitch3") as HslSwitch;
HslSwitch3.Text = "大仓C";
HslSwitch4 = controls.FirstOrDefault(x => x.Name == "HslSwitch4") as HslSwitch;
HslSwitch4.Text = "大仓D";
HslSwitch5 = controls.FirstOrDefault(x => x.Name == "HslSwitch5") as HslSwitch;
HslSwitch5.Text = "大仓E";
HslSwitch6 = controls.FirstOrDefault(x => x.Name == "HslSwitch6") as HslSwitch;
HslSwitch6.Text = "大仓F";
HslSwitch7 = controls.FirstOrDefault(x => x.Name == "HslSwitch7") as HslSwitch;
HslSwitch7.Text = "大仓G";
HslSwitch8 = controls.FirstOrDefault(x => x.Name == "HslSwitch8") as HslSwitch;
HslSwitch8.Text = "大仓H";
HslSwitch9 = controls.FirstOrDefault(x => x.Name == "HslSwitch9") as HslSwitch;
HslSwitch9.Text = "大仓I";
HslSwitch10= controls.FirstOrDefault(x => x.Name == "HslSwitch10") as HslSwitch;
HslSwitch10.Text = "大仓J";
HslSwitch11 = controls.FirstOrDefault(x => x.Name == "HslSwitch11") as HslSwitch;
HslSwitch11.Text = "大仓K";
HslSwitch12 = controls.FirstOrDefault(x => x.Name == "HslSwitch12") as HslSwitch;
HslSwitch12.Text = "大仓L";
HslSwitch13 = controls.FirstOrDefault(x => x.Name == "HslSwitch13") as HslSwitch;
HslSwitch13.Text = "大仓M";
HslSwitch14 = controls.FirstOrDefault(x => x.Name == "HslSwitch14") as HslSwitch;
HslSwitch14.Text = "大仓N";
HslSwitch15 = controls.FirstOrDefault(x => x.Name == "HslSwitch15") as HslSwitch;
HslSwitch15.Text = "大仓O";
4 months ago
HslSwitch16 = controls.FirstOrDefault(x => x.Name == "HslSwitch16") as HslSwitch;
HslSwitch16.Text = "回收仓侧吹启停";
4 months ago
4 months ago
HslSwitch17 = controls.FirstOrDefault(x => x.Name == "HslSwitch17") as HslSwitch;
HslSwitch17.Text = "回收仓振动电机启停";
4 months ago
HslSwitchz1 = controls.FirstOrDefault(x => x.Name == "HslSwitchz1") as HslSwitch;
HslSwitchz1.Text = "大仓A";
HslSwitchz1.SwitchStatusDescription = "正常;暂停中";
HslSwitchz2 = controls.FirstOrDefault(x => x.Name == "HslSwitchz2") as HslSwitch;
HslSwitchz2.Text = "大仓B";
HslSwitchz2.SwitchStatusDescription = "正常;暂停中";
HslSwitchz3 = controls.FirstOrDefault(x => x.Name == "HslSwitchz3") as HslSwitch;
HslSwitchz3.Text = "大仓C";
HslSwitchz3.SwitchStatusDescription = "正常;暂停中";
HslSwitchz4 = controls.FirstOrDefault(x => x.Name == "HslSwitchz4") as HslSwitch;
HslSwitchz4.Text = "大仓D";
HslSwitchz4.SwitchStatusDescription = "正常;暂停中";
HslSwitchz5 = controls.FirstOrDefault(x => x.Name == "HslSwitchz5") as HslSwitch;
HslSwitchz5.Text = "大仓E";
HslSwitchz5.SwitchStatusDescription = "正常;暂停中";
HslSwitchz6 = controls.FirstOrDefault(x => x.Name == "HslSwitchz6") as HslSwitch;
HslSwitchz6.Text = "大仓F";
HslSwitchz6.SwitchStatusDescription = "正常;暂停中";
HslSwitchz7 = controls.FirstOrDefault(x => x.Name == "HslSwitchz7") as HslSwitch;
HslSwitchz7.Text = "大仓G";
HslSwitchz7.SwitchStatusDescription = "正常;暂停中";
HslSwitchz8 = controls.FirstOrDefault(x => x.Name == "HslSwitchz8") as HslSwitch;
HslSwitchz8.Text = "大仓H";
HslSwitchz8.SwitchStatusDescription = "正常;暂停中";
HslSwitchz9 = controls.FirstOrDefault(x => x.Name == "HslSwitchz9") as HslSwitch;
HslSwitchz9.Text = "大仓I";
HslSwitchz9.SwitchStatusDescription = "正常;暂停中";
HslSwitchz10 = controls.FirstOrDefault(x => x.Name == "HslSwitchz10") as HslSwitch;
HslSwitchz10.Text = "大仓J";
HslSwitchz10.SwitchStatusDescription = "正常;暂停中";
HslSwitchz11 = controls.FirstOrDefault(x => x.Name == "HslSwitchz11") as HslSwitch;
HslSwitchz11.Text = "大仓K";
HslSwitchz11.SwitchStatusDescription = "正常;暂停中";
HslSwitchz12 = controls.FirstOrDefault(x => x.Name == "HslSwitchz12") as HslSwitch;
HslSwitchz12.Text = "大仓L";
HslSwitchz12.SwitchStatusDescription = "正常;暂停中";
HslSwitchz13 = controls.FirstOrDefault(x => x.Name == "HslSwitchz13") as HslSwitch;
HslSwitchz13.Text = "大仓M";
HslSwitchz13.SwitchStatusDescription = "正常;暂停中";
HslSwitchz14 = controls.FirstOrDefault(x => x.Name == "HslSwitchz14") as HslSwitch;
HslSwitchz14.Text = "大仓N";
HslSwitchz14.SwitchStatusDescription = "正常;暂停中";
HslSwitchz15 = controls.FirstOrDefault(x => x.Name == "HslSwitchz15") as HslSwitch;
HslSwitchz15.Text = "大仓O";
HslSwitchz15.SwitchStatusDescription = "正常;暂停中";
H1 = controls.FirstOrDefault(x => x.Name == "H1") as HslLanternSimple;
H2 = controls.FirstOrDefault(x => x.Name == "H2") as HslLanternSimple;
H3 = controls.FirstOrDefault(x => x.Name == "H3") as HslLanternSimple;
H4 = controls.FirstOrDefault(x => x.Name == "H4") as HslLanternSimple;
H5 = controls.FirstOrDefault(x => x.Name == "H5") as HslLanternSimple;
H6 = controls.FirstOrDefault(x => x.Name == "H6") as HslLanternSimple;
H7 = controls.FirstOrDefault(x => x.Name == "H7") as HslLanternSimple;
H8 = controls.FirstOrDefault(x => x.Name == "H8") as HslLanternSimple;
H9 = controls.FirstOrDefault(x => x.Name == "H9") as HslLanternSimple;
H10 = controls.FirstOrDefault(x => x.Name == "H10") as HslLanternSimple;
H11 = controls.FirstOrDefault(x => x.Name == "H11") as HslLanternSimple;
H12 = controls.FirstOrDefault(x => x.Name == "H12") as HslLanternSimple;
H13 = controls.FirstOrDefault(x => x.Name == "H13") as HslLanternSimple;
H14 = controls.FirstOrDefault(x => x.Name == "H14") as HslLanternSimple;
H15 = controls.FirstOrDefault(x => x.Name == "H15") as HslLanternSimple;
4 months ago
HslSwitch1.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch2.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch3.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch4.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch5.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch6.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch7.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch8.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch9.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch10.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch11.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch12.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch13.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch14.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
HslSwitch15.OnSwitchChanged += HslSwitch1_OnSwitchChanged;
4 months ago
HslSwitch16.OnSwitchChanged += HslSwitch16_OnSwitchChanged;
4 months ago
4 months ago
HslSwitchz1.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz2.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz3.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz4.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz5.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz6.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz7.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz8.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz9.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz10.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz11.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz12.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz13.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz14.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
HslSwitchz15.OnSwitchChanged += HslSwitchz1_OnSwitchChanged;
4 months ago
HslSwitch17.OnSwitchChanged += HslSwitch17_OnSwitchChanged;
5 months ago
MCButton2147483644_Click(new object(), new EventArgs());
4 months ago
AAA();
}
4 months ago
private void HslSwitch17_OnSwitchChanged(object arg1, bool arg2)
{
string add = "DB2119.17.0";
var val = PlcConnect.Instance.ReadBool(add).Content;
PlcConnect.Instance.Write(add, !val);
}
4 months ago
private void HslSwitch16_OnSwitchChanged(object arg1, bool arg2)
{
string add = "DB2119.16.7";
var val = PlcConnect.Instance.ReadBool(add).Content;
PlcConnect.Instance.Write(add, !val);
}
4 months ago
private void HslSwitch1_OnSwitchChanged(object arg1, bool arg2)
{
var hsl = arg1 as HslSwitch;
string add = "DB2119.15.0";
if (hsl.Name == "HslSwitch1")
{
add = "DB2119.15.0";
}
if (hsl.Name == "HslSwitch2")
{
add = "DB2119.15.1";
}
if (hsl.Name == "HslSwitch3")
{
add = "DB2119.15.2";
}
if (hsl.Name == "HslSwitch4")
{
add = "DB2119.15.3";
}
if (hsl.Name == "HslSwitch5")
{
add = "DB2119.15.4";
}
if (hsl.Name == "HslSwitch6")
{
add = "DB2119.15.5";
}
if (hsl.Name == "HslSwitch7")
{
add = "DB2119.15.6";
}
if (hsl.Name == "HslSwitch8")
{
add = "DB2119.15.7";
}
if (hsl.Name == "HslSwitch9")
{
add = "DB2119.16.0";
}
if (hsl.Name == "HslSwitch10")
{
add = "DB2119.16.1";
}
if (hsl.Name == "HslSwitch11")
{
add = "DB2119.16.2";
}
if (hsl.Name == "HslSwitch12")
{
add = "DB2119.16.3";
}
if (hsl.Name == "HslSwitch13")
{
add = "DB2119.16.4";
}
if (hsl.Name == "HslSwitch14")
{
add = "DB2119.16.5";
}
if (hsl.Name == "HslSwitch15")
{
add = "DB2119.16.6";
}
4 months ago
if (hsl.Name == "HslSwitch16")
{
add = "DB2119.16.7";
}
4 months ago
var val = PlcConnect.Instance.ReadBool(add).Content;
PlcConnect.Instance.Write(add, !val);
}
4 months ago
private void HslSwitchz1_OnSwitchChanged(object arg1, bool arg2)
{
var hsl = arg1 as HslSwitch;
string add = "";
if (hsl.Name == "HslSwitchz1")
{
add = "DB2119.17.1";
}
if (hsl.Name == "HslSwitchz2")
{
add = "DB2119.17.2";
}
if (hsl.Name == "HslSwitchz3")
{
add = "DB2119.17.3";
}
if (hsl.Name == "HslSwitchz4")
{
add = "DB2119.17.4";
}
if (hsl.Name == "HslSwitchz5")
{
add = "DB2119.17.5";
}
if (hsl.Name == "HslSwitchz6")
{
add = "DB2119.17.6";
}
if (hsl.Name == "HslSwitchz7")
{
add = "DB2119.17.7";
}
if (hsl.Name == "HslSwitchz8")
{
add = "DB2119.18.0";
}
if (hsl.Name == "HslSwitchz9")
{
add = "DB2119.18.1";
}
if (hsl.Name == "HslSwitchz10")
{
add = "DB2119.18.2";
}
if (hsl.Name == "HslSwitchz11")
{
add = "DB2119.18.3";
}
if (hsl.Name == "HslSwitchz12")
{
add = "DB2119.18.4";
}
if (hsl.Name == "HslSwitchz13")
{
add = "DB2119.18.5";
}
if (hsl.Name == "HslSwitchz14")
{
add = "DB2119.18.6";
}
if (hsl.Name == "HslSwitchz15")
{
add = "DB2119.18.7";
}
var val = PlcConnect.Instance.ReadBool(add).Content;
PlcConnect.Instance.Write(add, !val);
}
4 months ago
private void MCButtonB2_Click(object sender, EventArgs e)
{
string address = "DB2119.14.7";
var plc = PlcConnect.Instance;
plc.Write(address, true);
Thread.Sleep(500);
plc.Write(address, false);
MessageBox.Show("复位成功");
}
private void MCButtonB1_Click(object sender, EventArgs e)
{
string address = "DB2119.14.6";
var plc = PlcConnect.Instance;
plc.Write(address, true);
Thread.Sleep(500);
plc.Write(address, false);
MessageBox.Show("复位成功");
}
private void MCButtonA2_Click(object sender, EventArgs e)
{
string address = "DB2119.14.5";
var plc = PlcConnect.Instance;
plc.Write(address, true);
Thread.Sleep(500);
plc.Write(address, false);
MessageBox.Show("复位成功");
}
private void MCButtonA1_Click(object sender, EventArgs e)
{
string address = "DB2119.14.4";
var plc = PlcConnect.Instance;
plc.Write(address, true);
Thread.Sleep(500);
plc.Write(address, false);
MessageBox.Show("复位成功");
}
5 months ago
private void McD_Click(object sender, EventArgs e)
{
4 months ago
var sss = "DB2119.14.3";
5 months ago
bool a = PlcConnect.Instance.ReadBool(sss).Content;
PlcConnect.Instance.Write(sss, !a);
}
private void McC_Click(object sender, EventArgs e)
{
4 months ago
var sss = "DB2119.14.2";
5 months ago
bool a = PlcConnect.Instance.ReadBool(sss).Content;
PlcConnect.Instance.Write(sss, !a);
}
private void McB_Click(object sender, EventArgs e)
{
4 months ago
var sss = "DB2119.14.1";
5 months ago
bool a = PlcConnect.Instance.ReadBool(sss).Content;
PlcConnect.Instance.Write(sss, !a);
}
private void McA_Click(object sender, EventArgs e)
{
4 months ago
var sss = "DB2119.14.0";
5 months ago
bool a = PlcConnect.Instance.ReadBool(sss).Content;
PlcConnect.Instance.Write(sss, !a);
}
private void MCButton2147483644_Click1(object sender, EventArgs e)
{
var plc = PlcConnect.Instance;
int start = 1208;
plc.Write($"DB2108.{start}.0", short.Parse(txtAOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtBOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtCOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtDOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtEOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtFOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtGOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtHOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtIOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtJOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtKOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtLOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtMOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtNOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtOOpen.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtAClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtBClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtCClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtDClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtEClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtFClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtGClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtHClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtIClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtJClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtKClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtLClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtMClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtNClose.MCValue.ToString()));
start += 2;
plc.Write($"DB2108.{start}.0", short.Parse(txtOClose.MCValue.ToString()));
MessageBox.Show("下传数据成功");
}
/// <summary>
/// 同步
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MCButton2147483644_Click(object sender, EventArgs e)
{
5 months ago
Db2108PlcSetTime db = new Db2108PlcSetTime();
txtAOpen.Text = db.OpenA.ToString();
txtBOpen.Text = db.OpenB.ToString();
txtCOpen.Text = db.OpenC.ToString();
txtDOpen.Text = db.OpenD.ToString();
txtEOpen.Text = db.OpenE.ToString();
txtFOpen.Text = db.OpenF.ToString();
txtGOpen.Text = db.OpenG.ToString();
txtHOpen.Text = db.OpenH.ToString();
txtIOpen.Text = db.OpenI.ToString();
txtJOpen.Text = db.OpenJ.ToString();
txtKOpen.Text = db.OpenK.ToString();
txtLOpen.Text = db.OpenL.ToString();
txtMOpen.Text = db.OpenM.ToString();
txtNOpen.Text = db.OpenN.ToString();
txtOOpen.Text = db.OpenO.ToString();
txtAClose.Text = db.CloseA.ToString();
txtBClose.Text = db.CloseB.ToString();
txtCClose.Text = db.CloseC.ToString();
txtDClose.Text = db.CloseD.ToString();
txtEClose.Text = db.CloseE.ToString();
txtFClose.Text = db.CloseF.ToString();
txtGClose.Text = db.CloseG.ToString();
txtHClose.Text = db.CloseH.ToString();
txtIClose.Text = db.CloseI.ToString();
txtJClose.Text = db.CloseJ.ToString();
txtKClose.Text = db.CloseK.ToString();
txtLClose.Text = db.CloseL.ToString();
txtMClose.Text = db.CloseM.ToString();
txtNClose.Text = db.CloseN.ToString();
txtOClose.Text = db.CloseO.ToString();
}
private void BtnDd_Click(object sender, EventArgs e)
{
if (BtnDd.MCValue.ToString().Contains("开"))
{
DB2108HelperWriteNew.WriteD(true);
}
else
{
DB2108HelperWriteNew.WriteD(false);
}
}
private void BtnDc_Click(object sender, EventArgs e)
{
if (BtnDc.MCValue.ToString().Contains("开"))
{
DB2108HelperWriteNew.WriteC(true);
}
else
{
DB2108HelperWriteNew.WriteC(false);
}
}
private void BtnDb_Click(object sender, EventArgs e)
{
if (BtnDb.MCValue.ToString().Contains("开"))
{
DB2108HelperWriteNew.WriteB(true);
}
else
{
DB2108HelperWriteNew.WriteB(false);
}
}
private void BtnDa_Click(object sender, EventArgs e)
{
6 months ago
if (BtnDa.MCValue.ToString().Contains("开"))
{
DB2108HelperWriteNew.WriteA(true);
}
else
{
DB2108HelperWriteNew.WriteA(false);
}
6 months ago
}
6 months ago
private void BtnHotWaterB_Click(object sender, EventArgs e)
{
if (BtnHotWaterB.MCValue.ToString().Contains("开"))
{
PlcConnect.Instance.Write("DB2108.8.0", true);
}
else
{
PlcConnect.Instance.Write("DB2108.8.0", false);
}
}
private void BtnHotWaterA_Click(object sender, EventArgs e)
{
if (BtnHotWaterA.MCValue.ToString().Contains("开"))
{
PlcConnect.Instance.Write("DB2108.6.0", true);
}
else
{
PlcConnect.Instance.Write("DB2108.6.0", false);
}
}
private void BtnCoolWaterB_Click(object sender, EventArgs e)
{
if (BtnCoolWaterB.MCValue.ToString().Contains("开"))
{
PlcConnect.Instance.Write("DB2108.4.0", true);
}
else
{
PlcConnect.Instance.Write("DB2108.4.0", false);
}
}
private void BtnCoolWaterA_Click(object sender, EventArgs e)
{
if (BtnCoolWaterA.MCValue.ToString().Contains("开"))
{
PlcConnect.Instance.Write("DB2108.2.0", true);
}
else
{
PlcConnect.Instance.Write("DB2108.2.0", false);
}
}
private void BtnPuase_Click(object sender, EventArgs e)
{
//BtnPuase
if (BtnPuase.MCValue.ToString() == "启动")
{
PlcConnect.Instance.Write("DB2108.0.1", true);
}
else
{
PlcConnect.Instance.Write("DB2108.0.1", false);
}
}
private void BtnEnable_Click(object sender, EventArgs e)
{
5 months ago
if (BtnEnable.MCValue.ToString() == "启动使能")
6 months ago
{
5 months ago
PlcConnect.Instance.Write("DB2108.0.0", true);
6 months ago
}
else
{
PlcConnect.Instance.Write("DB2108.0.0", false);
}
}
6 months ago
private void MCButton2147483646_Click(object sender, EventArgs e)
{
DB2108HelperNew dB2108 = new DB2108HelperNew();
Time2108 time = dB2108.Time;
if (time != null)
{
vibSilo_On.MCValue = time.VibSiloOn;
vibSilo_Off.MCValue = time.VibSiloOff;
vibDaybin_On.MCValue = time.VibDaybinOn;
vibDaybin_Off.MCValue = time.VibDaybinOff;
vibHopper_On.MCValue = time.VibHopperOn;
vibHopper_Off.MCValue = time.VibHopperOff;
plsSilo_On.MCValue = time.PlsSiloOn;
plsSilo_Off.MCValue = time.PlsSiloOff;
plsDaybin_On.MCValue = time.PlsDaybinOn;
plsDaybin_Off.MCValue = time.PlsDaybinOff;
plsHopper_On.MCValue = time.PlsHopperOn;
plsHopper_Off.MCValue = time.PlsHopperOff;
}
6 months ago
5 months ago
6 months ago
6 months ago
}
private void BtnA_Click(object sender, EventArgs e)
{
5 months ago
6 months ago
DB2110WriteHelper.WriteA();
MessageBox.Show("清理成功");
}
private void BtnB_Click(object sender, EventArgs e)
{
DB2110WriteHelper.WriteB();
MessageBox.Show("清理成功");
}
private void BtnBc_Click(object sender, EventArgs e)
{
5 months ago
var b = Check(vibSilo_On);
6 months ago
if (b == false) return;
b = Check(vibSilo_Off);
if (b == false) return;
b = Check(vibDaybin_On);
if (b == false) return;
b = Check(vibDaybin_Off);
if (b == false) return;
b = Check(vibHopper_On);
if (b == false) return;
b = Check(vibHopper_Off);
if (b == false) return;
b = Check(plsSilo_On);
if (b == false) return;
b = Check(plsSilo_Off);
if (b == false) return;
b = Check(plsDaybin_On);
if (b == false) return;
b = Check(plsDaybin_Off);
if (b == false) return;
b = Check(plsHopper_On);
if (b == false) return;
b = Check(plsHopper_Off);
if (b == false) return;
5 months ago
Time2108 time = new Time2108();
6 months ago
time.VibSiloOn = ushort.Parse(vibSilo_On.MCValue.ToString());
time.VibSiloOff = ushort.Parse(vibSilo_Off.MCValue.ToString());
time.VibDaybinOn = ushort.Parse(vibDaybin_On.MCValue.ToString());
time.VibDaybinOff = ushort.Parse(vibDaybin_Off.MCValue.ToString());
5 months ago
time.VibHopperOn = ushort.Parse(vibHopper_On.MCValue.ToString());
time.VibHopperOff = ushort.Parse(vibHopper_Off.MCValue.ToString());
6 months ago
5 months ago
time.PlsSiloOn = ushort.Parse(plsSilo_On.MCValue.ToString());
time.PlsSiloOff = ushort.Parse(plsSilo_Off.MCValue.ToString());
6 months ago
5 months ago
time.PlsDaybinOn = ushort.Parse(plsDaybin_On.MCValue.ToString());
time.PlsDaybinOff = ushort.Parse(plsDaybin_Off.MCValue.ToString());
6 months ago
time.PlsHopperOn = ushort.Parse(plsHopper_On.MCValue.ToString());
time.PlsHopperOff = ushort.Parse(plsHopper_Off.MCValue.ToString());
DB2108HelperWriteNew.Inser(time);
MessageBox.Show("更新成功");
}
private bool Check(MCTextBox cTextBox)
{
try
{
int mc = Convert.ToInt32(cTextBox.MCValue.ToString());
5 months ago
if (mc <= 0 || mc > 60)
6 months ago
{
MessageBox.Show("范围错误 [1-60]");
return false;
}
}
catch (Exception)
{
MessageBox.Show("格式错误");
return false;
}
return true;
5 months ago
6 months ago
}
private void StateRefresh(object sender, EventArgs e)
{
6 months ago
if (GetAllControls().Count == 0)
{
timer.Stop();
timer.Dispose();
timer = null;
}
5 months ago
Db2110Help db2110 = new Db2110Help();
6 months ago
string a = db2110.GetA();
if (a.Length == 0)
{
MCLabelA.MCValue = "无";
}
else
{
MCLabelA.MCValue = a;
}
5 months ago
string b = db2110.GetB();
6 months ago
if (b.Length == 0)
{
MCLabelB.MCValue = "无";
}
else
{
MCLabelB.MCValue = b;
}
6 months ago
DB2108HelperNew dB2108 = new DB2108HelperNew();
var main = dB2108.Main;
if (main.pause)
{
BtnPuase.MCValue = "停止";
HslPuase.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnPuase.MCValue = "启动";
HslPuase.LanternBackground = System.Drawing.Color.Gray;
}
if (main.enable)
{
HslEnable.LanternBackground = System.Drawing.Color.Green;
6 months ago
BtnEnable.MCValue = "关闭使能";
6 months ago
}
else
{
BtnEnable.MCValue = "启动使能";
HslEnable.LanternBackground = System.Drawing.Color.Gray;
}
5 months ago
var ab = dB2108.CoolWaterA;
6 months ago
if (ab.enable)
{
BtnCoolWaterA.MCValue = "冷水秤A使能关闭";
5 months ago
CoolWaterA.LanternBackground = System.Drawing.Color.Green;
6 months ago
}
else
{
BtnCoolWaterA.MCValue = "冷水秤A使能开始";
CoolWaterA.LanternBackground = System.Drawing.Color.Gray;
}
5 months ago
ab = dB2108.CoolWaterB;
6 months ago
if (ab.enable)
{
BtnCoolWaterB.MCValue = "冷水秤B使能关闭";
CoolWaterB.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnCoolWaterB.MCValue = "冷水秤B使能开始";
CoolWaterB.LanternBackground = System.Drawing.Color.Gray;
}
ab = dB2108.HotWaterA;
if (ab.enable)
{
BtnHotWaterA.MCValue = "热水秤A使能关闭";
HotWaterA.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnHotWaterA.MCValue = "热水秤A使能开始";
HotWaterA.LanternBackground = System.Drawing.Color.Gray;
}
ab = dB2108.HotWaterB;
if (ab.enable)
{
BtnHotWaterB.MCValue = "热水秤B使能关闭";
HotWaterB.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnHotWaterB.MCValue = "热水秤B使能开始";
HotWaterB.LanternBackground = System.Drawing.Color.Gray;
}
6 months ago
//干混机
ab = dB2108.DryA;
if (ab.enable)
{
BtnDa.MCValue = "干混A使能关";
5 months ago
HslDa.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnDa.MCValue = "干混A使能开";
HslDa.LanternBackground = System.Drawing.Color.Gray;
}
ab = dB2108.DryB;
if (ab.enable)
{
BtnDb.MCValue = "干混B使能关";
HslDb.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnDb.MCValue = "干混B使能开";
HslDb.LanternBackground = System.Drawing.Color.Gray;
}
ab = dB2108.DryC;
if (ab.enable)
{
BtnDc.MCValue = "干混C使能关";
HslDc.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnDc.MCValue = "干混C使能开";
HslDc.LanternBackground = System.Drawing.Color.Gray;
}
ab = dB2108.DryD;
if (ab.enable)
{
BtnDd.MCValue = "干混D使能关";
HslDd.LanternBackground = System.Drawing.Color.Green;
}
else
{
BtnDd.MCValue = "干混D使能开";
HslDd.LanternBackground = System.Drawing.Color.Gray;
}
5 months ago
4 months ago
var bit = PlcConnect.Instance.ReadByte("DB2119.14.0").Content;
5 months ago
var a1 = bit.GetBit(0);
if (a1)
{
HA.LanternBackground = System.Drawing.Color.Green;
}
else
{
HA.LanternBackground = System.Drawing.Color.Gray;
}
a1 = bit.GetBit(1);
if (a1)
{
HB.LanternBackground = System.Drawing.Color.Green;
}
else
{
HB.LanternBackground = System.Drawing.Color.Gray;
}
a1 = bit.GetBit(2);
if (a1)
{
HC.LanternBackground = System.Drawing.Color.Green;
}
else
{
HC.LanternBackground = System.Drawing.Color.Gray;
}
a1 = bit.GetBit(3);
if (a1)
{
HD.LanternBackground = System.Drawing.Color.Green;
}
else
{
HD.LanternBackground = System.Drawing.Color.Gray;
}
4 months ago
var plc = PlcConnect.Instance;
//Hsldq1
4 months ago
var dq = plc.ReadBool("DB2119.21.0").Content;
4 months ago
if (dq)
{
Hsldq1.LanternBackground = System.Drawing.Color.Green;
}
else
{
Hsldq1.LanternBackground = System.Drawing.Color.Gray;
}
4 months ago
dq = plc.ReadBool("DB2119.21.2").Content;
4 months ago
if (dq)
{
Hsldq2.LanternBackground = System.Drawing.Color.Green;
}
else
{
Hsldq2.LanternBackground = System.Drawing.Color.Gray;
}
4 months ago
dq = plc.ReadBool("DB2119.20.7").Content;
4 months ago
if (dq)
{
HslKq1.LanternBackground = System.Drawing.Color.Green;
}
else
{
HslKq1.LanternBackground = System.Drawing.Color.Gray;
}
4 months ago
dq = plc.ReadBool("DB2119.21.1").Content;
4 months ago
if (dq)
{
HslKq2.LanternBackground = System.Drawing.Color.Green;
}
else
{
HslKq2.LanternBackground = System.Drawing.Color.Gray;
}
4 months ago
4 months ago
var byt = plc.Read("DB2119.19.0", 2).Content;
var at = byt[0];
Set(H1, at.GetBit(0));
Set(H2, at.GetBit(1));
Set(H3, at.GetBit(2));
Set(H4, at.GetBit(3));
Set(H5, at.GetBit(4));
Set(H6, at.GetBit(5));
Set(H7, at.GetBit(6));
Set(H8, at.GetBit(7));
at = byt[1];
Set(H9, at.GetBit(0));
Set(H10, at.GetBit(1));
Set(H11, at.GetBit(2));
Set(H12, at.GetBit(3));
Set(H13, at.GetBit(4));
Set(H14, at.GetBit(5));
Set(H15, at.GetBit(6));
4 months ago
4 months ago
}
public void Set(HslLanternSimple hsl,bool dq)
{
if (dq)
{
hsl.LanternBackground = System.Drawing.Color.Green;
}
else
{
hsl.LanternBackground = System.Drawing.Color.Gray;
}
}
public void AAA()
{
var plc=PlcConnect.Instance;
4 months ago
var byt = plc.Read("DB2119.15.0", 2).Content;
var at = byt[0];
4 months ago
this.HslSwitch1.SwitchStatus = at.GetBit(0);
4 months ago
this.HslSwitch2.SwitchStatus = at.GetBit(1);
this.HslSwitch3.SwitchStatus = at.GetBit(2);
this.HslSwitch4.SwitchStatus = at.GetBit(3);
this.HslSwitch5.SwitchStatus = at.GetBit(4);
this.HslSwitch6.SwitchStatus = at.GetBit(5);
this.HslSwitch7.SwitchStatus = at.GetBit(6);
this.HslSwitch8.SwitchStatus = at.GetBit(7);
at = byt[1];
this.HslSwitch9.SwitchStatus = at.GetBit(0);
this.HslSwitch10.SwitchStatus = at.GetBit(1);
this.HslSwitch11.SwitchStatus = at.GetBit(2);
this.HslSwitch12.SwitchStatus = at.GetBit(3);
this.HslSwitch13.SwitchStatus = at.GetBit(4);
this.HslSwitch14.SwitchStatus = at.GetBit(5);
this.HslSwitch15.SwitchStatus = at.GetBit(6);
4 months ago
var sss = plc.ReadBool("DB2119.16.7").Content;
this.HslSwitch16.SwitchStatus = sss;
4 months ago
sss = plc.ReadBool("DB2119.17.0").Content;
this.HslSwitch17.SwitchStatus = sss;
4 months ago
byt = plc.Read("DB2119.17.0", 2).Content;
at = byt[0];
this.HslSwitchz1.SwitchStatus = at.GetBit(1);
this.HslSwitchz2.SwitchStatus = at.GetBit(2);
this.HslSwitchz3.SwitchStatus = at.GetBit(3);
this.HslSwitchz4.SwitchStatus = at.GetBit(4);
this.HslSwitchz5.SwitchStatus = at.GetBit(5);
this.HslSwitchz6.SwitchStatus = at.GetBit(6);
this.HslSwitchz7.SwitchStatus = at.GetBit(7);
at = byt[1];
this.HslSwitchz8.SwitchStatus = at.GetBit(0);
this.HslSwitchz9.SwitchStatus = at.GetBit(1);
this.HslSwitchz10.SwitchStatus = at.GetBit(2);
this.HslSwitchz11.SwitchStatus = at.GetBit(3);
this.HslSwitchz12.SwitchStatus = at.GetBit(4);
this.HslSwitchz13.SwitchStatus = at.GetBit(5);
this.HslSwitchz14.SwitchStatus = at.GetBit(6);
this.HslSwitchz15.SwitchStatus = at.GetBit(7);
byt = plc.Read("DB2119.19.0", 2).Content;
at = byt[0];
Set(H1, at.GetBit(0));
Set(H2, at.GetBit(1));
Set(H3, at.GetBit(2));
Set(H4, at.GetBit(3));
Set(H5, at.GetBit(4));
Set(H6, at.GetBit(5));
Set(H7, at.GetBit(6));
Set(H8, at.GetBit(7));
at = byt[1];
Set(H9, at.GetBit(0));
Set(H10, at.GetBit(1));
Set(H11, at.GetBit(2));
Set(H12, at.GetBit(3));
Set(H13, at.GetBit(4));
Set(H14, at.GetBit(5));
Set(H15, at.GetBit(6));
6 months ago
}
5 months ago
4 months ago
6 months ago
}
}
5 months ago