|
|
@@ -1,4 +1,6 @@
|
|
|
-using NPOI.SS.UserModel;
|
|
|
+using DevExpress.DataAccess.Sql;
|
|
|
+using DevExpress.PivotGrid.OLAP.SchemaEntities;
|
|
|
+using NPOI.SS.UserModel;
|
|
|
using NPOI.SS.UserModel.Charts;
|
|
|
using NPOI.SS.Util;
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
@@ -234,6 +236,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
string str_STDDbName = result.GetSTDName();
|
|
|
userSTDDb = new UserSTDDbAccess(str_STDDbName, result.FilePath + "\\");
|
|
|
+
|
|
|
userSTDDbData = userSTDDb.GetSqlHelper() != null ?
|
|
|
userSTDDb.GetSubAttributeFromDatabase() : null;
|
|
|
}
|
|
|
@@ -283,6 +286,7 @@ namespace OTSIncAReportGrids
|
|
|
.Select(row => row["TypeName"].ToString()));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
#region 自定义方法
|
|
|
|
|
|
// 新增:为 userSTDDbData 建立索引以加速查找
|
|
|
@@ -482,6 +486,7 @@ namespace OTSIncAReportGrids
|
|
|
// 减少 UI 重绘开销
|
|
|
dgV_ParticlesDevidePage.SuspendLayout();
|
|
|
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
InitializeGridViewColumns(keyValues);
|
|
|
@@ -578,6 +583,11 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private void LoadParticleData(Dictionary<string, string> keyValues)
|
|
|
{
|
|
|
if (particlesFilter?.Rows.Count == 0) return;
|
|
|
@@ -600,18 +610,18 @@ namespace OTSIncAReportGrids
|
|
|
(pageSize * (PageIndex - 1) + add_rowindex + 1).ToString();
|
|
|
|
|
|
LoadParticleRowData(i, add_rowindex, keyValues, fieldPics);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void LoadParticleRowData(int rowIndex, int gridRowIndex,
|
|
|
- Dictionary<string, string> keyValues, Dictionary<string, Bitmap> fieldPics)
|
|
|
+ private void LoadParticleRowData(int rowIndex, int gridRowIndex,Dictionary<string, string> keyValues, Dictionary<string, Bitmap> fieldPics)
|
|
|
{
|
|
|
foreach (var kvp in keyValues)
|
|
|
{
|
|
|
- int columnIndex = dgV_ParticlesDevidePage.Columns.IndexOf(
|
|
|
- dgV_ParticlesDevidePage.Columns[kvp.Key]);
|
|
|
+ int columnIndex = dgV_ParticlesDevidePage.Columns.IndexOf(dgV_ParticlesDevidePage.Columns[kvp.Key]);
|
|
|
|
|
|
- if (columnIndex < 0) continue;
|
|
|
+ //if (columnIndex < 0) continue;
|
|
|
|
|
|
ProcessColumnData(rowIndex, gridRowIndex, columnIndex, kvp.Key, fieldPics);
|
|
|
}
|
|
|
@@ -647,11 +657,10 @@ namespace OTSIncAReportGrids
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- ProcessDefaultColumn(rowIndex, gridRowIndex, columnIndex, columnName);
|
|
|
+ AdjustTheFormatOfTheUnitValues(rowIndex, gridRowIndex, columnIndex, columnName);
|
|
|
}
|
|
|
|
|
|
- private void ProcessParticleImageColumn(int rowIndex, int gridRowIndex, int columnIndex,
|
|
|
- Dictionary<string, Bitmap> fieldPics)
|
|
|
+ private void ProcessParticleImageColumn(int rowIndex, int gridRowIndex, int columnIndex,Dictionary<string, Bitmap> fieldPics)
|
|
|
{
|
|
|
string subParticleString = Convert.ToString(particlesFilter.Rows[rowIndex]["SubParticles"]);
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Height = 150;
|
|
|
@@ -666,7 +675,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
bmap = CreateSingleParticleImage(rowIndex, fieldPics);
|
|
|
}
|
|
|
-
|
|
|
+ bmap.Tag = new List<string>() { particlesFilter.Rows[rowIndex]["fieldid"].ToString(), particlesFilter.Rows[rowIndex]["ParticleId"].ToString() };
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Value = bmap;
|
|
|
}
|
|
|
|
|
|
@@ -684,21 +693,10 @@ namespace OTSIncAReportGrids
|
|
|
var ratioY = (double)cellWidth / bmap1.Height;
|
|
|
var ratio = Math.Min(ratioX, ratioY);
|
|
|
var bmap = fldImgAccess.ScaleImageProportional(bmap1, ratio);
|
|
|
-
|
|
|
- if (bmap != null)
|
|
|
- {
|
|
|
- string[] str = subParticleString.Split(',');
|
|
|
- if (str.Length > 0)
|
|
|
- {
|
|
|
- var pair = str[0].Split(':');
|
|
|
- if (pair.Length >= 2)
|
|
|
- bmap.Tag = new List<string>() { pair[0], pair[1] };
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return bmap;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private Bitmap CreateSingleParticleImage(int rowIndex, Dictionary<string, Bitmap> fieldPics)
|
|
|
{
|
|
|
string fid = Convert.ToString(particlesFilter.Rows[rowIndex]["fieldid"]);
|
|
|
@@ -718,14 +716,10 @@ namespace OTSIncAReportGrids
|
|
|
};
|
|
|
|
|
|
var src = fieldPics[fid];
|
|
|
+
|
|
|
if (src != null)
|
|
|
{
|
|
|
var bmap = fldImgAccess.CapturePic(src, rectangle);
|
|
|
- bmap.Tag = new List<string>()
|
|
|
- {
|
|
|
- particlesFilter.Rows[rowIndex]["FieldId"].ToString(),
|
|
|
- particlesFilter.Rows[rowIndex]["ParticleId"].ToString()
|
|
|
- };
|
|
|
dgV_ParticlesDevidePage.Rows[0].Height = bmap.Height + 20;
|
|
|
return bmap;
|
|
|
}
|
|
|
@@ -794,7 +788,6 @@ namespace OTSIncAReportGrids
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Style.ForeColor = Color.Red;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
private void ProcessAbPosColumn(int rowIndex, int gridRowIndex)
|
|
|
{
|
|
|
Point semPos = new Point(
|
|
|
@@ -808,13 +801,21 @@ namespace OTSIncAReportGrids
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells["AbPosX"].Value = point.X;
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells["AbPosY"].Value = point.Y;
|
|
|
}
|
|
|
- private void ProcessDefaultColumn(int rowIndex, int gridRowIndex, int columnIndex, string columnName)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void AdjustTheFormatOfTheUnitValues(int rowIndex, int gridRowIndex, int columnIndex, string columnName)
|
|
|
{
|
|
|
if (!particlesFilter.Columns.Contains(columnName)) return;
|
|
|
-
|
|
|
+
|
|
|
+ if (columnName== "Element") return;
|
|
|
var cellValue = particlesFilter.Rows[rowIndex][columnName];
|
|
|
if (cellValue == null) return;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (double.TryParse(cellValue.ToString(), out double num))
|
|
|
{
|
|
|
dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells[columnIndex].Value = Math.Round(num, 2);
|
|
|
@@ -831,12 +832,8 @@ namespace OTSIncAReportGrids
|
|
|
dgV_ParticlesDevidePage.Columns.Clear();
|
|
|
|
|
|
var startFun = m_ReportApp.m_RptConfigFile.Systype;
|
|
|
- string str_DefaultComputedColName = "";
|
|
|
- str_ElementsColName = "";
|
|
|
-
|
|
|
- DataSet ds = XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
|
|
|
- DataTable dt = ds.Tables["Member"];
|
|
|
-
|
|
|
+ string str_DefaultComputedColName = ""; str_ElementsColName = "";
|
|
|
+ DataSet ds = XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData"); DataTable dt = ds.Tables["Member"];
|
|
|
foreach (DataRow element in dt.Rows)
|
|
|
{
|
|
|
string regName = element["RegName"].ToString();
|
|
|
@@ -849,7 +846,6 @@ namespace OTSIncAReportGrids
|
|
|
str_ElementsColName = element["strValue"].ToString();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
string[] strs = str_DefaultComputedColName.Split(',');
|
|
|
var keyValues = new Dictionary<string, string>
|
|
|
{
|
|
|
@@ -858,21 +854,25 @@ namespace OTSIncAReportGrids
|
|
|
["ParticleImage"] = table["str5"].ToString(),
|
|
|
["FieldId"] = "FieldId",
|
|
|
["ParticleId"] = "ParticleId",
|
|
|
+
|
|
|
+
|
|
|
["SEMPosX"] = "SEMPosX",
|
|
|
["SEMPosY"] = "SEMPosY"
|
|
|
};
|
|
|
|
|
|
+
|
|
|
foreach (string str in strs)
|
|
|
{
|
|
|
switch (str)
|
|
|
{
|
|
|
case "ParticleCoordinate":
|
|
|
keyValues["AbPosX"] = "PosX";
|
|
|
- keyValues["AbPosY"] = "PosY";
|
|
|
- break;
|
|
|
+ keyValues["AbPosY"] = "PosY";break;
|
|
|
case "Area":
|
|
|
keyValues["Area"] = table["str21"].ToString();
|
|
|
break;
|
|
|
+
|
|
|
+
|
|
|
case "EquivalentCircleDiameter":
|
|
|
keyValues["Equivalent"] = table["str22"].ToString();
|
|
|
break;
|
|
|
@@ -883,8 +883,9 @@ namespace OTSIncAReportGrids
|
|
|
keyValues["DMIN"] = table["str24"].ToString();
|
|
|
break;
|
|
|
case "DiameterRatio":
|
|
|
- keyValues["DiameterRatio"] = table["str25"].ToString();
|
|
|
- break;
|
|
|
+ keyValues["DiameterRatio"] = table["str25"].ToString();break;
|
|
|
+
|
|
|
+
|
|
|
case "FerretDiameter":
|
|
|
keyValues["DFERET"] = table["str26"].ToString();
|
|
|
break;
|
|
|
@@ -897,6 +898,7 @@ namespace OTSIncAReportGrids
|
|
|
case "INSCR":
|
|
|
keyValues["DINSCR"] = table["str29"].ToString();
|
|
|
break;
|
|
|
+
|
|
|
case "MEAN":
|
|
|
keyValues["DMEAN"] = table["str30"].ToString();
|
|
|
break;
|
|
|
@@ -2594,32 +2596,6 @@ namespace OTSIncAReportGrids
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- private void ProcessParticleImageColumn(int rowIndex, int gridRowIndex,Dictionary<string, Bitmap> fieldPics)
|
|
|
- {
|
|
|
- string subParticleString = Convert.ToString(particlesFilter.Rows[rowIndex]["SubParticles"]);
|
|
|
- dgV_ParticlesDevidePage.Rows[gridRowIndex].Height = 150;
|
|
|
- dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells["ParticleImage"].Style.BackColor = Color.Azure;
|
|
|
-
|
|
|
- Bitmap bitmap = null;
|
|
|
- if (!string.IsNullOrEmpty(subParticleString) && subParticleString != "IsSubParticle")
|
|
|
- {
|
|
|
- bitmap = CreateMergedParticleImage(subParticleString);
|
|
|
- }
|
|
|
- else if (subParticleString != "IsSubParticle")
|
|
|
- {
|
|
|
- bitmap = CreateSingleParticleImage(rowIndex, fieldPics);
|
|
|
- }
|
|
|
-
|
|
|
- dgV_ParticlesDevidePage.Rows[gridRowIndex].Cells["ParticleImage"].Value = bitmap;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 获取所有颗粒的分类信息
|
|
|
/// </summary>
|