章政 7 жил өмнө
parent
commit
1b0b4937ba

+ 18 - 18
PLCDataReader/Main.Designer.cs

@@ -848,7 +848,7 @@ namespace UAS_PLCDataReader
             this.CommandSetCheckedColumn.Tag = "0";
             this.CommandSetCheckedColumn.Visible = true;
             this.CommandSetCheckedColumn.VisibleIndex = 0;
-            this.CommandSetCheckedColumn.Width = 46;
+            this.CommandSetCheckedColumn.Width = 39;
             // 
             // CheckEditCommandSet
             // 
@@ -868,7 +868,7 @@ namespace UAS_PLCDataReader
             this.dc_code.Name = "dc_code";
             this.dc_code.Visible = true;
             this.dc_code.VisibleIndex = 1;
-            this.dc_code.Width = 64;
+            this.dc_code.Width = 55;
             // 
             // dc_name
             // 
@@ -877,15 +877,14 @@ namespace UAS_PLCDataReader
             this.dc_name.Name = "dc_name";
             this.dc_name.Visible = true;
             this.dc_name.VisibleIndex = 2;
-            this.dc_name.Width = 71;
+            this.dc_name.Width = 61;
             // 
             // dc_type
             // 
             this.dc_type.Caption = "指令值";
             this.dc_type.FieldName = "DC_TYPE";
             this.dc_type.Name = "dc_type";
-            this.dc_type.Visible = true;
-            this.dc_type.VisibleIndex = 3;
+            this.dc_type.Width = 65;
             // 
             // dc_typename
             // 
@@ -893,7 +892,9 @@ namespace UAS_PLCDataReader
             this.dc_typename.ColumnEdit = this.DataItemRepositoryItemComboBox1;
             this.dc_typename.FieldName = "DC_TYPENAME";
             this.dc_typename.Name = "dc_typename";
-            this.dc_typename.Width = 57;
+            this.dc_typename.Visible = true;
+            this.dc_typename.VisibleIndex = 3;
+            this.dc_typename.Width = 76;
             // 
             // dc_dataindex
             // 
@@ -902,6 +903,7 @@ namespace UAS_PLCDataReader
             this.dc_dataindex.Name = "dc_dataindex";
             this.dc_dataindex.Visible = true;
             this.dc_dataindex.VisibleIndex = 4;
+            this.dc_dataindex.Width = 62;
             // 
             // dc_value
             // 
@@ -910,7 +912,7 @@ namespace UAS_PLCDataReader
             this.dc_value.Name = "dc_value";
             this.dc_value.Visible = true;
             this.dc_value.VisibleIndex = 5;
-            this.dc_value.Width = 154;
+            this.dc_value.Width = 128;
             // 
             // dc_sendcoding
             // 
@@ -920,7 +922,7 @@ namespace UAS_PLCDataReader
             this.dc_sendcoding.Name = "dc_sendcoding";
             this.dc_sendcoding.Visible = true;
             this.dc_sendcoding.VisibleIndex = 6;
-            this.dc_sendcoding.Width = 138;
+            this.dc_sendcoding.Width = 114;
             // 
             // CommandSetRepositoryItemComboBox1
             // 
@@ -937,7 +939,7 @@ namespace UAS_PLCDataReader
             this.dc_receivecoding.Name = "dc_receivecoding";
             this.dc_receivecoding.Visible = true;
             this.dc_receivecoding.VisibleIndex = 7;
-            this.dc_receivecoding.Width = 139;
+            this.dc_receivecoding.Width = 115;
             // 
             // dc_man
             // 
@@ -947,7 +949,7 @@ namespace UAS_PLCDataReader
             this.dc_man.OptionsColumn.AllowEdit = false;
             this.dc_man.Visible = true;
             this.dc_man.VisibleIndex = 9;
-            this.dc_man.Width = 151;
+            this.dc_man.Width = 126;
             // 
             // dc_date
             // 
@@ -959,7 +961,7 @@ namespace UAS_PLCDataReader
             this.dc_date.OptionsColumn.AllowEdit = false;
             this.dc_date.Visible = true;
             this.dc_date.VisibleIndex = 10;
-            this.dc_date.Width = 118;
+            this.dc_date.Width = 107;
             // 
             // repositoryItemDateEdit1
             // 
@@ -977,7 +979,7 @@ namespace UAS_PLCDataReader
             this.db_name.Name = "db_name";
             this.db_name.Visible = true;
             this.db_name.VisibleIndex = 8;
-            this.db_name.Width = 57;
+            this.db_name.Width = 47;
             // 
             // PageDeviceNetSetting
             // 
@@ -1348,8 +1350,6 @@ namespace UAS_PLCDataReader
             this.dpc_function.Caption = "解析函数";
             this.dpc_function.FieldName = "DPC_FUNCTION";
             this.dpc_function.Name = "dpc_function";
-            this.dpc_function.Visible = true;
-            this.dpc_function.VisibleIndex = 5;
             this.dpc_function.Width = 90;
             // 
             // dpc_enable
@@ -1359,7 +1359,7 @@ namespace UAS_PLCDataReader
             this.dpc_enable.FieldName = "DPC_ENABLE";
             this.dpc_enable.Name = "dpc_enable";
             this.dpc_enable.Visible = true;
-            this.dpc_enable.VisibleIndex = 6;
+            this.dpc_enable.VisibleIndex = 5;
             this.dpc_enable.Width = 90;
             // 
             // em_name1
@@ -1369,7 +1369,7 @@ namespace UAS_PLCDataReader
             this.em_name1.Name = "em_name1";
             this.em_name1.OptionsColumn.AllowEdit = false;
             this.em_name1.Visible = true;
-            this.em_name1.VisibleIndex = 9;
+            this.em_name1.VisibleIndex = 8;
             // 
             // dpc_status
             // 
@@ -1392,7 +1392,7 @@ namespace UAS_PLCDataReader
             this.dpc_remark.FieldName = "DPC_REMARK";
             this.dpc_remark.Name = "dpc_remark";
             this.dpc_remark.Visible = true;
-            this.dpc_remark.VisibleIndex = 7;
+            this.dpc_remark.VisibleIndex = 6;
             this.dpc_remark.Width = 87;
             // 
             // POLLSETTINGSTATUSCOLUMN
@@ -1402,7 +1402,7 @@ namespace UAS_PLCDataReader
             this.POLLSETTINGSTATUSCOLUMN.Name = "POLLSETTINGSTATUSCOLUMN";
             this.POLLSETTINGSTATUSCOLUMN.OptionsColumn.ReadOnly = true;
             this.POLLSETTINGSTATUSCOLUMN.Visible = true;
-            this.POLLSETTINGSTATUSCOLUMN.VisibleIndex = 8;
+            this.POLLSETTINGSTATUSCOLUMN.VisibleIndex = 7;
             this.POLLSETTINGSTATUSCOLUMN.Width = 98;
             // 
             // PollingSetItemLookUpEdit

+ 2 - 1
PLCDataReader/Main.cs

@@ -539,7 +539,8 @@ namespace UAS_PLCDataReader
                     }
                     else
                     {
-                        if (ReturnData[Decode].ItemData == null|| ReturnData[Decode].ItemData.Count==0)
+                        //在未获取过数据的时候并且获取到的数据不为空的时候进行设备数据的更新
+                        if (ReturnData[Decode].ItemData == null || (ReturnData[Decode].ItemData.Count == 0 && ItemData.Count != 0))
                         {
                             ReturnData[Decode].ItemData = ItemData;
                             LogicHandler.UpdateDeviceData(dh, Decode, ItemData);

+ 8 - 1
PLCDataReader/PublicMethod/LogicHandler.cs

@@ -78,9 +78,16 @@ namespace UAS_PLCDataReader.PublicMethod
             }
             sql.Clear();
             sql.Append("update DeviceRunstatus set dr_qty=:dr_inqty,dr_okqty=:dr_okqty,dr_TEMPERATURE=:dr_TEMPERATURE where dr_decode='" + Decode + "'");
-            dh.ExecuteSql(sql.ToString(), "select", INQTY, OUTQTY, TEMPERATURE);
+            dh.ExecuteSql(sql.ToString(), "update", INQTY, OUTQTY, TEMPERATURE);
         }
 
+        /// <summary>
+        /// 更新设备运行状态
+        /// </summary>
+        /// <param name="dh"></param>
+        /// <param name="iDecode"></param>
+        /// <param name="iDename"></param>
+        /// <param name="iDestatus"></param>
         public static void UpdateDeviceStatus(DataHelper dh, string iDecode, string iDename, string iDestatus)
         {
             sql.Clear();