dep_deliver
杨威 5 months ago
parent a82f4ff4ea
commit a675ce8100

@ -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;
}
}
}

@ -92,6 +92,9 @@ namespace Mesnac.Action.ChemicalWeighing.Su
};
private void Sel()
{
var ssss= DateTime.Now.ToString("hh:mm:ss");
endTime.MCValue=ssss;
var a = Convert.ToDateTime(GetA());
var b = Convert.ToDateTime(GetB());
@ -173,7 +176,7 @@ namespace Mesnac.Action.ChemicalWeighing.Su
private string GetB()
{
return Convert.ToDateTime(endDate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endTime.MCValue).ToShortTimeString();
return Convert.ToDateTime(endDate.MCValue).AddHours(0).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endTime.MCValue).ToShortTimeString();
}
}
}

@ -1,5 +1,77 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="FormQuRenAnNue" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnC" 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">C线确认</Property>
<Property name="Location">624, 341</Property>
<Property name="Name">BtnC</Property>
<Property name="Size">196, 55</Property>
<Property name="TabIndex">65</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnB" 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">B线确认</Property>
<Property name="Location">360, 341</Property>
<Property name="Name">BtnB</Property>
<Property name="Size">207, 55</Property>
<Property name="TabIndex">64</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="BtnA" 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">A线确认</Property>
<Property name="Location">81, 341</Property>
<Property name="Name">BtnA</Property>
<Property name="Size">208, 55</Property>
<Property name="TabIndex">63</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslCO" children="Controls">
<Property name="Location">1332, 191</Property>
<Property name="Name">HslCO</Property>

@ -416,6 +416,7 @@
<Content Include="Data\MCProject\nodeDevice.xml" />
<Content Include="Data\MCProject\nodeForm\Formbaobao.xml" />
<Content Include="Data\MCProject\nodeForm\FormDanQi.xml" />
<Content Include="Data\MCProject\nodeForm\FormQuRenAnNue.xml" />
<Content Include="Data\MCProject\nodeForm\FrmAlarmInfo.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save