From 8b7829bc1be1312ee10f2fe64df241c6e0960df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?liming=20=E8=94=A1?= Date: Wed, 26 Aug 2026 14:53:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E8=80=97=E5=AE=9A=E6=97=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JY.Inspection/Config/Configure.ini | 1 + JY.Inspection/Frm/FormMesDataSet.cs | 5 + JY.Inspection/Frm/FormMesDataSet.designer.cs | 138 ++++++++++++++----- JY.Inspection/HomeForm.cs | 5 +- JY.Inspection/HomeForm.designer.cs | 108 +++++++-------- JY.Inspection/HomeForm.resx | 2 +- JY.Inspection/HomeFormExtend.cs | 52 ++++++- JY.Inspection/Mes/MESDataCombin.cs | 6 +- JY.Inspection/ViewModel/FrmMesSettingVM.cs | 9 ++ JY.MES/MES/CmdEnergyData.cs | 2 +- JY.Model/DB.Entity/SystemConfig.cs | 13 +- 11 files changed, 231 insertions(+), 110 deletions(-) diff --git a/JY.Inspection/Config/Configure.ini b/JY.Inspection/Config/Configure.ini index cf20884..36152d3 100644 --- a/JY.Inspection/Config/Configure.ini +++ b/JY.Inspection/Config/Configure.ini @@ -44,6 +44,7 @@ StartNGFL=0 Grading=0 MesRequestTime=2 LoginTime=10 +TaskInterval=1 [ͳ¼ƼÆÊý] ProdAllQty=0 diff --git a/JY.Inspection/Frm/FormMesDataSet.cs b/JY.Inspection/Frm/FormMesDataSet.cs index 250d22f..7beb095 100644 --- a/JY.Inspection/Frm/FormMesDataSet.cs +++ b/JY.Inspection/Frm/FormMesDataSet.cs @@ -38,6 +38,8 @@ namespace JY.Inspection.Frm tb_loginMes.DataBindings.Add(new Binding("Text", bindingSource1, "LoginMesUrl", true, DataSourceUpdateMode.OnPropertyChanged)); tb_euipAlarm.DataBindings.Add(new Binding("Text", bindingSource1, "EquipAlarmUrl", true, DataSourceUpdateMode.OnPropertyChanged)); tb_euipStatus.DataBindings.Add(new Binding("Text", bindingSource1, "EquipStatusUrl", true, DataSourceUpdateMode.OnPropertyChanged)); + num_taskInterval.DataBindings.Add(new Binding("Value", bindingSource1, "TaskInterval", true, + DataSourceUpdateMode.OnPropertyChanged)); } #endregion @@ -62,6 +64,8 @@ namespace JY.Inspection.Frm _viewModel.LoginMesUrl = IniFileHelper.ReadIniData("MES配置", "LoginMesUrl"); _viewModel.EquipAlarmUrl = IniFileHelper.ReadIniData("MES配置", "EquipAlarmUrl"); _viewModel.EquipStatusUrl = IniFileHelper.ReadIniData("MES配置", "EquipStatusUrl"); + int.TryParse(IniFileHelper.ReadIniData("MES配置", "TaskInterval"), out int taskInterval); + _viewModel.TaskInterval = taskInterval; LoginTime.Text = IniFileHelper.ReadIniData("MES配置", "LoginTime"); txtMesRequestTime.Text = IniFileHelper.ReadIniData("MES配置", "MesRequestTime"); @@ -90,6 +94,7 @@ namespace JY.Inspection.Frm IniFileHelper.WriteIniData("MES配置", "LoginMesUrl", _viewModel.LoginMesUrl.Trim()); IniFileHelper.WriteIniData("MES配置", "EquipAlarmUrl", _viewModel.EquipAlarmUrl.Trim()); IniFileHelper.WriteIniData("MES配置", "EquipStatusUrl", _viewModel.EquipStatusUrl.Trim()); + IniFileHelper.WriteIniData("MES配置", "TaskInterval", _viewModel.TaskInterval.ToString()); IniFileHelper.WriteIniData("MES配置", "LoginTime", LoginTime.Text.Trim()); LogManagerControl.AddLog($"用户[{Global.systemConfig.userName}]设置权限超时时间[{LoginTime.Text.Trim()}]", LogAddtype.local, Logtype.Warning); diff --git a/JY.Inspection/Frm/FormMesDataSet.designer.cs b/JY.Inspection/Frm/FormMesDataSet.designer.cs index a6b2b06..16e968e 100644 --- a/JY.Inspection/Frm/FormMesDataSet.designer.cs +++ b/JY.Inspection/Frm/FormMesDataSet.designer.cs @@ -48,6 +48,8 @@ namespace JY.Inspection.Frm this.metroLabel6 = new MetroFramework.Controls.MetroLabel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.metroPanel_mid = new MetroFramework.Controls.MetroPanel(); + this.tb_euipStatus = new MetroFramework.Controls.MetroTextBox(); + this.metroLabel12 = new MetroFramework.Controls.MetroLabel(); this.tb_euipAlarm = new MetroFramework.Controls.MetroTextBox(); this.metroLabel11 = new MetroFramework.Controls.MetroLabel(); this.tb_loginMes = new MetroFramework.Controls.MetroTextBox(); @@ -69,8 +71,9 @@ namespace JY.Inspection.Frm this.linkLabel_editCollectItemCfg = new System.Windows.Forms.LinkLabel(); this.chkIsMesUP = new System.Windows.Forms.CheckBox(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); - this.metroLabel12 = new MetroFramework.Controls.MetroLabel(); - this.tb_euipStatus = new MetroFramework.Controls.MetroTextBox(); + this.metroLabel13 = new MetroFramework.Controls.MetroLabel(); + this.num_taskInterval = new System.Windows.Forms.NumericUpDown(); + this.metroLabel14 = new MetroFramework.Controls.MetroLabel(); this.groupBox1.SuspendLayout(); this.metroPanel_mid.SuspendLayout(); this.metroPanel_top.SuspendLayout(); @@ -78,6 +81,7 @@ namespace JY.Inspection.Frm ((System.ComponentModel.ISupportInitialize)(this.txtMesRequestTime)).BeginInit(); this.metroPanel_bottom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_taskInterval)).BeginInit(); this.SuspendLayout(); // // btnExit @@ -410,6 +414,48 @@ namespace JY.Inspection.Frm this.metroPanel_mid.VerticalScrollbarHighlightOnWheel = false; this.metroPanel_mid.VerticalScrollbarSize = 13; // + // tb_euipStatus + // + // + // + // + this.tb_euipStatus.CustomButton.Image = null; + this.tb_euipStatus.CustomButton.Location = new System.Drawing.Point(671, 1); + this.tb_euipStatus.CustomButton.Margin = new System.Windows.Forms.Padding(4); + this.tb_euipStatus.CustomButton.Name = ""; + this.tb_euipStatus.CustomButton.Size = new System.Drawing.Size(27, 27); + this.tb_euipStatus.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; + this.tb_euipStatus.CustomButton.TabIndex = 1; + this.tb_euipStatus.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; + this.tb_euipStatus.CustomButton.UseSelectable = true; + this.tb_euipStatus.CustomButton.Visible = false; + this.tb_euipStatus.Lines = new string[0]; + this.tb_euipStatus.Location = new System.Drawing.Point(235, 260); + this.tb_euipStatus.Margin = new System.Windows.Forms.Padding(4); + this.tb_euipStatus.MaxLength = 32767; + this.tb_euipStatus.Name = "tb_euipStatus"; + this.tb_euipStatus.PasswordChar = '\0'; + this.tb_euipStatus.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.tb_euipStatus.SelectedText = ""; + this.tb_euipStatus.SelectionLength = 0; + this.tb_euipStatus.SelectionStart = 0; + this.tb_euipStatus.ShortcutsEnabled = true; + this.tb_euipStatus.Size = new System.Drawing.Size(699, 29); + this.tb_euipStatus.TabIndex = 45; + this.tb_euipStatus.UseSelectable = true; + this.tb_euipStatus.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); + this.tb_euipStatus.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); + // + // metroLabel12 + // + this.metroLabel12.AutoSize = true; + this.metroLabel12.Location = new System.Drawing.Point(41, 269); + this.metroLabel12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.metroLabel12.Name = "metroLabel12"; + this.metroLabel12.Size = new System.Drawing.Size(144, 20); + this.metroLabel12.TabIndex = 44; + this.metroLabel12.Text = "设备状态接口地址:"; + // // tb_euipAlarm // // @@ -580,6 +626,9 @@ namespace JY.Inspection.Frm // // metroPanel_top // + this.metroPanel_top.Controls.Add(this.metroLabel14); + this.metroPanel_top.Controls.Add(this.num_taskInterval); + this.metroPanel_top.Controls.Add(this.metroLabel13); this.metroPanel_top.Controls.Add(this.tb_productType); this.metroPanel_top.Controls.Add(this.metroLabel18); this.metroPanel_top.Controls.Add(this.metroLabel21); @@ -786,47 +835,56 @@ namespace JY.Inspection.Frm this.chkIsMesUP.Text = "开启MES模式"; this.chkIsMesUP.UseVisualStyleBackColor = true; // - // metroLabel12 + // metroLabel13 // - this.metroLabel12.AutoSize = true; - this.metroLabel12.Location = new System.Drawing.Point(41, 269); - this.metroLabel12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.metroLabel12.Name = "metroLabel12"; - this.metroLabel12.Size = new System.Drawing.Size(144, 20); - this.metroLabel12.TabIndex = 44; - this.metroLabel12.Text = "设备状态接口地址:"; + this.metroLabel13.AutoSize = true; + this.metroLabel13.Location = new System.Drawing.Point(484, 110); + this.metroLabel13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.metroLabel13.Name = "metroLabel13"; + this.metroLabel13.Size = new System.Drawing.Size(114, 20); + this.metroLabel13.TabIndex = 185; + this.metroLabel13.Text = "定时任务间隔:"; // - // tb_euipStatus + // num_taskInterval // + this.num_taskInterval.DecimalPlaces = 1; + this.num_taskInterval.Increment = new decimal(new int[] { + 5, + 0, + 0, + 65536}); + this.num_taskInterval.Location = new System.Drawing.Point(655, 110); + this.num_taskInterval.Margin = new System.Windows.Forms.Padding(4); + this.num_taskInterval.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.num_taskInterval.Minimum = new decimal(new int[] { + 5, + 0, + 0, + 65536}); + this.num_taskInterval.Name = "num_taskInterval"; + this.num_taskInterval.Size = new System.Drawing.Size(101, 25); + this.num_taskInterval.TabIndex = 186; + this.num_taskInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.num_taskInterval.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // + // metroLabel14 // - // - this.tb_euipStatus.CustomButton.Image = null; - this.tb_euipStatus.CustomButton.Location = new System.Drawing.Point(671, 1); - this.tb_euipStatus.CustomButton.Margin = new System.Windows.Forms.Padding(4); - this.tb_euipStatus.CustomButton.Name = ""; - this.tb_euipStatus.CustomButton.Size = new System.Drawing.Size(27, 27); - this.tb_euipStatus.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; - this.tb_euipStatus.CustomButton.TabIndex = 1; - this.tb_euipStatus.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; - this.tb_euipStatus.CustomButton.UseSelectable = true; - this.tb_euipStatus.CustomButton.Visible = false; - this.tb_euipStatus.Lines = new string[0]; - this.tb_euipStatus.Location = new System.Drawing.Point(235, 260); - this.tb_euipStatus.Margin = new System.Windows.Forms.Padding(4); - this.tb_euipStatus.MaxLength = 32767; - this.tb_euipStatus.Name = "tb_euipStatus"; - this.tb_euipStatus.PasswordChar = '\0'; - this.tb_euipStatus.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.tb_euipStatus.SelectedText = ""; - this.tb_euipStatus.SelectionLength = 0; - this.tb_euipStatus.SelectionStart = 0; - this.tb_euipStatus.ShortcutsEnabled = true; - this.tb_euipStatus.Size = new System.Drawing.Size(699, 29); - this.tb_euipStatus.TabIndex = 45; - this.tb_euipStatus.UseSelectable = true; - this.tb_euipStatus.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); - this.tb_euipStatus.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); + this.metroLabel14.AutoSize = true; + this.metroLabel14.Location = new System.Drawing.Point(764, 110); + this.metroLabel14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.metroLabel14.Name = "metroLabel14"; + this.metroLabel14.Size = new System.Drawing.Size(32, 20); + this.metroLabel14.TabIndex = 187; + this.metroLabel14.Text = "min"; + this.metroLabel14.Visible = false; // // FormMesDataSet // @@ -853,6 +911,7 @@ namespace JY.Inspection.Frm this.metroPanel_bottom.ResumeLayout(false); this.metroPanel_bottom.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_taskInterval)).EndInit(); this.ResumeLayout(false); } @@ -898,5 +957,8 @@ namespace JY.Inspection.Frm private MetroFramework.Controls.MetroLabel metroLabel11; private MetroFramework.Controls.MetroTextBox tb_euipStatus; private MetroFramework.Controls.MetroLabel metroLabel12; + private System.Windows.Forms.NumericUpDown num_taskInterval; + private MetroFramework.Controls.MetroLabel metroLabel13; + private MetroFramework.Controls.MetroLabel metroLabel14; } } \ No newline at end of file diff --git a/JY.Inspection/HomeForm.cs b/JY.Inspection/HomeForm.cs index d08d55d..a5bd4f3 100644 --- a/JY.Inspection/HomeForm.cs +++ b/JY.Inspection/HomeForm.cs @@ -635,6 +635,9 @@ namespace JY.Inspection Global.systemConfig.StationArrivalUrl = IniFileHelper.ReadIniData("MES配置", "StationArrivalUrl"); Global.systemConfig.StationExitUrl = IniFileHelper.ReadIniData("MES配置", "StationExitUrl"); Global.systemConfig.LoginMesUrl = IniFileHelper.ReadIniData("MES配置", "LoginMesUrl"); + Global.systemConfig.EquipAlarmUrl = IniFileHelper.ReadIniData("MES配置", "EquipAlarmUrl"); + Global.systemConfig.EquipStatusUrl = IniFileHelper.ReadIniData("MES配置", "EquipStatusUrl"); + Global.systemConfig.TaskInterval = Convert.ToInt32(IniFileHelper.ReadIniData("MES配置", "TaskInterval")); try { @@ -2055,7 +2058,7 @@ namespace JY.Inspection #region 947 MES if (Global.systemConfig.isUpMes) { - // TODO 进站数据上传 + // 进站数据上传 ReqArrivalStation req = new ReqArrivalStation() { SiteCode = Global.systemConfig.siteCode, diff --git a/JY.Inspection/HomeForm.designer.cs b/JY.Inspection/HomeForm.designer.cs index db6aec0..c9305ca 100644 --- a/JY.Inspection/HomeForm.designer.cs +++ b/JY.Inspection/HomeForm.designer.cs @@ -31,12 +31,12 @@ namespace JY.Inspection { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HomeForm)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.tsmiLogin = new System.Windows.Forms.ToolStripMenuItem(); this.mES测试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -632,24 +632,24 @@ namespace JY.Inspection this.dgvDataShow_B.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgvDataShow_B.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dgvDataShow_B.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); - dataGridViewCellStyle7.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvDataShow_B.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); + dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + dataGridViewCellStyle1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvDataShow_B.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dgvDataShow_B.ColumnHeadersHeight = 29; this.dgvDataShow_B.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle8.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Silver; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvDataShow_B.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Silver; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvDataShow_B.DefaultCellStyle = dataGridViewCellStyle2; this.dgvDataShow_B.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvDataShow_B.EnableHeadersVisualStyles = false; this.dgvDataShow_B.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); @@ -658,14 +658,14 @@ namespace JY.Inspection this.dgvDataShow_B.Name = "dgvDataShow_B"; this.dgvDataShow_B.ReadOnly = true; this.dgvDataShow_B.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken; - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); - dataGridViewCellStyle9.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvDataShow_B.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvDataShow_B.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.dgvDataShow_B.RowHeadersVisible = false; this.dgvDataShow_B.RowHeadersWidth = 51; this.dgvDataShow_B.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; @@ -696,14 +696,14 @@ namespace JY.Inspection this.dgvDataShow_A.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgvDataShow_A.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dgvDataShow_A.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); - dataGridViewCellStyle10.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - dataGridViewCellStyle10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); - dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvDataShow_A.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); + dataGridViewCellStyle4.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvDataShow_A.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dgvDataShow_A.ColumnHeadersHeight = 29; this.dgvDataShow_A.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dgvDataShow_A.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -713,14 +713,14 @@ namespace JY.Inspection this.Column3, this.Column4, this.Column5}); - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle11.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle11.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.Silver; - dataGridViewCellStyle11.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvDataShow_A.DefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle5.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Silver; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvDataShow_A.DefaultCellStyle = dataGridViewCellStyle5; this.dgvDataShow_A.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvDataShow_A.EnableHeadersVisualStyles = false; this.dgvDataShow_A.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); @@ -729,14 +729,14 @@ namespace JY.Inspection this.dgvDataShow_A.Name = "dgvDataShow_A"; this.dgvDataShow_A.ReadOnly = true; this.dgvDataShow_A.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken; - dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); - dataGridViewCellStyle12.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); - dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvDataShow_A.RowHeadersDefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247))))); + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvDataShow_A.RowHeadersDefaultCellStyle = dataGridViewCellStyle6; this.dgvDataShow_A.RowHeadersVisible = false; this.dgvDataShow_A.RowHeadersWidth = 51; this.dgvDataShow_A.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; diff --git a/JY.Inspection/HomeForm.resx b/JY.Inspection/HomeForm.resx index 74875cd..61a885d 100644 --- a/JY.Inspection/HomeForm.resx +++ b/JY.Inspection/HomeForm.resx @@ -331,7 +331,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAE - CgAAAk1TRnQBSQFMAgEBAwEAAfABCAHwAQgBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CgAAAk1TRnQBSQFMAgEBAwEAAQgBCQEIAQkBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/JY.Inspection/HomeFormExtend.cs b/JY.Inspection/HomeFormExtend.cs index 9d10da3..913fd9c 100644 --- a/JY.Inspection/HomeFormExtend.cs +++ b/JY.Inspection/HomeFormExtend.cs @@ -1,4 +1,5 @@ -using JY.Model; +using JY.Inspection.Mes; +using JY.Model; using JY.Model.Common; using NPOI.SS.Formula.Functions; using System; @@ -21,8 +22,53 @@ namespace JY.Inspection } scheduler.AddTask(state => { - Debug.WriteLine("Hello"); - }, interval: 1000 * 60); + //Debug.WriteLine("Hello"); + List data = this.Invoke(new Func>(() => { + List list = new List(); + + #region 添加电表数据 + //相电压UA + list.Add(txtPhaseVolUA.Text); + //相电压UB + list.Add(txtPhaseVolUB.Text); + //相电压UC + list.Add(txtPhaseVolUC.Text); + //线电压UAB + list.Add(txtLineVolUAB.Text); + //线电压UBC + list.Add(txtLineVolUBC.Text); + //线电压UAC + list.Add(txtLineVolUAC.Text); + + //电流IA + list.Add(txtIA.Text); + //电流IB + list.Add(txtIB.Text); + //电流IC + list.Add(txtIC.Text); + + //A相有功功率 + list.Add(txtPowerA.Text); + //B相有功功率 + list.Add(txtPowerB.Text); + //C相有功功率 + list.Add(txtPowerC.Text); + //总有功功率 + list.Add(txtTotalPower.Text); + #endregion + + return list; + })) as List; + + if (data == null || data.Count == 0) + { + return; + } + + Debug.WriteLine($"定时任务执行中, 时间: {DateTime.Now}"); + + new MESDataCombin().UpEnergyDataMqtt(data); + }, interval: 1000 * 60 * Global.systemConfig.TaskInterval); } #endregion } diff --git a/JY.Inspection/Mes/MESDataCombin.cs b/JY.Inspection/Mes/MESDataCombin.cs index 578f8bb..353f0ea 100644 --- a/JY.Inspection/Mes/MESDataCombin.cs +++ b/JY.Inspection/Mes/MESDataCombin.cs @@ -59,7 +59,7 @@ namespace JY.Inspection.Mes MesCallResult UpAlarmData(ReqAlarm req); // TODO 能耗 - void UpEnergyDataMqtt(List dataList); + void UpEnergyDataMqtt(List dataList); // TODO 设备打标 } @@ -385,7 +385,7 @@ namespace JY.Inspection.Mes } // TODO 能耗定时上传 - public void UpEnergyDataMqtt(List dataList) + public void UpEnergyDataMqtt(List dataList) { if (dataList == null || dataList.Count == 0) { @@ -416,7 +416,7 @@ namespace JY.Inspection.Mes cmd.Taglist.Add(new CollectionItem() { Equipment_Code = Global.systemConfig.equipCode, EMeter_Name = dataNameArr[i], - EMeter_Value = dataList[i].ToString() + EMeter_Value = dataList[i] }); } diff --git a/JY.Inspection/ViewModel/FrmMesSettingVM.cs b/JY.Inspection/ViewModel/FrmMesSettingVM.cs index 929f796..7afb651 100644 --- a/JY.Inspection/ViewModel/FrmMesSettingVM.cs +++ b/JY.Inspection/ViewModel/FrmMesSettingVM.cs @@ -89,5 +89,14 @@ namespace JY.Inspection.ViewModel get { return productType; } set { productType = value; OnPropertyChanged(); } } + + private int taskInterval; + + public int TaskInterval + { + get { return taskInterval; } + set { taskInterval = value; OnPropertyChanged(); } + } + } } diff --git a/JY.MES/MES/CmdEnergyData.cs b/JY.MES/MES/CmdEnergyData.cs index 4e4cad8..b53c989 100644 --- a/JY.MES/MES/CmdEnergyData.cs +++ b/JY.MES/MES/CmdEnergyData.cs @@ -54,7 +54,7 @@ namespace JY.MES.MES /// /// 采集数组 /// - public List Taglist { get; set; } + public List Taglist { get; set; } = new List(); } public class CollectionItem diff --git a/JY.Model/DB.Entity/SystemConfig.cs b/JY.Model/DB.Entity/SystemConfig.cs index 863bd0e..6a032f2 100644 --- a/JY.Model/DB.Entity/SystemConfig.cs +++ b/JY.Model/DB.Entity/SystemConfig.cs @@ -112,14 +112,9 @@ namespace JY.Model /// public string userName = ""; - - - - - - - - - + /// + /// 定时任务间隔时间 + /// + public int TaskInterval { get; set; } = 1; } }