|
|
|
@ -1,12 +1,19 @@
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using DataBlockHelper;
|
|
|
|
|
using DataBlockHelper.DBHelpers;
|
|
|
|
|
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Controls.ChemicalWeighing;
|
|
|
|
|
using Mesnac.Controls.Default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Dan
|
|
|
|
|
{
|
|
|
|
@ -14,6 +21,10 @@ namespace Mesnac.Action.ChemicalWeighing.Dan
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Que que;
|
|
|
|
|
public Timer timer;
|
|
|
|
|
MCButton BtnA;
|
|
|
|
|
MCButton BtnB;
|
|
|
|
|
MCButton BtnC;
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
RunIni(runtime);
|
|
|
|
@ -29,6 +40,142 @@ namespace Mesnac.Action.ChemicalWeighing.Dan
|
|
|
|
|
var pro = controller.FirstOrDefault(x => x.Name == name) as HslLanternSimple;
|
|
|
|
|
sourceProperty.SetValue(que, pro);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BtnA = controller.FirstOrDefault(x => x.Name == "BtnA") as MCButton;
|
|
|
|
|
BtnB = controller.FirstOrDefault(x => x.Name == "BtnB") as MCButton;
|
|
|
|
|
BtnC = controller.FirstOrDefault(x => x.Name == "BtnC") as MCButton;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// M20.4 A线确认
|
|
|
|
|
//M20.5 B线确认
|
|
|
|
|
//M20.6 C线确认
|
|
|
|
|
|
|
|
|
|
BtnA.Click += (s, e) =>
|
|
|
|
|
{
|
|
|
|
|
var a= PlcConnect.Instance.ReadBool("M20.4").Content;
|
|
|
|
|
if (a)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("A线已经确认");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PlcConnect.Instance.Write("M20.4",true);
|
|
|
|
|
MessageBox.Show("A线确认成功");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BtnB.Click += (s, e) =>
|
|
|
|
|
{
|
|
|
|
|
var b = PlcConnect.Instance.ReadBool("M20.5").Content;
|
|
|
|
|
if (b)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("B线已经确认");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PlcConnect.Instance.Write("M20.5", true);
|
|
|
|
|
MessageBox.Show("B线确认成功");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BtnC.Click += (s, e) =>
|
|
|
|
|
{
|
|
|
|
|
var c = PlcConnect.Instance.ReadBool("M20.6").Content;
|
|
|
|
|
if (c)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("C线已经确认");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PlcConnect.Instance.Write("M20.6", true);
|
|
|
|
|
MessageBox.Show("C线确认成功");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timer = new Timer();
|
|
|
|
|
timer.Interval = 1000;
|
|
|
|
|
timer.Enabled = true;
|
|
|
|
|
timer.Tick += new EventHandler(StateRefresh);//添加事件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void StateRefresh(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (GetAllControls().Count == 0)
|
|
|
|
|
{
|
|
|
|
|
timer.Stop();
|
|
|
|
|
timer.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db92DengHelp dB92 = new Db92DengHelp();
|
|
|
|
|
var a = dB92.DegA;
|
|
|
|
|
SetValue(que.HslAA,a.A);
|
|
|
|
|
SetValue(que.HslAB, a.B);
|
|
|
|
|
SetValue(que.HslAC, a.C);
|
|
|
|
|
SetValue(que.HslAD, a.D);
|
|
|
|
|
SetValue(que.HslAE, a.E);
|
|
|
|
|
SetValue(que.HslAF, a.F);
|
|
|
|
|
SetValue(que.HslAG, a.G);
|
|
|
|
|
SetValue(que.HslAH, a.H);
|
|
|
|
|
SetValue(que.HslAI, a.I);
|
|
|
|
|
SetValue(que.HslAJ, a.J);
|
|
|
|
|
SetValue(que.HslAK, a.K);
|
|
|
|
|
SetValue(que.HslAL, a.L);
|
|
|
|
|
SetValue(que.HslAM, a.M);
|
|
|
|
|
SetValue(que.HslAN, a.N);
|
|
|
|
|
SetValue(que.HslAO, a.O);
|
|
|
|
|
a = dB92.DegB;
|
|
|
|
|
|
|
|
|
|
SetValue(que.HslBA, a.A);
|
|
|
|
|
SetValue(que.HslBB, a.B);
|
|
|
|
|
SetValue(que.HslBC, a.C);
|
|
|
|
|
SetValue(que.HslBD, a.D);
|
|
|
|
|
SetValue(que.HslBE, a.E);
|
|
|
|
|
SetValue(que.HslBF, a.F);
|
|
|
|
|
SetValue(que.HslBG, a.G);
|
|
|
|
|
SetValue(que.HslBH, a.H);
|
|
|
|
|
SetValue(que.HslBI, a.I);
|
|
|
|
|
SetValue(que.HslBJ, a.J);
|
|
|
|
|
SetValue(que.HslBK, a.K);
|
|
|
|
|
SetValue(que.HslBL, a.L);
|
|
|
|
|
SetValue(que.HslBM, a.M);
|
|
|
|
|
SetValue(que.HslBN, a.N);
|
|
|
|
|
SetValue(que.HslBO, a.O);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a = dB92.DegC;
|
|
|
|
|
|
|
|
|
|
SetValue(que.HslCA, a.A);
|
|
|
|
|
SetValue(que.HslCB, a.B);
|
|
|
|
|
SetValue(que.HslCC, a.C);
|
|
|
|
|
SetValue(que.HslCD, a.D);
|
|
|
|
|
SetValue(que.HslCE, a.E);
|
|
|
|
|
SetValue(que.HslCF, a.F);
|
|
|
|
|
SetValue(que.HslCG, a.G);
|
|
|
|
|
SetValue(que.HslCH, a.H);
|
|
|
|
|
SetValue(que.HslCI, a.I);
|
|
|
|
|
SetValue(que.HslCJ, a.J);
|
|
|
|
|
SetValue(que.HslCK, a.K);
|
|
|
|
|
SetValue(que.HslCL, a.L);
|
|
|
|
|
SetValue(que.HslCM, a.M);
|
|
|
|
|
SetValue(que.HslCN, a.N);
|
|
|
|
|
SetValue(que.HslCO, a.O);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetValue(HslLanternSimple simple,bool boolDeg)
|
|
|
|
|
{
|
|
|
|
|
if (boolDeg)
|
|
|
|
|
{
|
|
|
|
|
simple.LanternBackground=System.Drawing.Color.Green;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
simple.LanternBackground = System.Drawing.Color.Gray;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|