diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/DBHelper/PlcConnect.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/DBHelper/PlcConnect.cs
index c9684c6..3796b22 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/DBHelper/PlcConnect.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/DBHelper/PlcConnect.cs
@@ -20,15 +20,15 @@ namespace Mesnac.Action.ChemicalWeighing
{
SiemensPLCS siemensPLCS = SiemensPLCS.S1500;
SiemensS7Net s7 = new SiemensS7Net(siemensPLCS);
-
+
//配料IP
- s7.IpAddress = "192.168.10.130";
+ s7.IpAddress = "127.0.0.1";// "192.168.10.130";
s7.Port = 102;
var su = s7.ConnectServer();
if (!su.IsSuccess)
{
- s7.IpAddress = "192.168.10.130";
+ s7.IpAddress = "127.0.0.1";// "192.168.10.130";
s7.Port = 102;
var su1 = s7.ConnectServer();
if (!su1.IsSuccess)
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
index 92d9d10..fdcffba 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -772,6 +772,10 @@
{18BCAA9F-D601-43B6-B443-E6B126ADF540}
Mesnac.Controls.Base
+
+ {b9b99759-8b95-4078-a5e9-a63e0e48384c}
+ Mesnac.Controls.ChemicalWeighing
+
{f022c0e6-2819-4fb1-bb86-0f389f061a44}
Mesnac.Controls.Default
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Show/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Show/InitFormAction.cs
index a66274c..6dba64d 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Show/InitFormAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Show/InitFormAction.cs
@@ -33,10 +33,14 @@ namespace Mesnac.Action.ChemicalWeighing.Show
string planFlag= string.Empty;
string planFlag2 = string.Empty;
bool planFlag3 = true;
+ bool Flag4 = true;
+ bool Flag5 = true;
#endregion
System.Timers.Timer timer = new System.Timers.Timer(3000);
System.Timers.Timer timer2 = new System.Timers.Timer(3000);
+ System.Timers.Timer timer3 = new System.Timers.Timer(1000);
+ System.Timers.Timer timer4 = new System.Timers.Timer(1000);
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime);
@@ -74,6 +78,17 @@ namespace Mesnac.Action.ChemicalWeighing.Show
timer2.AutoReset = true;
timer2.Enabled = true;
timer2.Start();
+
+ timer3.Elapsed += new ElapsedEventHandler(UpdateShow1);
+ timer3.AutoReset = true;
+ timer3.Enabled = true;
+ timer3.Start();
+
+ timer4.Elapsed += new ElapsedEventHandler(UpdateShow2);
+ timer4.AutoReset = true;
+ timer4.Enabled = true;
+ timer4.Start();
+
//StartServer1();
//StartServer2();
#region 初始化
@@ -179,6 +194,13 @@ namespace Mesnac.Action.ChemicalWeighing.Show
private void StartServer1(object sender, ElapsedEventArgs e)
{
+ var lblPlanName = base.GetControlById("lblPlanName") as System.Windows.Forms.Label;//配方名称
+ if (lblPlanName == null)
+ {
+ timer.Stop();
+ timer.Close();
+ return;
+ }
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_weigh").FirstOrDefault(); //获取本机台计划控件
if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
{
@@ -191,13 +213,7 @@ namespace Mesnac.Action.ChemicalWeighing.Show
try
{
- var lblPlanName = base.GetControlById("lblPlanName") as System.Windows.Forms.Label;//配方名称
- if (lblPlanName == null)
- {
- timer.Stop();
- timer.Close();
- return;
- }
+
var lblRecipeName = base.GetControlById("lblRecipeName") as System.Windows.Forms.Label;//配方名称
var lblTotalBatch = base.GetControlById("lblTotalBatch") as System.Windows.Forms.Label;//总批次
@@ -352,18 +368,11 @@ namespace Mesnac.Action.ChemicalWeighing.Show
private void StartServer2(object sender, ElapsedEventArgs e)
{
- DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "xl_weigh").FirstOrDefault(); //获取本机台计划控件
- if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Error("{首页展示}缺少本机台计划网格控件...");
- return;
- }
-
var lblPlanName = base.GetControlById("lblPlanName2") as System.Windows.Forms.Label;//计划名称
if (lblPlanName == null)
{
- timer.Stop();
- timer.Close();
+ timer2.Stop();
+ timer2.Close();
return;
}
var lblRecipeName = base.GetControlById("lblRecipeName2") as System.Windows.Forms.Label;//配方名称
@@ -375,6 +384,14 @@ namespace Mesnac.Action.ChemicalWeighing.Show
var lblStateMessage = base.GetControlById("lblStateMessage2") as System.Windows.Forms.Label;//配方名称
var lblPlanStateMessage = base.GetControlById("lblPlanState2") as System.Windows.Forms.Label;//计划状态
var rate = base.GetControlById("lblRate") as System.Windows.Forms.Label;//理论固含
+
+ DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_weigh").FirstOrDefault(); //获取本机台计划控件
+ if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
+ {
+ ICSharpCode.Core.LoggingService.Error("{首页展示}缺少本机台计划网格控件...");
+ return;
+ }
+
DataTable table = PlanHelper.GetProWeighbridge2Plan();//正在执行的任务
if (table == null)
{
@@ -507,7 +524,198 @@ namespace Mesnac.Action.ChemicalWeighing.Show
}
+ private void UpdateShow1(object sender, ElapsedEventArgs e)
+ {
+ var lblPlanName = base.GetControlById("lblPlanName2") as System.Windows.Forms.Label;//计划名称
+ if (lblPlanName == null)
+ {
+ timer3.Stop();
+ timer3.Close();
+ return;
+ }
+ if (Flag4)
+ {
+ Flag4 = false;
+ try
+ {
+ var lblReqSerialName = base.GetControlById("lblTotalBatch") as System.Windows.Forms.Label;//计划数
+ var lblFinishedNumName = base.GetControlById("MCLabel203") as System.Windows.Forms.Label;//完成数
+ var lblResidueNumName = base.GetControlById("MCLabel244") as System.Windows.Forms.Label;//剩余
+ var lblRealTimeWeightName = base.GetControlById("lblRealTimeWeight") as System.Windows.Forms.Label;//实时
+ var lblSetWeight = base.GetControlById("lblSetWeight") as System.Windows.Forms.Label;//设定重量
+ var lblTankNo = base.GetControlById("lblTankNo") as System.Windows.Forms.Label;//罐号
+ var lblRate = base.GetControlById("MCLabel240") as System.Windows.Forms.Label;//实际固含
+ var pbName = base.GetControlById("XProgressBar") as System.Windows.Forms.ProgressBar;//柱状图
+ var lblTimeOut = base.GetControlById("lblTimeOut") as System.Windows.Forms.Label;//倒计时
+ var lblStatus01 = base.GetControlById("GreenLight2") as Mesnac.Controls.ChemicalWeighing.GreenLight;//加料
+ var lblStatus02 = base.GetControlById("RedLight2") as Mesnac.Controls.ChemicalWeighing.RedLight;//超重
+ var lblStatus03 = base.GetControlById("YellewLight2") as Mesnac.Controls.ChemicalWeighing.YellewLight;//完成
+ var btn16 = base.GetControlById("MCBtn16") as System.Windows.Forms.Button;//设定值
+ var btn17 = base.GetControlById("MCBtn17") as System.Windows.Forms.Button;//实时值
+
+ SiemensS7Net plc = PlcConnect.Instance;
+ int reqSerial = plc.ReadInt16("DB110.DBW22").Content;//计划数
+ lblReqSerialName.Text = reqSerial.ToString();
+ int finishedNum = plc.ReadInt16("DB110.DBW2").Content;//完成数
+ lblFinishedNumName.Text = finishedNum.ToString();
+ int residueNum = (plc.ReadInt16("DB110.DBW8").Content / 10) - (plc.ReadInt16("DB110.DBW16").Content / 10);//剩余数
+ lblResidueNumName.Text = residueNum.ToString();
+ int scaleWeight = plc.ReadInt16("DB110.DBW0").Content / 10;//实时
+ lblRealTimeWeightName.Text = scaleWeight.ToString();
+ int set_R = plc.ReadInt16("DB110.DBW8").Content / 10;//设定重量||柱状图最大值
+ lblSetWeight.Text = set_R.ToString();
+ int materialNo = plc.ReadInt16("DB110.DBW1758").Content / 10;//罐号
+ lblTankNo.Text = materialNo.ToString();
+ decimal p= decimal.Parse(plc.ReadInt16("DB110.DBW10").Content.ToString());
+ decimal rate_R = p / 100;//实际固含
+
+ lblRate.Text = rate_R.ToString();
+ int timeOut = plc.ReadInt16("DB110.DBW1766").Content;//倒计时
+ lblTimeOut.Text = timeOut.ToString();
+ int act_Weight = plc.ReadInt16("DB110.DBW16").Content / 10;//柱状图实时值||实际重量
+ pbName.Maximum = set_R;
+ pbName.Minimum = 0;
+ pbName.Value = act_Weight;
+
+ btn16.Text = set_R.ToString();
+ btn17.Text = scaleWeight.ToString();
+ int status01 = plc.ReadInt16("DB110.DBW1770").Content;//加料
+ if (status01 == 1)
+ {
+ lblStatus01.Status = Mesnac.Controls.ChemicalWeighing.GreenLight.Statuses.ylMove;
+ }
+ else
+ {
+ lblStatus01.Status = Mesnac.Controls.ChemicalWeighing.GreenLight.Statuses.ylNormal;
+ }
+ int status02 = plc.ReadInt16("DB110.DBW1772").Content;//完成
+ if (status02 == 1)
+ {
+ lblStatus03.Status = Mesnac.Controls.ChemicalWeighing.YellewLight.Statuses.ylYellew;
+ }
+ else
+ {
+ lblStatus03.Status = Mesnac.Controls.ChemicalWeighing.YellewLight.Statuses.ylNormal;
+ }
+ int status03 = plc.ReadInt16("DB110.DBW1774").Content;//超重
+ if (status03 == 1)
+ {
+
+ lblStatus02.Status = Mesnac.Controls.ChemicalWeighing.RedLight.Statuses.ylAlarm;
+ }
+ else
+ {
+ lblStatus02.Status = Mesnac.Controls.ChemicalWeighing.RedLight.Statuses.ylNormal;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+ finally
+ {
+ Flag4 = true;
+ }
+ }
+
+ }
+ private void UpdateShow2(object sender, ElapsedEventArgs e)
+ {
+ var lblPlanName = base.GetControlById("lblPlanName2") as System.Windows.Forms.Label;//计划名称
+ if (lblPlanName == null)
+ {
+ timer4.Stop();
+ timer4.Close();
+ return;
+ }
+ if (Flag5)
+ {
+ Flag5 = false;
+
+ try
+ {
+ var lblReqSerialName = base.GetControlById("MCLabel217") as System.Windows.Forms.Label;//计划数
+ var lblFinishedNumName = base.GetControlById("MCLabel213") as System.Windows.Forms.Label;//完成数
+ var lblResidueNumName = base.GetControlById("MCLabel246") as System.Windows.Forms.Label;//剩余
+ var lblRealTimeWeightName = base.GetControlById("MCLabel223") as System.Windows.Forms.Label;//实时
+ var lblSetWeight = base.GetControlById("MCLabel222") as System.Windows.Forms.Label;//设定重量
+ var lblTankNo = base.GetControlById("MCLabel218") as System.Windows.Forms.Label;//罐号
+ var lblRate = base.GetControlById("MCLabel237") as System.Windows.Forms.Label;//实际固含
+ var pbName = base.GetControlById("XProgressBar2147483646") as System.Windows.Forms.ProgressBar;//柱状图
+ var lblTimeOut = base.GetControlById("MCLabel229") as System.Windows.Forms.Label;//倒计时
+ var lblStatus01 = base.GetControlById("GreenLight1") as Mesnac.Controls.ChemicalWeighing.GreenLight;//加料
+ var lblStatus02 = base.GetControlById("RedLight1") as Mesnac.Controls.ChemicalWeighing.RedLight;//超重
+ var lblStatus03 = base.GetControlById("YellewLight1") as Mesnac.Controls.ChemicalWeighing.YellewLight;//完成
+ var btn16 = base.GetControlById("MCBtn15") as System.Windows.Forms.Button;//设定值
+ var btn17 = base.GetControlById("MCBtn14") as System.Windows.Forms.Button;//实时值
+
+ SiemensS7Net plc = PlcConnect.Instance;
+ int reqSerial = plc.ReadInt16("DB111.DBW22").Content;//计划数
+ lblReqSerialName.Text = reqSerial.ToString();
+ int finishedNum = plc.ReadInt16("DB111.DBW2").Content;//完成数
+ lblFinishedNumName.Text = finishedNum.ToString();
+ int residueNum = (plc.ReadInt16("DB111.DBW8").Content / 10) - (plc.ReadInt16("DB111.DBW16").Content / 10);//剩余数
+ lblResidueNumName.Text = residueNum.ToString();
+ int scaleWeight = plc.ReadInt16("DB111.DBW0").Content / 10;//实时
+ lblRealTimeWeightName.Text = scaleWeight.ToString();
+ int set_R = plc.ReadInt16("DB111.DBW8").Content / 10;//设定重量||柱状图最大值
+ lblSetWeight.Text = set_R.ToString();
+ int materialNo = plc.ReadInt16("DB111.DBW1758").Content / 10;//罐号
+ lblTankNo.Text = materialNo.ToString();
+ decimal p = decimal.Parse(plc.ReadInt16("DB111.DBW10").Content.ToString());
+ decimal rate_R = p / 100;//实际固含
+
+ lblRate.Text = rate_R.ToString();
+ int timeOut = plc.ReadInt16("DB111.DBW1766").Content;//倒计时
+ lblTimeOut.Text = timeOut.ToString();
+ int act_Weight = plc.ReadInt16("DB111.DBW16").Content / 10;//柱状图实时值||实际重量
+ pbName.Maximum = set_R;
+ pbName.Minimum = 0;
+ pbName.Value = act_Weight;
+
+ btn16.Text = set_R.ToString();
+ btn17.Text = scaleWeight.ToString();
+ int status01 = plc.ReadInt16("DB111.DBW1770").Content;//加料
+ if (status01 == 1)
+ {
+ lblStatus01.Status = Mesnac.Controls.ChemicalWeighing.GreenLight.Statuses.ylMove;
+ }
+ else
+ {
+ lblStatus01.Status = Mesnac.Controls.ChemicalWeighing.GreenLight.Statuses.ylNormal;
+ }
+ int status02 = plc.ReadInt16("DB111.DBW1772").Content;//完成
+ if (status02 == 1)
+ {
+ lblStatus03.Status = Mesnac.Controls.ChemicalWeighing.YellewLight.Statuses.ylYellew;
+ }
+ else
+ {
+ lblStatus03.Status = Mesnac.Controls.ChemicalWeighing.YellewLight.Statuses.ylNormal;
+ }
+ int status03 = plc.ReadInt16("DB111.DBW1774").Content;//超重
+ if (status03 == 1)
+ {
+
+ lblStatus02.Status = Mesnac.Controls.ChemicalWeighing.RedLight.Statuses.ylAlarm;
+ }
+ else
+ {
+ lblStatus02.Status = Mesnac.Controls.ChemicalWeighing.RedLight.Statuses.ylNormal;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ }
+ finally
+ {
+ Flag5 = true;
+ }
+ }
+
+ }
#region 设置(网格控件)计划状态背景色
diff --git a/Main/MCEdit/Data/MCProject/nodeDevice.xml b/Main/MCEdit/Data/MCProject/nodeDevice.xml
index bb9e99a..315e704 100644
--- a/Main/MCEdit/Data/MCProject/nodeDevice.xml
+++ b/Main/MCEdit/Data/MCProject/nodeDevice.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/Main/MCEdit/Data/MCProject/nodeForm/溶剂称量.xml b/Main/MCEdit/Data/MCProject/nodeForm/溶剂称量.xml
index 2e03bfe..29942a2 100644
--- a/Main/MCEdit/Data/MCProject/nodeForm/溶剂称量.xml
+++ b/Main/MCEdit/Data/MCProject/nodeForm/溶剂称量.xml
@@ -54,7 +54,8 @@
-