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.ParametersWithPCStateMonitor { public partial class ParametersWithPCStateMonitor : Form { string DmChange_Pressure = "mainPress_V1"; string DmChange_Weight = "Hopper_1"; string DmChange_PID = "convey_V1"; public ParametersWithPCStateMonitor() { InitializeComponent(); StateMonitor_Pressure(DmChange_Pressure); StateMonitor_Weight(DmChange_Weight); StateMonitor_PID(DmChange_PID); } private void StateMonitor_Pressure(string dmName) { ActualValue.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ActualValue"); LowLimit.Text = PlcCommunicationUtil.GetDataToString(dmName, "_LowLimit"); HighLimit.Text = PlcCommunicationUtil.GetDataToString(dmName, "_HighLimit"); Alarm.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Alarm"); } private void StateMonitor_PID(string dmName) { PV.Text = PlcCommunicationUtil.GetDataToString(dmName, "_PV"); SV.Text = PlcCommunicationUtil.GetDataToString(dmName, "_SV"); } private void StateMonitor_Weight(string dmName) { ActWeight.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ActWeight"); HighWeight.Text = PlcCommunicationUtil.GetDataToString(dmName, "_HighWeight"); LowWeight.Text = PlcCommunicationUtil.GetDataToString(dmName, "_LowWeight"); HighLevel.Text = PlcCommunicationUtil.GetDataToString(dmName, "_HighLevel"); LowLevel.Text = PlcCommunicationUtil.GetDataToString(dmName, "_LowLevel"); } private void ListBox_DmChange_Pressure_SelectedIndexChanged(object sender, EventArgs e) { DmChange_Pressure = dmNameValue[ListBox_DmChange_Pressure.Text]; StateMonitor_Pressure(DmChange_Pressure); } private void ListBox_DmChange_Weight_SelectedIndexChanged(object sender, EventArgs e) { DmChange_Weight = dmNameValue[ListBox_DmChange_Weight.Text]; StateMonitor_Weight(DmChange_Weight); } private void Refresh_Click(object sender, EventArgs e) { StateMonitor_Pressure(DmChange_Pressure); StateMonitor_Weight(DmChange_Weight); StateMonitor_PID(DmChange_PID); } private IDictionary dmNameValue = new Dictionary() { ["压送秤A气源压力"] = "mainPress_V1", ["压送秤A顶部压力"] = "topPressure_V1", ["压送秤A底部压力"] = "linePressure_V1", ["压送秤B气源压力"] = "mainPress_V2", ["压送秤B顶部压力"] = "topPressure_V2", ["压送秤B底部压力"] = "linePressure_V2", ["压送秤C气源压力"] = "mainPress_V3", ["压送秤C顶部压力"] = "topPressure_V3", ["压送秤C底部压力"] = "linePressure_V3", ["压送秤D气源压力"] = "mainPress_V4", ["压送秤D顶部压力"] = "topPressure_V4", ["压送秤D底部压力"] = "linePressure_V4", ["压送秤E气源压力"] = "mainPress_V5", ["压送秤E顶部压力"] = "topPressure_V5", ["压送秤E底部压力"] = "linePressure_V5", ["日罐压力B1"] = "presDaybin_B1", ["日罐压力B2"] = "presDaybin_B2", ["日罐压力B3"] = "presDaybin_B3", ["日罐压力B4"] = "presDaybin_B4", ["日罐压力B5"] = "presDaybin_B5", ["日罐压力B6"] = "presDaybin_B6", ["日罐压力B7"] = "presDaybin_B7", ["日罐压力B8"] = "presDaybin_B8", ["日罐压力B9"] = "presDaybin_B9", ["日罐压力B10"] = "presDaybin_B10", ["日罐压力B11"] = "presDaybin_B11", ["日罐压力B12"] = "presDaybin_B12", ["管道压力传感器1"] = "PR2PCP01", ["管道压力传感器2"] = "PR2PCP02", ["管道压力传感器3"] = "PR2PCP03", ["干混缓存A重量"] = "Hopper_1", ["干混缓存B重量"] = "Hopper_2", ["干混缓存C重量"] = "Hopper_3", ["干混缓存D重量"] = "Hopper_4", ["压送秤A重量"] = "Vessel_1", ["压送秤B重量"] = "Vessel_2", ["压送秤C重量"] = "Vessel_3", ["压送秤D重量"] = "Vessel_4", ["压送秤E重量"] = "Vessel_5", ["热水秤A重量"] = "WScale_1", ["热水秤B重量"] = "WScale_2", ["冷水秤A重量"] = "WScale_3", ["冷水秤B重量"] = "WScale_4", ["压送秤A输送比例阀"] = "convey_V1", ["压送秤A清扫比例阀"] = "purge_V1", ["压送秤B输送比例阀"] = "convey_V2", ["压送秤B清扫比例阀"] = "purge_V2", ["压送秤C输送比例阀"] = "convey_V3", ["压送秤C清扫比例阀"] = "purge_V3", ["压送秤D输送比例阀"] = "convey_V4", ["压送秤D清扫比例阀"] = "purge_V4", ["压送秤E输送比例阀"] = "convey_V5", ["压送秤E清扫比例阀"] = "purge_V5", }; private void ListBox_DmChange_PID_SelectedIndexChanged(object sender, EventArgs e) { DmChange_PID = dmNameValue[ListBox_DmChange_PID.Text]; StateMonitor_PID(DmChange_PID); } } }