Browse Source

显示内容调整

章政 7 years ago
parent
commit
75f58c8231
2 changed files with 9 additions and 31 deletions
  1. 2 1
      PLCDataReader/Device/Information/DeviceStatusInfo.cs
  2. 7 30
      PLCDataReader/Main.cs

+ 2 - 1
PLCDataReader/Device/Information/DeviceStatusInfo.cs

@@ -42,7 +42,8 @@ namespace UAS_PLCDataReader.Device.Infomation
             if (Main.ReturnData.ContainsKey(de_code))
             {
                 dpg_count.Text = Main.ReturnData[de_code].SendCount.ToString();
-                dpg_runtime.Text = (DateTime.Now - Main.ReturnData[de_code].StartTime).TotalMinutes.ToString().Substring(0, 3) + "分钟";
+                string totalMinutes = (DateTime.Now - Main.ReturnData[de_code].StartTime).TotalMinutes.ToString();
+                dpg_runtime.Text = (DateTime.Now - Main.ReturnData[de_code].StartTime).TotalMinutes.ToString("f1") + "分钟";
                 dpg_starttime.Text = Main.ReturnData[de_code].StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                 dpg_senddatasize.Text = Main.ReturnData[de_code].SendDataSize.ToString();
                 dpg_receivedatasize.Text = Main.ReturnData[de_code].ReceiveDataSize.ToString();

+ 7 - 30
PLCDataReader/Main.cs

@@ -290,7 +290,6 @@ namespace UAS_PLCDataReader
         /// <param name="e"></param>
         private void TimerUpdateDevice_Tick(object sender, EventArgs e)
         {
-            Console.WriteLine("Begin" + QueueUpdateDevice.Count);
             while (QueueUpdateDevice.Count > 0)
             {
                 Entity.Device item = QueueUpdateDevice.Dequeue();
@@ -306,7 +305,6 @@ namespace UAS_PLCDataReader
                 sql.Append(" where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + item.Decode + "')");
                 dh.ExecuteSql(sql.ToString(), "update");
             }
-            Console.WriteLine("End" + QueueUpdateDevice.Count);
         }
         #endregion
 
@@ -533,31 +531,6 @@ namespace UAS_PLCDataReader
                         }
                     }
                     client[DpcID].Returnvalue.Remove(IP);
-                    //SQL.Clear();
-                    ////更新轮询状态
-                    //sql.Clear();
-                    //sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Running' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
-                    //dh.ExecuteSql(sql.ToString(), "update");
-                    ////更新轮询日志状态
-                    //sql.Clear();
-                    //sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+" + SendCommandByteSize);
-                    //sql.Append(",dpg_receivedatasize=nvl(dpg_receivedatasize,0)+" + ReceiveCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
-                    //sql.Append(" where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
-                    //dh.ExecuteSql(sql.ToString(), "update");
-                }
-                else
-                {
-                    //SQL.Clear();
-                    ////更新轮询状态
-                    //sql.Clear();
-                    //sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Stop' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
-                    //dh.ExecuteSql(sql.ToString(), "update");
-                    ////更新轮询日志状态
-                    //sql.Clear();
-                    //sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+");
-                    //sql.Append(SendCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
-                    //sql.Append("where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
-                    //dh.ExecuteSql(sql.ToString(), "update");
                 }
             }
         }
@@ -769,13 +742,17 @@ namespace UAS_PLCDataReader
                         pic.Picedit.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
                         pic.Picedit.MouseHover += Pic_MouseHover;
                         pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
-                        if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
+                        //如果该设备已启动
+                        if (ReturnData.ContainsKey(dt.Rows[j * CountPerRow + i]["de_code"].ToString()))
                         {
-                            pic.Picedit.Image = Properties.Resources.network_offline;
+                            if (ReturnData[dt.Rows[j * CountPerRow + i]["de_code"].ToString()].RunStatus == "Running")
+                            {
+                                pic.Picedit.Image = Properties.Resources.net_connected;
+                            }
                         }
                         else
                         {
-                            pic.Picedit.Image = Properties.Resources.net_connected;
+                            pic.Picedit.Image = Properties.Resources.network_offline;
                         }
                         pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
                         pic.Picedit.BorderStyle = BorderStyles.HotFlat;