Browse Source

数据显示微调

刘彬 2 weeks ago
parent
commit
53e0e996c9
2 changed files with 13 additions and 6 deletions
  1. 10 3
      Core/Management.cs
  2. 3 3
      Views/WorkRunView.xaml

+ 10 - 3
Core/Management.cs

@@ -375,7 +375,7 @@ namespace DefaultEdit.Core
                 {
                     if (s7PlcCommunicate!=null&& s7PlcCommunicate.IsConnected )
                     {
-                        byte []buff= s7PlcCommunicate.ReadByte(25, 780, 74);
+                        byte []buff= s7PlcCommunicate.ReadByte(25, 780, 84);
                         int actuallength=buff[53];
                         byte[] buffsT = new byte[ actuallength ];
                         Array.Copy(buff, 54, buffsT, 0, actuallength);
@@ -399,7 +399,7 @@ namespace DefaultEdit.Core
                         CurrConfig.RealSpeed = s7PlcCommunicate.GetRealAt(buff, 36);
                         CurrConfig.RealSpeed2 = s7PlcCommunicate.GetRealAt(buff, 40);
                         CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 44);
-                        CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 48);
+                        CurrConfig.Time2 = s7PlcCommunicate.GetTimeSpanAt(buff, 48);
 
                         //CurrConfig.Power1_1 = s7PlcCommunicate.GetShortAt(buff, 20);
                         //CurrConfig.Power1_2 = s7PlcCommunicate.GetShortAt(buff, 22);
@@ -409,7 +409,14 @@ namespace DefaultEdit.Core
                         CurrConfig.Realtime = (float)(stopwatchs[0].ElapsedMilliseconds / 1000.0);
                         CurrConfig.Realtime2 = (float)(stopwatchs[1].ElapsedMilliseconds / 1000.0);
                         CurrConfig.Realtime3 = (float)(stopwatchs[2].ElapsedMilliseconds / 1000.0);
-                       
+
+                        for (int i = 0; i < stopwatchs.Length; i++)
+                        {
+                            if (stopwatchs[i].ElapsedMilliseconds / 1000.0 > 1000) 
+                            {
+                                stopwatchs[i].Stop();
+                            }
+                        }
                     }
 
                 }

+ 3 - 3
Views/WorkRunView.xaml

@@ -296,7 +296,7 @@
                         <TextBlock Text="第一次离心时间"
                                    Grid.Row="2"
                                    Grid.Column="0" />
-                        <TextBlock Text="{Binding Management.CurrConfig.Time,StringFormat=ss}"
+                        <TextBlock Text="{Binding Management.CurrConfig.Time.TotalSeconds}"
                                    Grid.Row="2"
                                    Grid.Column="1" />
 
@@ -310,14 +310,14 @@
                         <TextBlock Text="第二次离心时间"
                                    Grid.Row="4"
                                    Grid.Column="0" />
-                        <TextBlock Text="{Binding Management.CurrConfig.Time,StringFormat=ss}"
+                        <TextBlock Text="{Binding Management.CurrConfig.Time2.TotalSeconds}"
                                    Grid.Row="4"
                                    Grid.Column="1" />
                         
                         <TextBlock Text="光固化时间"
                                    Grid.Row="5"
                                    Grid.Column="0" />
-                        <TextBlock Text="{Binding Management.CurrConfig.PTime1,StringFormat=ss}"
+                        <TextBlock Text="{Binding Management.CurrConfig.PTime1.TotalSeconds}"
                                    Grid.Row="5"
                                    Grid.Column="1" />
                     </Grid>