|
@@ -15,6 +15,7 @@ using MECF.Framework.UI.Client.CenterViews.Operations.RealTime;
|
|
|
using MECF.Framework.UI.Client.ClientBase;
|
|
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
+using NPOI.Util;
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
using OpenSEMI.ClientBase;
|
|
|
using SciChart.Charting.Visuals;
|
|
@@ -695,11 +696,43 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
|
|
|
|
|
|
string stepID = "", stepName = "", subRecipeLoopInfo = "", subRecipeStepName = "", subRecipeStepNumber = "", tempCorrection = "", tempPid = "";
|
|
|
|
|
|
- int maxRow = GetMaxRow(pmDataTable, systemDataTable);
|
|
|
+ Dictionary<DateTime, List<string>> pmDataDictList = new Dictionary<DateTime, List<string>>();
|
|
|
+ if (pmDataTable != null && pmDataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < pmDataTable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ _cancellationTokenSource?.Token.ThrowIfCancellationRequested();
|
|
|
+ List<string> strings = new List<string>();
|
|
|
+
|
|
|
+ foreach (var item in pmList)
|
|
|
+ {
|
|
|
+ if (!pmDataTable.Columns.Contains(item))
|
|
|
+ continue;
|
|
|
+ strings.Add(pmDataTable.Rows[i][item].ToString());
|
|
|
+ }
|
|
|
+ pmDataDictList.Add(new DateTime((long)pmDataTable.Rows[i]["InternalTimeStamp"]), strings);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Dictionary<DateTime, List<string>> systemDataDictList = new Dictionary<DateTime, List<string>>();
|
|
|
+ if (systemDataTable != null && systemDataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < systemDataTable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ _cancellationTokenSource?.Token.ThrowIfCancellationRequested();
|
|
|
+ List<string> strings = new List<string>();
|
|
|
|
|
|
+ foreach (var item in systemList)
|
|
|
+ {
|
|
|
+ if (!systemDataTable.Columns.Contains(item))
|
|
|
+ continue;
|
|
|
+ strings.Add(systemDataTable.Rows[i][item].ToString());
|
|
|
+ }
|
|
|
+ systemDataDictList.Add(new DateTime((long)systemDataTable.Rows[i]["InternalTimeStamp"]), strings);
|
|
|
+ }
|
|
|
+ }
|
|
|
IWorkbook workbook = new XSSFWorkbook();
|
|
|
ISheet sheet = workbook.CreateSheet("Sheet1");
|
|
|
-
|
|
|
+
|
|
|
#region Recipe 信息
|
|
|
|
|
|
int rowIndex = 0;
|
|
@@ -806,73 +839,90 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
|
|
|
|
|
|
|
|
|
rowIndex = 5;
|
|
|
- _stepInfo = _stepInfo.OrderByDescending(x => x.StartTime).ToList();
|
|
|
+ _stepInfo = _stepInfo.OrderBy(x => x.StartTime).ToList();
|
|
|
|
|
|
- for (int i = 0; i < maxRow; i++)
|
|
|
+ for (int i = 0; i < _stepInfo.Count; i++)
|
|
|
{
|
|
|
- IRow dataRow = sheet.CreateRow(rowIndex++);
|
|
|
- dataRow.HeightInPoints = 25;
|
|
|
- var pmRow = pmDataTable != null && pmDataTable.Rows.Count > 0 ? pmDataTable.Rows[i] : null;
|
|
|
- var systemRow = systemDataTable != null && systemDataTable.Rows.Count > 0 ? systemDataTable.Rows[i] : null;
|
|
|
-
|
|
|
- DateTime dateTimeKey = new DateTime(systemRow != null ? (long)systemRow[0] : (long)pmRow[0]);
|
|
|
-
|
|
|
- var tempStepInfo = _stepInfo.FirstOrDefault(x => x.StartTime <= dateTimeKey);
|
|
|
-
|
|
|
- if (tempStepInfo != null)
|
|
|
+ var tempStepInfo = _stepInfo[i];
|
|
|
+ var rowCount = tempStepInfo.StepTime;
|
|
|
+ if (!string.IsNullOrEmpty(tempStepInfo.SubRecipeStepNumber))
|
|
|
{
|
|
|
- stepID = tempStepInfo.StepNo;
|
|
|
- stepName = tempStepInfo.StepName;
|
|
|
- subRecipeStepName = tempStepInfo.SubRecipeStepName;
|
|
|
- subRecipeStepNumber = tempStepInfo.SubRecipeStepNumber;
|
|
|
- subRecipeLoopInfo = !string.IsNullOrEmpty(tempStepInfo.SubRecipeLoopInfo) ? tempStepInfo.SubRecipeLoopInfo.Replace("/", "|") : tempStepInfo.SubRecipeLoopInfo;
|
|
|
- tempCorrection = !string.IsNullOrEmpty(tempStepInfo.TempCorrection) ? tempStepInfo.TempCorrection : "";
|
|
|
- tempPid = !string.IsNullOrEmpty(tempStepInfo.TempPid) ? tempStepInfo.TempPid : "";
|
|
|
+ rowCount = int.Parse(tempStepInfo.SubRecipeStepTime);
|
|
|
}
|
|
|
|
|
|
- cellIndex = 0;
|
|
|
-
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(dateTimeKey.ToString(DateTimeUtil.DateFormat));
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(dateTimeKey.ToString(DateTimeUtil.TimeFormat));
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(stepID);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(stepName);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeStepName);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeStepNumber);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeLoopInfo);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(tempCorrection);
|
|
|
- dataRow.CreateCell(cellIndex++).SetCellValue(tempPid);
|
|
|
- if (pmRow == null && systemRow != null)
|
|
|
+ for (int jx = 1; jx < rowCount + 1; jx++)
|
|
|
{
|
|
|
- for (int j = 1; j < systemRow.ItemArray.Length; j++)
|
|
|
- {
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
|
|
|
- }
|
|
|
- for (int j = 0; j < (pmDataTable?.Columns.Count ?? 0); j++)
|
|
|
+ IRow dataRow = sheet.CreateRow(rowIndex++);
|
|
|
+ dataRow.HeightInPoints = 25;
|
|
|
+ var rowStartTime = jx == 1 ? tempStepInfo.StartTime : tempStepInfo.StartTime.AddSeconds(jx - 1);
|
|
|
+ var rowEndTime = tempStepInfo.StartTime.AddSeconds(jx);
|
|
|
+ if (tempStepInfo != null)
|
|
|
{
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, "");
|
|
|
+ stepID = tempStepInfo.StepNo;
|
|
|
+ stepName = tempStepInfo.StepName;
|
|
|
+ subRecipeStepName = tempStepInfo.SubRecipeStepName;
|
|
|
+ subRecipeStepNumber = tempStepInfo.SubRecipeStepNumber;
|
|
|
+ subRecipeLoopInfo = !string.IsNullOrEmpty(tempStepInfo.SubRecipeLoopInfo) ? tempStepInfo.SubRecipeLoopInfo.Replace("/", "|") : tempStepInfo.SubRecipeLoopInfo;
|
|
|
+ tempCorrection = !string.IsNullOrEmpty(tempStepInfo.TempCorrection) ? tempStepInfo.TempCorrection : "";
|
|
|
+ tempPid = !string.IsNullOrEmpty(tempStepInfo.TempPid) ? tempStepInfo.TempPid : "";
|
|
|
}
|
|
|
- }
|
|
|
- else if (pmRow != null && systemRow == null)
|
|
|
- {
|
|
|
|
|
|
- for (int j = 0; j < (systemDataTable?.Columns?.Count ?? 0); j++)
|
|
|
- {
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, "");
|
|
|
- }
|
|
|
- for (int j = 1; j < pmRow.ItemArray.Length; j++)
|
|
|
+ cellIndex = 0;
|
|
|
+
|
|
|
+ var pmRow = new List<string>();
|
|
|
+ var newRowStartTime = new DateTime(rowStartTime.Year, rowStartTime.Month, rowStartTime.Day, rowStartTime.Hour, rowStartTime.Minute, rowStartTime.Second);
|
|
|
+ var newRowEndTime = new DateTime(rowEndTime.Year, rowEndTime.Month, rowEndTime.Day, rowEndTime.Hour, rowEndTime.Minute, rowEndTime.Second);
|
|
|
+ var rowPm = pmDataDictList.Keys.FirstOrDefault(a => a.Ticks >= newRowStartTime.Ticks);
|
|
|
+ if (rowPm != null)
|
|
|
+ pmRow = pmDataDictList[rowPm];
|
|
|
+
|
|
|
+ var systemRow = new List<string>();
|
|
|
+ var rowsSystem = systemDataDictList.Keys.FirstOrDefault(a => a.Ticks >= newRowStartTime.Ticks);
|
|
|
+ if (rowsSystem != null)
|
|
|
+ systemRow = systemDataDictList[rowsSystem];
|
|
|
+
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(rowStartTime.ToString(DateTimeUtil.DateFormat));
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(rowStartTime.ToString(DateTimeUtil.TimeFormat));
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(stepID);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(stepName);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeStepName);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeStepNumber);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(subRecipeLoopInfo);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(tempCorrection);
|
|
|
+ dataRow.CreateCell(cellIndex++).SetCellValue(tempPid);
|
|
|
+ if (pmRow == null && systemRow != null)
|
|
|
{
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
|
|
|
+ for (int j = 1; j < systemRow.Count; j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
|
|
|
+ }
|
|
|
+ for (int j = 0; j < (pmDataTable?.Columns.Count ?? 0); j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, "");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (systemDataTable != null)
|
|
|
- {
|
|
|
- for (int j = 1; j < systemRow.ItemArray.Length; j++)
|
|
|
+ else if (pmRow != null && systemRow == null)
|
|
|
{
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
|
|
|
+
|
|
|
+ for (int j = 0; j < (systemDataTable?.Columns?.Count ?? 0); j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, "");
|
|
|
+ }
|
|
|
+ for (int j = 1; j < pmRow.Count; j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
|
|
|
+ }
|
|
|
}
|
|
|
- for (int j = 1; j < pmRow.ItemArray.Length; j++)
|
|
|
+ else if (systemDataTable != null)
|
|
|
{
|
|
|
- WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
|
|
|
+ for (int j = 1; j < systemRow.Count; j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
|
|
|
+ }
|
|
|
+ for (int j = 1; j < pmRow.Count; j++)
|
|
|
+ {
|
|
|
+ WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -961,6 +1011,8 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
|
|
|
|
|
|
public DataTable GetDataTable(ModuleName type, List<string> queryColNameList, DateTime startTime, DateTime endTime)
|
|
|
{
|
|
|
+ startTime = startTime.AddSeconds(-10);
|
|
|
+ endTime = endTime.AddSeconds(10);
|
|
|
var tableName = ModuleName.PM1.ToString();
|
|
|
|
|
|
if (type == ModuleName.System)
|