diff --git a/ProductionSystem/Forms/HomeFormInfo.Designer.cs b/ProductionSystem/Forms/HomeFormInfo.Designer.cs index 1352ba0..88eee5e 100644 --- a/ProductionSystem/Forms/HomeFormInfo.Designer.cs +++ b/ProductionSystem/Forms/HomeFormInfo.Designer.cs @@ -36,8 +36,8 @@ this.topFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.middleFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.bottomPanelControl = new DevExpress.XtraEditors.PanelControl(); - this.Loading = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ProductionSystem.Forms.CommonForms.WaitForm1), true, true); this.hslCurveHistory = new HslControls.HslCurveHistory(); + this.Loading = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ProductionSystem.Forms.CommonForms.WaitForm1), true, true); ((System.ComponentModel.ISupportInitialize)(this.topPanelControl)).BeginInit(); this.topPanelControl.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.stackPanel1)).BeginInit(); @@ -55,9 +55,9 @@ this.topPanelControl.Controls.Add(this.stackPanel1); this.topPanelControl.Dock = System.Windows.Forms.DockStyle.Top; this.topPanelControl.Location = new System.Drawing.Point(0, 0); - this.topPanelControl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.topPanelControl.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.topPanelControl.Name = "topPanelControl"; - this.topPanelControl.Size = new System.Drawing.Size(1044, 33); + this.topPanelControl.Size = new System.Drawing.Size(1193, 42); this.topPanelControl.TabIndex = 6; // // stackPanel1 @@ -70,27 +70,27 @@ this.stackPanel1.Margin = new System.Windows.Forms.Padding(0); this.stackPanel1.Name = "stackPanel1"; this.stackPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.stackPanel1.Size = new System.Drawing.Size(1044, 33); + this.stackPanel1.Size = new System.Drawing.Size(1193, 42); this.stackPanel1.TabIndex = 0; // // txtPLCConnectStatus // this.txtPLCConnectStatus.Enabled = false; - this.txtPLCConnectStatus.Location = new System.Drawing.Point(940, 6); - this.txtPLCConnectStatus.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.txtPLCConnectStatus.Location = new System.Drawing.Point(1074, 9); + this.txtPLCConnectStatus.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.txtPLCConnectStatus.Name = "txtPLCConnectStatus"; this.txtPLCConnectStatus.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); this.txtPLCConnectStatus.Properties.Appearance.Options.UseFont = true; this.txtPLCConnectStatus.Properties.Appearance.Options.UseTextOptions = true; this.txtPLCConnectStatus.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; this.txtPLCConnectStatus.Properties.ReadOnly = true; - this.txtPLCConnectStatus.Size = new System.Drawing.Size(100, 20); + this.txtPLCConnectStatus.Size = new System.Drawing.Size(114, 24); this.txtPLCConnectStatus.TabIndex = 2; // // cmbProductType // - this.cmbProductType.Location = new System.Drawing.Point(780, 6); - this.cmbProductType.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cmbProductType.Location = new System.Drawing.Point(890, 9); + this.cmbProductType.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.cmbProductType.Name = "cmbProductType"; this.cmbProductType.Properties.AppearanceFocused.Font = new System.Drawing.Font("Tahoma", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic)))); this.cmbProductType.Properties.AppearanceFocused.Options.UseFont = true; @@ -100,19 +100,19 @@ new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.cmbProductType.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cmbProductType.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cmbProductType.Size = new System.Drawing.Size(152, 20); + this.cmbProductType.Size = new System.Drawing.Size(174, 24); this.cmbProductType.TabIndex = 1; this.cmbProductType.SelectedIndexChanged += new System.EventHandler(this.cmbProductType_SelectedIndexChanged); // // txtProductCode // - this.txtProductCode.Location = new System.Drawing.Point(617, 6); - this.txtProductCode.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.txtProductCode.Location = new System.Drawing.Point(703, 9); + this.txtProductCode.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.txtProductCode.Name = "txtProductCode"; this.txtProductCode.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); this.txtProductCode.Properties.Appearance.Options.UseFont = true; this.txtProductCode.Properties.ReadOnly = true; - this.txtProductCode.Size = new System.Drawing.Size(155, 20); + this.txtProductCode.Size = new System.Drawing.Size(177, 24); this.txtProductCode.TabIndex = 3; this.txtProductCode.EditValueChanged += new System.EventHandler(this.txtProductCode_EditValueChanged); // @@ -122,10 +122,10 @@ this.topFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.topFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Top; this.topFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.topFlowLayoutPanel.Location = new System.Drawing.Point(0, 33); - this.topFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.topFlowLayoutPanel.Location = new System.Drawing.Point(0, 42); + this.topFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.topFlowLayoutPanel.Name = "topFlowLayoutPanel"; - this.topFlowLayoutPanel.Size = new System.Drawing.Size(1044, 150); + this.topFlowLayoutPanel.Size = new System.Drawing.Size(1193, 192); this.topFlowLayoutPanel.TabIndex = 8; // // middleFlowLayoutPanel @@ -134,10 +134,10 @@ this.middleFlowLayoutPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.middleFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.middleFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.middleFlowLayoutPanel.Location = new System.Drawing.Point(0, 183); - this.middleFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.middleFlowLayoutPanel.Location = new System.Drawing.Point(0, 234); + this.middleFlowLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.middleFlowLayoutPanel.Name = "middleFlowLayoutPanel"; - this.middleFlowLayoutPanel.Size = new System.Drawing.Size(1044, 67); + this.middleFlowLayoutPanel.Size = new System.Drawing.Size(1193, 87); this.middleFlowLayoutPanel.TabIndex = 10; this.middleFlowLayoutPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.middleFlowLayoutPanel_Paint); // @@ -146,22 +146,18 @@ this.bottomPanelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.bottomPanelControl.Controls.Add(this.hslCurveHistory); this.bottomPanelControl.Dock = System.Windows.Forms.DockStyle.Bottom; - this.bottomPanelControl.Location = new System.Drawing.Point(0, 250); - this.bottomPanelControl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.bottomPanelControl.Location = new System.Drawing.Point(0, 321); + this.bottomPanelControl.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.bottomPanelControl.Name = "bottomPanelControl"; - this.bottomPanelControl.Size = new System.Drawing.Size(1044, 450); + this.bottomPanelControl.Size = new System.Drawing.Size(1193, 579); this.bottomPanelControl.TabIndex = 11; // - // Loading - // - this.Loading.ClosingDelay = 500; - // // hslCurveHistory // this.hslCurveHistory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46))))); this.hslCurveHistory.ButtomHeight = 0; this.hslCurveHistory.Cursor = System.Windows.Forms.Cursors.Arrow; - this.hslCurveHistory.CurveNameWidth = 100; + this.hslCurveHistory.CurveNameWidth = 200; this.hslCurveHistory.DashCoordinateColor = System.Drawing.Color.FromArgb(((int)(((byte)(72)))), ((int)(((byte)(72)))), ((int)(((byte)(72))))); this.hslCurveHistory.DataTipWidth = 200; this.hslCurveHistory.DateTimeFormate = "HH:mm:ss"; @@ -175,7 +171,7 @@ this.hslCurveHistory.Name = "hslCurveHistory"; this.hslCurveHistory.RenderRightCoordinate = false; this.hslCurveHistory.RightWidth = 2; - this.hslCurveHistory.Size = new System.Drawing.Size(1044, 450); + this.hslCurveHistory.Size = new System.Drawing.Size(1193, 579); this.hslCurveHistory.TabIndex = 2; this.hslCurveHistory.Text = "hslCurveHistory1"; this.hslCurveHistory.TopCurveNameHeight = 20; @@ -183,19 +179,23 @@ this.hslCurveHistory.ValueMaxRight = 5F; this.hslCurveHistory.ValueSegment = 10; // + // Loading + // + this.Loading.ClosingDelay = 500; + // // HomeFormInfo // this.Appearance.BackColor = System.Drawing.Color.White; this.Appearance.Options.UseBackColor = true; - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1044, 700); + this.ClientSize = new System.Drawing.Size(1193, 900); this.Controls.Add(this.middleFlowLayoutPanel); this.Controls.Add(this.bottomPanelControl); this.Controls.Add(this.topFlowLayoutPanel); this.Controls.Add(this.topPanelControl); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); this.Name = "HomeFormInfo"; this.Text = "HomeForm"; this.Load += new System.EventHandler(this.HomeForm_Load); diff --git a/ProductionSystem/Forms/HomeFormInfo.cs b/ProductionSystem/Forms/HomeFormInfo.cs index 1f64cdb..df7e6ad 100644 --- a/ProductionSystem/Forms/HomeFormInfo.cs +++ b/ProductionSystem/Forms/HomeFormInfo.cs @@ -1910,16 +1910,46 @@ namespace ProductionSystem.Forms { "BZ3", "D1304" }, //高压 { "BZ4", "D1312" }, - + { "BZ5", "D1308" }, { "BZ6", "D1310" }, //外露 { "BZ7", "D1306" }, - + { "BZ8", "D1314" }, }; return tagDict; } + + private string GetStep() + { + var dic = GetTagDict(); + string str = ""; + foreach (var item in dic) + { + string key = item.Key; + string value = item.Value; + + var entity = + Program.CommandPointKeyValues.FirstOrDefault(m => m.Key == value); + if (entity != null) + { + var va = OmronHelper.GetPlcVal(entity.DataType, entity.Address); + if (va.Item2.ToDouble().ToInt() == 1) + { + str = key; + break; + } + + } + + + + } + return str; + } + + @@ -2471,30 +2501,46 @@ namespace ProductionSystem.Forms //模拟数据 for (int i = 0; i < Program.Times.Length; i++) { - //Program.OutPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 200); - //Program.InPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 400); - //Program.GastankPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 600); - //Program.XVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 800); - //Program.YVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 1000); - var sbElecttricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(),GetStep()); - var electricity = sbElecttricity.Electricity; - Program.CurrentData[i] = float.Parse(electricity); + var step = GetStep(); + + if (step == "BZ1") + { + var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity; + Program.Current1Data[i] = float.Parse(electricity); + } + else if(step == "BZ2") + { + var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity; + Program.Current2Data[i] = float.Parse(electricity); + } + else if (step == "BZ3") + { + var electricity = result2Service.QueryLatestStep(Program.ProductType, GetCode(), step).Electricity; + Program.Current3Data[i] = float.Parse(electricity); + } Program.Times[i] = DateTime.Now.AddSeconds(i - 1000); - } //if (Program.VoltageData.Length > 0) //{ // hslCurveHistory.SetLeftCurve("电压", Program.VoltageData, Color.DarkOliveGreen, CurveStyle.Curve, "{0:F2} V"); //} - if (Program.CurrentData.Length > 0) + if (Program.Current1Data.Length > 0) + { + hslCurveHistory.SetLeftCurve("水泵1电流", Program.Current1Data, Color.OrangeRed, CurveStyle.Curve, "{0:F2} A"); + } + if (Program.Current2Data.Length > 0) + { + hslCurveHistory.SetLeftCurve("水泵2电流", Program.Current2Data, Color.YellowGreen, CurveStyle.Curve, "{0:F2} A"); + } + if (Program.Current3Data.Length > 0) { - hslCurveHistory.SetLeftCurve("电流", Program.CurrentData, Color.Yellow, CurveStyle.Curve, "{0:F2} A"); + hslCurveHistory.SetLeftCurve("水泵3电流", Program.Current3Data, Color.LightBlue, CurveStyle.Curve, "{0:F2} A"); } if (Program.Times.Length > 0) { hslCurveHistory.SetDateTimes(Program.Times); } - hslCurveHistory.ScrollToRight(); + //hslCurveHistory.ScrollToRight(); // 将曲线显示出来 hslCurveHistory.RenderCurveUI(); } diff --git a/ProductionSystem/Program.cs b/ProductionSystem/Program.cs index 6f57d3f..9e3d2a0 100644 --- a/ProductionSystem/Program.cs +++ b/ProductionSystem/Program.cs @@ -427,7 +427,9 @@ namespace ProductionSystem //public static float[] YVibrateData = new float[1000];//Y轴震动 //public static float[] ZVibrateData = new float[1000];//Z轴震动 public static float[] VoltageData = new float[1000];//电压 - public static float[] CurrentData = new float[1000];//电流 + public static float[] Current1Data = new float[1000];//水泵1电流 + public static float[] Current2Data = new float[1000];//水泵2电流 + public static float[] Current3Data = new float[1000];//水泵3电流 //public static float[] NoiseData = new float[1000];//噪音 public static DateTime[] Times = new DateTime[1000];