我叫锄头 12 months ago
commit eef0f2f153

@ -28,6 +28,7 @@ using HslCommunication.Core;
using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.ManualControl; using Mesnac.Action.ChemicalWeighing.ManualControl;
using DevExpress.Pdf.Native; using DevExpress.Pdf.Native;
using DevExpress.Utils.Drawing.Helpers;
namespace Mesnac.Action.ChemicalWeighing.MainDetailControl namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
{ {
@ -44,6 +45,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
private Timer timer; private Timer timer;
private string AlarmString = "报警信息 ";
//DataTable ParametersWithPCTable = new DataTable(); //DataTable ParametersWithPCTable = new DataTable();
//所有Alarm点位 //所有Alarm点位
@ -75,6 +78,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
//报警列表控件 //报警列表控件
private DbMCControl AlarmForm = null; private DbMCControl AlarmForm = null;
private MCLabel MCWatchDog; private MCLabel MCWatchDog;
private HslMoveText AlarmMoveText;
//控件实体类 //控件实体类
HslLanternAlarmEntity HslAlarmE = new HslLanternAlarmEntity(); HslLanternAlarmEntity HslAlarmE = new HslLanternAlarmEntity();
@ -112,6 +116,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
DetailE.EMStop = Controls.FirstOrDefault(x => x.Name == "EMStop") as SystemStateShow; DetailE.EMStop = Controls.FirstOrDefault(x => x.Name == "EMStop") as SystemStateShow;
MCWatchDog = Controls.FirstOrDefault(x => x.Name == "MCWatchDog") as MCLabel; MCWatchDog = Controls.FirstOrDefault(x => x.Name == "MCWatchDog") as MCLabel;
AlarmMoveText = Controls.FirstOrDefault(x => x.Name == "AlarmMoveText") as HslMoveText;
SetAllControls(); SetAllControls();
@ -162,6 +167,9 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
#region 控件导入 #region 控件导入
/// <summary>
/// 控件实体类导入前端控件
/// </summary>
private void SetAllControls() private void SetAllControls()
{ {
ControlsHelper.ControlImport<HslLanternAlarm>(HslAlarmE, Controls); ControlsHelper.ControlImport<HslLanternAlarm>(HslAlarmE, Controls);
@ -177,8 +185,6 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
ControlsHelper.ControlImport<ThreeWayValve>(ThreeValveE, Controls); ControlsHelper.ControlImport<ThreeWayValve>(ThreeValveE, Controls);
ControlsHelper.ControlImport<HslLedDisplay>(LedDisplayE, Controls); ControlsHelper.ControlImport<HslLedDisplay>(LedDisplayE, Controls);
Type ledDisplayType = LedDisplayE.GetType(); Type ledDisplayType = LedDisplayE.GetType();
PropertyInfo[] properties = ledDisplayType.GetProperties(); PropertyInfo[] properties = ledDisplayType.GetProperties();
foreach (PropertyInfo sourceProperty in properties) foreach (PropertyInfo sourceProperty in properties)
@ -196,6 +202,11 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
ledDisplay.DisplayText = "00:00"; ledDisplay.DisplayText = "00:00";
property.SetValue(LedDisplayE, ledDisplay); property.SetValue(LedDisplayE, ledDisplay);
} }
this.AlarmMoveText.Font = new Font("宋体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134);
this.AlarmMoveText.ForeColor = Color.White;
this.AlarmMoveText.MoveSpeed = 10f;
this.AlarmMoveText.Text = AlarmString;
} }
#endregion #endregion
@ -553,12 +564,18 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
TempTable.Rows.Clear(); TempTable.Rows.Clear();
StringBuilder sb = new StringBuilder();
//string nowtime = DateTime.Now.ToString(); //string nowtime = DateTime.Now.ToString();
//报警点位遍历 //报警点位遍历
foreach (DataRow rows in AllAlarmTable.Rows) foreach (DataRow rows in AllAlarmTable.Rows)
{ {
if ((int)rows["Alarm_Block"] == 2102 && b2[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) if ((int)rows["Alarm_Block"] == 2102 && b2[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
{ {
sb.Append(rows["Alarm_Other_Info"].ToString());
sb.Append(" ");
sb.Append(rows["Alarm_Cn_Info"].ToString());
sb.Append(@" \ ");
DataRow dr = TempTable.NewRow(); DataRow dr = TempTable.NewRow();
dr[0] = rows["Alarm_Other_Info"]; dr[0] = rows["Alarm_Other_Info"];
dr[1] = rows["Alarm_Cn_Info"]; dr[1] = rows["Alarm_Cn_Info"];
@ -567,6 +584,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
} }
else if ((int)rows["Alarm_Block"] == 2107 && b7[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) else if ((int)rows["Alarm_Block"] == 2107 && b7[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
{ {
sb.Append(rows["Alarm_Other_Info"].ToString());
sb.Append(" ");
sb.Append(rows["Alarm_Cn_Info"].ToString());
sb.Append(@" \ ");
DataRow dr = TempTable.NewRow(); DataRow dr = TempTable.NewRow();
dr[0] = rows["Alarm_Other_Info"]; dr[0] = rows["Alarm_Other_Info"];
dr[1] = rows["Alarm_Cn_Info"]; dr[1] = rows["Alarm_Cn_Info"];
@ -575,6 +596,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
} }
else if ((int)rows["Alarm_Block"] == 2103 && b3[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) else if ((int)rows["Alarm_Block"] == 2103 && b3[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true)
{ {
sb.Append(rows["Alarm_Other_Info"].ToString());
sb.Append(" ");
sb.Append(rows["Alarm_Cn_Info"].ToString());
sb.Append(@" \ ");
DataRow dr = TempTable.NewRow(); DataRow dr = TempTable.NewRow();
dr[0] = rows["Alarm_Other_Info"]; dr[0] = rows["Alarm_Other_Info"];
dr[1] = rows["Alarm_Cn_Info"]; dr[1] = rows["Alarm_Cn_Info"];
@ -582,6 +607,14 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
TempTable.Rows.Add(dr); TempTable.Rows.Add(dr);
} }
} }
string str = sb.ToString();
str = str.Replace("\r\n", string.Empty);
if (str != AlarmString)
{
AlarmString = str;
AlarmMoveText.Text = str;
}
} }
#endregion #endregion
@ -1068,7 +1101,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
PlcReadTemp.DM2DSF01L_Set = false; PlcReadTemp.DM2DSF01L_Set = false;
PlcReadTemp.DM2DSF01R_Set = true; PlcReadTemp.DM2DSF01R_Set = true;
} }
} }
else else
{ {
@ -1377,7 +1410,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
//yang 4特殊处理下 采用2107 //yang 4特殊处理下 采用2107
if(!PlcReadTemp.DM2DSF01L_Set&& !PlcReadTemp.DM2DSF01L_Set) if (!PlcReadTemp.DM2DSF01L_Set && !PlcReadTemp.DM2DSF01L_Set)
{ {
PlcReadTemp.ValueWeight4 = 0; PlcReadTemp.ValueWeight4 = 0;
} }
@ -1700,7 +1733,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
/// </summary> /// </summary>
private string DryStepConvert(int code) private string DryStepConvert(int code)
{ {
switch(code) switch (code)
{ {
case 1: return "加粉料"; case 1: return "加粉料";
case 4: return "时间控制"; case 4: return "时间控制";
@ -1895,11 +1928,11 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
} }
public void SetMCLabel(MCLabel obj, bool state, int flag) public void SetMCLabel(MCLabel obj, bool state, int flag)
{ {
if(flag == 1) if (flag == 1)
{ {
obj.Text = state ? "自动" : "手动"; obj.Text = state ? "自动" : "手动";
} }
else if(flag == 2) else if (flag == 2)
{ {
obj.Text = state ? "开启" : "关闭"; obj.Text = state ? "开启" : "关闭";
} }

@ -33,7 +33,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
{ {
public class TestAction : DatabaseAction, IAction public class TestAction : DatabaseAction, IAction
{ {
MCButton mCButton; MCButton mCButton;
// LoggingService<TestAction> _log; // LoggingService<TestAction> _log;
@ -45,26 +45,29 @@ namespace Mesnac.Action.ChemicalWeighing.Test
{ {
} }
public void Run(RuntimeParameter runtime) public void Run(RuntimeParameter runtime)
{ {
base.RunIni(runtime); //必须调用 base.RunIni(runtime); //必须调用
var allDb=GetAllControls(); var allDb = GetAllControls();
mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton; mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton;
hslMove= allDb.FirstOrDefault(x => x.Name == "HslMoveText1") as HslMoveText; hslMove = allDb.FirstOrDefault(x => x.Name == "HslMoveText1") as HslMoveText;
this.hslMove.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); this.hslMove.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.hslMove.BackColor = Color.FromArgb(128, 128, 255); this.hslMove.BackColor = Color.FromArgb(128, 128, 255);
this.hslMove.Font = new Font("楷体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134); this.hslMove.Font = new Font("楷体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134);
this.hslMove.ForeColor = Color.Yellow; this.hslMove.ForeColor = Color.Yellow;
this.hslMove.Margin = new Padding(5, 6, 5, 6); this.hslMove.Margin = new Padding(5, 6, 5, 6);
this.hslMove.MoveSpeed = 20f; this.hslMove.MoveSpeed = 20f;
this.hslMove.Size = new Size(726, 49); this.hslMove.Size = new Size(726, 49);
this.hslMove.TabIndex = 8; this.hslMove.TabIndex = 8;
this.hslMove.Text = "公告:这是一条测试的公告信息。"; this.hslMove.Text = @"公告这是一条测试的公告信息11111111111111111111111111111111111111111111111111111111111" +
"1111111111111112312321" +
"3213213213213" +
"3213333333333333333311111。";
mCButton.Click += MCButton_Click; mCButton.Click += MCButton_Click;

@ -1,6 +1,11 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MainDetail" children="Controls"> <Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MainDetail" children="Controls">
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls"> <Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslMoveText, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="AlarmMoveText" children="Controls">
<Property name="Location">32, 860</Property>
<Property name="Name">AlarmMoveText</Property>
<Property name="Size">1865, 28</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCDataGridView, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCDataGridView1" children="Controls"> <Object type="Mesnac.Controls.Default.MCDataGridView, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCDataGridView1" children="Controls">
<Property name="DisplayAllColumn">False</Property> <Property name="DisplayAllColumn">False</Property>
<Property name="DgvColumn"> <Property name="DgvColumn">
@ -26,14 +31,13 @@
<Property name="DbOptionType">InitData</Property> <Property name="DbOptionType">InitData</Property>
<Property name="MCVisible">True</Property> <Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property> <Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="BackgroundColor">32, 72, 98</Property> <Property name="BackgroundColor">32, 72, 98</Property>
<Property name="BorderStyle">None</Property> <Property name="BorderStyle">None</Property>
<Property name="GridColor">DarkCyan</Property> <Property name="GridColor">DarkCyan</Property>
<Property name="MultiSelect">False</Property> <Property name="MultiSelect">False</Property>
<Property name="Location">1410, 664</Property> <Property name="Location">1410, 664</Property>
<Property name="Name">MCDataGridView1</Property> <Property name="Name">MCDataGridView1</Property>
<Property name="Size">466, 224</Property> <Property name="Size">466, 190</Property>
<Property name="TabIndex">564</Property> <Property name="TabIndex">564</Property>
</Object> </Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLedDisplay, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="RGVWaitDisPlay8" children="Controls"> <Object type="Mesnac.Controls.ChemicalWeighing.HslLedDisplay, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="RGVWaitDisPlay8" children="Controls">

Loading…
Cancel
Save