Browse Source

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

HaoShuang 5 years ago
parent
commit
38301993ac

+ 52 - 51
HOZProject/FormHOZMain.Designer.cs

@@ -30,14 +30,16 @@
         {
             this.plMain = new System.Windows.Forms.Panel();
             this.plFill = new System.Windows.Forms.Panel();
-            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.textBox1 = new System.Windows.Forms.TextBox();
             this.button1 = new System.Windows.Forms.Button();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.textBox2 = new System.Windows.Forms.TextBox();
-            this.textBox1 = new System.Windows.Forms.TextBox();
             this.plPrarInfo = new System.Windows.Forms.Panel();
             this.listmsg = new System.Windows.Forms.ListBox();
             this.pbImage = new System.Windows.Forms.PictureBox();
             this.plSEM = new System.Windows.Forms.Panel();
+            this.lblFlowContent = new System.Windows.Forms.Label();
             this.plLeft = new System.Windows.Forms.Panel();
             this.label1 = new System.Windows.Forms.Label();
             this.plLeftContent = new System.Windows.Forms.Panel();
@@ -54,10 +56,9 @@
             this.pbSave = new System.Windows.Forms.PictureBox();
             this.pbOpen = new System.Windows.Forms.PictureBox();
             this.pbNew = new System.Windows.Forms.PictureBox();
-            this.groupBox1 = new System.Windows.Forms.GroupBox();
-            this.lblFlowContent = new System.Windows.Forms.Label();
             this.plMain.SuspendLayout();
             this.plFill.SuspendLayout();
+            this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pbImage)).BeginInit();
             this.plSEM.SuspendLayout();
             this.plLeft.SuspendLayout();
@@ -74,7 +75,6 @@
             ((System.ComponentModel.ISupportInitialize)(this.pbSave)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbOpen)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbNew)).BeginInit();
-            this.groupBox1.SuspendLayout();
             this.SuspendLayout();
             // 
             // plMain
@@ -107,17 +107,29 @@
             this.plFill.Size = new System.Drawing.Size(894, 658);
             this.plFill.TabIndex = 5;
             // 
-            // comboBox1
+            // groupBox1
             // 
-            this.comboBox1.FormattingEnabled = true;
-            this.comboBox1.Items.AddRange(new object[] {
-            "0",
-            "1",
-            "2"});
-            this.comboBox1.Location = new System.Drawing.Point(6, 74);
-            this.comboBox1.Name = "comboBox1";
-            this.comboBox1.Size = new System.Drawing.Size(100, 20);
-            this.comboBox1.TabIndex = 25;
+            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox1.Controls.Add(this.textBox1);
+            this.groupBox1.Controls.Add(this.button1);
+            this.groupBox1.Controls.Add(this.comboBox1);
+            this.groupBox1.Controls.Add(this.textBox2);
+            this.groupBox1.ForeColor = System.Drawing.Color.White;
+            this.groupBox1.Location = new System.Drawing.Point(694, 2);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(200, 100);
+            this.groupBox1.TabIndex = 26;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "测试设置状态";
+            this.groupBox1.Visible = false;
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(6, 20);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(100, 21);
+            this.textBox1.TabIndex = 21;
+            this.textBox1.Text = "切孔名称";
             // 
             // button1
             // 
@@ -130,6 +142,18 @@
             this.button1.UseVisualStyleBackColor = true;
             this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
+            // comboBox1
+            // 
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "0",
+            "1",
+            "2"});
+            this.comboBox1.Location = new System.Drawing.Point(6, 74);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(100, 20);
+            this.comboBox1.TabIndex = 25;
+            // 
             // textBox2
             // 
             this.textBox2.Location = new System.Drawing.Point(6, 47);
@@ -138,14 +162,6 @@
             this.textBox2.TabIndex = 22;
             this.textBox2.Text = "编号";
             // 
-            // textBox1
-            // 
-            this.textBox1.Location = new System.Drawing.Point(6, 20);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Size = new System.Drawing.Size(100, 21);
-            this.textBox1.TabIndex = 21;
-            this.textBox1.Text = "切孔名称";
-            // 
             // plPrarInfo
             // 
             this.plPrarInfo.BackColor = System.Drawing.Color.White;
@@ -185,6 +201,17 @@
             this.plSEM.Size = new System.Drawing.Size(894, 90);
             this.plSEM.TabIndex = 19;
             // 
+            // lblFlowContent
+            // 
+            this.lblFlowContent.AutoSize = true;
+            this.lblFlowContent.Font = new System.Drawing.Font("宋体", 10F);
+            this.lblFlowContent.ForeColor = System.Drawing.Color.White;
+            this.lblFlowContent.Location = new System.Drawing.Point(23, 38);
+            this.lblFlowContent.Name = "lblFlowContent";
+            this.lblFlowContent.Size = new System.Drawing.Size(28, 14);
+            this.lblFlowContent.TabIndex = 0;
+            this.lblFlowContent.Text = "---";
+            // 
             // plLeft
             // 
             this.plLeft.BackColor = System.Drawing.Color.Black;
@@ -393,32 +420,6 @@
             this.pbNew.Visible = false;
             this.pbNew.Click += new System.EventHandler(this.pbNew_Click);
             // 
-            // groupBox1
-            // 
-            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.groupBox1.Controls.Add(this.textBox1);
-            this.groupBox1.Controls.Add(this.button1);
-            this.groupBox1.Controls.Add(this.comboBox1);
-            this.groupBox1.Controls.Add(this.textBox2);
-            this.groupBox1.ForeColor = System.Drawing.Color.White;
-            this.groupBox1.Location = new System.Drawing.Point(694, 2);
-            this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(200, 100);
-            this.groupBox1.TabIndex = 26;
-            this.groupBox1.TabStop = false;
-            this.groupBox1.Text = "测试设置状态";
-            // 
-            // lblFlowContent
-            // 
-            this.lblFlowContent.AutoSize = true;
-            this.lblFlowContent.Font = new System.Drawing.Font("宋体", 10F);
-            this.lblFlowContent.ForeColor = System.Drawing.Color.White;
-            this.lblFlowContent.Location = new System.Drawing.Point(23, 38);
-            this.lblFlowContent.Name = "lblFlowContent";
-            this.lblFlowContent.Size = new System.Drawing.Size(28, 14);
-            this.lblFlowContent.TabIndex = 0;
-            this.lblFlowContent.Text = "---";
-            // 
             // FormHOZMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -435,6 +436,8 @@
             this.Load += new System.EventHandler(this.FormHOZMain_Load);
             this.plMain.ResumeLayout(false);
             this.plFill.ResumeLayout(false);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pbImage)).EndInit();
             this.plSEM.ResumeLayout(false);
             this.plSEM.PerformLayout();
@@ -453,8 +456,6 @@
             ((System.ComponentModel.ISupportInitialize)(this.pbSave)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbOpen)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbNew)).EndInit();
-            this.groupBox1.ResumeLayout(false);
-            this.groupBox1.PerformLayout();
             this.ResumeLayout(false);
 
         }

+ 13 - 6
HOZProject/MeasureMsgDispose/MeasureMsgManage.cs

@@ -6,6 +6,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using System.IO;
 
 namespace HOZProject
 {
@@ -22,15 +23,21 @@ namespace HOZProject
             {
                 case "1-3":
                     //设置图像
-                    formHOZ.pbImage.Image = null;
+                    FileStream fileStream = new FileStream(args.Picture_Information.Picture_FullPath, FileMode.Open, FileAccess.Read);
+                    formHOZ.pbImage.Image = Image.FromStream(fileStream);
+                    fileStream.Close();
+                    fileStream.Dispose();
                     //流程内容
-                    formHOZ.lblFlowContent.Text = "1-3";
+                    string semParaContent = "电压:"+args.Picture_Information.Work_Voltage;
+                    semParaContent += "  放大倍数:" + args.Picture_Information.Magnification;
+                    semParaContent += "  工作距离:" + args.Picture_Information.Work_Distance;
+                    formHOZ.lblFlowContent.Text = semParaContent;
                     break;
                 default:
-                    //设置图像
-                    formHOZ.pbImage.Image = null;//new Bitmap(@"C:\Users\think\Pictures\ico\001.jpg");
-                    //流程内容
-                    formHOZ.lblFlowContent.Text = "1";
+                    ////设置图像
+                    //formHOZ.pbImage.Image = null;
+                    ////流程内容
+                    //formHOZ.lblFlowContent.Text = "1";
                     break;
 
             }

+ 3 - 4
HOZProject/UserControls/UCTimeLine.cs

@@ -249,14 +249,13 @@ namespace HOZProject
                     {
                         switch (item.State)
                         {
+                                //出错
                             case 0:
                                 lineColor = Color.Red;
                                 break;
+                                //完成
                             case 1:
-                                lineColor = Color.Yellow;
-                                break;
-                            case 2:
-                                lineColor = Color.White;
+                                lineColor = Color.GreenYellow;
                                 break;
                             default:
                                 lineColor = TextColors.Light;

+ 29 - 9
HOZProject/UserControls/UControl_Init.cs

@@ -69,12 +69,11 @@ namespace HOZProject
                 {
                     List<CutHole> ListCutHole = FormHOZMainObject.m_MeasureFile.ListCutHole;
                     //文件路径
-                    string filePath = FormHOZMainObject.m_MeasureFile.FilePath;
-                    string fileName = FormHOZMainObject.m_MeasureFile.FileName;
+                    string CutHoleFilePath = FormHOZMainObject.m_MeasureFile.CutHoleFilePath;
                     FormHOZMainObject.CreateCutHoleList(ListCutHole);
                     //显示导入的切孔数量
                     lblCutHoleCount.Text = string.Format("成功导入{0}个切孔", ListCutHole.Count);
-                    tbCutHoleFilePath.Text = filePath + fileName;
+                    tbCutHoleFilePath.Text = CutHoleFilePath;
                 }
             }
         }
@@ -183,7 +182,7 @@ namespace HOZProject
         /// <summary>
         /// 编辑confing 文件信息
         /// </summary>
-        public void EditConfig()
+        public bool EditConfig()
         {
             try
             {
@@ -263,6 +262,7 @@ namespace HOZProject
                 {
                     cfm.Correction_Angle = 54.0;
                 }
+                
 
                 cfm.SampleName = cbbWYP.Text;
                 cfm.Firm = cbbWCS.Text;
@@ -282,11 +282,12 @@ namespace HOZProject
 
                 config.Save(ConfigurationSaveMode.Modified);
                 ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
+                return true;
             }
             catch (Exception ex)
             {
-
-                throw;
+                LogManager.LogError(ex.Message);
+                return false;
             }
         }
 
@@ -426,7 +427,15 @@ namespace HOZProject
             cbbWQGD.Text = config.AppSettings.Settings["Location_Voltage"].Value;
             cbbWPZF.Text = config.AppSettings.Settings["Photograph_Magnification"].Value;
             cbbWPZD.Text = config.AppSettings.Settings["Photograph_Voltage"].Value;
-            cbbWXZ.Text = config.AppSettings.Settings["Correction_Angle"].Value;
+            string Correction_Angle = config.AppSettings.Settings["Correction_Angle"].Value;
+            if (Correction_Angle == "36")
+            {
+                cbbWXZ.SelectedIndex = 0;
+            }
+            else
+            {
+                cbbWXZ.SelectedIndex = 1;
+            }
             cbbWYP.Text = config.AppSettings.Settings["SampleName"].Value;
             cbbWCS.Text = config.AppSettings.Settings["Firms"].Value;
         }
@@ -450,7 +459,15 @@ namespace HOZProject
                 cbbWQGD.Text = cfm.m_Config.Location_Voltage.ToString();
                 cbbWPZF.Text = cfm.m_Config.Photograph_Magnification.ToString();
                 cbbWPZD.Text = cfm.m_Config.Photograph_Voltage.ToString();
-                cbbWXZ.Text = cfm.m_Config.Correction_Angle.ToString();
+                string Correction_Angle = cfm.m_Config.Correction_Angle.ToString();
+                if (Correction_Angle == "36")
+                {
+                    cbbWXZ.SelectedIndex = 0;
+                }
+                else
+                {
+                    cbbWXZ.SelectedIndex = 1;
+                }
                 cbbWYP.Text = cfm.m_Config.SampleName;
                 cbbWCS.Text = cfm.m_Config.Firm;
             }
@@ -463,7 +480,10 @@ namespace HOZProject
         /// <param name="e"></param>
         private void btnSaveDefalutPara_Click(object sender, EventArgs e)
         {
-            EditConfig();
+            if (EditConfig())
+            {
+                MessageBox.Show("保存成功!", "提示");
+            }
         }
         #endregion
 

+ 1 - 1
HOZProject/UserControls/UControl_ParaInfo.cs

@@ -143,7 +143,7 @@ namespace HOZProject
                 TimeLineItem tlItem = new TimeLineItem();
                 tlItem.Details = nodeList[i].Attributes["Details"].Value;
                 tlItem.Code = nodeList[i].Attributes["Code"].Value;
-                tlItem.State = 0;
+                tlItem.State = -1;
                 tlItem.Title = nodeList[i].Attributes["Title"].Value;
                 tlItem.IsData = Convert.ToBoolean(nodeList[i].Attributes["IsData"].Value);
                 timeLineItem[i] = tlItem;

+ 23 - 3
MeasureData/MeasureFile.cs

@@ -37,6 +37,14 @@ namespace MeasureData
             set { this.m_filepath = value; }
         }
 
+        //切孔文件路径
+        private string m_CutHoleFilePath;
+        public string CutHoleFilePath
+        {
+            get { return this.m_CutHoleFilePath; }
+            set { this.m_CutHoleFilePath = value; }
+        }
+
         //切孔链表
         private List<CutHole> m_listCutHole;
         public List<CutHole> ListCutHole
@@ -164,6 +172,18 @@ namespace MeasureData
         //保存
         public bool Save()
         {
+            SaveFileDialog saveFileDialog = new SaveFileDialog();
+            if (saveFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                //获得文件路径  
+                string localFilePath = saveFileDialog.FileName.ToString();
+                //获取文件名,不带路径  
+                string fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1); 
+                //获取文件路径,不带文件名 
+                string FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));
+                this.FilePath = FilePath;
+                this.FileName = fileNameExt;
+            }
             //如果是新文件
             this.FileName.Trim();
             if (string.Compare(this.FileName,UNTITLED_FILE_NAME) == 0)
@@ -254,9 +274,9 @@ namespace MeasureData
                     //文件打开后执行以下程序
                     if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
                     {
-                        a_FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName);                             //绝对路径
-                        FilePath = a_FilePathName.Substring(0, a_FilePathName.LastIndexOf('\\')+1);
-                        FileName = pOpenFileDialog.SafeFileName;
+                        a_FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName);                             
+                        //绝对路径
+                        CutHoleFilePath = a_FilePathName;
 
                     }
                 }

+ 27 - 21
MeasureThread/Measure.cs

@@ -328,7 +328,6 @@ namespace MeasureThread
 
         public ThreadStatusEventArgs(string a_State)
         {
-            this.m_state = a_State;
             picture_Information = new PictureInformation();
             image_Information = new ImageInformation();
         }
@@ -362,6 +361,9 @@ namespace MeasureThread
         public event ThreadStatusHandler SendThreadStatus;  // 声明事件
         public event CutHolesStatusHandler SendCutHolesStatus;  // 声明事件
 
+        //定义一个全局的消息类
+        ThreadStatusEventArgs arg = new ThreadStatusEventArgs("0-0");
+
         //全局只有一个fatorySEM
         static FactoryHardware factorySEM = FactoryHardware.Instance;
         ISEMControl iSEM = factorySEM.ISEM;
@@ -467,7 +469,7 @@ namespace MeasureThread
 
         public void SendMsg(string step_code)
         {
-            ThreadStatusEventArgs arg = new ThreadStatusEventArgs(step_code);
+            arg.Step_Code = step_code;
             arg.Time = DateTime.Now;
             switch(step_code)
             {
@@ -494,8 +496,7 @@ namespace MeasureThread
                     //取消电子束校正并初始化
                     break;
                 default:
-                    arg.Step_Code = "0-0";
-                    arg.Message = step_code;
+                    arg.State = "1";
                     break;
             }
             SendThreadStatus(this, arg);
@@ -544,6 +545,7 @@ namespace MeasureThread
             for (int i = 0; i < m_cutHoles.Count; i++)
             {
                 m_nWorkHoleNo = i;
+                arg.HoleName = cutHoles[m_nWorkHoleNo].HoleName;
                 if (i == 0)
                 {
                     SendMsg("第一个切孔开始测量");
@@ -720,27 +722,30 @@ namespace MeasureThread
         /// <returns></returns>
         public bool GetPoistion()
         {
-            SendMsg("自动定位");
+            //SendMsg("自动定位");
             //13.自动定位切割
             {
-                SendMsg("放大600倍");
                 //1.控制SEM放大600X
                 if (!iSEM.SetMagnification(600))
                 {
                     return false;
                 }
+                arg.Message = "放大600倍";
+                SendMsg("1-1");
 
                 //2.控制SEM自动对焦、亮度、对比度
                 // if (!MeasParam.FocusMode)
                 {
-                    if (DialogResult.Yes == MessageBox.Show("图像拍摄已完成?", "确认消息", MessageBoxButtons.YesNo))
+                    if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                     {
-                        SendMsg("拍摄照片完成");
+                        arg.Message = "自动对焦完成";
+                        SendMsg("1-2");
                         //return true;
                     }
                     else
                     {
-                        SendMsg("拍摄照片失败");
+                        arg.Message = "自动对焦失败";
+                        SendMsg("1-2");
                         return false;
                     }
                     //弹出手动对焦的窗口
@@ -751,17 +756,17 @@ namespace MeasureThread
                 //}
 
                 //3.设置SEM进行角度补偿54度
-                SendMsg("设置校正54度");
-                if (!TiltCorrection(54))
-                {
-                    SendMsg("设置SEM进行角度补偿54度");
-                    return false;
-                }
-
-                Thread.Sleep(5000);
+                //if (!TiltCorrection(54))
+                //{
+                //    SendMsg("设置SEM进行角度补偿54度");
+                //    return false;
+                //}
+                //arg.Message = "设置校正54度";
+                //SendMsg("1-15");
+                //Thread.Sleep(5000);
 
                 //4.控制SEM拍照
-                SendMsg("SEM拍照");
+                
                 //5.保存照片
                 {
                     //1. 创建目录,已经完成
@@ -769,16 +774,17 @@ namespace MeasureThread
                     //3. 保存图片1
                     WorkingFolder = m_measureFile.FilePath;
                     String fileName1 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName1;
-                    SendMsg("SEM拍照存储到" + fileName1);
+                    arg.Picture_Information.Picture_FullPath = fileName1;
                     if (!GetImage(ImageMode.SEM, fileName1))
                     {
                         SendMsg("SEM拍照失败");
                         return false;
                     }
-
+                    arg.Message = "SEM拍照";
+                    SendMsg("1-3");
                     Thread.Sleep(3000);
                 }
-
+                
                 //6.设置FIB拍照参数——扫描时间、束流等
                 //7.控制FIB自动亮度、对比度
                 SendMsg("切换FIB控制");