|
|
@@ -24,6 +24,7 @@ using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Windows.Media;
|
|
|
+using static NPOI.HSSF.Util.HSSFColor;
|
|
|
using static OTSDataType.otsdataconst;
|
|
|
using static OTSIncAReportApp.OTSReport_Export;
|
|
|
|
|
|
@@ -37,23 +38,48 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
//string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath;
|
|
|
ParticleData fielddata;
|
|
|
FieldImage imgAcc;
|
|
|
- /// <summary>
|
|
|
- /// DEV颗粒列表颗粒前20个谱图排序
|
|
|
- /// </summary>
|
|
|
- /// <param name="m_mbszclass"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public List<DataTable> Get_dev_kllb_data(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,BasicData basicData,out List<DataTable> a_FilteredData)
|
|
|
+
|
|
|
+
|
|
|
+ //ResultFile result;
|
|
|
+ /// <summary>
|
|
|
+ /// DEV颗粒列表颗粒前20个谱图排序
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="m_mbszclass"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<DataTable> Get_dev_kllb_data(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,BasicData basicData,out List<DataTable> a_FilteredData)
|
|
|
{
|
|
|
|
|
|
//------------------加载模块,获取数据-------------------------------------------------
|
|
|
string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath;
|
|
|
fielddata = new ParticleData(str_resultPath);
|
|
|
- imgAcc = new FieldImage(str_resultPath );
|
|
|
+ imgAcc = new FieldImage(str_resultPath);
|
|
|
List<DataTable> OutDt = new List<DataTable>();
|
|
|
a_FilteredData = new List<DataTable>();
|
|
|
|
|
|
List<DataTable> datas = basicData.GetMeasurements();
|
|
|
- for (int i = 0; i < datas.Count; i++)
|
|
|
+ DataTable SpliceMeasurements= basicData.GetSpliceMeasurements();
|
|
|
+
|
|
|
+ DataTable spliceAll = basicData.ObtainInformationOnSplicedParticles(m_otsreport_export);//拼接颗粒信息
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ResultFile result;
|
|
|
+ string sou = m_otsreport_export.m_ReportApp.m_conditionChoose.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
|
|
|
+ if (sou.Contains("+"))
|
|
|
+ {
|
|
|
+ MessageBox.Show("This function does not support multiple samples!");
|
|
|
+ result = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[0];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE)];
|
|
|
+ }
|
|
|
+ ParticlesGridDevidePage particlesGridDevide = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
|
|
|
+ particlesGridDevide.fldImgAccess = new FieldImage(result.FilePath);
|
|
|
+ particlesGridDevide.Particledata= new ParticleData(result.FilePath);
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < datas.Count; i++)
|
|
|
{
|
|
|
int serialNumber = 1;
|
|
|
if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.TCCleannessA/*|| m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA*/)
|
|
|
@@ -155,7 +181,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
- DataTable p1Data = fielddata.AddElementColumn(p1Data_b, m_mbszclass);
|
|
|
+ DataTable p1Data = fielddata.AddElementColumn(p1Data_b, m_mbszclass, spliceAll);
|
|
|
|
|
|
|
|
|
#region 插入颗粒部份
|
|
|
@@ -184,41 +210,123 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
DataTable table1=p1Data.Clone();
|
|
|
table1.ImportRow(p1Data.Rows[i_row]);
|
|
|
|
|
|
+ bool isSplice = false;
|
|
|
+ for (int b = 0; b < spliceAll.Rows.Count; b++)
|
|
|
+ {
|
|
|
+ if (spliceAll.Rows[b]["SubParticles"].ToString() == p1Data.Rows[i_row]["SubParticles"].ToString())
|
|
|
+ {
|
|
|
+ isSplice = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- Bitmap bp_particle = imgAcc.GetBitmapByParticleForUncombinedParticle(table1);
|
|
|
- bp_particle = imageProcessor.ResizeImageWithPadding(bp_particle, 120, 120, System.Drawing.Color.White);
|
|
|
- bp_particle.Tag = new List<string>() { p1Data.Rows[i_row]["FieldId"].ToString(), p1Data.Rows[i_row]["ParticleId"].ToString(), p1Data.Rows[i_row]["TypeId"].ToString() };
|
|
|
- //获取该颗粒的xray能谱图像
|
|
|
- DataTable DT_XR = ExportXRay(str_fieldid, str_particleid, fielddata);
|
|
|
- //ElementIcons.Add(DT_XR);
|
|
|
- System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
|
|
|
- str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
|
|
|
- Bitmap ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
|
|
|
- DataTable SegmentData = fielddata.GetSegment();
|
|
|
- Bitmap BinaryParticles = ImageSplicer.ParticleBinaryDiagram(SegmentData, Convert.ToInt32(str_fieldid), Convert.ToInt32(str_particleid));
|
|
|
- Bitmap BP = imageProcessor.ResizeImageWithPadding(BinaryParticles, 120, 120, System.Drawing.Color.White);
|
|
|
- //获取该颗粒的二次放大处理图像
|
|
|
- //Bitmap ls_processbitmap = OTSIncAReportGraph.Class.DrawFunction.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
|
|
|
- //再将图像转成二进制流-------------------------------------------------------------------
|
|
|
- //原图
|
|
|
- MemoryStream newms_p1 = new MemoryStream();
|
|
|
- bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+ //原图
|
|
|
+ Bitmap bp_particle;
|
|
|
//二次放大图
|
|
|
- MemoryStream newms_p2 = new MemoryStream();
|
|
|
- BP.Save(newms_p2, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
- //能谱图
|
|
|
- MemoryStream newms_p3 = new MemoryStream();
|
|
|
- ls_xraybpnew.Save(newms_p3, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
- //---------------------------------------------------------------------------------------
|
|
|
- DataRow dr = DT_Largest20.NewRow();
|
|
|
+ Bitmap BP;
|
|
|
+ //获取该颗粒的xray能谱图像
|
|
|
+ Bitmap ls_xraybpnew;
|
|
|
+
|
|
|
+ if (!isSplice)
|
|
|
+ {
|
|
|
+ //原图
|
|
|
+ bp_particle = imgAcc.GetBitmapByParticleForUncombinedParticle(table1);
|
|
|
+ bp_particle = imageProcessor.ResizeImageWithPadding(bp_particle, 120, 120, System.Drawing.Color.White);
|
|
|
+ bp_particle.Tag = new List<string>() { p1Data.Rows[i_row]["FieldId"].ToString(), p1Data.Rows[i_row]["ParticleId"].ToString(), p1Data.Rows[i_row]["TypeId"].ToString() };
|
|
|
+ MemoryStream newms_p1 = new MemoryStream();
|
|
|
+ bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+
|
|
|
+
|
|
|
+ //获取该颗粒的xray能谱图像
|
|
|
+ DataTable DT_XR = ExportXRay(str_fieldid, str_particleid, fielddata);
|
|
|
+ //ElementIcons.Add(DT_XR);
|
|
|
+ System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
|
|
|
+ str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
|
|
|
+ ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理 //能谱图
|
|
|
+ MemoryStream newms_p3 = new MemoryStream();
|
|
|
+ ls_xraybpnew.Save(newms_p3, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ DataTable SegmentData = fielddata.GetSegment();
|
|
|
+ Bitmap BinaryParticles = ImageSplicer.ParticleBinaryDiagram(SegmentData, Convert.ToInt32(str_fieldid), Convert.ToInt32(str_particleid));
|
|
|
+ BP = imageProcessor.ResizeImageWithPadding(BinaryParticles, 120, 120, System.Drawing.Color.White);
|
|
|
+ //二次放大图
|
|
|
+ MemoryStream newms_p2 = new MemoryStream();
|
|
|
+ BP.Save(newms_p2, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+
|
|
|
+ newms_p1.Dispose();
|
|
|
+ newms_p2.Dispose();
|
|
|
+ newms_p3.Dispose();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<string> strFieldId = new List<string>();
|
|
|
+ List<string> strXrayId = new List<string>();
|
|
|
+ string detailedLocation = p1Data.Rows[i_row]["SubParticles"].ToString();
|
|
|
+ string[] fruits = detailedLocation.Split(',');
|
|
|
+ for (int p2 = 0; p2 < fruits.Length; p2++)
|
|
|
+ {
|
|
|
+ string[] fruit = fruits[p2].Split(':');
|
|
|
+ strFieldId.Add(fruit[0]);
|
|
|
+ strXrayId.Add(fruit[1]);
|
|
|
+ }
|
|
|
+ DataTable SpliceData = p1Data.Clone();
|
|
|
+ for (int splice = 0; splice < SpliceMeasurements.Rows.Count; splice++)
|
|
|
+ {
|
|
|
+ for (int splice2 = 0; splice2 < strFieldId.Count; splice2++)
|
|
|
+ {
|
|
|
+ if (SpliceMeasurements.Rows[splice]["FieldId"].ToString() == strFieldId[splice2] && SpliceMeasurements.Rows[splice]["XrayId"].ToString() == strXrayId[splice2])
|
|
|
+ {
|
|
|
+ SpliceData.Rows.Add(SpliceMeasurements.Rows[splice].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ double pix = particlesGridDevide.result.GetPixelSize();
|
|
|
+ int bitHeight = particlesGridDevide.result.GetImageHeight();
|
|
|
+ int bitWidth = particlesGridDevide.result.GetImageWidth();
|
|
|
+
|
|
|
+
|
|
|
+ //原图
|
|
|
+ Bitmap original = particlesGridDevide.fldImgAccess.GetBitmapForParticleAll
|
|
|
+ (p1Data.Rows[i_row]["SubParticles"].ToString(), SpliceData, pix, bitHeight, bitWidth);
|
|
|
+ bp_particle= OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(original, 120, 120);
|
|
|
+ //黑白图
|
|
|
+ Dictionary<string, List<Segment>> segsData = new Dictionary<string, List<Segment>>();
|
|
|
+ foreach (DataRow dow in SpliceData.Rows)
|
|
|
+ {
|
|
|
+ int fldid = Convert.ToInt32(dow["fieldid"]);
|
|
|
+ int partid = Convert.ToInt32(dow["particleId"]);
|
|
|
+ var listseg = particlesGridDevide.Particledata.GetSegmentData(fldid, partid);
|
|
|
+ string key = dow["fieldid"].ToString() + "_" + dow["particleid"].ToString();
|
|
|
+ segsData.Add(key, listseg);
|
|
|
+ }
|
|
|
+ Bitmap black = particlesGridDevide.fldImgAccess.GetBitmapForParticleAllWithBlackAndWhite
|
|
|
+ (p1Data.Rows[i_row]["SubParticles"].ToString(), SpliceData, segsData, pix, bitHeight, bitWidth);
|
|
|
+ BP = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(black, 120, 120);
|
|
|
+
|
|
|
+ //谱图
|
|
|
+ Bitmap xraybpnew = splice_ExportXRayBitmap
|
|
|
+ (p1Data.Rows[i_row]["SubParticles"].ToString(), Convert.ToInt32(p1Data.Rows[i_row]["particleId"]),
|
|
|
+ Convert.ToInt32(p1Data.Rows[i_row]["fieldid"]), particlesGridDevide.Particledata, p1Data.Rows[i_row]["TypeName"].ToString());
|
|
|
+ ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(xraybpnew, 700, 115);//能谱图处理
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //---------------------------------------------------------------------------------------
|
|
|
+ DataRow dr = DT_Largest20.NewRow();
|
|
|
dr["p1"] = bp_particle;
|
|
|
dr["p2"] = BP;
|
|
|
dr["p3"] = ls_xraybpnew;
|
|
|
|
|
|
|
|
|
- newms_p1.Dispose();
|
|
|
- newms_p2.Dispose();
|
|
|
- newms_p3.Dispose();
|
|
|
+
|
|
|
dr["pid"] = serialNumber++.ToString();
|
|
|
//颗粒列表列中第一个可选参数
|
|
|
dr["Size"] = datatable_data(p1Data, i_row, m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p1);
|
|
|
@@ -302,7 +410,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
{
|
|
|
return SplicingParticlesData;
|
|
|
}
|
|
|
- ResultFile result = null;
|
|
|
+ ResultFile result;
|
|
|
string sou = m_otsreport_export.m_ReportApp.m_conditionChoose.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
|
|
|
if (sou.Contains("+"))
|
|
|
{
|
|
|
@@ -341,8 +449,25 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
/// <param name="file_pic"></param>
|
|
|
/// <param name="list_dt"></param>
|
|
|
/// <param name="m_otsreport_export"></param>
|
|
|
- public void Get_dev_kllb_data_frame_pic(c_TemplateClass m_mbszclass, out DataTable file_pic, out List<DataTable> list_dt, OTSReport_Export m_otsreport_export, List<DataTable> FrameData)
|
|
|
+ public void Get_dev_kllb_data_frame_pic(c_TemplateClass m_mbszclass, out DataTable file_pic, out List<DataTable> list_dt, OTSReport_Export m_otsreport_export, List<DataTable> a_FrameData)
|
|
|
{
|
|
|
+ //去除拼接后的颗粒
|
|
|
+ List<DataTable> FrameData = new List<DataTable>();
|
|
|
+ for (int i = 0; i < a_FrameData.Count; i++)
|
|
|
+ {
|
|
|
+ DataTable DT = a_FrameData[i].Clone();
|
|
|
+ for (int a = 0; a < a_FrameData[i].Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (a_FrameData[i].Rows[a]["SubParticles"].ToString() == "")
|
|
|
+ {
|
|
|
+ DT.Rows.Add(a_FrameData[i].Rows[a].ItemArray);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ FrameData.Add(DT);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
|
|
|
//根据sql条件,查询获取颗粒信息数据
|
|
|
ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
|
|
|
@@ -576,7 +701,36 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
ret_bp = control_XRayTable1.ExportXRayImage();
|
|
|
return ret_bp;
|
|
|
}
|
|
|
- private string datatable_data(DataTable dt, int it, string str)
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 输入颗粒的所在帧图id,颗粒id,颗粒类型id,获取对应的XRay能谱数据图
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private Bitmap splice_ExportXRayBitmap(string subParticleString,int a_particleId,int a_fieldid, ParticleData particleData,string a_TyoeName)
|
|
|
+ {
|
|
|
+ Bitmap ret_bp;
|
|
|
+ //显示xray相关信息
|
|
|
+ uint[] Analysis_xray = new uint[2000];
|
|
|
+
|
|
|
+ List<Element> list_celementchemistryclr = new List<Element>();
|
|
|
+ //获取Xray数据
|
|
|
+ Particle list = particleData.GetXrayByParticleIDAndFieldID(subParticleString, a_particleId, a_fieldid, out Analysis_xray);
|
|
|
+ List<ShowElementInfo> list_showelementinfo = particleData.GetShowElementInfos(list.ElementList);
|
|
|
+
|
|
|
+
|
|
|
+ //获取数据后,需要对xraytable设置
|
|
|
+ OTSIncAReportGraph.Controls.Control_XRayTable control_XRayTable1 = new Control_XRayTable();
|
|
|
+ control_XRayTable1.SetXRayShowLineValue(Analysis_xray, list_showelementinfo);
|
|
|
+ control_XRayTable1.MaterialName = a_TyoeName;
|
|
|
+ control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
|
|
|
+ control_XRayTable1.Visible = true;
|
|
|
+ control_XRayTable1.Invalidate();
|
|
|
+ control_XRayTable1.Refresh();
|
|
|
+ ret_bp = control_XRayTable1.ExportXRayImage();
|
|
|
+ return ret_bp;
|
|
|
+ }
|
|
|
+ private string datatable_data(DataTable dt, int it, string str)
|
|
|
{
|
|
|
if (str == "Hardness")
|
|
|
{
|
|
|
@@ -696,6 +850,8 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
|
|
|
{
|
|
|
|
|
|
DataTable dt;
|
|
|
+ string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath;
|
|
|
+ imgAcc = new FieldImage(str_resultPath);
|
|
|
|
|
|
if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
|
|
|
{
|