Browse Source

优化支持多命令查询

callm 4 years ago
parent
commit
058dcfe2bf

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

@@ -43,11 +43,11 @@ namespace UAS_PLCDataReader.Device.Infomation
             }
             //查询设备参数信息
             sql.Clear();
-            sql.Append("select dr_updatedate,case when dc_type='INQTY' then '投入' when dc_type='OUTQTY' then '产出' when dc_type='NGQTY' then '不良'");
+            sql.Append("select dr_updatedate,case when dc_type='INQTY' then '投入' when dc_type='INGORE' then '忽略' when dc_type='OUTQTY' then '产出' when dc_type='NGQTY' then '不良'");
             sql.Append("when dc_type='PARAM1' then de_item1 when dc_type='PARAM2' then de_item2 when dc_type='PARAM3' then de_item3 ");
             sql.Append("when dc_type='PARAM4' then de_item4 when dc_type='PARAM5' then de_item5 when dc_type='PARAM6' then de_item6 ");
             sql.Append("when dc_type='PARAM7' then de_item7 when dc_type='PARAM8' then de_item8 when dc_type='PARAM9' then de_item9 ");
-            sql.Append("when dc_type='PARAM10' then de_item10 end dc_name,case when dc_type='INQTY' then dr_qty when dc_type='OUTQTY' then dr_okqty when dc_type='NGQTY' then dr_ngqty ");
+            sql.Append("when dc_type='PARAM10' then de_item10 end dc_name,case when dc_type='INQTY' when dc_type='INGORE' then '忽略' then dr_qty when dc_type='OUTQTY' then dr_okqty when dc_type='NGQTY' then dr_ngqty ");
             sql.Append("when dc_type='TEMPERATURE' then dr_TEMPERATURE when dc_type='PARAM1' then dr_value1 when dc_type='PARAM2' then dr_value2 ");
             sql.Append("when dc_type='PARAM3' then dr_value3 when dc_type='PARAM4' then dr_value4 when dc_type='PARAM5' then dr_value5 ");
             sql.Append("when dc_type='PARAM6' then dr_value6 when dc_type='PARAM7' then dr_value7 when dc_type='PARAM8' then dr_value8 ");

+ 2 - 2
PLCDataReader/Entity/Polling.cs

@@ -26,7 +26,7 @@ namespace UAS_PLCDataReader.Entity
 
         private DataHelper dh;
 
-        private string commandCode;
+        private string[] commandCode;
 
         public string DeviceCode
         {
@@ -132,7 +132,7 @@ namespace UAS_PLCDataReader.Entity
             }
         }
 
-        public string CommandCode
+        public string[] CommandCode
         {
             get
             {

+ 5 - 0
PLCDataReader/Login.cs

@@ -20,6 +20,11 @@ namespace UAS_PLCDataReader
 
         private void Login_Load(object sender, EventArgs e)
         {
+            //int[] arr= BaseUtil.GetDecimalData("01030C00CD0000004C0000002E0000A9", 8);
+            //for (int i = 0; i < arr.Length; i++)
+            //{
+            //    Console.WriteLine(arr[i]);
+            //}
             SystemInf.dh = dh;
             DataTable dt = (DataTable)dh.ExecuteSql("select ma_user,ma_function from master", "select");
             BaseUtil.FillComBoxEditWidthDataTable(Master, "ma_function", "ma_user", dt, false);

+ 107 - 75
PLCDataReader/Main.Designer.cs

@@ -36,6 +36,7 @@ namespace UAS_PLCDataReader
             this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
+            this.applicationMenu1 = new DevExpress.XtraBars.Ribbon.ApplicationMenu(this.components);
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
             this.ButtonDeviceNetSetting = new DevExpress.XtraBars.BarButtonItem();
             this.ButtonCommandSet = new DevExpress.XtraBars.BarButtonItem();
@@ -120,6 +121,7 @@ namespace UAS_PLCDataReader
             this.CommandSetRepositoryItemComboBox1 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();
             this.dc_receivecoding = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dc_man = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.dc_address = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dc_date = new DevExpress.XtraGrid.Columns.GridColumn();
             this.repositoryItemDateEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemDateEdit();
             this.db_name = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -226,6 +228,7 @@ namespace UAS_PLCDataReader
             this.dr_runstatus = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dr_qty = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dr_inqty = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.dr_ngqty = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dr_value1 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dr_value2 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dr_value3 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -241,6 +244,7 @@ namespace UAS_PLCDataReader
             this.TimerUpdateDevice = new System.Windows.Forms.Timer(this.components);
             this.TimerUpdateSQL = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.applicationMenu1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
             this.PageDeviceList.SuspendLayout();
@@ -301,6 +305,7 @@ namespace UAS_PLCDataReader
             // 
             // RibbonNav
             // 
+            this.RibbonNav.ApplicationButtonDropDownControl = this.applicationMenu1;
             this.RibbonNav.ApplicationIcon = global::UAS_PLCDataReader.Properties.Resources.U_Letter_72px_1121581_easyicon_net;
             this.RibbonNav.DrawGroupCaptions = DevExpress.Utils.DefaultBoolean.False;
             this.RibbonNav.ExpandCollapseItem.Id = 0;
@@ -322,7 +327,12 @@ namespace UAS_PLCDataReader
             this.RibbonNav.Pages.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPage[] {
             this.DeviceInf,
             this.DeviceCommandSetting});
-            this.RibbonNav.Size = new System.Drawing.Size(1040, 128);
+            this.RibbonNav.Size = new System.Drawing.Size(1040, 252);
+            // 
+            // applicationMenu1
+            // 
+            this.applicationMenu1.Name = "applicationMenu1";
+            this.applicationMenu1.Ribbon = this.RibbonNav;
             // 
             // ButtonDeviceList
             // 
@@ -459,11 +469,11 @@ namespace UAS_PLCDataReader
             // MainTabControl
             // 
             this.MainTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.MainTabControl.Location = new System.Drawing.Point(0, 128);
+            this.MainTabControl.Location = new System.Drawing.Point(0, 252);
             this.MainTabControl.Name = "MainTabControl";
             this.MainTabControl.SelectedTabPage = this.PageDeviceList;
             this.MainTabControl.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False;
-            this.MainTabControl.Size = new System.Drawing.Size(1040, 584);
+            this.MainTabControl.Size = new System.Drawing.Size(1040, 460);
             this.MainTabControl.TabIndex = 3;
             this.MainTabControl.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
             this.PageDeviceList,
@@ -491,7 +501,7 @@ namespace UAS_PLCDataReader
             this.PageDeviceList.Controls.Add(this.GridDeviceList);
             this.PageDeviceList.Name = "PageDeviceList";
             this.PageDeviceList.PageVisible = false;
-            this.PageDeviceList.Size = new System.Drawing.Size(1034, 578);
+            this.PageDeviceList.Size = new System.Drawing.Size(1028, 448);
             this.PageDeviceList.Text = "设备主档资料";
             this.PageDeviceList.VisibleChanged += new System.EventHandler(this.PageDeviceList_VisibleChanged);
             // 
@@ -499,7 +509,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonAddDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonAddDevice.Grid = null;
-            this.ButtonAddDevice.Location = new System.Drawing.Point(818, 4);
+            this.ButtonAddDevice.Location = new System.Drawing.Point(812, 4);
             this.ButtonAddDevice.Name = "ButtonAddDevice";
             this.ButtonAddDevice.Size = new System.Drawing.Size(64, 23);
             this.ButtonAddDevice.TabIndex = 16;
@@ -509,7 +519,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonDeleteDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonDeleteDevice.Grid = null;
-            this.ButtonDeleteDevice.Location = new System.Drawing.Point(958, 4);
+            this.ButtonDeleteDevice.Location = new System.Drawing.Point(952, 4);
             this.ButtonDeleteDevice.Name = "ButtonDeleteDevice";
             this.ButtonDeleteDevice.Size = new System.Drawing.Size(64, 23);
             this.ButtonDeleteDevice.TabIndex = 15;
@@ -520,7 +530,7 @@ namespace UAS_PLCDataReader
             this.ButtonSaveDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonSaveDevice.Grid = null;
             this.ButtonSaveDevice.HandlerOtherFirst = true;
-            this.ButtonSaveDevice.Location = new System.Drawing.Point(888, 4);
+            this.ButtonSaveDevice.Location = new System.Drawing.Point(882, 4);
             this.ButtonSaveDevice.Name = "ButtonSaveDevice";
             this.ButtonSaveDevice.Size = new System.Drawing.Size(64, 23);
             this.ButtonSaveDevice.TabIndex = 14;
@@ -541,7 +551,7 @@ namespace UAS_PLCDataReader
             this.ComBoxDeviceListMan.Properties.NullText = "";
             this.ComBoxDeviceListMan.Properties.ValueMember = "EM_CODE";
             this.ComBoxDeviceListMan.Properties.View = this.searchLookUpEdit1View;
-            this.ComBoxDeviceListMan.Size = new System.Drawing.Size(100, 22);
+            this.ComBoxDeviceListMan.Size = new System.Drawing.Size(100, 34);
             this.ComBoxDeviceListMan.TabIndex = 12;
             this.ComBoxDeviceListMan.Visible = false;
             // 
@@ -576,7 +586,7 @@ namespace UAS_PLCDataReader
             this.ComBoxDeviceListMan_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.ComBoxDeviceListMan_label.Location = new System.Drawing.Point(318, 8);
             this.ComBoxDeviceListMan_label.Name = "ComBoxDeviceListMan_label";
-            this.ComBoxDeviceListMan_label.Size = new System.Drawing.Size(32, 16);
+            this.ComBoxDeviceListMan_label.Size = new System.Drawing.Size(64, 33);
             this.ComBoxDeviceListMan_label.TabIndex = 11;
             this.ComBoxDeviceListMan_label.Text = "人员";
             this.ComBoxDeviceListMan_label.Visible = false;
@@ -591,7 +601,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceListWC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceListWC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceListWC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceListWC.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceListWC.TabIndex = 6;
             this.ComboxDeviceListWC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceListWC_SelectedIndexChanged);
             // 
@@ -605,7 +615,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceListLC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceListLC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceListLC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceListLC.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceListLC.TabIndex = 7;
             this.ComboxDeviceListLC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceListLC_SelectedIndexChanged);
             // 
@@ -614,7 +624,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceListLC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.ComboxDeviceListLC_label.Location = new System.Drawing.Point(161, 8);
             this.ComboxDeviceListLC_label.Name = "ComboxDeviceListLC_label";
-            this.ComboxDeviceListLC_label.Size = new System.Drawing.Size(32, 16);
+            this.ComboxDeviceListLC_label.Size = new System.Drawing.Size(64, 33);
             this.ComboxDeviceListLC_label.TabIndex = 9;
             this.ComboxDeviceListLC_label.Text = "线别";
             // 
@@ -623,7 +633,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceListWC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.ComboxDeviceListWC_label.Location = new System.Drawing.Point(10, 8);
             this.ComboxDeviceListWC_label.Name = "ComboxDeviceListWC_label";
-            this.ComboxDeviceListWC_label.Size = new System.Drawing.Size(32, 16);
+            this.ComboxDeviceListWC_label.Size = new System.Drawing.Size(64, 33);
             this.ComboxDeviceListWC_label.TabIndex = 8;
             this.ComboxDeviceListWC_label.Text = "车间";
             // 
@@ -644,7 +654,7 @@ namespace UAS_PLCDataReader
             this.DataItemRepositoryItemComboBox1,
             this.DeviceItemSearchLookUpEdit});
             this.GridDeviceList.RowCount = 0;
-            this.GridDeviceList.Size = new System.Drawing.Size(1034, 547);
+            this.GridDeviceList.Size = new System.Drawing.Size(1028, 417);
             this.GridDeviceList.TabIndex = 0;
             this.GridDeviceList.TableName = null;
             this.GridDeviceList.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -950,7 +960,7 @@ namespace UAS_PLCDataReader
             this.PageCommandSet.Controls.Add(this.GridCommandSetting);
             this.PageCommandSet.Name = "PageCommandSet";
             this.PageCommandSet.PageVisible = false;
-            this.PageCommandSet.Size = new System.Drawing.Size(1034, 578);
+            this.PageCommandSet.Size = new System.Drawing.Size(1028, 448);
             this.PageCommandSet.Text = "设备指令设置";
             this.PageCommandSet.VisibleChanged += new System.EventHandler(this.PageCommandSet_VisibleChanged);
             // 
@@ -958,7 +968,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonDeleteCommand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonDeleteCommand.Grid = null;
-            this.ButtonDeleteCommand.Location = new System.Drawing.Point(952, 5);
+            this.ButtonDeleteCommand.Location = new System.Drawing.Point(946, 5);
             this.ButtonDeleteCommand.Name = "ButtonDeleteCommand";
             this.ButtonDeleteCommand.Size = new System.Drawing.Size(64, 23);
             this.ButtonDeleteCommand.TabIndex = 6;
@@ -969,7 +979,7 @@ namespace UAS_PLCDataReader
             this.Brand_label.Appearance.Font = new System.Drawing.Font("微软雅黑", 12F);
             this.Brand_label.Location = new System.Drawing.Point(8, 5);
             this.Brand_label.Name = "Brand_label";
-            this.Brand_label.Size = new System.Drawing.Size(32, 21);
+            this.Brand_label.Size = new System.Drawing.Size(64, 41);
             this.Brand_label.TabIndex = 5;
             this.Brand_label.Text = "品牌";
             // 
@@ -983,7 +993,7 @@ namespace UAS_PLCDataReader
             this.Brand.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.Brand.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.Brand.Size = new System.Drawing.Size(100, 24);
+            this.Brand.Size = new System.Drawing.Size(100, 38);
             this.Brand.TabIndex = 4;
             this.Brand.SelectedIndexChanged += new System.EventHandler(this.Brand_SelectedIndexChanged);
             // 
@@ -991,7 +1001,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonNewCommand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonNewCommand.Grid = null;
-            this.ButtonNewCommand.Location = new System.Drawing.Point(812, 5);
+            this.ButtonNewCommand.Location = new System.Drawing.Point(806, 5);
             this.ButtonNewCommand.Name = "ButtonNewCommand";
             this.ButtonNewCommand.Size = new System.Drawing.Size(64, 23);
             this.ButtonNewCommand.TabIndex = 3;
@@ -1002,7 +1012,7 @@ namespace UAS_PLCDataReader
             this.ButtonSaveCommand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonSaveCommand.Grid = null;
             this.ButtonSaveCommand.HandlerOtherFirst = true;
-            this.ButtonSaveCommand.Location = new System.Drawing.Point(882, 5);
+            this.ButtonSaveCommand.Location = new System.Drawing.Point(876, 5);
             this.ButtonSaveCommand.Name = "ButtonSaveCommand";
             this.ButtonSaveCommand.Size = new System.Drawing.Size(64, 23);
             this.ButtonSaveCommand.TabIndex = 2;
@@ -1027,7 +1037,7 @@ namespace UAS_PLCDataReader
             this.CommandSetRepositoryItemComboBox1,
             this.repositoryItemDateEdit1});
             this.GridCommandSetting.RowCount = 0;
-            this.GridCommandSetting.Size = new System.Drawing.Size(1034, 547);
+            this.GridCommandSetting.Size = new System.Drawing.Size(1028, 417);
             this.GridCommandSetting.TabIndex = 1;
             this.GridCommandSetting.TableName = null;
             this.GridCommandSetting.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -1048,6 +1058,7 @@ namespace UAS_PLCDataReader
             this.dc_sendcoding,
             this.dc_receivecoding,
             this.dc_man,
+            this.dc_address,
             this.dc_date,
             this.db_name});
             this.GridViewCommandSet.GridControl = this.GridCommandSetting;
@@ -1173,6 +1184,14 @@ namespace UAS_PLCDataReader
             this.dc_man.VisibleIndex = 8;
             this.dc_man.Width = 126;
             // 
+            // dc_address
+            // 
+            this.dc_address.Caption = "占据地址";
+            this.dc_address.FieldName = "DC_ADDRESS";
+            this.dc_address.Name = "dc_address";
+            this.dc_address.Visible = true;
+            this.dc_address.VisibleIndex = 10;
+            // 
             // dc_date
             // 
             this.dc_date.Caption = "维护时间";
@@ -1211,14 +1230,14 @@ namespace UAS_PLCDataReader
             this.PageDeviceNetSetting.Controls.Add(this.GridDeviceNetSetting);
             this.PageDeviceNetSetting.Name = "PageDeviceNetSetting";
             this.PageDeviceNetSetting.PageVisible = false;
-            this.PageDeviceNetSetting.Size = new System.Drawing.Size(1034, 578);
+            this.PageDeviceNetSetting.Size = new System.Drawing.Size(1028, 448);
             this.PageDeviceNetSetting.Text = "设备网络配置";
             // 
             // ButtonDeleteNetConfig
             // 
             this.ButtonDeleteNetConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonDeleteNetConfig.Grid = null;
-            this.ButtonDeleteNetConfig.Location = new System.Drawing.Point(949, 7);
+            this.ButtonDeleteNetConfig.Location = new System.Drawing.Point(943, 7);
             this.ButtonDeleteNetConfig.Name = "ButtonDeleteNetConfig";
             this.ButtonDeleteNetConfig.Size = new System.Drawing.Size(64, 23);
             this.ButtonDeleteNetConfig.TabIndex = 12;
@@ -1228,7 +1247,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonAddNetConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonAddNetConfig.Grid = null;
-            this.ButtonAddNetConfig.Location = new System.Drawing.Point(809, 7);
+            this.ButtonAddNetConfig.Location = new System.Drawing.Point(803, 7);
             this.ButtonAddNetConfig.Name = "ButtonAddNetConfig";
             this.ButtonAddNetConfig.Size = new System.Drawing.Size(64, 23);
             this.ButtonAddNetConfig.TabIndex = 11;
@@ -1239,7 +1258,7 @@ namespace UAS_PLCDataReader
             this.ButtonSaveNetConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonSaveNetConfig.Grid = null;
             this.ButtonSaveNetConfig.HandlerOtherFirst = false;
-            this.ButtonSaveNetConfig.Location = new System.Drawing.Point(879, 7);
+            this.ButtonSaveNetConfig.Location = new System.Drawing.Point(873, 7);
             this.ButtonSaveNetConfig.Name = "ButtonSaveNetConfig";
             this.ButtonSaveNetConfig.Size = new System.Drawing.Size(64, 23);
             this.ButtonSaveNetConfig.TabIndex = 10;
@@ -1261,7 +1280,7 @@ namespace UAS_PLCDataReader
             this.GridDeviceNetSetting.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.dpc_enableCheckEdit});
             this.GridDeviceNetSetting.RowCount = 0;
-            this.GridDeviceNetSetting.Size = new System.Drawing.Size(1031, 544);
+            this.GridDeviceNetSetting.Size = new System.Drawing.Size(1025, 414);
             this.GridDeviceNetSetting.TabIndex = 0;
             this.GridDeviceNetSetting.TableName = null;
             this.GridDeviceNetSetting.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -1371,7 +1390,7 @@ namespace UAS_PLCDataReader
             this.PagePollingSetting.Controls.Add(this.GridPollingSetting);
             this.PagePollingSetting.Name = "PagePollingSetting";
             this.PagePollingSetting.PageVisible = false;
-            this.PagePollingSetting.Size = new System.Drawing.Size(1034, 578);
+            this.PagePollingSetting.Size = new System.Drawing.Size(1028, 448);
             this.PagePollingSetting.Text = "设备轮询配置";
             this.PagePollingSetting.VisibleChanged += new System.EventHandler(this.PagePollingSetting_VisibleChanged);
             // 
@@ -1379,7 +1398,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonDeleteCommandSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonDeleteCommandSet.Grid = null;
-            this.ButtonDeleteCommandSet.Location = new System.Drawing.Point(957, 6);
+            this.ButtonDeleteCommandSet.Location = new System.Drawing.Point(951, 6);
             this.ButtonDeleteCommandSet.Name = "ButtonDeleteCommandSet";
             this.ButtonDeleteCommandSet.Size = new System.Drawing.Size(64, 23);
             this.ButtonDeleteCommandSet.TabIndex = 9;
@@ -1389,7 +1408,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonNewCommandSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonNewCommandSet.Grid = null;
-            this.ButtonNewCommandSet.Location = new System.Drawing.Point(817, 6);
+            this.ButtonNewCommandSet.Location = new System.Drawing.Point(811, 6);
             this.ButtonNewCommandSet.Name = "ButtonNewCommandSet";
             this.ButtonNewCommandSet.Size = new System.Drawing.Size(64, 23);
             this.ButtonNewCommandSet.TabIndex = 8;
@@ -1400,7 +1419,7 @@ namespace UAS_PLCDataReader
             this.ButtonSaveCommandSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonSaveCommandSet.Grid = null;
             this.ButtonSaveCommandSet.HandlerOtherFirst = true;
-            this.ButtonSaveCommandSet.Location = new System.Drawing.Point(887, 6);
+            this.ButtonSaveCommandSet.Location = new System.Drawing.Point(881, 6);
             this.ButtonSaveCommandSet.Name = "ButtonSaveCommandSet";
             this.ButtonSaveCommandSet.Size = new System.Drawing.Size(64, 23);
             this.ButtonSaveCommandSet.TabIndex = 7;
@@ -1410,7 +1429,7 @@ namespace UAS_PLCDataReader
             // ButtonPausePolling
             // 
             this.ButtonPausePolling.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.ButtonPausePolling.Location = new System.Drawing.Point(736, 6);
+            this.ButtonPausePolling.Location = new System.Drawing.Point(730, 6);
             this.ButtonPausePolling.Name = "ButtonPausePolling";
             this.ButtonPausePolling.Size = new System.Drawing.Size(75, 23);
             this.ButtonPausePolling.TabIndex = 2;
@@ -1420,7 +1439,7 @@ namespace UAS_PLCDataReader
             // ButtonStartPolling
             // 
             this.ButtonStartPolling.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.ButtonStartPolling.Location = new System.Drawing.Point(655, 6);
+            this.ButtonStartPolling.Location = new System.Drawing.Point(649, 6);
             this.ButtonStartPolling.Name = "ButtonStartPolling";
             this.ButtonStartPolling.Size = new System.Drawing.Size(75, 23);
             this.ButtonStartPolling.TabIndex = 1;
@@ -1446,7 +1465,7 @@ namespace UAS_PLCDataReader
             this.PollSettingItemSearchLookUpEdit,
             this.PollSettingDeviceSearchLookUpEdit});
             this.GridPollingSetting.RowCount = 0;
-            this.GridPollingSetting.Size = new System.Drawing.Size(1034, 544);
+            this.GridPollingSetting.Size = new System.Drawing.Size(1028, 414);
             this.GridPollingSetting.TabIndex = 0;
             this.GridPollingSetting.TableName = null;
             this.GridPollingSetting.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -1668,14 +1687,14 @@ namespace UAS_PLCDataReader
             this.PagePolling.Controls.Add(this.GridPolling);
             this.PagePolling.Name = "PagePolling";
             this.PagePolling.PageVisible = false;
-            this.PagePolling.Size = new System.Drawing.Size(1034, 578);
+            this.PagePolling.Size = new System.Drawing.Size(1028, 448);
             this.PagePolling.Text = "xtraTabPage1";
             // 
             // ButtonAddPolling
             // 
             this.ButtonAddPolling.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonAddPolling.Grid = null;
-            this.ButtonAddPolling.Location = new System.Drawing.Point(885, 552);
+            this.ButtonAddPolling.Location = new System.Drawing.Point(879, 422);
             this.ButtonAddPolling.Name = "ButtonAddPolling";
             this.ButtonAddPolling.Size = new System.Drawing.Size(64, 23);
             this.ButtonAddPolling.TabIndex = 9;
@@ -1685,7 +1704,7 @@ namespace UAS_PLCDataReader
             // 
             this.ButtonDeletePolling.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonDeletePolling.Grid = null;
-            this.ButtonDeletePolling.Location = new System.Drawing.Point(814, 552);
+            this.ButtonDeletePolling.Location = new System.Drawing.Point(808, 422);
             this.ButtonDeletePolling.Name = "ButtonDeletePolling";
             this.ButtonDeletePolling.Size = new System.Drawing.Size(64, 23);
             this.ButtonDeletePolling.TabIndex = 8;
@@ -1696,7 +1715,7 @@ namespace UAS_PLCDataReader
             this.ButtonSavePolling.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonSavePolling.Grid = null;
             this.ButtonSavePolling.HandlerOtherFirst = false;
-            this.ButtonSavePolling.Location = new System.Drawing.Point(956, 552);
+            this.ButtonSavePolling.Location = new System.Drawing.Point(950, 422);
             this.ButtonSavePolling.Name = "ButtonSavePolling";
             this.ButtonSavePolling.Size = new System.Drawing.Size(64, 23);
             this.ButtonSavePolling.TabIndex = 7;
@@ -1718,7 +1737,7 @@ namespace UAS_PLCDataReader
             this.GridPolling.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.dpc_enableCheckEdit});
             this.GridPolling.RowCount = 0;
-            this.GridPolling.Size = new System.Drawing.Size(1034, 550);
+            this.GridPolling.Size = new System.Drawing.Size(1028, 420);
             this.GridPolling.TabIndex = 0;
             this.GridPolling.TableName = null;
             this.GridPolling.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -1811,7 +1830,7 @@ namespace UAS_PLCDataReader
             this.PageDeviceStatus.Controls.Add(this.PanelDeviceStatus);
             this.PageDeviceStatus.Name = "PageDeviceStatus";
             this.PageDeviceStatus.PageVisible = false;
-            this.PageDeviceStatus.Size = new System.Drawing.Size(1034, 578);
+            this.PageDeviceStatus.Size = new System.Drawing.Size(1028, 448);
             this.PageDeviceStatus.Text = "设备状态查看";
             this.PageDeviceStatus.VisibleChanged += new System.EventHandler(this.PageDeviceStatus_VisibleChanged);
             // 
@@ -1825,7 +1844,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceDepartment.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceDepartment.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceDepartment.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceDepartment.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceDepartment.TabIndex = 6;
             this.ComboxDeviceDepartment.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusLC_SelectedIndexChanged);
             // 
@@ -1839,7 +1858,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceFloor.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceFloor.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceFloor.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceFloor.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceFloor.TabIndex = 7;
             this.ComboxDeviceFloor.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusLC_SelectedIndexChanged);
             // 
@@ -1848,7 +1867,7 @@ namespace UAS_PLCDataReader
             this.label_ComboxDeviceFloor.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.label_ComboxDeviceFloor.Location = new System.Drawing.Point(477, 13);
             this.label_ComboxDeviceFloor.Name = "label_ComboxDeviceFloor";
-            this.label_ComboxDeviceFloor.Size = new System.Drawing.Size(32, 16);
+            this.label_ComboxDeviceFloor.Size = new System.Drawing.Size(64, 33);
             this.label_ComboxDeviceFloor.TabIndex = 9;
             this.label_ComboxDeviceFloor.Text = "楼层";
             // 
@@ -1857,7 +1876,7 @@ namespace UAS_PLCDataReader
             this.label_ComboxDeviceDepartment.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.label_ComboxDeviceDepartment.Location = new System.Drawing.Point(326, 13);
             this.label_ComboxDeviceDepartment.Name = "label_ComboxDeviceDepartment";
-            this.label_ComboxDeviceDepartment.Size = new System.Drawing.Size(32, 16);
+            this.label_ComboxDeviceDepartment.Size = new System.Drawing.Size(64, 33);
             this.label_ComboxDeviceDepartment.TabIndex = 8;
             this.label_ComboxDeviceDepartment.Text = "部门";
             // 
@@ -1871,7 +1890,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceStatusWC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceStatusWC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceStatusWC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceStatusWC.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceStatusWC.TabIndex = 0;
             this.ComboxDeviceStatusWC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusWC_SelectedIndexChanged);
             // 
@@ -1885,7 +1904,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceStatusLC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.ComboxDeviceStatusLC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
-            this.ComboxDeviceStatusLC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceStatusLC.Size = new System.Drawing.Size(100, 36);
             this.ComboxDeviceStatusLC.TabIndex = 0;
             this.ComboxDeviceStatusLC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusLC_SelectedIndexChanged);
             // 
@@ -1897,7 +1916,7 @@ namespace UAS_PLCDataReader
             this.CheckEditDeviceStatusEnable.Properties.Appearance.Font = new System.Drawing.Font("黑体", 10F);
             this.CheckEditDeviceStatusEnable.Properties.Appearance.Options.UseFont = true;
             this.CheckEditDeviceStatusEnable.Properties.Caption = "只显示已启用设备";
-            this.CheckEditDeviceStatusEnable.Size = new System.Drawing.Size(142, 19);
+            this.CheckEditDeviceStatusEnable.Size = new System.Drawing.Size(142, 34);
             this.CheckEditDeviceStatusEnable.TabIndex = 5;
             this.CheckEditDeviceStatusEnable.CheckedChanged += new System.EventHandler(this.CheckEditDeviceStatusEnable_CheckedChanged);
             // 
@@ -1906,7 +1925,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceStatusLC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.ComboxDeviceStatusLC_label.Location = new System.Drawing.Point(173, 13);
             this.ComboxDeviceStatusLC_label.Name = "ComboxDeviceStatusLC_label";
-            this.ComboxDeviceStatusLC_label.Size = new System.Drawing.Size(32, 16);
+            this.ComboxDeviceStatusLC_label.Size = new System.Drawing.Size(64, 33);
             this.ComboxDeviceStatusLC_label.TabIndex = 4;
             this.ComboxDeviceStatusLC_label.Text = "线别";
             // 
@@ -1915,7 +1934,7 @@ namespace UAS_PLCDataReader
             this.ComboxDeviceStatusWC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.ComboxDeviceStatusWC_label.Location = new System.Drawing.Point(22, 13);
             this.ComboxDeviceStatusWC_label.Name = "ComboxDeviceStatusWC_label";
-            this.ComboxDeviceStatusWC_label.Size = new System.Drawing.Size(32, 16);
+            this.ComboxDeviceStatusWC_label.Size = new System.Drawing.Size(64, 33);
             this.ComboxDeviceStatusWC_label.TabIndex = 2;
             this.ComboxDeviceStatusWC_label.Text = "车间";
             // 
@@ -1926,7 +1945,7 @@ namespace UAS_PLCDataReader
             | System.Windows.Forms.AnchorStyles.Right)));
             this.PanelDeviceStatus.Location = new System.Drawing.Point(0, 35);
             this.PanelDeviceStatus.Name = "PanelDeviceStatus";
-            this.PanelDeviceStatus.Size = new System.Drawing.Size(1034, 543);
+            this.PanelDeviceStatus.Size = new System.Drawing.Size(1028, 413);
             this.PanelDeviceStatus.TabIndex = 0;
             // 
             // PageWorkCenterStatus
@@ -1934,7 +1953,7 @@ namespace UAS_PLCDataReader
             this.PageWorkCenterStatus.Controls.Add(this.GridWorkCenterStatus);
             this.PageWorkCenterStatus.Name = "PageWorkCenterStatus";
             this.PageWorkCenterStatus.PageVisible = false;
-            this.PageWorkCenterStatus.Size = new System.Drawing.Size(1034, 578);
+            this.PageWorkCenterStatus.Size = new System.Drawing.Size(1028, 448);
             this.PageWorkCenterStatus.Text = "设备工作中心";
             // 
             // GridWorkCenterStatus
@@ -1951,7 +1970,7 @@ namespace UAS_PLCDataReader
             this.GridWorkCenterStatus.MenuManager = this.RibbonNav;
             this.GridWorkCenterStatus.Name = "GridWorkCenterStatus";
             this.GridWorkCenterStatus.RowCount = 0;
-            this.GridWorkCenterStatus.Size = new System.Drawing.Size(1031, 575);
+            this.GridWorkCenterStatus.Size = new System.Drawing.Size(1025, 445);
             this.GridWorkCenterStatus.TabIndex = 0;
             this.GridWorkCenterStatus.TableName = null;
             this.GridWorkCenterStatus.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -1972,7 +1991,7 @@ namespace UAS_PLCDataReader
             this.PageDeviceRunLog.Controls.Add(this.GridDeviceRunLog);
             this.PageDeviceRunLog.Name = "PageDeviceRunLog";
             this.PageDeviceRunLog.PageVisible = false;
-            this.PageDeviceRunLog.Size = new System.Drawing.Size(1034, 578);
+            this.PageDeviceRunLog.Size = new System.Drawing.Size(1028, 448);
             this.PageDeviceRunLog.Text = "设备运行日志";
             // 
             // ButtonSearchDeviceRunLog
@@ -1989,7 +2008,7 @@ namespace UAS_PLCDataReader
             this.TextDrrDeCode.Location = new System.Drawing.Point(64, 5);
             this.TextDrrDeCode.MenuManager = this.RibbonNav;
             this.TextDrrDeCode.Name = "TextDrrDeCode";
-            this.TextDrrDeCode.Size = new System.Drawing.Size(100, 20);
+            this.TextDrrDeCode.Size = new System.Drawing.Size(100, 36);
             this.TextDrrDeCode.TabIndex = 2;
             // 
             // LabelDrrDeCode
@@ -1997,7 +2016,7 @@ namespace UAS_PLCDataReader
             this.LabelDrrDeCode.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.LabelDrrDeCode.Location = new System.Drawing.Point(10, 7);
             this.LabelDrrDeCode.Name = "LabelDrrDeCode";
-            this.LabelDrrDeCode.Size = new System.Drawing.Size(48, 17);
+            this.LabelDrrDeCode.Size = new System.Drawing.Size(96, 31);
             this.LabelDrrDeCode.TabIndex = 1;
             this.LabelDrrDeCode.Text = "设备编号";
             // 
@@ -2015,7 +2034,7 @@ namespace UAS_PLCDataReader
             this.GridDeviceRunLog.MenuManager = this.RibbonNav;
             this.GridDeviceRunLog.Name = "GridDeviceRunLog";
             this.GridDeviceRunLog.RowCount = 0;
-            this.GridDeviceRunLog.Size = new System.Drawing.Size(1035, 554);
+            this.GridDeviceRunLog.Size = new System.Drawing.Size(1029, 424);
             this.GridDeviceRunLog.TabIndex = 0;
             this.GridDeviceRunLog.TableName = null;
             this.GridDeviceRunLog.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -2125,7 +2144,7 @@ namespace UAS_PLCDataReader
             this.PageClientParam.Controls.Add(this.label1);
             this.PageClientParam.Name = "PageClientParam";
             this.PageClientParam.PageVisible = false;
-            this.PageClientParam.Size = new System.Drawing.Size(1034, 578);
+            this.PageClientParam.Size = new System.Drawing.Size(1028, 448);
             this.PageClientParam.Text = "客户端参数设置";
             this.PageClientParam.VisibleChanged += new System.EventHandler(this.PageClientParam_VisibleChanged);
             // 
@@ -2135,7 +2154,7 @@ namespace UAS_PLCDataReader
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.label2.Location = new System.Drawing.Point(28, 78);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(106, 21);
+            this.label2.Size = new System.Drawing.Size(210, 41);
             this.label2.TabIndex = 6;
             this.label2.Text = "立即更新参数";
             // 
@@ -2145,7 +2164,7 @@ namespace UAS_PLCDataReader
             this.CheckOUTQTY.MenuManager = this.RibbonNav;
             this.CheckOUTQTY.Name = "CheckOUTQTY";
             this.CheckOUTQTY.Properties.Caption = "产出";
-            this.CheckOUTQTY.Size = new System.Drawing.Size(75, 19);
+            this.CheckOUTQTY.Size = new System.Drawing.Size(75, 34);
             this.CheckOUTQTY.TabIndex = 5;
             // 
             // CheckPARAM
@@ -2154,7 +2173,7 @@ namespace UAS_PLCDataReader
             this.CheckPARAM.MenuManager = this.RibbonNav;
             this.CheckPARAM.Name = "CheckPARAM";
             this.CheckPARAM.Properties.Caption = "其他参数";
-            this.CheckPARAM.Size = new System.Drawing.Size(75, 19);
+            this.CheckPARAM.Size = new System.Drawing.Size(75, 34);
             this.CheckPARAM.TabIndex = 4;
             // 
             // CheckINQTY
@@ -2163,7 +2182,7 @@ namespace UAS_PLCDataReader
             this.CheckINQTY.MenuManager = this.RibbonNav;
             this.CheckINQTY.Name = "CheckINQTY";
             this.CheckINQTY.Properties.Caption = "投入";
-            this.CheckINQTY.Size = new System.Drawing.Size(75, 19);
+            this.CheckINQTY.Size = new System.Drawing.Size(75, 34);
             this.CheckINQTY.TabIndex = 3;
             // 
             // ButtonSaveClientParam
@@ -2179,7 +2198,7 @@ namespace UAS_PLCDataReader
             // 
             this.UpdateTimeSpan.Location = new System.Drawing.Point(140, 30);
             this.UpdateTimeSpan.Name = "UpdateTimeSpan";
-            this.UpdateTimeSpan.Size = new System.Drawing.Size(53, 22);
+            this.UpdateTimeSpan.Size = new System.Drawing.Size(53, 36);
             this.UpdateTimeSpan.TabIndex = 1;
             // 
             // label1
@@ -2188,7 +2207,7 @@ namespace UAS_PLCDataReader
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.label1.Location = new System.Drawing.Point(28, 30);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(106, 21);
+            this.label1.Size = new System.Drawing.Size(210, 41);
             this.label1.TabIndex = 0;
             this.label1.Text = "数据上传时间";
             // 
@@ -2198,14 +2217,14 @@ namespace UAS_PLCDataReader
             this.PageDeviceData.Controls.Add(this.GridDeviceData);
             this.PageDeviceData.Name = "PageDeviceData";
             this.PageDeviceData.PageVisible = false;
-            this.PageDeviceData.Size = new System.Drawing.Size(1034, 578);
+            this.PageDeviceData.Size = new System.Drawing.Size(1028, 448);
             this.PageDeviceData.Text = "设备运行数据";
             // 
             // ButtonRefreshDeviceData
             // 
             this.ButtonRefreshDeviceData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.ButtonRefreshDeviceData.Grid = null;
-            this.ButtonRefreshDeviceData.Location = new System.Drawing.Point(954, 4);
+            this.ButtonRefreshDeviceData.Location = new System.Drawing.Point(948, 4);
             this.ButtonRefreshDeviceData.Name = "ButtonRefreshDeviceData";
             this.ButtonRefreshDeviceData.Size = new System.Drawing.Size(64, 23);
             this.ButtonRefreshDeviceData.TabIndex = 7;
@@ -2226,7 +2245,7 @@ namespace UAS_PLCDataReader
             this.GridDeviceData.MenuManager = this.RibbonNav;
             this.GridDeviceData.Name = "GridDeviceData";
             this.GridDeviceData.RowCount = 0;
-            this.GridDeviceData.Size = new System.Drawing.Size(1034, 546);
+            this.GridDeviceData.Size = new System.Drawing.Size(1028, 416);
             this.GridDeviceData.TabIndex = 0;
             this.GridDeviceData.TableName = null;
             this.GridDeviceData.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -2240,6 +2259,7 @@ namespace UAS_PLCDataReader
             this.dr_runstatus,
             this.dr_qty,
             this.dr_inqty,
+            this.dr_ngqty,
             this.dr_value1,
             this.dr_value2,
             this.dr_value3,
@@ -2300,13 +2320,21 @@ namespace UAS_PLCDataReader
             this.dr_inqty.Visible = true;
             this.dr_inqty.VisibleIndex = 4;
             // 
+            // dr_ngqty
+            // 
+            this.dr_ngqty.Caption = "总不良";
+            this.dr_ngqty.FieldName = "DR_NGQTY";
+            this.dr_ngqty.Name = "dr_ngqty";
+            this.dr_ngqty.Visible = true;
+            this.dr_ngqty.VisibleIndex = 5;
+            // 
             // dr_value1
             // 
             this.dr_value1.Caption = "参数1";
             this.dr_value1.FieldName = "DR_VALUE1";
             this.dr_value1.Name = "dr_value1";
             this.dr_value1.Visible = true;
-            this.dr_value1.VisibleIndex = 5;
+            this.dr_value1.VisibleIndex = 6;
             // 
             // dr_value2
             // 
@@ -2314,7 +2342,7 @@ namespace UAS_PLCDataReader
             this.dr_value2.FieldName = "DR_VALUE2";
             this.dr_value2.Name = "dr_value2";
             this.dr_value2.Visible = true;
-            this.dr_value2.VisibleIndex = 6;
+            this.dr_value2.VisibleIndex = 7;
             // 
             // dr_value3
             // 
@@ -2322,7 +2350,7 @@ namespace UAS_PLCDataReader
             this.dr_value3.FieldName = "DR_VALUE3";
             this.dr_value3.Name = "dr_value3";
             this.dr_value3.Visible = true;
-            this.dr_value3.VisibleIndex = 7;
+            this.dr_value3.VisibleIndex = 8;
             // 
             // dr_value4
             // 
@@ -2330,7 +2358,7 @@ namespace UAS_PLCDataReader
             this.dr_value4.FieldName = "DR_VALUE4";
             this.dr_value4.Name = "dr_value4";
             this.dr_value4.Visible = true;
-            this.dr_value4.VisibleIndex = 8;
+            this.dr_value4.VisibleIndex = 9;
             // 
             // dr_value5
             // 
@@ -2338,7 +2366,7 @@ namespace UAS_PLCDataReader
             this.dr_value5.FieldName = "DR_VALUE5";
             this.dr_value5.Name = "dr_value5";
             this.dr_value5.Visible = true;
-            this.dr_value5.VisibleIndex = 9;
+            this.dr_value5.VisibleIndex = 10;
             // 
             // dr_value6
             // 
@@ -2346,7 +2374,7 @@ namespace UAS_PLCDataReader
             this.dr_value6.FieldName = "DR_VALUE6";
             this.dr_value6.Name = "dr_value6";
             this.dr_value6.Visible = true;
-            this.dr_value6.VisibleIndex = 10;
+            this.dr_value6.VisibleIndex = 11;
             // 
             // dr_value7
             // 
@@ -2354,7 +2382,7 @@ namespace UAS_PLCDataReader
             this.dr_value7.FieldName = "DR_VALUE7";
             this.dr_value7.Name = "dr_value7";
             this.dr_value7.Visible = true;
-            this.dr_value7.VisibleIndex = 11;
+            this.dr_value7.VisibleIndex = 12;
             // 
             // dr_value8
             // 
@@ -2362,7 +2390,7 @@ namespace UAS_PLCDataReader
             this.dr_value8.FieldName = "DR_VALUE8";
             this.dr_value8.Name = "dr_value8";
             this.dr_value8.Visible = true;
-            this.dr_value8.VisibleIndex = 12;
+            this.dr_value8.VisibleIndex = 13;
             // 
             // dr_value9
             // 
@@ -2370,7 +2398,7 @@ namespace UAS_PLCDataReader
             this.dr_value9.FieldName = "DR_VALUE9";
             this.dr_value9.Name = "dr_value9";
             this.dr_value9.Visible = true;
-            this.dr_value9.VisibleIndex = 13;
+            this.dr_value9.VisibleIndex = 14;
             // 
             // dr_value10
             // 
@@ -2378,7 +2406,7 @@ namespace UAS_PLCDataReader
             this.dr_value10.FieldName = "DR_VALUE10";
             this.dr_value10.Name = "dr_value10";
             this.dr_value10.Visible = true;
-            this.dr_value10.VisibleIndex = 14;
+            this.dr_value10.VisibleIndex = 15;
             // 
             // TimerDeviceStatus
             // 
@@ -2417,6 +2445,7 @@ namespace UAS_PLCDataReader
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
             this.Load += new System.EventHandler(this.Main_Load);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.applicationMenu1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).EndInit();
             this.MainTabControl.ResumeLayout(false);
             this.PageDeviceList.ResumeLayout(false);
@@ -2690,5 +2719,8 @@ namespace UAS_PLCDataReader
         private CheckEdit CheckPARAM;
         private CheckEdit CheckINQTY;
         private DevExpress.XtraGrid.Columns.GridColumn dc_ifng;
+        private DevExpress.XtraGrid.Columns.GridColumn dc_address;
+        private DevExpress.XtraBars.Ribbon.ApplicationMenu applicationMenu1;
+        private DevExpress.XtraGrid.Columns.GridColumn dr_ngqty;
     }
 }

+ 164 - 123
PLCDataReader/Main.cs

@@ -14,6 +14,7 @@ using UAS_PLCDataReader.Entity;
 using UAS_PLCDataReader.PublicMethod;
 using UAS_PLCDataReader.CustomerControl.PictureEditWithText;
 using UAS_PLCDataReader.Device.Infomation;
+using System.Threading;
 
 namespace UAS_PLCDataReader
 {
@@ -109,9 +110,13 @@ namespace UAS_PLCDataReader
             ComboBoxData cbd15 = new ComboBoxData();
             cbd15.Text = "参数10";
             cbd15.Value = "PARAM10";
+            ComboBoxData cbd17 = new ComboBoxData();
+            cbd17.Text = "忽略";
+            cbd17.Value = "INGORE";
             DataItemRepositoryItemComboBox1.Items.Add(cbd3);
             DataItemRepositoryItemComboBox1.Items.Add(cbd4);
             DataItemRepositoryItemComboBox1.Items.Add(cbd16);
+            DataItemRepositoryItemComboBox1.Items.Add(cbd17);
             DataItemRepositoryItemComboBox1.Items.Add(cbd5);
             DataItemRepositoryItemComboBox1.Items.Add(cbd6);
             DataItemRepositoryItemComboBox1.Items.Add(cbd7);
@@ -173,6 +178,7 @@ namespace UAS_PLCDataReader
 
         private void Main_Load(object sender, EventArgs e)
         {
+
             //设备列表
             GridDeviceList.GetDataSQL = "SELECT 0 CHECKEDCOLUMN,DE_ID,DE_CODE,DE_NAME,DE_CURRENTCENTERCODE,DE_CURRENTCENTERNAME,DE_SPEC,DE_INDATE,DE_RUNSTATUS,DE_ADDRESS,DE_INMAN,DE_LINECODE,DE_WCCODE,DE_VENDCODE,DE_VENDNAME,DE_STEPCODE,DE_STEPNAME,DE_SOURCECODE,DE_ITEM1,DE_ITEM2,DE_ITEM3,DE_ITEM4,DE_ITEM5,DE_ITEM6,DE_ITEM7,DE_ITEM8,DE_ITEM9,DE_ITEM10 FROM DEVICE ORDER BY DE_CODE".ToUpper();
             GridDeviceList.TableName = "device";
@@ -191,10 +197,10 @@ namespace UAS_PLCDataReader
             ButtonDeleteCommandSet.Grid = GridPollingSetting;
 
             //指令设置界面
-            GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_ifng,dc_name,dc_type,case when dc_type='INQTY' then '投入' when dc_type='NGQTY' then '不良' when dc_type='OUTQTY' then '产出' when dc_type='TEMPERATURE' then '温度' when dc_type='PARAM1' then '参数1' when dc_type='PARAM2' then '参数2' when dc_type='PARAM3' then '参数3' when dc_type='PARAM4' then '参数4' when dc_type='PARAM5' then '参数5' when dc_type='PARAM6' then '参数6' when dc_type='PARAM7' then '参数7' when dc_type='PARAM8' then '参数8' when dc_type='PARAM9' then '参数9' when dc_type='PARAM10' then '参数10' when dc_type='PARAM3' then '参数3'  end dc_typename,dc_value,dc_dataindex,dc_sendcoding,dc_receivecoding,db_name,dc_man,dc_date from devicecommand left join devicebrand on db_code=dc_debrand ".ToUpper();
+            GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_ifng,dc_name,dc_type,case when dc_type='INQTY' then '投入' when dc_type='INGORE' then '忽略' when dc_type='NGQTY' then '不良' when dc_type='OUTQTY' then '产出' when dc_type='TEMPERATURE' then '温度' when dc_type='PARAM1' then '参数1' when dc_type='PARAM2' then '参数2' when dc_type='PARAM3' then '参数3' when dc_type='PARAM4' then '参数4' when dc_type='PARAM5' then '参数5' when dc_type='PARAM6' then '参数6' when dc_type='PARAM7' then '参数7' when dc_type='PARAM8' then '参数8' when dc_type='PARAM9' then '参数9' when dc_type='PARAM10' then '参数10' when dc_type='PARAM3' then '参数3'  end dc_typename,dc_value,dc_dataindex,dc_sendcoding,dc_receivecoding,db_name,dc_man,dc_date,dc_address from devicecommand left join devicebrand on db_code=dc_debrand ".ToUpper();
             GridCommandSetting.TableName = "devicecommand";
             GridCommandSetting.ID = "dc_id";
-            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type)";
+            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type,dc_address) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type,:)";
             ButtonSaveCommand.Grid = GridCommandSetting;
             ButtonDeleteCommand.Grid = GridCommandSetting;
             ButtonNewCommand.Grid = GridCommandSetting;
@@ -208,12 +214,14 @@ namespace UAS_PLCDataReader
             ButtonAddNetConfig.Grid = GridDeviceNetSetting;
             ButtonSaveNetConfig.Grid = GridDeviceNetSetting;
 
-            GridDeviceData.GetDataSQL = "select dr_decode,dr_dename,case when dr_runstatus='disconnect' then '无法连接' when dr_runstatus='stopped' then '未运行' when dr_runstatus='running' then '运行中' when dr_runstatus='noanswer' then '无应答' end dr_runstatus,dr_qty,dr_okqty,de_item1||':'||dr_value1 dr_value1,de_item2||':'||dr_value2 dr_value2,de_item3||':'||dr_value3 dr_value3,de_item4||':'||dr_value4 dr_value4,de_item5||':'||dr_value5 dr_value5,de_item6||':'||dr_value6 dr_value6,de_item7||':'||dr_value7 dr_value7,de_item8||':'||dr_value8 dr_value8,de_item9||':'||dr_value9 dr_value9,de_item10||':'||dr_value10 dr_value10 from devicerunstatus left join device on dr_decode=de_code order by dr_decode";
+            GridDeviceData.GetDataSQL = "select dr_decode,dr_dename,case when dr_runstatus='disconnect' then '无法连接' when dr_runstatus='stopped' then '未运行' when dr_runstatus='running' then '运行中' when dr_runstatus='noanswer' then '无应答' end dr_runstatus,dr_qty,dr_okqty,dr_ngqty,de_item1||':'||dr_value1 dr_value1,de_item2||':'||dr_value2 dr_value2,de_item3||':'||dr_value3 dr_value3,de_item4||':'||dr_value4 dr_value4,de_item5||':'||dr_value5 dr_value5,de_item6||':'||dr_value6 dr_value6,de_item7||':'||dr_value7 dr_value7,de_item8||':'||dr_value8 dr_value8,de_item9||':'||dr_value9 dr_value9,de_item10||':'||dr_value10 dr_value10 from devicerunstatus left join device on dr_decode=de_code order by dr_decode";
 
             GridDeviceRunLog.GetDataSQL = "SELECT drr_id,drr_decode,drr_dename,to_char(drr_date,'YYYY-MM-DD hh24:mi:ss')drr_date,drr_doman,drr_remark,drr_logstatus FROM DEVICERUNRECORD where rownum<500 order by drr_id desc";
             GridDeviceRunLog.ID = "drr_id";
             GridDeviceRunLog.TableName = "DEVICERUNRECORD";
 
+            TimerUpdateSQL.Start();
+
             if (int.TryParse(BaseUtil.GetCacheData("UpdateTime").ToString(), out TimeSpan))
             {
                 TimerUpdateDevice.Interval = TimeSpan * 60 * 1000;
@@ -223,7 +231,6 @@ namespace UAS_PLCDataReader
                 TimerUpdateDevice.Interval = 60 * 1000;
             }
             TimerUpdateDevice.Start();
-            TimerUpdateSQL.Start();
 
             //ButtonPollingSetting.PerformClick();
             //ButtonStartPolling.PerformClick();
@@ -410,7 +417,7 @@ namespace UAS_PLCDataReader
         /// <param name="e"></param>
         private void ButtonSaveCommand_Click(object sender, EventArgs e)
         {
-            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type,dc_ifng) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type,:dc_ifng)";
+            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type,dc_ifng,dc_address) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type,:dc_ifng,:dc_address)";
             ButtonSaveCommand.DoSaveAfterHandler(true);
             sql.Clear();
             sql.Append("update devicecommand set dc_man='" + User.UserName + "',dc_date=sysdate where dc_id=:dc_id");
@@ -454,44 +461,60 @@ namespace UAS_PLCDataReader
 
         List<string> StartDecode = new List<string>();
 
-        List<string> StartDccode = new List<string>();
-
         List<Polling> StartPolling = new List<Polling>();
 
         private void ButtonStartPolling_Click(object sender, EventArgs e)
         {
             GridView grid = GridViewPollSetting;
             StartDecode.Clear();
-            StartDccode.Clear();
             StartPolling.Clear();
+            string LastDecode = "";
+            string NextDecode = "";
+            List<string> CommandCode = new List<string>();
             for (int i = 0; i < GridPollingSetting.RowCount; i++)
             {
-                Polling pl = new Polling();
-                pl.Id = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_ID").ToString());
-                pl.DeviceCode = GridViewPollSetting.GetRowCellValue(i, "DPC_DECODE").ToString();
-                pl.DeviceName = GridViewPollSetting.GetRowCellValue(i, "DPC_DENAME").ToString();
-                pl.CommandCode = GridViewPollSetting.GetRowCellValue(i, "DPC_DCCODE").ToString();
-                pl.Interval = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_INTERVAL").ToString());
-                pl.Enable = GridViewPollSetting.GetRowCellValue(i, "DPC_ENABLE").ToString() != "0";
-                if (pl.Enable)
+                LastDecode = GridViewPollSetting.GetRowCellValue(i, "DPC_DECODE").ToString();
+                if (i + 1 < GridPollingSetting.RowCount)
+                {
+                    NextDecode = GridViewPollSetting.GetRowCellValue(i + 1, "DPC_DECODE").ToString();
+                }
+                //设备编号不相同的时候
+                if (LastDecode != NextDecode || i == GridPollingSetting.RowCount - 1)
+                {
+                    Polling pl = new Polling();
+                    //加入最后一行指令
+                    CommandCode.Add(GridViewPollSetting.GetRowCellValue(i, "DPC_DCCODE").ToString());
+                    pl.Id = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_ID").ToString());
+                    pl.DeviceCode = LastDecode;
+                    pl.DeviceName = GridViewPollSetting.GetRowCellValue(i, "DPC_DENAME").ToString();
+                    pl.CommandCode = CommandCode.ToArray();
+                    pl.Interval = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_INTERVAL").ToString());
+                    pl.Enable = GridViewPollSetting.GetRowCellValue(i, "DPC_ENABLE").ToString() != "0";
+                    if (pl.Enable)
+                    {
+                        //一台设备只需要添加一次,多条鱼鱼
+                        StartDecode.Add(pl.DeviceCode);
+                        StartPolling.Add(pl);
+                        //插入轮询日志
+                        sql.Clear();
+                        sql.Append("insert into DEVICEPOLLINGLOG(dpg_id,dpg_decode,dpg_starttime,dpg_interval)values");
+                        sql.Append("(DEVICEPOLLINGLOG_seq.nextval,'" + pl.DeviceCode + "',sysdate,'" + pl.Interval + "')");
+                        QueueUpdateDevice.Enqueue(sql.ToString());
+                        LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "设备启动", DeviceStatus.Noanswer, -1);
+                        //添加到状态为运行的行
+                        PollSettingPaintRowIndex.Add(i);
+                        GridPollingSetting.Focus();
+                        CommandCode.Clear();
+                    }
+                    else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "设备未启用", DeviceStatus.Stopped, 0);
+                }
+                else
                 {
-                    StartDecode.Add(pl.DeviceCode);
-                    StartDccode.Add(pl.CommandCode);
-                    StartPolling.Add(pl);
-                    //插入轮询日志
-                    sql.Clear();
-                    sql.Append("insert into DEVICEPOLLINGLOG(dpg_id,dpg_decode,dpg_starttime,dpg_interval)values");
-                    sql.Append("(DEVICEPOLLINGLOG_seq.nextval,'" + pl.DeviceCode + "',sysdate,'" + pl.Interval + "')");
-                    QueueUpdateDevice.Enqueue(sql.ToString());
-                    LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "设备启动", DeviceStatus.Noanswer, -1);
-                    //添加到状态为运行的行
-                    PollSettingPaintRowIndex.Add(i);
-                    GridPollingSetting.Focus();
+                    CommandCode.Add(GridViewPollSetting.GetRowCellValue(i, "DPC_DCCODE").ToString());
                 }
-                else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "设备未启用", DeviceStatus.Stopped, 0);
             }
             DNC = (DataTable)dh.ExecuteSql("select dnc_ip,dnc_port,dnc_decode from DEVICENETCONFIG where dnc_decode in (" + BaseUtil.ArrayToString(StartDecode) + ")", "select");
-            DC = (DataTable)dh.ExecuteSql("select dc_sendcoding,dc_value,dc_receivecoding,dc_type,dc_code from devicecommand where dc_code in (" + BaseUtil.ArrayToString(StartDccode) + ") order by dc_dataindex", "select");
+            DC = (DataTable)dh.ExecuteSql("select dpc_decode,dc_sendcoding,dc_value,dc_receivecoding,dc_type,dc_code,dc_address from devicecommand left join devicepollingconfig on dc_code=dpc_dccode where dpc_decode in (" + BaseUtil.ArrayToString(StartDecode) + ") order by dc_dataindex", "select");
             for (int i = 0; i < StartPolling.Count; i++)
             {
                 pt.AddTask(RunTask, StartPolling[i]);
@@ -530,6 +553,7 @@ namespace UAS_PLCDataReader
             timer.Interval = pl.Interval * 1000;
             timer.Elapsed += Timer_Tick;
             GC.KeepAlive(timer);
+            Thread.Sleep(5000);
             timer.Start();
             try
             {
@@ -546,7 +570,7 @@ namespace UAS_PLCDataReader
         static DataTable DNC;
         static DataTable DC;
 
-        static Dictionary<string, ModBusTCPClient> client = new Dictionary<string, ModBusTCPClient>();
+        volatile static Dictionary<string, ModBusTCPClient> client = new Dictionary<string, ModBusTCPClient>();
         /// <summary>
         /// 轮询执行的业务
         /// </summary>
@@ -557,114 +581,131 @@ namespace UAS_PLCDataReader
             PollingTimer timer = (PollingTimer)sender;
             Polling pl = (Polling)timer.Polling;
             string Decode = pl.DeviceCode;
-            string Dccode = pl.CommandCode;
+            string[] Dccode = pl.CommandCode;
             string DpcID = pl.Id.ToString();
             DataRow[] dnc_dr = DNC.Select("dnc_decode='" + Decode + "'");
-            DataRow[] dc_dr = DC.Select("dc_code='" + Dccode + "'");
-            if (dnc_dr.Length > 0)
+            try
             {
-                string IP = dnc_dr[0]["dnc_ip"].ToString() + ":" + dnc_dr[0]["dnc_port"].ToString();
-                string Command = "";
-                int SendCommandByteSize = 0;
-                if (dc_dr.Length > 0)
-                {
-                    Command = dc_dr[0]["dc_value"].ToString();
-                    SendCommandByteSize = Encoding.Default.GetBytes(Command.ToCharArray()).Length;
-                }
-                if (client.ContainsKey(DpcID))
-                {
-                    client[DpcID].Send(Command);
-                }
-                else
-                {
-                    try
-                    {
-                        ModBusTCPClient modclient = new ModBusTCPClient(dnc_dr[0]["dnc_ip"].ToString(), dnc_dr[0]["dnc_port"].ToString(), pl.DeviceCode, pl.DeviceName);
-                        modclient.Dh = dh;
-                        client.Add(DpcID, modclient);
-                    }
-                    catch (Exception ex)
-                    {
-                        LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, ex.Message, DeviceStatus.Disconnect, -1);
-                    }
-                }
-                //如果不包含该项数据则在键值对中添加
-                if (!ReturnData.ContainsKey(Decode))
-                {
-                    //添加本地数据内容
-                    Entity.Device device = new Entity.Device();
-                    device.Decode = pl.DeviceCode;
-                    device.Dename = pl.DeviceName;
-                    device.StartTime = DateTime.Now;
-                    device.RunStatus = "running";
-                    device.SendDataSize += SendCommandByteSize;
-                    device.SendCount += 1;
-                    device.Dccode = pl.CommandCode;
-                    ReturnData.Add(Decode, device);
-                }
-                else
+                for (int i = 0; i < Dccode.Length; i++)
                 {
-                    //每次更新轮询的数据
-                    ReturnData[Decode].SendDataSize += SendCommandByteSize;
-                    ReturnData[Decode].SendCount += 1;
-                    //检测键值对是否发生变化,发生变化时赋予新值
-                }
-                //成功返回了信息
-                if (client[DpcID].Returnvalue.ContainsKey(IP))
-                {
-                    int ReceiveCommandByteSize = Encoding.Default.GetBytes(client[DpcID].Returnvalue[IP].ToCharArray()).Length;
-                    //存放返回的所有数据
-                    Dictionary<string, string> ItemData = new Dictionary<string, string>();
-                    int[] Arr = BaseUtil.GetDecimalData(BaseUtil.ASCIIToString(client[DpcID].Returnvalue[IP]), 8);
-                    //返回的参数个数和定义的参数个数相等或者小于的时候
-                    if (Arr.Length == dc_dr.Length || dc_dr.Length > Arr.Length)
+                    Console.WriteLine(Decode + Dccode[i]);
+                    DataRow[] dc_dr = DC.Select("dc_code='" + Dccode[i] + "' and dpc_decode='" + Decode + "'");
+                    ////每个地址占的位数
+                    //List<int> DataSize = new List<int>();
+                    if (dnc_dr.Length > 0)
                     {
-                        for (int i = 0; i < Arr.Length; i++)
+                        string IP = dnc_dr[0]["dnc_ip"].ToString() + ":" + dnc_dr[0]["dnc_port"].ToString();
+                        string Command = "";
+                        int SendCommandByteSize = 0;
+                        if (dc_dr.Length > 0)
                         {
-                            ItemData.Add(dc_dr[i]["dc_type"].ToString(), Arr[i].ToString());
+                            Command = dc_dr[0]["dc_value"].ToString();
+                            SendCommandByteSize = Encoding.Default.GetBytes(Command.ToCharArray()).Length;
                         }
-                    }
-                    else
-                    {
-                        for (int i = 0; i < dc_dr.Length; i++)
+                        if (client.ContainsKey(IP))
                         {
-                            ItemData.Add(dc_dr[i]["dc_type"].ToString(), Arr[i].ToString());
+                            client[IP].Send(Command);
                         }
-                    }
-                    if (!ReturnData.ContainsKey(Decode))
-                    {
-                        //添加本地数据内容
-                        Entity.Device device = new Entity.Device();
-                        device.Decode = pl.DeviceCode;
-                        device.Dename = pl.DeviceName;
-                        device.StartTime = DateTime.Now;
-                        device.RunStatus = "running";
-                        device.ReceiveDataSize += ReceiveCommandByteSize;
-                        device.Dccode = pl.CommandCode;
-                        device.ItemData = ItemData;
-                        ReturnData.Add(Decode, device);
-                    }
-                    else
-                    {
-                        //在未获取过数据的时候并且获取到的数据不为空的时候进行设备数据的更新
-                        if (ReturnData[Decode].ItemData == null || (ReturnData[Decode].ItemData.Count == 0 && ItemData.Count != 0))
+                        else
                         {
-                            ReturnData[Decode].ItemData = ItemData;
-                            LogicHandler.UpdateDeviceData(Decode, ItemData);
+                            try
+                            {
+                                ModBusTCPClient modclient = new ModBusTCPClient(dnc_dr[0]["dnc_ip"].ToString(), dnc_dr[0]["dnc_port"].ToString(), pl.DeviceCode, pl.DeviceName);
+                                modclient.Dh = dh;
+                                client.Add(IP, modclient);
+                            }
+                            catch (Exception ex)
+                            {
+                                Console.WriteLine(ex.Message + ex.StackTrace);
+                                LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, ex.Message, DeviceStatus.Disconnect, -1);
+                            }
                         }
-                        //每次更新轮询的数据
-                        ReturnData[Decode].ReceiveDataSize += ReceiveCommandByteSize;
-                        //检测键值对是否发生变化,发生变化时赋予新值并上传信息
-                        if (BaseUtil.CheckDicDiff(ReturnData[Decode].ItemData, ItemData))
+                        //如果不包含该项数据则在键值对中添加
+                        if (!ReturnData.ContainsKey(Decode + Dccode[i]))
+                        {
+                            //添加本地数据内容
+                            Entity.Device device = new Entity.Device();
+                            device.Decode = pl.DeviceCode;
+                            device.Dename = pl.DeviceName;
+                            device.StartTime = DateTime.Now;
+                            device.RunStatus = "running";
+                            device.SendDataSize += SendCommandByteSize;
+                            device.SendCount += 1;
+                            device.Dccode = Dccode[i];
+                            ReturnData.Add(Decode + Dccode[i], device);
+                        }
+                        else
                         {
-                            LogicHandler.UpdateDeviceData(Decode, ItemData);
+                            //每次更新轮询的数据
+                            ReturnData[Decode + Dccode[i]].SendDataSize += SendCommandByteSize;
+                            ReturnData[Decode + Dccode[i]].SendCount += 1;
+                            //检测键值对是否发生变化,发生变化时赋予新值
+                        }
+                        //成功返回了信息
+                        if (client[IP].Returnvalue.ContainsKey(IP))
+                        {
+                            int ReceiveCommandByteSize = Encoding.Default.GetBytes(client[IP].Returnvalue[IP].ToCharArray()).Length;
+                            //存放返回的所有数据
+                            Dictionary<string, string> ItemData = new Dictionary<string, string>();
+                            int[] Arr = BaseUtil.GetDecimalData(BaseUtil.ASCIIToString(client[IP].Returnvalue[IP]), 8);
+                            Console.WriteLine(IP + " " + Arr.Length + " " + dc_dr.Length);
+                            //返回的参数个数和定义的参数个数相等或者小于的时候
+                            if (Arr.Length == dc_dr.Length || dc_dr.Length > Arr.Length)
+                            {
+                                for (int j = 0; j < Arr.Length; j++)
+                                {
+                                    ItemData.Add(dc_dr[j]["dc_type"].ToString(), Arr[j].ToString());
+                                }
+                            }
+                            else
+                            {
+                                for (int j = 0; j < dc_dr.Length; j++)
+                                {
+                                    ItemData.Add(dc_dr[j]["dc_type"].ToString(), Arr[j].ToString());
+                                }
+                            }
+                            if (!ReturnData.ContainsKey(Decode + Dccode[i]))
+                            {
+                                //添加本地数据内容
+                                Entity.Device device = new Entity.Device();
+                                device.Decode = pl.DeviceCode;
+                                device.Dename = pl.DeviceName;
+                                device.StartTime = DateTime.Now;
+                                device.RunStatus = "running";
+                                device.ReceiveDataSize += ReceiveCommandByteSize;
+                                device.Dccode = Dccode[i];
+                                device.ItemData = ItemData;
+                                ReturnData.Add(Decode + Dccode[i], device);
+                            }
+                            else
+                            {
+                                //在未获取过数据的时候并且获取到的数据不为空的时候进行设备数据的更新
+                                if (ReturnData[Decode + Dccode[i]].ItemData == null || (ReturnData[Decode + Dccode[i]].ItemData.Count == 0 && ItemData.Count != 0))
+                                {
+                                    ReturnData[Decode + Dccode[i]].ItemData = ItemData;
+                                    LogicHandler.UpdateDeviceData(Decode, ItemData);
+                                }
+                                //每次更新轮询的数据
+                                ReturnData[Decode + Dccode[i]].ReceiveDataSize += ReceiveCommandByteSize;
+                                //检测键值对是否发生变化,发生变化时赋予新值并上传信息
+                                //LogicHandler.UpdateDeviceData(Decode, ItemData);
+
+                                if (BaseUtil.CheckDicDiff(ReturnData[Decode + Dccode[i]].ItemData, ItemData))
+                                {
+                                    LogicHandler.UpdateDeviceData(Decode, ItemData);
+                                }
+                                ReturnData[Decode + Dccode[i]].ItemData = ItemData;
+                            }
+                            client[IP].Returnvalue.Remove(IP);
                         }
-                        ReturnData[Decode].ItemData = ItemData;
                     }
-                    client[DpcID].Returnvalue.Remove(IP);
+                    else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "未配置联网信息", DeviceStatus.Disconnect, -1);
                 }
             }
-            else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "未配置联网信息", DeviceStatus.Disconnect, -1);
+            catch (Exception ex)
+            {
+                LogicHandler.DoCommandLog(User.UserCode, "", ex.Message + ex.StackTrace);
+            }
         }
 
         /// <summary>

+ 3 - 0
PLCDataReader/Main.resx

@@ -117,6 +117,9 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="applicationMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>855, 23</value>
+  </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="ButtonDeviceNetSetting.Glyph" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

+ 7 - 6
PLCDataReader/PublicMethod/BaseUtil.cs

@@ -406,6 +406,7 @@ namespace UAS_PLCDataReader.PublicMethod
 
         public static int[] GetDecimalData(string HexStr, int DataSize)
         {
+            Console.WriteLine(HexStr);
             List<int> ReturnData = new List<int>();
             try
             {
@@ -419,19 +420,19 @@ namespace UAS_PLCDataReader.PublicMethod
                     //每个地址位存的数据是DataSize个
                     for (int i = 0; i < RealData.Length; i = i + DataSize)
                     {
-                        if (i + DataSize < RealData.Length)
+                        if (i + DataSize <= RealData.Length)
                         {
-                            if (Convert.ToInt32("0x" + (RealData.Substring(i, DataSize).Substring(0, 4)), 16) / 1 != 0)
-                                ReturnData.Add(Convert.ToInt32("0x" + (RealData.Substring(i, DataSize).Substring(0, 4)), 16));
-                            if (Convert.ToInt32("0x" + (RealData.Substring(i, DataSize).Substring(4, 4)), 16) / 1 != 0)
-                                ReturnData.Add(Convert.ToInt32("0x" + (RealData.Substring(i, DataSize).Substring(4, 4)), 16));
+                            //低位在前,高位在后返回2710 0000,转换0000 2710
+                            string Low = RealData.Substring(i, DataSize).Substring(4, 4);
+                            string High = RealData.Substring(i, DataSize).Substring(0, 4);
+                            ReturnData.Add(Convert.ToInt32("0x" + Low + High, 16));
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
-                Console.WriteLine(ex.Message);
+                Console.WriteLine(ex.Message + ex.StackTrace);
             }
             return ReturnData.ToArray();
         }

+ 59 - 32
PLCDataReader/PublicMethod/LogicHandler.cs

@@ -172,76 +172,103 @@ namespace UAS_PLCDataReader.PublicMethod
         /// <param name="ItemData"></param>
         public static void UpdateDeviceData(string Decode, Dictionary<string, string> ItemData)
         {
-            string INQTY = "";
-            string OUTQTY = "";
-            string NGQTY = "";
-            string TEMPERATURE = "";
-            string PARAM1 = "";
-            string PARAM2 = "";
-            string PARAM3 = "";
-            string PARAM4 = "";
-            string PARAM5 = "";
-            string PARAM6 = "";
-            string PARAM7 = "";
-            string PARAM8 = "";
-            string PARAM9 = "";
-            string PARAM10 = "";
             if (ItemData == null)
                 return;
+            StringBuilder sql = new StringBuilder();
+            sql.Append("update DeviceRunstatus set ");
             foreach (var item in ItemData)
             {
                 switch (item.Key)
                 {
                     case "INQTY":
-                        INQTY = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_qty='" + item.Value + "',");
+                        }
                         break;
                     case "OUTQTY":
-                        OUTQTY = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_okqty='" + item.Value + "',");
+                        }
                         break;
                     case "NGQTY":
-                        NGQTY = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_ngqty='" + item.Value + "',");
+                        }
                         break;
                     case "TEMPERATURE":
-                        TEMPERATURE = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_TEMPERATURE='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM1":
-                        PARAM1 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value1='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM2":
-                        PARAM2 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value2='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM3":
-                        PARAM3 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value3='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM4":
-                        PARAM4 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value4='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM5":
-                        PARAM5 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value5='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM6":
-                        PARAM6 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value6='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM7":
-                        PARAM7 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value7='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM8":
-                        PARAM8 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value8='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM9":
-                        PARAM9 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value9='" + item.Value + "',");
+                        }
                         break;
                     case "PARAM10":
-                        PARAM10 = item.Value;
+                        if (item.Value != "")
+                        {
+                            sql.Append("dr_value10='" + item.Value + "',");
+                        }
                         break;
                     default:
                         break;
                 }
             }
-            StringBuilder sql = new StringBuilder();
-            sql.Clear();
-            sql.Append("update DeviceRunstatus set dr_qty='" + INQTY + "',dr_okqty='" + OUTQTY + "',dr_TEMPERATURE='" + TEMPERATURE + "',");
-            sql.Append("dr_ngqty='" + NGQTY + "',dr_value1='" + PARAM1 + "',dr_value2='" + PARAM2 + "',dr_value3='" + PARAM3 + "',dr_value4='" + PARAM4 + "',dr_value5='" + PARAM5 + "',dr_value6='" + PARAM6 + "',dr_value7='" + PARAM7 + "',dr_value8='" + PARAM8 + "',dr_value9='" + PARAM9 + "',dr_value10='" + PARAM10 + "',dr_updatedate=sysdate where dr_decode='" + Decode + "'");
+            sql.Append("dr_updatedate=sysdate where dr_decode='" + Decode + "'");
             Main.QueueUpdateDevice.Enqueue(sql.ToString());
         }
 

+ 1 - 1
PLCDataReader/PublicMethod/ModBusTCPClient.cs

@@ -164,7 +164,7 @@ namespace UAS_PLCDataReader.PublicMethod
             {
                 LogicHandler.UpdateDeviceStatus(decode, dename, ex.Message, DeviceStatus.Disconnect, -1);
                 LogicHandler.DoDevicePollingLog(decode, false);
-                LogManager.DoLog(ex.Message + ex.StackTrace + "\n" + decode + " " + str);
+                Console.WriteLine(ex.Message + ex.StackTrace + "\n" + decode + " " + str);
             }
         }
     }