瀏覽代碼

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

# Conflicts:
#	HOZProject/UserControls/UControl_Init.cs
#	MeasureThread/Measure.cs
HaoShuang 4 年之前
父節點
當前提交
7479bf80b5

+ 7 - 1
HOZProject/App.config

@@ -5,7 +5,7 @@
     </startup>
     <appSettings>
       <!--厂商_数据源-->
-      <add key="Firm" value="厂商A,厂商B,厂商C,厂商D"/>
+      <add key="Firm" value="N-BOG,LG,SDC"/>
       <!--样品类型_数据源-->
       <add key="Sample_Type" value="0,1,2"/>
       <!--拍照的工作电压_数据源-->
@@ -48,9 +48,15 @@
       <add key="PT_Depostion" value="False"/>
       <!--FIB的放大倍数-->
       <add key="FIB_Magnification" value="1500"/>
+      <!--层高分析的放大倍数-->
+      <add key="FH_Magnification" value="1500"/>
+      <!--层高分析的电压-->
+      <add key="FH_Voltage" value="3000"/>
       
       <!--自动对焦模式,手动1,自有2,客户3-->
       <add key="Focus_Mode" value="2"/>
+      <!--图像接口模式,人工干预-1,自动运算-2-->
+      <add key="Hand_Intervene" value="2"/>
 
       <!--远程IP地址-->
       <add key="WebServerIP" value="127.0.0.1"/>

+ 31 - 30
HOZProject/FormHOZMain.Designer.cs

@@ -88,7 +88,7 @@
             this.plMain.Controls.Add(this.plLeft);
             this.plMain.Controls.Add(this.plTop);
             this.plMain.Location = new System.Drawing.Point(16, 15);
-            this.plMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plMain.Margin = new System.Windows.Forms.Padding(4);
             this.plMain.Name = "plMain";
             this.plMain.Size = new System.Drawing.Size(1333, 895);
             this.plMain.TabIndex = 1;
@@ -105,7 +105,7 @@
             this.plFill.Controls.Add(this.pbImage);
             this.plFill.Controls.Add(this.plSEM);
             this.plFill.Location = new System.Drawing.Point(141, 108);
-            this.plFill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plFill.Margin = new System.Windows.Forms.Padding(4);
             this.plFill.Name = "plFill";
             this.plFill.Size = new System.Drawing.Size(1192, 788);
             this.plFill.TabIndex = 5;
@@ -119,9 +119,9 @@
             this.groupBox1.Controls.Add(this.textBox2);
             this.groupBox1.ForeColor = System.Drawing.Color.White;
             this.groupBox1.Location = new System.Drawing.Point(925, 2);
-            this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
             this.groupBox1.Size = new System.Drawing.Size(267, 125);
             this.groupBox1.TabIndex = 26;
             this.groupBox1.TabStop = false;
@@ -131,7 +131,7 @@
             // textBox1
             // 
             this.textBox1.Location = new System.Drawing.Point(8, 25);
-            this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.textBox1.Margin = new System.Windows.Forms.Padding(4);
             this.textBox1.Name = "textBox1";
             this.textBox1.Size = new System.Drawing.Size(132, 25);
             this.textBox1.TabIndex = 21;
@@ -141,7 +141,7 @@
             // 
             this.button1.ForeColor = System.Drawing.Color.Black;
             this.button1.Location = new System.Drawing.Point(159, 25);
-            this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.button1.Margin = new System.Windows.Forms.Padding(4);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(100, 92);
             this.button1.TabIndex = 24;
@@ -156,7 +156,7 @@
             "True",
             "False"});
             this.comboBox1.Location = new System.Drawing.Point(8, 92);
-            this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
             this.comboBox1.Name = "comboBox1";
             this.comboBox1.Size = new System.Drawing.Size(132, 23);
             this.comboBox1.TabIndex = 25;
@@ -164,7 +164,7 @@
             // textBox2
             // 
             this.textBox2.Location = new System.Drawing.Point(8, 59);
-            this.textBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.textBox2.Margin = new System.Windows.Forms.Padding(4);
             this.textBox2.Name = "textBox2";
             this.textBox2.Size = new System.Drawing.Size(132, 25);
             this.textBox2.TabIndex = 22;
@@ -174,7 +174,7 @@
             // 
             this.plPrarInfo.BackColor = System.Drawing.Color.White;
             this.plPrarInfo.Location = new System.Drawing.Point(0, 0);
-            this.plPrarInfo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plPrarInfo.Margin = new System.Windows.Forms.Padding(4);
             this.plPrarInfo.Name = "plPrarInfo";
             this.plPrarInfo.Size = new System.Drawing.Size(291, 125);
             this.plPrarInfo.TabIndex = 2;
@@ -196,7 +196,7 @@
             // 
             this.pbImage.Dock = System.Windows.Forms.DockStyle.Fill;
             this.pbImage.Location = new System.Drawing.Point(0, 0);
-            this.pbImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbImage.Margin = new System.Windows.Forms.Padding(4);
             this.pbImage.Name = "pbImage";
             this.pbImage.Size = new System.Drawing.Size(1192, 718);
             this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@@ -210,7 +210,7 @@
             this.plSEM.Controls.Add(this.lblFlowContent);
             this.plSEM.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.plSEM.Location = new System.Drawing.Point(0, 718);
-            this.plSEM.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plSEM.Margin = new System.Windows.Forms.Padding(4);
             this.plSEM.Name = "plSEM";
             this.plSEM.Size = new System.Drawing.Size(1192, 70);
             this.plSEM.TabIndex = 19;
@@ -246,7 +246,7 @@
             this.plLeft.Controls.Add(this.plLeftContent);
             this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
             this.plLeft.Location = new System.Drawing.Point(0, 100);
-            this.plLeft.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plLeft.Margin = new System.Windows.Forms.Padding(4);
             this.plLeft.Name = "plLeft";
             this.plLeft.Size = new System.Drawing.Size(133, 795);
             this.plLeft.TabIndex = 4;
@@ -257,7 +257,7 @@
             this.label1.BackColor = System.Drawing.Color.Transparent;
             this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.ForeColor = System.Drawing.Color.Gainsboro;
-            this.label1.Location = new System.Drawing.Point(29, 4);
+            this.label1.Location = new System.Drawing.Point(24, 4);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(87, 15);
@@ -271,7 +271,7 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             this.plLeftContent.AutoScroll = true;
             this.plLeftContent.Location = new System.Drawing.Point(7, 24);
-            this.plLeftContent.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plLeftContent.Margin = new System.Windows.Forms.Padding(4);
             this.plLeftContent.Name = "plLeftContent";
             this.plLeftContent.Size = new System.Drawing.Size(120, 771);
             this.plLeftContent.TabIndex = 0;
@@ -293,7 +293,7 @@
             this.plTop.Controls.Add(this.pbNew);
             this.plTop.Dock = System.Windows.Forms.DockStyle.Top;
             this.plTop.Location = new System.Drawing.Point(0, 0);
-            this.plTop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plTop.Margin = new System.Windows.Forms.Padding(4);
             this.plTop.Name = "plTop";
             this.plTop.Size = new System.Drawing.Size(1333, 100);
             this.plTop.TabIndex = 3;
@@ -305,7 +305,7 @@
             this.pbStop.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbStop.Enabled = false;
             this.pbStop.Location = new System.Drawing.Point(596, 5);
-            this.pbStop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbStop.Margin = new System.Windows.Forms.Padding(4);
             this.pbStop.Name = "pbStop";
             this.pbStop.Size = new System.Drawing.Size(91, 89);
             this.pbStop.TabIndex = 8;
@@ -320,7 +320,7 @@
             this.pbPause.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbPause.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbPause.Location = new System.Drawing.Point(695, 5);
-            this.pbPause.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbPause.Margin = new System.Windows.Forms.Padding(4);
             this.pbPause.Name = "pbPause";
             this.pbPause.Size = new System.Drawing.Size(91, 89);
             this.pbPause.TabIndex = 8;
@@ -333,7 +333,7 @@
             this.pbStart.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbStart.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbStart.Location = new System.Drawing.Point(497, 5);
-            this.pbStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbStart.Margin = new System.Windows.Forms.Padding(4);
             this.pbStart.Name = "pbStart";
             this.pbStart.Size = new System.Drawing.Size(91, 89);
             this.pbStart.TabIndex = 8;
@@ -349,7 +349,7 @@
             this.pbMax.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbMax.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbMax.Location = new System.Drawing.Point(1247, 0);
-            this.pbMax.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbMax.Margin = new System.Windows.Forms.Padding(4);
             this.pbMax.Name = "pbMax";
             this.pbMax.Size = new System.Drawing.Size(37, 39);
             this.pbMax.TabIndex = 7;
@@ -365,7 +365,7 @@
             this.pbMin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbMin.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbMin.Location = new System.Drawing.Point(1201, 0);
-            this.pbMin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbMin.Margin = new System.Windows.Forms.Padding(4);
             this.pbMin.Name = "pbMin";
             this.pbMin.Size = new System.Drawing.Size(37, 39);
             this.pbMin.TabIndex = 7;
@@ -381,7 +381,7 @@
             this.pbClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbClose.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbClose.Location = new System.Drawing.Point(1292, 0);
-            this.pbClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbClose.Margin = new System.Windows.Forms.Padding(4);
             this.pbClose.Name = "pbClose";
             this.pbClose.Size = new System.Drawing.Size(37, 39);
             this.pbClose.TabIndex = 7;
@@ -396,7 +396,7 @@
             this.pbImportTemplateFile.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbImportTemplateFile.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbImportTemplateFile.Location = new System.Drawing.Point(299, 5);
-            this.pbImportTemplateFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbImportTemplateFile.Margin = new System.Windows.Forms.Padding(4);
             this.pbImportTemplateFile.Name = "pbImportTemplateFile";
             this.pbImportTemplateFile.Size = new System.Drawing.Size(91, 89);
             this.pbImportTemplateFile.TabIndex = 6;
@@ -409,7 +409,7 @@
             this.pbLog.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbLog.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbLog.Location = new System.Drawing.Point(396, 5);
-            this.pbLog.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbLog.Margin = new System.Windows.Forms.Padding(4);
             this.pbLog.Name = "pbLog";
             this.pbLog.Size = new System.Drawing.Size(91, 89);
             this.pbLog.TabIndex = 6;
@@ -422,7 +422,7 @@
             this.pbInit.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbInit.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbInit.Location = new System.Drawing.Point(201, 5);
-            this.pbInit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbInit.Margin = new System.Windows.Forms.Padding(4);
             this.pbInit.Name = "pbInit";
             this.pbInit.Size = new System.Drawing.Size(91, 89);
             this.pbInit.TabIndex = 5;
@@ -435,7 +435,7 @@
             this.pbSave.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbSave.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbSave.Location = new System.Drawing.Point(104, 5);
-            this.pbSave.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbSave.Margin = new System.Windows.Forms.Padding(4);
             this.pbSave.Name = "pbSave";
             this.pbSave.Size = new System.Drawing.Size(91, 89);
             this.pbSave.TabIndex = 4;
@@ -448,7 +448,7 @@
             this.pbOpen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbOpen.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbOpen.Location = new System.Drawing.Point(7, 5);
-            this.pbOpen.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbOpen.Margin = new System.Windows.Forms.Padding(4);
             this.pbOpen.Name = "pbOpen";
             this.pbOpen.Size = new System.Drawing.Size(91, 89);
             this.pbOpen.TabIndex = 3;
@@ -461,7 +461,7 @@
             this.pbNew.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbNew.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbNew.Location = new System.Drawing.Point(7, 5);
-            this.pbNew.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbNew.Margin = new System.Windows.Forms.Padding(4);
             this.pbNew.Name = "pbNew";
             this.pbNew.Size = new System.Drawing.Size(91, 89);
             this.pbNew.TabIndex = 3;
@@ -478,12 +478,13 @@
             this.ControlBox = false;
             this.Controls.Add(this.plMain);
             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(4);
+            this.MinimumSize = new System.Drawing.Size(1365, 925);
             this.Name = "FormHOZMain";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "FormHOZMain";
-            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             this.Load += new System.EventHandler(this.FormHOZMain_Load);
+            this.Resize += new System.EventHandler(this.FormHOZMain_Resize);
             this.plMain.ResumeLayout(false);
             this.plFill.ResumeLayout(false);
             this.groupBox1.ResumeLayout(false);

+ 77 - 3
HOZProject/FormHOZMain.cs

@@ -19,6 +19,54 @@ namespace HOZProject
 {
     public partial class FormHOZMain : Form
     {
+        #region 控制窗体可以调整大小用
+        const int HTLEFT = 10;
+        const int HTRIGHT = 11;
+        const int HTTOP = 12;
+        const int HTTOPLEFT = 13;
+        const int HTTOPRIGHT = 14;
+        const int HTBOTTOM = 15;
+        const int HTBOTTOMLEFT = 0x10;
+        const int HTBOTTOMRIGHT = 17;
+        protected override void WndProc(ref Message m)
+        {
+            switch (m.Msg)
+            {
+                case 0x0084:
+                    base.WndProc(ref m);
+                    Point vPoint = new Point((int)m.LParam & 0xFFFF,
+                        (int)m.LParam >> 16 & 0xFFFF);
+                    vPoint = PointToClient(vPoint);
+                    if (vPoint.X <= 5)
+                        if (vPoint.Y <= 5)
+                            m.Result = (IntPtr)HTTOPLEFT;
+                        else if (vPoint.Y >= ClientSize.Height - 5)
+                            m.Result = (IntPtr)HTBOTTOMLEFT;
+                        else m.Result = (IntPtr)HTLEFT;
+                    else if (vPoint.X >= ClientSize.Width - 5)
+                        if (vPoint.Y <= 5)
+                            m.Result = (IntPtr)HTTOPRIGHT;
+                        else if (vPoint.Y >= ClientSize.Height - 5)
+                            m.Result = (IntPtr)HTBOTTOMRIGHT;
+                        else m.Result = (IntPtr)HTRIGHT;
+                    else if (vPoint.Y <= 5)
+                        m.Result = (IntPtr)HTTOP;
+                    else if (vPoint.Y >= ClientSize.Height - 5)
+                        m.Result = (IntPtr)HTBOTTOM;
+                    break;
+                case 0x0201://鼠标左键按下的消息 
+                    m.Msg = 0x00A1;//更改消息为非客户区按下鼠标 
+                    m.LParam = IntPtr.Zero;//默认值 
+                    m.WParam = new IntPtr(2);//鼠标放在标题栏内 
+                    base.WndProc(ref m);
+                    break;
+                default:
+                    base.WndProc(ref m);
+                    break;
+            }
+        }
+        #endregion
+
         #region 成员变量
         public BackgroundWorker m_BackgroundWorker;// 申明后台对象
         /// <summary>
@@ -124,6 +172,8 @@ namespace HOZProject
                 m_Ms.M_Min = Convert.ToSingle(ConfigurationManager.AppSettings["M_Min"]);
                 m_Ms.M_Max = Convert.ToSingle(ConfigurationManager.AppSettings["M_Max"]);
 
+                //人工干预
+                m_Ms.hand_intervene = Convert.ToInt32(ConfigurationManager.AppSettings["Hand_Intervene"]);
 
                 m_Ms.InitMeas(m_MeasureFile);
                 //注册事件
@@ -403,6 +453,7 @@ namespace HOZProject
                 uControl_Init = new UControl_Init(this);
                 uControl_Init.ReloadConfig();
             }
+            
             m_MeasureFile.MParam = uControl_Init.GetMeasureParam();
         }
 
@@ -496,8 +547,18 @@ namespace HOZProject
             //判断保存的路径是否存在
             if (!Directory.Exists(m_TemplateFilePath))
             {
-                //创建路径
-                Directory.CreateDirectory(m_TemplateFilePath);
+                ////创建路径
+                //Directory.CreateDirectory(m_TemplateFilePath);
+                FolderBrowserDialog dialog = new FolderBrowserDialog();
+                dialog.Description = "请选择文件路径";
+                //dialog.RootFolder = Environment.SpecialFolder.Programs;
+                if (dialog.ShowDialog() == DialogResult.OK)
+                {
+                    m_TemplateFilePath = dialog.SelectedPath;
+                    config.AppSettings.Settings["TemplateFilePath"].Value = m_TemplateFilePath;
+                    config.Save(ConfigurationSaveMode.Modified);
+                    ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
+                }
             }
             //打开默认路径
             OpenFileDialog openFileDialog = new OpenFileDialog();
@@ -686,6 +747,8 @@ namespace HOZProject
                                 //失败
                                 case (int)ThreadState.Failed:
                                     uControl_ParaInfo.lblShowState.Text = "失败";
+                                    uControl_ParaInfo.pbMeasure.Value = 100;
+                                    uControl_ParaInfo.lblCompletedAmount.Text = "100%";
                                     break;
                             }
                             break;
@@ -830,6 +893,17 @@ namespace HOZProject
             }
         }
         #endregion
-        
+
+        private void FormHOZMain_Resize(object sender, EventArgs e)
+        {
+            plMain.Left = 12;
+            plMain.Top = 12;
+            plMain.Width = this.Width - 24;
+            plMain.Height = this.Height - 24;
+            plFill.Width = plMain.Width - plLeft.Width - 4;
+            plFill.Height = plMain.Height - plTop.Height - 4;
+            plFill.Left = plLeft.Width + 4;
+            plFill.Top = plTop.Height + 4;
+        }
     }
 }

+ 13 - 1
HOZProject/Program.cs

@@ -17,9 +17,21 @@ namespace HOZProject
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new FormUCMain());
-            Application.Run(new FormHOZMain());
+            //Application.Run(new FormHOZMain());
             //Application.Run(new FormMeasureTest());
             //Application.Run(new FormUnitControl());
+            bool createdNew;//返回是否赋予了使用线程的互斥体初始所属权 
+            System.Threading.Mutex instance = new System.Threading.Mutex(true, "MutexName", out createdNew); //同步基元变量 
+            if (createdNew) //赋予了线程初始所属权,也就是首次使用互斥体 
+            {
+                Application.Run(new FormHOZMain());
+                instance.ReleaseMutex();
+            }
+            else
+            {
+                MessageBox.Show("已经启动了一个程序,请先退出!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                Application.Exit();
+            }
         }
     }
 }

+ 28 - 4
HOZProject/UserControls/UControl_Init.cs

@@ -283,7 +283,14 @@ namespace HOZProject
         #region 创建与读取样品参数、配置文件
         private void btnCreateConfig_Click(object sender, EventArgs e)
         {
-            SaveTemplateFile();
+            if (Convert.ToInt32(cbbWFIB.Text) < 200)
+            {
+                MessageBox.Show("FIB最小放大倍数为200倍");
+            }
+            else
+            {
+                SaveTemplateFile();
+            }
         }
         /// <summary>
         /// 获取测量参数,初始化窗体中的控件信息
@@ -350,7 +357,17 @@ namespace HOZProject
                 if (!Directory.Exists(m_TemplateFilePath))
                 {
                     //创建路径
-                    Directory.CreateDirectory(m_TemplateFilePath);
+                    //Directory.CreateDirectory(m_TemplateFilePath);
+                    FolderBrowserDialog dialog = new FolderBrowserDialog();
+                    dialog.Description = "请选择文件路径";
+                    //dialog.RootFolder = Environment.SpecialFolder.Programs;
+                    if (dialog.ShowDialog() == DialogResult.OK)
+                    {
+                        m_TemplateFilePath = dialog.SelectedPath;
+                        config.AppSettings.Settings["TemplateFilePath"].Value = m_TemplateFilePath;
+                        config.Save(ConfigurationSaveMode.Modified);
+                        ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
+                    }
                 }
             }
             SaveFileDialog saveFileDialog = new SaveFileDialog();
@@ -692,9 +709,16 @@ namespace HOZProject
         /// <param name="e"></param>
         private void btnSaveDefalutPara_Click(object sender, EventArgs e)
         {
-            if (EditConfig())
+            if (Convert.ToInt32(cbbWFIB.Text) < 200)
+            {
+                MessageBox.Show("FIB最小放大倍数为200倍");
+            }
+            else
             {
-                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                if (EditConfig())
+                {
+                    MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                }
             }
         }
         #endregion

+ 2 - 2
HOZProject/UserControls/UControl_ParaInfo.Designer.cs

@@ -628,13 +628,13 @@
         private System.Windows.Forms.ImageList imageList1;
         private System.Windows.Forms.Panel panel3;
         private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.ProgressBar pbMeasure;
+        public System.Windows.Forms.ProgressBar pbMeasure;
         private System.Windows.Forms.Panel panel4;
         private System.Windows.Forms.Label label8;
         private System.Windows.Forms.PictureBox pbClose;
         private System.Windows.Forms.Panel plTimeLine;
         public System.Windows.Forms.Label lblShowState;
-        private System.Windows.Forms.Label lblCompletedAmount;
+        public System.Windows.Forms.Label lblCompletedAmount;
         public System.Windows.Forms.CheckBox CkIsSwitch;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Label label10;

+ 45 - 14
HOZProject/UserControls/UControl_ParaInfo.cs

@@ -121,10 +121,25 @@ namespace HOZProject
                 }
                 try
                 {
-                    int pbValue = (int)((float)finishCount / (float)unFinishedCount*100);
-                    pbMeasure.Value = pbValue;
-                    lblCompletedAmount.Text = pbValue + "%";
+                    if (lblShowState.Text == "失败")
+                    {
+                        pbMeasure.Value = 100;
+                        lblCompletedAmount.Text = "100%";
+                    }
+                    else
+                    {
+                        int pbValue = (int)((float)finishCount / (float)unFinishedCount * 100);
+                        pbMeasure.Value = pbValue;
+                        lblCompletedAmount.Text = pbValue + "%";
+                    }
+
                 }
+                //try
+                //{
+                //    int pbValue = (int)((float)finishCount / (float)unFinishedCount*100);
+                //    pbMeasure.Value = pbValue;
+                //    lblCompletedAmount.Text = pbValue + "%";
+                //}
                 catch (Exception)
                 {
 
@@ -160,27 +175,43 @@ namespace HOZProject
         {
             int multiple = 1000;
             //设置Position参数
-            lblX.Text = (Position.X * multiple).ToString("f3");
-            lblY.Text = (Position.Y * multiple).ToString("f3");
-            lblZ.Text = (Position.Z * multiple).ToString("f3");
+            lblX.Text = (Position.X * multiple).ToString("f2");
+            lblY.Text = (Position.Y * multiple).ToString("f2");
+            lblZ.Text = (Position.Z * multiple).ToString("f2");
             lblR.Text = Position.R.ToString();
             lblT.Text = Position.T.ToString();
             lblM.Text = (Position.M * multiple).ToString();
-            if(StartTime== "0001/1/1 0:00:00")
+            try
             {
-                lblShowStartTime.Text = "";
+                DateTime dtst = Convert.ToDateTime(StartTime);
+                if (dtst.Year != System.DateTime.Now.Year)
+                {
+                    lblShowStartTime.Text = "";
+                }
+                else
+                {
+                    lblShowStartTime.Text = StartTime;
+                }
             }
-            else
+            catch
             {
-                lblShowStartTime.Text = StartTime;
+                lblShowStartTime.Text = "";
             }
-            if (EndTime == "0001/1/1 0:00:00")
+            try
             {
-                lblShowEndTime.Text = "";
+                DateTime dtet = Convert.ToDateTime(EndTime);
+                if (dtet.Year != System.DateTime.Now.Year)
+                {
+                    lblShowEndTime.Text = "";
+                }
+                else
+                {
+                    lblShowEndTime.Text = EndTime;
+                }
             }
-            else
+            catch
             {
-                lblShowEndTime.Text = EndTime;
+                lblShowEndTime.Text = "";
             }
             
             //设置切孔状态

+ 12 - 0
MeasureData/FocusParam.cs

@@ -117,6 +117,18 @@ namespace MeasureData
             slo_fcsparam.Register("fStep", dfStep);
             slo_fcsparam.Register("Type", nType);
 
+            dUp.AssignValue(this.UP);
+            dDown.AssignValue(this.Down);
+            dStep.AssignValue(this.Step);
+            dRange.AssignValue(this.Range);
+            dfStep.AssignValue(this.fStep);
+
+            slo_fcsparam.Register("UP", dUp);
+            slo_fcsparam.Register("DOWN", dDown);
+            slo_fcsparam.Register("STEP", dStep);
+            slo_fcsparam.Register("RANGE", dRange);
+            slo_fcsparam.Register("FSTEP", dfStep);
+
             if (isStoring)
             {
                 slo_fcsparam.Serialize(true, xml, rootNode);

+ 123 - 118
MeasureThread/Measure.cs

@@ -412,6 +412,9 @@ namespace MeasureThread
         //扫描周期
         private float cycle_time = 0;
 
+        //人工干预
+        public int hand_intervene = 2;
+
         //样品台保护值
         public float X_Min = 0;
         public float X_Max = 0.13f;
@@ -1371,55 +1374,52 @@ namespace MeasureThread
                 }
 
                 //10.将照片传给客户,返回梯形位置坐标,及样品类型参数(是否需要PT沉积,PT坐标位置,PT宽度、PT高度、梯形上、下边及深度、扫描时间、束流、样品放大倍数1、样品放大倍数2等切割参数)
-                //if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
-                //{
-                //    arg.Message = "样品台移动到指定位置";
-                //    arg.State = true;
-                //    SendMsg("1-7");
-                //    x1 = iSEM.GetStageAtX();
-                //    y1 = iSEM.GetStageAtY();
-                //}
-                //else
-                //{
-                    LogManager.AddHardwareLog("准备移动样品台", true);
-                    LogManager.AddHardwareLog("文件名="+fileName2, true);
-                    LogManager.AddHardwareLog("样品类型="+m_MsParam.SampleName, true);
-                    LogManager.AddHardwareLog("供应商名称="+m_MsParam.Firm, true);
-                    wr.Img_Cut_Position(fileName2, Convert.ToInt32(m_MsParam.SampleName), m_MsParam.Firm, out x1, out y1, out x2, out y2, out state);
-                    LogManager.AddHardwareLog("FIB梯形左上角和右上角位置信息= " + x1.ToString() + ", " + y1.ToString() + ", " + x2.ToString() + ", " + y2.ToString(), true);
-                    LogManager.AddHardwareLog("准备移动样品台返回状态=" + state.ToString(), true);
-                    if (state == 1)
+
+                LogManager.AddHardwareLog("准备移动样品台", true);
+                LogManager.AddHardwareLog("文件名="+fileName2, true);
+                LogManager.AddHardwareLog("样品类型="+m_MsParam.SampleName, true);
+                LogManager.AddHardwareLog("供应商名称="+m_MsParam.Firm, true);
+                wr.Img_Cut_Position(fileName2, Convert.ToInt32(m_MsParam.SampleName), m_MsParam.Firm, out x1, out y1, out x2, out y2, out state);
+                LogManager.AddHardwareLog("FIB梯形左上角和右上角位置信息= " + x1.ToString() + ", " + y1.ToString() + ", " + x2.ToString() + ", " + y2.ToString(), true);
+                LogManager.AddHardwareLog("准备移动样品台返回状态=" + state.ToString(), true);
+                if (state == 1)
+                {
+                    //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                    float xc = (x1 + x2) / 2;
+                    float yc = (y1 + y2) / 2;
+                    if (!MoveToPix(xc,yc))
+                    {
+                        arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                        arg.State = false;
+                        SendMsg("1-13");
+                        return false;
+                    }
+                    arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置成功";
+                    arg.State = true;
+                    SendMsg("1-13");
+
+                    if (hand_intervene == 1)
+                    {
+                        MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
+                    }   
+                }
+                else
+                {
+                    arg.Message = "图像接口参数state返回值为零";
+                    arg.State = false;
+                    SendMsg("1-13");
+                    if(hand_intervene==1)
                     {
-                        //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
-                        float xc = (x1 + x2) / 2;
-                        float yc = (y1 + y2) / 2;
-                        if (!MoveToPix(xc,yc))
+                        if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
                         {
-                            arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                            arg.State = false;
-                            SendMsg("1-13");
                             return false;
                         }
-                        arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置成功";
-                        arg.State = true;
-                        SendMsg("1-13");
-
-                        //MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
-                        
                     }
                     else
                     {
-                        //if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
-                        //{
-                            arg.Message = "图像接口参数state返回值为零";
-                            arg.State = false;
-                            SendMsg("1-13");
-                            return false;
-                        //}
+                        return false;
                     }
-                    x1 = iSEM.GetStageAtX();
-                    y1 = iSEM.GetStageAtY();
-                //}
+                }
                 //判断是否停止进程
                 if (key_stop)
                 {
@@ -1670,13 +1670,20 @@ namespace MeasureThread
             wr.Img_Cut_Success(fileName31, fileName32, out state);
             if(state == 0)
             {
-                //if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
-                //{
-                    arg.Message = "图像接口参数state返回值为零";
-                    arg.State = false;
-                    SendMsg("1-21");
+                arg.Message = "图像接口参数state返回值为零";
+                arg.State = false;
+                SendMsg("1-21");
+                if (hand_intervene == 1)
+                {
+                    if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
                     return false;
-                //}
+                }
             }
             arg.State = true;
             arg.Message = "FIB切割校验成功";
@@ -1798,61 +1805,56 @@ namespace MeasureThread
 
             //4.将照片传给客户,获取偏移坐标,以及偏移角度
             //5.根据坐标控制SEM移动到切孔位置,居中
-            //这里是否用到拉直操作,我没有加
-            //if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
-            //{
-            //    arg.State = true;
-            //    arg.Message = "样品台移动到指定位置";
-            //    SendMsg("1-20");
-            //    x1 = iSEM.GetStageAtX();
-            //    y1 = iSEM.GetStageAtY();
-            //}
-            //else
-            //{
-                LogManager.AddHardwareLog("准备移动样品台", true);
-                LogManager.AddHardwareLog("文件名=" + fileName4, true);
-                wr.Img_Trapezoid_Top_Center_Position(fileName4,out x2, out y2, out state);
-                LogManager.AddHardwareLog("梯形中心点返回数据=" + x2.ToString() + ", " + y2.ToString(), true);
-                LogManager.AddHardwareLog("准备移动样品台返回状态=" + state.ToString(), true);
-                if (state == 1)
+            LogManager.AddHardwareLog("准备移动样品台", true);
+            LogManager.AddHardwareLog("文件名=" + fileName4, true);
+            wr.Img_Trapezoid_Top_Center_Position(fileName4,out x2, out y2, out state);
+            LogManager.AddHardwareLog("梯形中心点返回数据=" + x2.ToString() + ", " + y2.ToString(), true);
+            LogManager.AddHardwareLog("准备移动样品台返回状态=" + state.ToString(), true);
+            if (state == 1)
+            {
+                //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                if (!MoveToPix(x2, y2))
                 {
-                    //Straightening(angle, 65, 65, x1, y1, ref x2, ref y2);
-                    //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
-                    if (!MoveToPix(x2, y2))
+                    arg.State = false;
+                    arg.Message = "移动到新(" + x2.ToString() + "," + y2.ToString() + ")位置失败";
+                    SendMsg("1-25");
+                    return false;
+                }
+                //判断是否移动完成
+                while (true)
+                {
+                    Thread.Sleep(5000);
+                    if (iSEM.GetStageIs() == 0)
                     {
-                        arg.State = false;
-                        arg.Message = "移动到新(" + x2.ToString() + "," + y2.ToString() + ")位置失败";
-                        SendMsg("1-25");
-                        return false;
+                        break;
                     }
-                    //判断是否移动完成
-                    while (true)
+                }
+                arg.State = true;
+                arg.Message = "移动到新(" + x2.ToString() + "," + y2.ToString() + ")位置失败";
+                SendMsg("1-25");
+
+                if (hand_intervene == 1)
+                {
+                    MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
+                }
+            }
+            else
+            {
+                arg.Message = "图像接口参数state返回值为零";
+                arg.State = false;
+                SendMsg("1-25");
+                if (hand_intervene == 1)
+                {
+                    if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
                     {
-                        Thread.Sleep(5000);
-                        if (iSEM.GetStageIs() == 0)
-                        {
-                            break;
-                        }
+                        return false;
                     }
-                    arg.State = true;
-                    arg.Message = "移动到新(" + x2.ToString() + "," + y2.ToString() + ")位置失败";
-                    SendMsg("1-25");
-                    
-                    //MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
                 }
                 else
                 {
-                    //if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
-                    //{
-                        arg.Message = "图像接口参数state返回值为零";
-                        arg.State = false;
-                        SendMsg("1-25");
-                        return false;
-                    //}
+                    return false;
                 }
-                //x1 = iSEM.GetStageAtX();
-                //y1 = iSEM.GetStageAtY();
-            //}
+            }
             //判断是否停止进程
             if (key_stop)
             {
@@ -2007,17 +2009,6 @@ namespace MeasureThread
 
             if (m_MsParam.Is_Photograph == false)
             {
-                //6、获取偏移坐标,7、移动到位
-                //if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
-                //{
-                //    arg.Message = "样品台移动到指定位置";
-                //    arg.State = true;
-                //    SendMsg("1-26");
-                //    x1 = iSEM.GetStageAtX();
-                //    y1 = iSEM.GetStageAtY();
-                //}
-                //else
-                //{
                 //8,计算切割面区域偏移角度及方向
                 float degree = 0;
                 int direction = 0;
@@ -2036,21 +2027,28 @@ namespace MeasureThread
                     arg.Message = "图像接口返回角度为:" + degree.ToString();
                     SendMsg("1-30");
 
-                    //MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
+                    if (hand_intervene == 1)
+                    {
+                        MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
+                    }
                 }
                 else
                 {
-                    //if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
-                    //{
                     arg.Message = "图像接口参数State返回值为零";
                     arg.State = false;
                     SendMsg("1-30");
-                    return false;
-                    //}
+                    if(hand_intervene == 1)
+                    {
+                        if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
+                        {
+                            return false;
+                        }
+                    }
+                    else
+                    {
+                        return false;
+                    }
                 }
-                //x1 = iSEM.GetStageAtX();
-                //y1 = iSEM.GetStageAtY();
-                //}
                 //判断是否停止进程
                 if (key_stop)
                 {
@@ -2820,13 +2818,20 @@ namespace MeasureThread
             LogManager.AddHardwareLog("样品" + m_nWorkHoleNo.ToString() + "初始化拉直角度=" + degree.ToString(), true);
             if (state == 0)
             {
-                //if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
-                //{
-                    arg.Message = "华为接口参数state返回为零";
-                    arg.State = false;
-                    SendMsg("1-6");
+                arg.Message = "华为接口参数state返回为零";
+                arg.State = false;
+                SendMsg("1-6");
+                if (hand_intervene == 1)
+                {
+                    if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
                     return false;
-                //}
+                }
             }
             if (direction == 2)
             {