|
@@ -1,14 +1,18 @@
|
|
|
-using NPOI.HSSF.UserModel;
|
|
|
-using NPOI.SS.UserModel;
|
|
|
+using NPOI.SS.UserModel;
|
|
|
+using NPOI.SS.UserModel.Charts;
|
|
|
+using NPOI.SS.Util;
|
|
|
+using NPOI.XSSF.UserModel;
|
|
|
+using OTSCommon.Model;
|
|
|
using OTSIncAReportApp;
|
|
|
+using OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage;
|
|
|
using OTSIncAReportApp.DataOperation.DataAccess;
|
|
|
-using OTSCommon.Model;
|
|
|
using OTSIncAReportApp.SysMgrTools;
|
|
|
using OTSIncAReportGraph.Class;
|
|
|
+using OTSIncAReportGraph.Controls;
|
|
|
using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
|
|
|
using OTSIncAReportGrids.OTSIncAReportGridsFuncation;
|
|
|
using OTSIncAReportMailInterface;
|
|
|
-
|
|
|
+using OTSPeriodicTable;
|
|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
@@ -20,10 +24,6 @@ using System.Linq;
|
|
|
using System.Reflection;
|
|
|
using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
-using NPOI.XSSF.UserModel;
|
|
|
-using NPOI.SS.UserModel.Charts;
|
|
|
-using NPOI.SS.Util;
|
|
|
-using OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage;
|
|
|
|
|
|
namespace OTSIncAReportGrids
|
|
|
{
|
|
@@ -194,6 +194,23 @@ namespace OTSIncAReportGrids
|
|
|
Type dgvType = this.dgV_ParticlesDevidePage.GetType();
|
|
|
PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
pi.SetValue(this.dgV_ParticlesDevidePage, true, null);
|
|
|
+
|
|
|
+ this.control_XRayTable1 = new Control_XRayTable(null);
|
|
|
+ this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
|
|
+ this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
|
+ this.control_XRayTable1.GBInfoStr = "";
|
|
|
+ this.control_XRayTable1.GoodChineseName = "";
|
|
|
+ this.control_XRayTable1.MaterialName = "";
|
|
|
+ //this.control_XRayTable1.List_ShowElementInfo = ((System.Collections.Generic.List<OTSIncAReportGraph.Controls.ShowElementInfo>)(Resources.GetObject("control_XRayTable1.List_ShowElementInfo")));
|
|
|
+ this.control_XRayTable1.Location = new System.Drawing.Point(0, 400);
|
|
|
+ this.control_XRayTable1.Name = "control_XRayTable1";
|
|
|
+ this.control_XRayTable1.ShowAnalysisXray = true;
|
|
|
+ this.control_XRayTable1.ShowSearchXray = false;
|
|
|
+ this.control_XRayTable1.Size = new System.Drawing.Size(1004, 200);
|
|
|
+ this.control_XRayTable1.STDName = "";
|
|
|
+ this.control_XRayTable1.Visible = false;
|
|
|
+ this.control_XRayTable1.label_close.Visible = true;
|
|
|
+ this.Controls.Add(this.control_XRayTable1);
|
|
|
}
|
|
|
bool Init()
|
|
|
{
|
|
@@ -258,6 +275,8 @@ namespace OTSIncAReportGrids
|
|
|
cbB_PageSize.Items.Add("5000");
|
|
|
cbB_PageSize.Items.Add("All");
|
|
|
cbB_PageSize.SelectedIndex = 0;
|
|
|
+
|
|
|
+ dgV_ParticlesDevidePage.Focus();
|
|
|
}
|
|
|
|
|
|
#region 自定义方法
|
|
@@ -1460,7 +1479,20 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(tbx_Type.Text))
|
|
|
{
|
|
|
- condition += " and TypeName Like \"%" + tbx_Type.Text + "%\" ";
|
|
|
+ //string[] tr = tbx_Type.Text.Split(',');
|
|
|
+ //condition += "and (";
|
|
|
+ //for(int i=0;i<tr.Length;i++)
|
|
|
+ //{
|
|
|
+ // if(i==0)
|
|
|
+ // {
|
|
|
+ // condition += " TypeName = '"+ tr[i]+"'";
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // condition += " or TypeName = '" + tr[i] + "'";
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //condition += ")";
|
|
|
}
|
|
|
|
|
|
if (m_frm_userprogress.IsDisposed)
|
|
@@ -1498,31 +1530,6 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
private void cbB_order_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- //int ordernum = cbB_order.SelectedIndex;
|
|
|
- //if (ordernum == 0)
|
|
|
- //{
|
|
|
- // OrderFunction = "fieldid,particleid";
|
|
|
- //}
|
|
|
- //else if (ordernum == 1)
|
|
|
- //{
|
|
|
- // OrderFunction = "TypeName";
|
|
|
- //}
|
|
|
- //else if (ordernum == 2)
|
|
|
- //{
|
|
|
- // OrderFunction = "DMAX";
|
|
|
- //}
|
|
|
- //else if (ordernum == 3)
|
|
|
- //{
|
|
|
- // OrderFunction = "DMAX desc";
|
|
|
- //}
|
|
|
- //else if (ordernum == 4)
|
|
|
- //{
|
|
|
- // OrderFunction = "Area";
|
|
|
- //}
|
|
|
- //else if (ordernum == 5)
|
|
|
- //{
|
|
|
- // OrderFunction = "Area desc";
|
|
|
- //}
|
|
|
|
|
|
lnkFirst_Click(null, null);
|
|
|
SetDataGridViewStyle();
|
|
@@ -2497,7 +2504,6 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
private void dgV_ParticlesDevidePage_MouseDown(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
|
|
|
int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);
|
|
|
{
|
|
@@ -2635,10 +2641,121 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
private void dgV_ParticlesDevidePage_MouseUp(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
+ int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);
|
|
|
+ if (sel == (int)SelItem.MergeParticles)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
|
|
|
if (SelectRows.Count != 0)
|
|
|
{
|
|
|
+ if (SelectRows.Count == 1)
|
|
|
+ {
|
|
|
+ DataGridViewRow dgvr = SelectRows[0];
|
|
|
+ Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
|
|
|
+ List<string> list_str = (List<string>)ls_bp.Tag;
|
|
|
+
|
|
|
+
|
|
|
+ //显示xray相关信息
|
|
|
+ uint[] Search_xray = new uint[2000];
|
|
|
+ uint[] Analysis_xray = new uint[2000];
|
|
|
+ int i_xray_id = 0;
|
|
|
+ List<Element> list_celementchemistryclr = new List<Element>();
|
|
|
+ //获取Xray数据
|
|
|
+ ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(Convert.ToInt32(dgvr.Cells["particleId"].Value), Convert.ToInt32(dgvr.Cells["fieldid"].Value), out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
|
|
|
+
|
|
|
+ //get CElementChemistryClr list
|
|
|
+ List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
|
|
|
+ for (int i = 0; i < list_celementchemistryclr.Count; i++)
|
|
|
+ {
|
|
|
+ ShowElementInfo ls_sei = new ShowElementInfo();
|
|
|
+ ls_sei.ElementName = list_celementchemistryclr[i].Name;
|
|
|
+ ls_sei.Percentage = list_celementchemistryclr[i].Percentage;
|
|
|
+ ls_sei.dKF = Convert.ToDouble(CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).K_Peak);
|
|
|
+ double de_sx2 = 0;
|
|
|
+ if (CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak == "" || CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak == "-")
|
|
|
+ {
|
|
|
+ de_sx2 = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ de_sx2 = Convert.ToDouble(CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak);
|
|
|
+ }
|
|
|
+ ls_sei.dLF = de_sx2;
|
|
|
+ list_showelementinfo.Add(ls_sei);
|
|
|
+ }
|
|
|
+ string str_IncAName = "";
|
|
|
+ str_IncAName = Convert.ToString(dgvr.Cells[1].Value);
|
|
|
+ Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == Convert.ToInt32(dgvr.Cells["fieldid"].Value)).ParticleList.Find(x => x.ParticleId == Convert.ToInt32(dgvr.Cells["particleId"].Value));
|
|
|
+ control_XRayTable1.SetParticleInfo("Area:" + Math.Round(particle.Area, 2) + " " + "DELONG:" + Math.Round(particle.DELONG, 2) + " " + "DFERET:" + Math.Round(particle.DFERET, 2) + " " + "DINSCR:" + Math.Round(particle.DINSCR, 2) + " " + "DMAX:" + Math.Round(particle.DMAX, 2) + "\n" + "DMEAN:" + Math.Round(particle.DMEAN, 2) + " " + "DMIN:" + Math.Round(particle.DMIN, 2) + " " + "DPERP:" + Math.Round(particle.DPERP, 2) + " " + "ORIENTATION:" + Math.Round(particle.ORIENTATION, 2) + " " + "PERIMETER:" + Math.Round(particle.PERIMETER, 2));
|
|
|
+
|
|
|
+ //获取数据后,需要对xraytable设置
|
|
|
+ control_XRayTable1.Visible = true;
|
|
|
+ control_XRayTable1.SetXRayShowLineValue(null, Analysis_xray, list_showelementinfo);
|
|
|
+ //颗粒国标信息
|
|
|
+ control_XRayTable1.GBInfoStr = "";
|
|
|
+ control_XRayTable1.MaterialName = str_IncAName;//杂夹物
|
|
|
+
|
|
|
+ control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
|
|
|
+
|
|
|
+
|
|
|
+ string filePath = result.FilePath + "\\FIELD_FILES\\";
|
|
|
+ string imagePath = filePath + "Field" + dgvr.Cells["fieldid"].Value.ToString() + ".bmp";
|
|
|
+ Bitmap originalFieldImage=Particledata.ReadImageFile(imagePath);
|
|
|
+ string str = " particleId= " + dgvr.Cells["particleId"].Value.ToString() + " and fieldid = " + dgvr.Cells["fieldid"].Value.ToString();
|
|
|
+ DataRow[] drs = particles.Select(str);
|
|
|
+ if (drs.Length > 0)
|
|
|
+ {
|
|
|
+ Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(drs[0]["RectLeft"]), Y = Convert.ToInt32(drs[0]["RectTop"]), Width = Convert.ToInt32(drs[0]["RectWidth"]), Height = Convert.ToInt32(drs[0]["RectHeight"]) };
|
|
|
+ Bitmap dpImage = new Bitmap(originalFieldImage.Width, originalFieldImage.Height);
|
|
|
+ foreach (Segment seg in particle.SegmentList)
|
|
|
+ {
|
|
|
+ int f_length = seg.Length;
|
|
|
+ for (int m = 0; m < f_length; m++)
|
|
|
+ {
|
|
|
+ int lsjs_x = seg.Start + m;
|
|
|
+ int lsjs_y = seg.Height;
|
|
|
+ var pixelColor = originalFieldImage.GetPixel(lsjs_x, lsjs_y);
|
|
|
+ dpImage.SetPixel(lsjs_x, lsjs_y, pixelColor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Bitmap bmap = Particledata.GetBitmapByParticle(dpImage, rectangle);
|
|
|
+ Bitmap binarizedBmp = new Bitmap(bmap.Width, bmap.Height);
|
|
|
+ for (int x = 0; x < bmap.Width; x++)
|
|
|
+ {
|
|
|
+ for (int y = 0; y < bmap.Height; y++)
|
|
|
+ {
|
|
|
+ Color color = bmap.GetPixel(x, y);
|
|
|
+ if (color.A == 255&&color.B==0 && color.G == 0 && color.R == 0)
|
|
|
+ {
|
|
|
+ binarizedBmp.SetPixel(x, y, Color.White);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int grayValue = (color.R + color.G + color.B) / 3;
|
|
|
+ if(grayValue>0)
|
|
|
+ {
|
|
|
+ binarizedBmp.SetPixel(x, y, Color.Black);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ binarizedBmp.SetPixel(x, y, Color.White);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ control_XRayTable1.SetBitmapOfPictureBox(ls_bp, binarizedBmp);
|
|
|
+ Invalidate();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ control_XRayTable1.Visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
SaveParticleslist_select();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2649,6 +2766,94 @@ namespace OTSIncAReportGrids
|
|
|
ToolStripMenuItem_Delete_Particle_Click(null, null);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void dgV_ParticlesDevidePage_KeyUp(object sender, KeyEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.KeyData == Keys.Down)
|
|
|
+ {
|
|
|
+ dgV_ParticlesDevidePage_MouseUp(null, null);
|
|
|
+ }
|
|
|
+ if (e.KeyData == Keys.Up)
|
|
|
+ {
|
|
|
+ dgV_ParticlesDevidePage_MouseUp(null, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void tbx_Type_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ ParticleClassificationSelect particleClassificationSelect = new ParticleClassificationSelect(Particledata, tbx_Type.Text);
|
|
|
+ DialogResult result = particleClassificationSelect.ShowDialog();
|
|
|
+ if (result == DialogResult.OK)
|
|
|
+ {
|
|
|
+ condition = "";
|
|
|
+ tbx_Type.Text = particleClassificationSelect.ParticleClassificationSelected;
|
|
|
+ string[] tr = tbx_Type.Text.Split(',');
|
|
|
+ condition += " and (";
|
|
|
+ for (int i = 0; i < tr.Length; i++)
|
|
|
+ {
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ condition += " TypeName = '" + tr[i] + "'";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ condition += " or TypeName = '" + tr[i] + "'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ condition += ")";
|
|
|
+
|
|
|
+ if (m_frm_userprogress.IsDisposed)
|
|
|
+ {
|
|
|
+ ProgressStart();
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateTable();
|
|
|
+
|
|
|
+ lnkFirst_Click(null, null);
|
|
|
+ SetDataGridViewStyle();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void btn_particletypesel_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ ParticleClassificationSelect particleClassificationSelect = new ParticleClassificationSelect(Particledata, tbx_Type.Text);
|
|
|
+ DialogResult result = particleClassificationSelect.ShowDialog();
|
|
|
+ if (result == DialogResult.OK)
|
|
|
+ {
|
|
|
+ condition = "";
|
|
|
+ tbx_Type.Text = "";
|
|
|
+ if (particleClassificationSelect.ParticleClassificationSelected != "")
|
|
|
+ {
|
|
|
+ tbx_Type.Text = particleClassificationSelect.ParticleClassificationSelected;
|
|
|
+ string[] tr = tbx_Type.Text.Split(',');
|
|
|
+ condition += " and (";
|
|
|
+ for (int i = 0; i < tr.Length; i++)
|
|
|
+ {
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ condition += " TypeName = '" + tr[i] + "'";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ condition += " or TypeName = '" + tr[i] + "'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ condition += ")";
|
|
|
+ }
|
|
|
+ if (m_frm_userprogress.IsDisposed)
|
|
|
+ {
|
|
|
+ ProgressStart();
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateTable();
|
|
|
+
|
|
|
+ lnkFirst_Click(null, null);
|
|
|
+ SetDataGridViewStyle();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|