干混机使能开关

dep
杨威 5 months ago
parent d667fd02c3
commit 4fe160c30d

@ -63,12 +63,41 @@ namespace Mesnac.Action.ChemicalWeighing.Qu
MCButton BtnCoolWaterB; MCButton BtnCoolWaterB;
MCButton BtnHotWaterA; MCButton BtnHotWaterA;
MCButton BtnHotWaterB; MCButton BtnHotWaterB;
HslLanternSimple HslDa;
HslLanternSimple HslDb;
HslLanternSimple HslDc;
HslLanternSimple HslDd;
MCButton BtnDa;
MCButton BtnDb;
MCButton BtnDc;
MCButton BtnDd;
public void Run(RuntimeParameter runtime) public void Run(RuntimeParameter runtime)
{ {
base.RunIni(runtime); //必须调用 base.RunIni(runtime); //必须调用
var controls = GetAllControls(); var controls = GetAllControls();
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;
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;
BtnDa.Click += BtnDa_Click;
BtnDb.Click += BtnDb_Click;
BtnDc.Click += BtnDc_Click;
BtnDd.Click += BtnDd_Click;
BtnCoolWaterA = controls.FirstOrDefault(x => x.Name == "BtnCoolWaterA") as MCButton; BtnCoolWaterA = controls.FirstOrDefault(x => x.Name == "BtnCoolWaterA") as MCButton;
@ -163,6 +192,57 @@ namespace Mesnac.Action.ChemicalWeighing.Qu
timer.Enabled = true; timer.Enabled = true;
timer.Tick += new EventHandler(StateRefresh);//添加事件 timer.Tick += new EventHandler(StateRefresh);//添加事件
}
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)
{
if (BtnDd.MCValue.ToString().Contains("开"))
{
DB2108HelperWriteNew.WriteA(true);
}
else
{
DB2108HelperWriteNew.WriteA(false);
}
} }
private void BtnHotWaterB_Click(object sender, EventArgs e) private void BtnHotWaterB_Click(object sender, EventArgs e)
@ -476,6 +556,57 @@ namespace Mesnac.Action.ChemicalWeighing.Qu
HotWaterB.LanternBackground = System.Drawing.Color.Gray; HotWaterB.LanternBackground = System.Drawing.Color.Gray;
} }
//干混机
ab = dB2108.DryA;
if (ab.enable)
{
BtnDa.MCValue = "干混A使能关";
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;
}
} }
} }
} }

@ -52,5 +52,28 @@ namespace DataBlockHelper.DBHelpers
siemensS7Net.Write($"{DbName}.{start}.0", time.PlsHopperOff); siemensS7Net.Write($"{DbName}.{start}.0", time.PlsHopperOff);
} }
public static void WriteA(bool b)
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.72.0", b);
}
public static void WriteB(bool b)
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.74.0", b);
}
public static void WriteC(bool b)
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.76.0", b);
}
public static void WriteD(bool b)
{
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.78.0", b);
}
} }
} }

@ -1,5 +1,129 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="FrmQu" children="Controls"> <Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="FrmQu" children="Controls">
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox5" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslDd" children="Controls">
<Property name="Location">221, 193</Property>
<Property name="Name">HslDd</Property>
<Property name="Size">39, 32</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslDc" children="Controls">
<Property name="Location">38, 193</Property>
<Property name="Name">HslDc</Property>
<Property name="Size">39, 32</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnDd" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">启动</Property>
<Property name="Location">178, 260</Property>
<Property name="Name">BtnDd</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">23</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnDc" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">使能</Property>
<Property name="Location">12, 260</Property>
<Property name="Name">BtnDc</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">22</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslDb" children="Controls">
<Property name="Location">220, 26</Property>
<Property name="Name">HslDb</Property>
<Property name="Size">39, 32</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslDa" children="Controls">
<Property name="Location">37, 26</Property>
<Property name="Name">HslDa</Property>
<Property name="Size">39, 32</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnDb" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">启动</Property>
<Property name="Location">177, 93</Property>
<Property name="Name">BtnDb</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">19</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnDa" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">使能</Property>
<Property name="Location">11, 93</Property>
<Property name="Name">BtnDa</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">18</Property>
</Object>
<Property name="TabStop">False</Property>
<Property name="Text">干混机</Property>
<Property name="Location">30, 12</Property>
<Property name="Name">GroupBox5</Property>
<Property name="Size">316, 312</Property>
<Property name="TabIndex">16</Property>
</Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox4" children="Controls"> <Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox4" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HotWaterB" children="Controls"> <Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HotWaterB" children="Controls">
<Property name="Location">221, 193</Property> <Property name="Location">221, 193</Property>
@ -119,7 +243,7 @@
</Object> </Object>
<Property name="TabStop">False</Property> <Property name="TabStop">False</Property>
<Property name="Text">水秤</Property> <Property name="Text">水秤</Property>
<Property name="Location">371, 12</Property> <Property name="Location">364, 12</Property>
<Property name="Name">GroupBox4</Property> <Property name="Name">GroupBox4</Property>
<Property name="Size">316, 312</Property> <Property name="Size">316, 312</Property>
<Property name="TabIndex">15</Property> <Property name="TabIndex">15</Property>
@ -185,7 +309,7 @@
</Object> </Object>
<Property name="TabStop">False</Property> <Property name="TabStop">False</Property>
<Property name="Text">主风机</Property> <Property name="Text">主风机</Property>
<Property name="Location">25, 12</Property> <Property name="Location">364, 364</Property>
<Property name="Name">GroupBox3</Property> <Property name="Name">GroupBox3</Property>
<Property name="Size">316, 145</Property> <Property name="Size">316, 145</Property>
<Property name="TabIndex">14</Property> <Property name="TabIndex">14</Property>
@ -747,7 +871,7 @@
<Property name="Text">取消时间</Property> <Property name="Text">取消时间</Property>
<Property name="Location">731, 23</Property> <Property name="Location">731, 23</Property>
<Property name="Name">GroupBox2</Property> <Property name="Name">GroupBox2</Property>
<Property name="Size">475, 486</Property> <Property name="Size">556, 486</Property>
<Property name="TabIndex">13</Property> <Property name="TabIndex">13</Property>
</Object> </Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls"> <Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls">
@ -839,9 +963,9 @@
</Object> </Object>
<Property name="TabStop">False</Property> <Property name="TabStop">False</Property>
<Property name="Text">取消队列</Property> <Property name="Text">取消队列</Property>
<Property name="Location">25, 358</Property> <Property name="Location">731, 528</Property>
<Property name="Name">GroupBox1</Property> <Property name="Name">GroupBox1</Property>
<Property name="Size">662, 151</Property> <Property name="Size">556, 151</Property>
<Property name="TabIndex">12</Property> <Property name="TabIndex">12</Property>
</Object> </Object>
<Property name="LoadActionList"> <Property name="LoadActionList">
@ -860,7 +984,7 @@
<Property name="MCPurview">False</Property> <Property name="MCPurview">False</Property>
<Property name="AllowOriginalSizeShow">False</Property> <Property name="AllowOriginalSizeShow">False</Property>
<Property name="BackColor">Control</Property> <Property name="BackColor">Control</Property>
<Property name="Size">1246, 717</Property> <Property name="Size">1370, 805</Property>
<Property name="StartPosition">WindowsDefaultLocation</Property> <Property name="StartPosition">WindowsDefaultLocation</Property>
<Property name="Text">缓存队列取消</Property> <Property name="Text">缓存队列取消</Property>
<Property name="WindowState">Normal</Property> <Property name="WindowState">Normal</Property>

Loading…
Cancel
Save