diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/Entity/HslControlsEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/Entity/HslControlsEntity.cs index 8138d1f..bff4123 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/Entity/HslControlsEntity.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/Entity/HslControlsEntity.cs @@ -54,4 +54,24 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity public HslSwitch HslSwitch8 { get; set; } } + + public class HslLedDisplayEntity + { + public HslLedDisplay WetWaitDisPlay1 { get; set; } + public HslLedDisplay WetWaitDisPlay2 { get; set; } + public HslLedDisplay WetWaitDisPlay3 { get; set; } + public HslLedDisplay WetWaitDisPlay4 { get; set; } + public HslLedDisplay WetWaitDisPlay5 { get; set; } + public HslLedDisplay WetWaitDisPlay6 { get; set; } + public HslLedDisplay WetWaitDisPlay7 { get; set; } + public HslLedDisplay WetWaitDisPlay8 { get; set; } + public HslLedDisplay RGVWaitDisPlay1 { get; set; } + public HslLedDisplay RGVWaitDisPlay2 { get; set; } + public HslLedDisplay RGVWaitDisPlay3 { get; set; } + public HslLedDisplay RGVWaitDisPlay4 { get; set; } + public HslLedDisplay RGVWaitDisPlay5 { get; set; } + public HslLedDisplay RGVWaitDisPlay6 { get; set; } + public HslLedDisplay RGVWaitDisPlay7 { get; set; } + public HslLedDisplay RGVWaitDisPlay8 { get; set; } + } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 95d571e..1068b29 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -89,6 +89,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl LjSwithEntity SwithE = new LjSwithEntity(); ThreeWayValveEntity ThreeValveE = new ThreeWayValveEntity(); DeviceDetailEntity DetailE = new DeviceDetailEntity(); + HslLedDisplayEntity LedDisplayE = new HslLedDisplayEntity(); #endregion @@ -145,10 +146,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl AllAlarmTable = DBHelp.GetTable(@"SELECT Alarm_ID, Alarm_Block, Alarm_Word, Alarm_Bit, Alarm_Cn_Info, Alarm_Other_Info FROM Pmt_Alarm"); - timer = new Timer(); - timer.Interval = 1000; - timer.Enabled = true; - timer.Tick += GetPlcValue;//添加事件 + //timer = new Timer(); + //timer.Interval = 1000; + //timer.Enabled = true; + //timer.Tick += GetPlcValue;//添加事件 } @@ -168,6 +169,26 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl ControlsHelper.ControlImport(ControlCabinetE, Controls); ControlsHelper.ControlImport(SwithE, Controls); ControlsHelper.ControlImport(ThreeValveE, Controls); + ControlsHelper.ControlImport(LedDisplayE, Controls); + + Type ledDisplayType = LedDisplayE.GetType(); + PropertyInfo[] properties = ledDisplayType.GetProperties(); + foreach (PropertyInfo sourceProperty in properties) + { + string name = sourceProperty.Name; + PropertyInfo property = ledDisplayType.GetProperty(name); + HslLedDisplay ledDisplay = (HslLedDisplay)property.GetValue(LedDisplayE); + //bottle.Value = n * i++; + ledDisplay.BackColor = Color.FromArgb(46, 46, 46); + ledDisplay.DisplayBackColor = Color.FromArgb(62, 62, 62); + ledDisplay.DisplayNumber = 5; + ledDisplay.DisplayText = "12:00"; + ledDisplay.ForeColor = Color.Pink; + ledDisplay.LedNumberSize = 2; + ledDisplay.Margin = new Padding(1, 1, 1, 1); + ledDisplay.TabIndex = 8; + property.SetValue(LedDisplayE, ledDisplay); + } } #endregion @@ -360,6 +381,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl case 1: LabelE.WetWait1.Text = MixWaitTime(record); LabelE.WetWait1.ForeColor = MixTimeBackColor(record); + LedDisplayE.WetWaitDisPlay1.DisplayText = "12:45"; LabelE.RGVWait1.Text = "0"; break; case 2: diff --git a/DataBlockHelper/DBHelpers/Db3000Helper.cs b/DataBlockHelper/DBHelpers/Db3000Helper.cs index 34743ba..9c26809 100644 --- a/DataBlockHelper/DBHelpers/Db3000Helper.cs +++ b/DataBlockHelper/DBHelpers/Db3000Helper.cs @@ -8,23 +8,24 @@ namespace DataBlockHelper.DBHelpers public static List ReadDb() { List ls = new List(); - var operateResult = PlcConnect.Instance.Read("DB3000.0.0",1); + var operateResult = PlcConnect.Instance.Read("DB3000.0.0", 1); if (operateResult.IsSuccess) { var context = operateResult.Content; - + for (var i = 0; i < 6; i++) { - var bo= context.GetBoolByIndex(i); + var bo = context.GetBoolByIndex(i); ls.Add(bo); - - } - - } - - + else + { + for (var i = 0; i < 6; i++) + { + ls.Add(false); + } + } return ls; } @@ -34,7 +35,8 @@ namespace DataBlockHelper.DBHelpers /// /// - public static List ReadModel() { + public static List ReadModel() + { List ls = new List(); var operateResult = PlcConnect.Instance.Read("DB3000.2.0", 1); @@ -42,21 +44,29 @@ namespace DataBlockHelper.DBHelpers { var context = operateResult.Content; - for (var i = 0; i <8; i++) + for (var i = 0; i < 8; i++) { var bo = context.GetBoolByIndex(i); ls.Add(bo); } } + else + { + for (var i = 0; i < 8; i++) + { + ls.Add(false); + } + } + return ls; } - public static void WriteModel(int no,bool b) + public static void WriteModel(int no, bool b) { int id = no - 1; string address = $"DB3000.2.{id}"; - PlcConnect.Instance.Write(address,b); + PlcConnect.Instance.Write(address, b); } } } \ No newline at end of file diff --git a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml index 5cd2774..9590d4c 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml @@ -1,6 +1,86 @@ + + 1775, 659 + RGVWaitDisPlay8 + 72, 22 + + + 1694, 659 + RGVWaitDisPlay7 + 72, 22 + + + 1775, 631 + WetWaitDisPlay8 + 72, 22 + + + 1694, 631 + WetWaitDisPlay7 + 72, 22 + + + 1467, 659 + RGVWaitDisPlay6 + 72, 22 + + + 1386, 659 + RGVWaitDisPlay5 + 72, 22 + + + 1467, 631 + WetWaitDisPlay6 + 72, 22 + + + 1386, 631 + WetWaitDisPlay5 + 72, 22 + + + 1221, 659 + RGVWaitDisPlay4 + 72, 22 + + + 1140, 659 + RGVWaitDisPlay3 + 72, 22 + + + 1221, 631 + WetWaitDisPlay4 + 72, 22 + + + 1140, 631 + WetWaitDisPlay3 + 72, 22 + + + 915, 659 + RGVWaitDisPlay2 + 72, 22 + + + 834, 659 + RGVWaitDisPlay1 + 72, 22 + + + 915, 631 + WetWaitDisPlay2 + 72, 22 + + + 834, 631 + WetWaitDisPlay1 + 72, 22 + @@ -1890,7 +1970,6 @@ 31, 15 - ylNormal 1185, 423 DM2BSF01L @@ -1903,7 +1982,6 @@ 31, 15 - ylNormal 1425, 423 DM2CSF01L @@ -1916,7 +1994,6 @@ 31, 15 - ylNormal 1739, 423 DM2DSF01L @@ -1929,7 +2006,6 @@ 31, 15 - ylNormal 878, 423 DM2ASF01L @@ -2443,42 +2519,36 @@ 41, 14 - ylNormal 143, 12 DM1CSF01 41, 14 - ylNormal 279, 29 DM1FSF01 41, 14 - ylNormal 409, 29 DM1JSF01 41, 14 - ylNormal 397, 12 DM1ISF01 41, 14 - ylNormal 543, 28 DM1NSF01 41, 14 - ylNormal 531, 12 DM1MSF01 @@ -3315,7 +3385,6 @@ 6, 1 - ylNormal 153, 29 DM1DSF01