You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
9.0 KiB
C#

using DevExpress.PivotGrid.OLAP.Mdx;
using Mesnac.Action.ChemicalWeighing.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.EngineeringDebuggingMode.ValveStateMonitor
{
public partial class ValveStateMonitor : Form
{
string DmName_S = "BU3DBT06";
string DmName_D = "DV1PCP01";
public ValveStateMonitor()
{
InitializeComponent();
StateMonitor_D(DmName_D);
StateMonitor_S(DmName_S);
}
private void DmChange_S_SelectedIndexChanged(object sender, EventArgs e)
{
DmName_S = dmNameValue[DmChange_S.Text];
StateMonitor_S(DmName_S);
}
private void StateMonitor_S(string dmName)
{
ManualMode_S.Text = GetDataToString(dmName, "_ManualMode");
AutoMode_S.Text = GetDataToString(dmName, "_AutoMode");
SetManual_S.Text = GetDataToString(dmName, "_SetManual");
SetAuto_S.Text = GetDataToString(dmName, "_SetAuto");
AlarmReset_S.Text = GetDataToString(dmName, "_AlarmReset");
SetPosition_S.Text = GetDataToString(dmName, "_SetPosition");
UnSetPosition_S.Text = GetDataToString(dmName, "_UnSetPosition");
Set_S.Text = GetDataToString(dmName, "_Set");
AlarmSetPos_S.Text = GetDataToString(dmName, "_AlarmSetPos");
AlarmUnSetPos_S.Text = GetDataToString(dmName, "_AlarmUnSetPos");
AlarmPosition_S.Text = GetDataToString(dmName, "_AlarmPosition");
Alarm_S.Text = GetDataToString(dmName, "_Alarm");
}
private void DmChange_D_SelectedIndexChanged(object sender, EventArgs e)
{
DmName_D = dmNameValue[DmChange_D.Text];
StateMonitor_D(DmName_D);
}
private void StateMonitor_D(string dmName)
{
ManualMode_D.Text = GetDataToString(dmName, "_ManualMode");
AutoMode_D.Text = GetDataToString(dmName, "_AutoMode");
SetLeftManual_D.Text = GetDataToString(dmName, "_SetLeftManual");
SetRightManual_D.Text = GetDataToString(dmName, "_SetRightManual");
SetLeftAuto_D.Text = GetDataToString(dmName, "_SetLeftAuto");
SetRightAuto_D.Text = GetDataToString(dmName, "_SetRightAuto");
AlarmReset_D.Text = GetDataToString(dmName, "_AlarmReset");
LeftPosition_D.Text = GetDataToString(dmName, "_LeftPosition");
RightPosition_D.Text = GetDataToString(dmName, "_RightPosition");
SetLeft_D.Text = GetDataToString(dmName, "_SetLeft");
SetRight_D.Text = GetDataToString(dmName, "_SetRight");
AlarmLeftPosition_D.Text = GetDataToString(dmName, "_AlarmLeftPosition");
AlarmRightPosition_D.Text = GetDataToString(dmName, "_AlarmRightPosition");
AlarmPosition_D.Text = GetDataToString(dmName, "_AlarmPosition");
Alarm_D.Text = GetDataToString(dmName, "_Alarm");
}
private IDictionary<string, string> dmNameValue = new Dictionary<string, string>()
{
["输送线C1号压送罐出料蝶阀电磁阀"] = "BU3DBT06",
["输送线C2号压送罐出料蝶阀电磁阀"] = "BU3DBT07",
["输送线A1号压送罐进料蝶阀电磁阀"] = "BU1DBT01",
["输送线A1号压送罐返气蝶阀电磁阀"] = "BU1DBT03",
["输送线A2号压送罐进料蝶阀电磁阀"] = "BU1DBT02",
["输送线A2号压送罐返气蝶阀电磁阀"] = "BU1DBT04",
["输送线B1号压送罐进料蝶阀电磁阀"] = "BU2DBT01",
["输送线B1号压送罐返气蝶阀电磁阀"] = "BU2DBT03",
["输送线B2号压送罐进料蝶阀电磁阀"] = "BU2DBT02",
["输送线B2号压送罐返气蝶阀电磁阀"] = "BU2DBT04",
["输送线C1号压送罐进料蝶阀电磁阀"] = "BU3DBT01",
["输送线C1号压送罐返气蝶阀电磁阀"] = "BU3DBT03",
["输送线C2号压送罐进料蝶阀电磁阀"] = "BU3DBT02",
["输送线C2号压送罐返气蝶阀电磁阀"] = "BU3DBT04",
["输送线A1号压送罐出料蝶阀电磁阀"] = "BU1DBT06",
["输送线A2号压送罐出料蝶阀电磁阀"] = "BU1DBT07",
["输送线B1号压送罐出料蝶阀电磁阀"] = "BU2DBT06",
["输送线B2号压送罐出料蝶阀电磁阀"] = "BU2DBT07",
["输送线A1号压送罐充气角座阀"] = "AS1DBT01",
["输送线A2号压送罐充气角座阀"] = "AS1DBT02",
["输送线A清扫角座阀"] = "AS1DBT03",
["输送线A1号压送罐流态化角座阀"] = "AS1DBT04",
["输送线A2号压送罐流态化角座阀"] = "AS1DBT05",
["输送线A压送罐出料主管角座阀"] = "AS1DBT06",
["输送线A压送罐出料辅管角座阀"] = "AS1DBT07",
["输送线B1号压送罐充气角座阀"] = "AS2DBT01",
["输送线B2号压送罐充气角座阀"] = "AS2DBT02",
["输送线B清扫角座阀"] = "AS2DBT03",
["输送线B1号压送罐流态化角座阀"] = "AS2DBT04",
["输送线B2号压送罐流态化角座阀"] = "AS2DBT05",
["输送线B压送罐出料主管角座阀"] = "AS2DBT06",
["输送线B压送罐出料辅管角座阀"] = "AS2DBT07",
["输送线C1号压送罐充气角座阀"] = "AS3DBT01",
["输送线C2号压送罐充气角座阀"] = "AS3DBT02",
["输送线C清扫角座阀"] = "AS3DBT03",
["输送线C1号压送罐流态化角座阀"] = "AS3DBT04",
["输送线C2号压送罐流态化角座阀"] = "AS3DBT05",
["输送线C压送罐出料主管角座阀"] = "AS3DBT06",
["输送线C压送罐出料辅管角座阀"] = "AS3DBT07",
["输送线A辅管角座阀"] = "AS1PCP01",
["输送线B辅管角座阀"] = "AS1PCP02",
["输送线C辅管角座阀"] = "AS1PCP03",
["大仓A外喷淋阀门"] = "AS1ASI01",
["大仓B外喷淋阀门"] = "AS1BSI01",
["大仓C外喷淋阀门"] = "AS1CSI01",
["大仓D外喷淋阀门"] = "AS1DSI01",
["大仓E外喷淋阀门"] = "AS1ESI01",
["大仓F外喷淋阀门"] = "AS1FSI01",
["大仓G外喷淋阀门"] = "AS1GSI01",
["大仓H外喷淋阀门"] = "AS1HSI01",
["大仓I外喷淋阀门"] = "AS1ISI01",
["大仓J外喷淋阀门"] = "AS1JSI01",
["大仓O外喷淋阀门"] = "AS1OSI01",
["输送线A滚筒筛分机侧吹阀"] = "SV1DSM01",
["输送线A滚筒筛分机振动阀"] = "SV1DSM02",
["输送线B滚筒筛分机侧吹阀"] = "SV2DSM01",
["输送线B滚筒筛分机振动阀"] = "SV2DSM02",
["输送线C滚筒筛分机侧吹阀"] = "SV3DSM01",
["输送线C滚筒筛分机振动阀"] = "SV3DSM02",
["二级除尘器侧吹脉冲阀1"] = "PV1GDC01",
["二级除尘器侧吹脉冲阀2"] = "PV1GDC02",
["分配阀1直通电磁阀"] = "DV1PCP01",
["分配阀2直通电磁阀"] = "DV1PCP02",
["分配阀3直通电磁阀"] = "DV1PCP03",
["分配阀4直通电磁阀"] = "DV1PCP04",
["分配阀5直通电磁阀"] = "DV1PCP05",
["分配阀6直通电磁阀"] = "DV1PCP06",
["分配阀7直通电磁阀"] = "DV1PCP07",
["分配阀8直通电磁阀"] = "DV1PCP08",
["分配阀9直通电磁阀"] = "DV1PCP09",
["分配阀10直通电磁阀"] = "DV1PCP10",
["分配阀11直通电磁阀"] = "DV1PCP11",
["分配阀12直通电磁阀"] = "DV1PCP12",
["分配阀13直通电磁阀"] = "DV1PCP13",
["分配阀14直通电磁阀"] = "DV1PCP14",
["分配阀15直通电磁阀"] = "DV1PCP15",
["磨粉系统旋转阀气密封电磁阀"] = "SV1GDS01"
};
/// <summary>
/// 根据属性名和现在选择的数据块名得到PLC数据块的具体引用
/// </summary>
/// <param name="dmValue">数据块属性名</param>
/// <returns></returns>
private DataKeyValue GetDataNameValue(string dmName, string dmValue)
{
return new DataKeyValue(dmName + dmValue);
}
/// <summary>
/// 从PLC中读取值
/// </summary>
/// <param name="dmValue">要读取的属性</param>
/// <returns></returns>
private string GetDataToString(string dmName, string dmValue)
{
return GetDataNameValue(dmName, dmValue).NowValue.ToString();
}
private void Refresh_Click(object sender, EventArgs e)
{
StateMonitor_D(DmName_D);
StateMonitor_S(DmName_S);
}
}
}