Procházet zdrojové kódy

Merge branch 'EDS' of http://192.168.1.123:10080/SDD1/HOZ into EDS

gsp před 4 roky
rodič
revize
b4caac518d
1 změnil soubory, kde provedl 31 přidání a 28 odebrání
  1. 31 28
      MeasureThread/Measure.cs

+ 31 - 28
MeasureThread/Measure.cs

@@ -2679,12 +2679,12 @@ namespace MeasureThread
                         log.Error("测量线程报错:倾斜补偿角度为54度失败", false);
                         arg.Message = "角度补偿54度失败!";
                         arg.State = false;
-                        SendMsg("1-0");
+                        SendMsg("0-2");
                         return false;
                     }
                     arg.Message = "角度补偿54度成功!";
                     arg.State = true;
-                    SendMsg("1-0");
+                    SendMsg("0-2");
                     Thread.Sleep(1000);
                     //判断是否停止进程
                     if (key_stop)
@@ -2715,7 +2715,7 @@ namespace MeasureThread
                 {
                     arg.Message = "拉直操作自动对焦成功!";
                     arg.State = true;
-                    SendMsg("1-3");
+                    SendMsg("1-0");
                     Thread.Sleep(1000);
                     arg.Message = "拉直拍照成功!";
                     arg.Picture_Information.Picture_FullPath = "";
@@ -2728,7 +2728,7 @@ namespace MeasureThread
                     Thread.Sleep(1000);
                 }
 
-                //13. 自动 定位功能  
+                //13. 自动 定位功能 PT沉积 
                 log.Warn("测量线程:第一个孔的测试过程-自动定位开始!", true);
                 if (!GetPoistion())
                 {
@@ -2876,12 +2876,12 @@ namespace MeasureThread
                 {
                     arg.Message = "角度补偿54度失败!";
                     arg.State = false;
-                    SendMsg("1-0");
+                    SendMsg("0-2");
                     return false;
                 }
                 arg.Message = "角度补偿54度成功!";
                 arg.State = true;
-                SendMsg("1-0");
+                SendMsg("0-2");
                 Thread.Sleep(2000);
                 //判断是否停止进程
                 if (key_stop)
@@ -2909,7 +2909,7 @@ namespace MeasureThread
             {
                 arg.Message = "拉直操作自动对焦成功!";
                 arg.State = true;
-                SendMsg("1-3");
+                SendMsg("1-0");
                 Thread.Sleep(1000);
                 arg.Message = "拉直拍照成功!";
                 arg.Picture_Information.Picture_FullPath = "";
@@ -3244,7 +3244,7 @@ namespace MeasureThread
                 log.Error("测量线程报错:拉直操作自动对焦失败,程序退出。", false);
                 arg.Message = "拉直操作自动对焦失败!";
                 arg.State = false;
-                SendMsg("1-3");
+                SendMsg("1-0");
                 return false;
             }
 
@@ -3259,7 +3259,7 @@ namespace MeasureThread
 
             arg.Message = "拉直操作自动对焦成功!";
             arg.State = true;
-            SendMsg("1-3");
+            SendMsg("1-0");
             //判断是否停止进程
             if (key_stop)
             {
@@ -5619,7 +5619,7 @@ namespace MeasureThread
 
 
                 iExtender.GrabImage(edsfn, 0, 0, 0, 0, 0);//get the field eds image where the anylysis point locate.
-
+                SendMsg("4-5");//向界面发送指令:能谱拍照
                 //arg.State = false;
                 arg.Message = "";
                 arg.Picture_Information.Picture_FullPath = edsfn;
@@ -5897,7 +5897,7 @@ namespace MeasureThread
             {
                 arg.Message = "放大" + mag.ToString("0.0") + "倍失败";
                 arg.State = false;
-                SendMsg("3-1");
+                //SendMsg("3-1");
                 log.Error("测量线程报错:" + arg.Message, false);
                 return false;
             }
@@ -5970,6 +5970,7 @@ namespace MeasureThread
             log.Info("测量线程:图像处理接口,准备移动样品台", true);
             log.Info("文件名=" + fileName4, true);
             wr.Img_Trapezoid_Top_Center_Position(fileName4, Convert.ToInt32(MParam.SampleName), MParam.Firm, out x2, out y2, out state);
+            SendMsg("4-2");
             log.Info("梯形中心点返回数据=" + x2.ToString() + ", " + y2.ToString(), true);
             log.Info("准备移动样品台返回状态=" + state.ToString(), true);
             if (state == 1)
@@ -6015,7 +6016,7 @@ namespace MeasureThread
             {
                 arg.Message = "图像接口参数state返回值为零";
                 arg.State = false;
-                SendMsg("3-3");
+                //SendMsg("3-3");
                 if (hand_intervene == 1)
                 {
                     if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
@@ -6036,7 +6037,7 @@ namespace MeasureThread
                 log.Info("停止键按下", true);
                 return false;
             }
-
+            
             return true;
         }
 
@@ -6149,7 +6150,6 @@ namespace MeasureThread
                 return false;
             }
             Thread.Sleep(3000);
-
             //3、设置SEM补偿角度
             if (MParam.Is_Photograph == false)
             {
@@ -6171,6 +6171,7 @@ namespace MeasureThread
                     return false;
                 }
             }
+            SendMsg("4-4");
 
             //add by zjx 2020-12-21 根据客户的需求修改图片的名称
             String fileName5 = data_path + "\\EDS\\" + MParam.Firm + "-" + MParam.Photograph_Magnification.ToString("0") + "-" + m_cutHoles[m_nWorkHoleNo].HoleName + "-" + ImageName5;
@@ -6239,7 +6240,7 @@ namespace MeasureThread
 
                     arg.State = true;
                     arg.Message = "图像接口返回角度为:" + degree.ToString();
-                    SendMsg("3-8");
+                    //SendMsg("3-8");
 
                     if (hand_intervene == 1)
                     {
@@ -6250,7 +6251,7 @@ namespace MeasureThread
                 {
                     arg.Message = "图像接口参数State返回值为零";
                     arg.State = false;
-                    SendMsg("3-8");
+                    //SendMsg("3-8");
                     if (hand_intervene == 1)
                     {
                         if (DialogResult.Yes != MessageBox.Show("网络参数State返回为0。\n是否继续操作?。", "确认消息", MessageBoxButtons.YesNo))
@@ -6576,7 +6577,7 @@ namespace MeasureThread
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
-                SendMsg("4-5");//向界面发送指令:能谱拍照
+                
 
                 log.Warn("EDS获取指定观测点图片,并打Xray");
                 DoEDS(m_nWorkHoleNo, m_cutHoles[m_nWorkHoleNo].HoleName, 1);
@@ -6709,7 +6710,7 @@ namespace MeasureThread
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(100 + Convert.ToInt32(cycle_time));
-
+            //SendMsg("4-2");
             //6.调用161步过程
             log.Warn("开始梯形移到视野中心!");
             iSEM.SetMagnification(600);
@@ -6718,9 +6719,7 @@ namespace MeasureThread
             {
                 return false;
             }
-            SendMsg("4-2");
-            Thread.Sleep(200);
-            SendMsg("4-3");//向界面发送指令:移动到拍摄点位置
+            SendMsg("4-3");
             Thread.Sleep(500);
             //7.调用171步过程
 
@@ -6731,6 +6730,8 @@ namespace MeasureThread
             {
                 return false;
             }
+            //SendMsg("4-3");//向界面发送指令:移动到拍摄点位置
+            Thread.Sleep(200);
             return true;
         }
 
@@ -6817,10 +6818,7 @@ namespace MeasureThread
             {
                 using (System.Drawing.Image img = Image.FromFile(picFullPath))
                 {
-                    //Bitmap bmp = new Bitmap(img.Width, img.Height);
-                    // add by zjx 2020-12-24 根据客户要求把标尺的图片修改成8位颜色
                     Bitmap bmp = new Bitmap(img.Width, img.Height);
-                    // add by zjx 2020-12-24 根据客户要求把标尺的图片修改成8位颜色 end
                     using (Graphics g = Graphics.FromImage(bmp))
                     {
                         g.DrawImage(img, 0, 0, img.Width, img.Height);
@@ -6829,10 +6827,15 @@ namespace MeasureThread
                         SolidBrush sbrush = new SolidBrush(Color.LimeGreen);
                         g.DrawString(str, font, sbrush, new PointF(40, img.Height - 30));
                     }
-                    String path1 = Path.GetDirectoryName(picFullPath) + Path.GetFileNameWithoutExtension(picFullPath) + "_Data." + Path.GetExtension(picFullPath);
-                    log.Info("Path.GetDirectoryName(picFullPath)==" + Path.GetDirectoryName(picFullPath) + "Path.GetFileNameWithoutExtension(picFullPath)==" + Path.GetFileNameWithoutExtension(picFullPath) + "Path.GetExtension(picFullPath)==" + Path.GetExtension(picFullPath), true);
-                    log.Info("在测量图上显示放大倍数和像素大小信息===============" + path1, true);
-                    bmp.Save(path1);
+                    System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
+                    Bitmap newBitmap = new Bitmap(img.Width, img.Height, bmpData.Stride, System.Drawing.Imaging.PixelFormat.Format8bppIndexed, bmpData.Scan0);
+
+                    String path = Path.GetDirectoryName(picFullPath) +
+                        Path.GetFileNameWithoutExtension(picFullPath) +
+                        "_Data" + Path.GetExtension(picFullPath);
+
+                    newBitmap.SetResolution(1, 1);
+                    newBitmap.Save(path);
                 }
             }
             catch