diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 1068b29..cb23142 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -146,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;//添加事件 } @@ -171,6 +171,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl ControlsHelper.ControlImport(ThreeValveE, Controls); ControlsHelper.ControlImport(LedDisplayE, Controls); + + Type ledDisplayType = LedDisplayE.GetType(); PropertyInfo[] properties = ledDisplayType.GetProperties(); foreach (PropertyInfo sourceProperty in properties) @@ -182,11 +184,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl 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.ForeColor = Color.White; ledDisplay.LedNumberSize = 2; - ledDisplay.Margin = new Padding(1, 1, 1, 1); - ledDisplay.TabIndex = 8; + ledDisplay.LeftRightOffect = 2; + ledDisplay.DisplayText = "00:00"; property.SetValue(LedDisplayE, ledDisplay); } } @@ -381,33 +382,50 @@ 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"; + LedDisplayE.WetWaitDisPlay1.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay1.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay1.DisplayText = "00:00"; break; case 2: LabelE.WetWait2.Text = MixWaitTime(record); LabelE.WetWait2.ForeColor = MixTimeBackColor(record); LabelE.RGVWait2.Text = "0"; + LedDisplayE.WetWaitDisPlay2.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay2.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay2.DisplayText = "00:00"; break; case 3: LabelE.WetWait3.Text = MixWaitTime(record); LabelE.WetWait3.ForeColor = MixTimeBackColor(record); LabelE.RGVWait3.Text = "0"; + LedDisplayE.WetWaitDisPlay3.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay3.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay3.DisplayText = "00:00"; break; case 4: LabelE.WetWait4.Text = MixWaitTime(record); LabelE.WetWait4.ForeColor = MixTimeBackColor(record); LabelE.RGVWait4.Text = "0"; + LedDisplayE.WetWaitDisPlay4.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay4.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay4.DisplayText = "00:00"; break; case 5: LabelE.WetWait5.Text = MixWaitTime(record); LabelE.WetWait5.ForeColor = MixTimeBackColor(record); LabelE.RGVWait5.Text = "0"; + LedDisplayE.WetWaitDisPlay5.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay5.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay5.DisplayText = "00:00"; break; case 6: LabelE.WetWait6.Text = MixWaitTime(record); LabelE.WetWait6.ForeColor = MixTimeBackColor(record); LabelE.RGVWait6.Text = "0"; + LedDisplayE.WetWaitDisPlay6.DisplayText = MixWaitTimeLed(record); + LedDisplayE.WetWaitDisPlay6.ForeColor = MixTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay6.DisplayText = "00:00"; break; default: break; @@ -420,26 +438,38 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl case 1: LabelE.RGVWait1.Text = RGVWaitTime(record); LabelE.WetWait1.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay1.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay1.ForeColor = RGVTimeBackColor(record); break; case 2: LabelE.RGVWait2.Text = RGVWaitTime(record); LabelE.WetWait2.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay2.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay2.ForeColor = RGVTimeBackColor(record); break; case 3: LabelE.RGVWait3.Text = RGVWaitTime(record); LabelE.WetWait3.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay3.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay3.ForeColor = RGVTimeBackColor(record); break; case 4: LabelE.RGVWait4.Text = RGVWaitTime(record); LabelE.WetWait4.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay4.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay4.ForeColor = RGVTimeBackColor(record); break; case 5: LabelE.RGVWait5.Text = RGVWaitTime(record); LabelE.WetWait5.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay5.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay5.ForeColor = RGVTimeBackColor(record); break; case 6: LabelE.RGVWait6.Text = RGVWaitTime(record); LabelE.WetWait6.ForeColor = RGVTimeBackColor(record); + LedDisplayE.RGVWaitDisPlay6.DisplayText = RGVWaitTimeLed(record); + LedDisplayE.RGVWaitDisPlay6.ForeColor = RGVTimeBackColor(record); break; default: break; @@ -460,6 +490,18 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl int t = Convert.ToInt32((DateTime.Now - record.MixReadyStartTime).TotalSeconds); return SecondToMinute(t); } + private string RGVWaitTimeLed(Lj_RGVTimeRecord record) + { + int t = Convert.ToInt32((DateTime.Now - record.RGVReachTime).TotalSeconds); + return SecondToTime(t); + } + + private string MixWaitTimeLed(Lj_RGVTimeRecord record) + { + int t = Convert.ToInt32((DateTime.Now - record.MixReadyStartTime).TotalSeconds); + return SecondToTime(t); + } + private Color RGVTimeBackColor(Lj_RGVTimeRecord record) { @@ -501,6 +543,17 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl return m + " 分 " + s + " 秒 "; } + private string SecondToTime(int t) + { + int m = t / 60; + int s = t % 60; + if (m == 0) + { + return "00:" + t; + } + return m + ":" + s; + } + #endregion #region 报警管理 diff --git a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml index 9590d4c..9e8cbf3 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml @@ -2,84 +2,84 @@ - 1775, 659 + 1773, 669 RGVWaitDisPlay8 - 72, 22 + 75, 32 - 1694, 659 + 1692, 669 RGVWaitDisPlay7 - 72, 22 + 75, 32 - 1775, 631 + 1773, 631 WetWaitDisPlay8 - 72, 22 + 75, 32 - 1694, 631 + 1692, 631 WetWaitDisPlay7 - 72, 22 + 75, 32 - 1467, 659 + 1459, 669 RGVWaitDisPlay6 - 72, 22 + 75, 32 - 1386, 659 + 1378, 669 RGVWaitDisPlay5 - 72, 22 + 75, 32 - 1467, 631 + 1459, 631 WetWaitDisPlay6 - 72, 22 + 75, 32 - 1386, 631 + 1378, 631 WetWaitDisPlay5 - 72, 22 + 75, 32 - 1221, 659 + 1218, 669 RGVWaitDisPlay4 - 72, 22 + 75, 32 - 1140, 659 + 1137, 669 RGVWaitDisPlay3 - 72, 22 + 75, 32 - 1221, 631 + 1218, 631 WetWaitDisPlay4 - 72, 22 + 75, 32 - 1140, 631 + 1137, 631 WetWaitDisPlay3 - 72, 22 + 75, 32 - 915, 659 + 912, 669 RGVWaitDisPlay2 - 72, 22 + 75, 32 - 834, 659 + 831, 669 RGVWaitDisPlay1 - 72, 22 + 75, 32 - 915, 631 + 912, 631 WetWaitDisPlay2 - 72, 22 + 75, 32 - 834, 631 + 831, 631 WetWaitDisPlay1 - 72, 22 + 75, 32