Sfoglia il codice sorgente

增加人工干预配置文件。

@wang_qi0307 4 anni fa
parent
commit
7ea51c7e81
3 ha cambiato i file con 131 aggiunte e 137 eliminazioni
  1. 6 0
      HOZProject/App.config
  2. 2 0
      HOZProject/FormHOZMain.cs
  3. 123 137
      MeasureThread/Measure.cs

+ 6 - 0
HOZProject/App.config

@@ -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"/>

+ 2 - 0
HOZProject/FormHOZMain.cs

@@ -105,6 +105,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);
                 //注册事件

+ 123 - 137
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;
@@ -1111,55 +1114,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)
                     {
-                        //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
-                        float xc = (x1 + x2) / 2;
-                        float yc = (y1 + y2) / 2;
-                        if (!MoveToPix(xc,yc))
+                        MessageBox.Show("Web返回数据移动是否正确?\n如果错误请手动移动到指定位置后按确认", "确认消息", MessageBoxButtons.OK);
+                    }   
+                }
+                else
+                {
+                    arg.Message = "图像接口参数state返回值为零";
+                    arg.State = false;
+                    SendMsg("1-13");
+                    if(hand_intervene==1)
+                    {
+                        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)
                 {
@@ -1389,13 +1389,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切割校验成功";
@@ -1517,61 +1524,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)
             {
@@ -1709,17 +1711,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;
@@ -1738,46 +1729,34 @@ 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)
                 {
                     return false;
                 }
 
-                ////11、自动对焦。与之前操作相同
-                //if (ImageFocus("1-28"))
-                //{
-                //    arg.Message = "自动对焦完成";
-                //    arg.State = true;
-                //    SendMsg("1-28");
-                //}
-                //else
-                //{
-                //    arg.Message = "自动对焦失败";
-                //    arg.State = false;
-                //    SendMsg("1-28");
-                //}
-                ////判断是否停止进程
-                //if (key_stop)
-                //{
-                //    return false;
-                //}
-
                 //12拍照
                 String fileName6 = data_path + "\\" + m_cutHoles[m_nWorkHoleNo].HoleName + "_" + m_MsParam.Photograph_Magnification.ToString("0") + "_" + ImageName6;
                 arg.Picture_Information.Picture_FullPath = fileName6;
@@ -2482,13 +2461,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)
             {