diff --git a/DHSoftware/MainWindow.Designer.cs b/DHSoftware/MainWindow.Designer.cs index ad67f56..3643181 100644 --- a/DHSoftware/MainWindow.Designer.cs +++ b/DHSoftware/MainWindow.Designer.cs @@ -62,6 +62,16 @@ btnLoadProject = new AntdUI.Button(); sltProjects = new AntdUI.Select(); segmented1 = new AntdUI.Segmented(); + panel5 = new Panel(); + panel7 = new Panel(); + label2 = new Label(); + lblNum = new Label(); + lblUPH = new Label(); + label4 = new Label(); + lblstarttime = new Label(); + label6 = new Label(); + lblNowtime = new Label(); + label8 = new Label(); titlebar.SuspendLayout(); pageHeader1.SuspendLayout(); panelmain.SuspendLayout(); @@ -82,6 +92,8 @@ tabsConfig.SuspendLayout(); panel1.SuspendLayout(); panel3.SuspendLayout(); + panel5.SuspendLayout(); + panel7.SuspendLayout(); SuspendLayout(); // // titlebar @@ -258,7 +270,8 @@ // // tabPage3 // - tabPage3.Controls.Add(richTextBox1); + tabPage3.Controls.Add(panel7); + tabPage3.Controls.Add(panel5); tabPage3.Location = new Point(3, 28); tabPage3.Name = "tabPage3"; tabPage3.Size = new Size(574, 145); @@ -270,9 +283,10 @@ richTextBox1.Dock = DockStyle.Fill; richTextBox1.Location = new Point(0, 0); richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new Size(574, 145); + richTextBox1.Size = new Size(374, 145); richTextBox1.TabIndex = 0; richTextBox1.Text = ""; + richTextBox1.TextChanged += richTextBox1_TextChanged; // // tabsConfig // @@ -437,6 +451,103 @@ segmented1.Text = "segmented1"; segmented1.SelectIndexChanged += segmented1_SelectIndexChanged; // + // panel5 + // + panel5.Controls.Add(lblNowtime); + panel5.Controls.Add(label8); + panel5.Controls.Add(lblstarttime); + panel5.Controls.Add(label6); + panel5.Controls.Add(lblUPH); + panel5.Controls.Add(label4); + panel5.Controls.Add(lblNum); + panel5.Controls.Add(label2); + panel5.Dock = DockStyle.Right; + panel5.Location = new Point(374, 0); + panel5.Name = "panel5"; + panel5.Size = new Size(200, 145); + panel5.TabIndex = 1; + // + // panel7 + // + panel7.Controls.Add(richTextBox1); + panel7.Dock = DockStyle.Fill; + panel7.Location = new Point(0, 0); + panel7.Name = "panel7"; + panel7.Size = new Size(374, 145); + panel7.TabIndex = 2; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(7, 75); + label2.Name = "label2"; + label2.Size = new Size(32, 17); + label2.TabIndex = 0; + label2.Text = "总数"; + // + // lblNum + // + lblNum.AutoSize = true; + lblNum.Location = new Point(70, 75); + lblNum.Name = "lblNum"; + lblNum.Size = new Size(15, 17); + lblNum.TabIndex = 1; + lblNum.Text = "0"; + // + // lblUPH + // + lblUPH.AutoSize = true; + lblUPH.Location = new Point(70, 105); + lblUPH.Name = "lblUPH"; + lblUPH.Size = new Size(15, 17); + lblUPH.TabIndex = 3; + lblUPH.Text = "0"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(7, 105); + label4.Name = "label4"; + label4.Size = new Size(33, 17); + label4.TabIndex = 2; + label4.Text = "UPH"; + // + // lblstarttime + // + lblstarttime.AutoSize = true; + lblstarttime.Location = new Point(69, 15); + lblstarttime.Name = "lblstarttime"; + lblstarttime.Size = new Size(15, 17); + lblstarttime.TabIndex = 5; + lblstarttime.Text = "0"; + // + // label6 + // + label6.AutoSize = true; + label6.Location = new Point(7, 15); + label6.Name = "label6"; + label6.Size = new Size(56, 17); + label6.TabIndex = 4; + label6.Text = "开始时间"; + // + // lblNowtime + // + lblNowtime.AutoSize = true; + lblNowtime.Location = new Point(69, 41); + lblNowtime.Name = "lblNowtime"; + lblNowtime.Size = new Size(15, 17); + lblNowtime.TabIndex = 7; + lblNowtime.Text = "0"; + // + // label8 + // + label8.AutoSize = true; + label8.Location = new Point(7, 41); + label8.Name = "label8"; + label8.Size = new Size(56, 17); + label8.TabIndex = 6; + label8.Text = "此刻时间"; + // // MainWindow // ClientSize = new Size(1024, 648); @@ -473,6 +584,9 @@ tabsConfig.ResumeLayout(false); panel1.ResumeLayout(false); panel3.ResumeLayout(false); + panel5.ResumeLayout(false); + panel5.PerformLayout(); + panel7.ResumeLayout(false); ResumeLayout(false); } @@ -504,5 +618,15 @@ private AntdUI.Button btnAddProject; private AntdUI.Button btnLoadProject; public AntdUI.Select sltProjects; + private Panel panel7; + private Panel panel5; + private Label lblNum; + private Label label2; + private Label lblNowtime; + private Label label8; + private Label lblstarttime; + private Label label6; + private Label lblUPH; + private Label label4; } } \ No newline at end of file diff --git a/DHSoftware/MainWindow.cs b/DHSoftware/MainWindow.cs index 90ab720..3cc18a1 100644 --- a/DHSoftware/MainWindow.cs +++ b/DHSoftware/MainWindow.cs @@ -508,7 +508,8 @@ namespace DHSoftware { camera.CameraDisConnect(); } - PLC.PLCDisConnect(); + if (PLC != null) + PLC.PLCDisConnect(); CloseWindow.Instance.Close();// 关闭提示窗口 //Application.Exit(); System.Environment.Exit(0); @@ -566,7 +567,7 @@ namespace DHSoftware private List SimboStationMLEngineList = new List(); private Dictionary HalconToolDict = new Dictionary(); public List RecongnitionLabelList { get; set; } = new List(); - public DateTime startTime; + public DateTime ProcessstartTime; private void HandleStartButton() { @@ -577,6 +578,8 @@ namespace DHSoftware private void StartProcess() { + ProcessstartTime= DateTime.Now; + lblstarttime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss") //计数清零 PieceCount = 0; //吹气点位归置 @@ -718,12 +721,12 @@ namespace DHSoftware /// private void StartPLCAction() { - if (PLC.PLCItemList?.Count > 0) + if (PLC.PLCItemList?.Count > 0) { - List startPLCList= PLC.PLCItemList.Where(it=>it.StartExecute).ToList(); - if (startPLCList?.Count > 0) + List startPLCList = PLC.PLCItemList.Where(it => it.StartExecute).ToList(); + if (startPLCList?.Count > 0) { - + } } } @@ -1404,13 +1407,16 @@ namespace DHSoftware public void CalculateOEE() { - TimeSpan timeSpan = DateTime.Now - startTime; + TimeSpan timeSpan = DateTime.Now - ProcessstartTime; UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100; //UPM = (int)UPH / 60; this.BeginInvoke(new MethodInvoker(delegate () { + lblNowtime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); label1.Text = UPH.ToString(); + lblUPH.Text = UPH.ToString(); + lblNum.Text = ProductNum_Total.ToString(); })); } @@ -1437,5 +1443,10 @@ namespace DHSoftware private void splitter1_SplitterMoved(object sender, SplitterEventArgs e) { } + + private void richTextBox1_TextChanged(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/DHSoftware/MainWindow.resx b/DHSoftware/MainWindow.resx index 8a0b8d7..1a56e4c 100644 --- a/DHSoftware/MainWindow.resx +++ b/DHSoftware/MainWindow.resx @@ -1,7 +1,7 @@