瀏覽代碼

fix 单步需要多少条数据 根据两个Step的 startTime 相减/
如果时间是当天的第一秒与最后一秒 不需要再冗余数据

jiangjy 3 周之前
父節點
當前提交
51dbfc6a27
共有 1 個文件被更改,包括 23 次插入13 次删除
  1. 23 13
      FrameworkLocal/UIClient/CenterViews/DataLogs/ProcessHistory/ProcessExportAllViewModel.cs

+ 23 - 13
FrameworkLocal/UIClient/CenterViews/DataLogs/ProcessHistory/ProcessExportAllViewModel.cs

@@ -36,6 +36,7 @@ using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Windows;
+using static log4net.Appender.RollingFileAppender;
 using static MECF.Framework.Common.FAServices.DataVariables;
 using Action = System.Action;
 using Media = System.Windows.Media;
@@ -424,10 +425,7 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
 
                                 //Annotations.Add(VerLine(Media.Brushes.AliceBlue, StartTime, Media.Brushes.Blue, $"{stepNo}"));
                                 var time = StartTime.AddSeconds(stepTime);
-                                if (EndTime < time && time < ProcessDataLotList[0].ProcessEndTime)//解决process过程abort,数据导出问题:数据点时间范围大于recipe结束时间。
-                                {
-                                    EndTime = StartTime.AddSeconds(stepTime);
-                                }
+
                                 _stepInfo.Add(new StepInfo()
                                 {
                                     StartTime = StartTime,
@@ -844,11 +842,17 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
             for (int i = 0; i < _stepInfo.Count; i++)
             {
                 var tempStepInfo = _stepInfo[i];
-                var rowCount = tempStepInfo.StepTime;
-                if (!string.IsNullOrEmpty(tempStepInfo.SubRecipeStepNumber))
+                var durationTIme = new TimeSpan();
+
+                if (i == (_stepInfo.Count() - 1))
                 {
-                    rowCount = int.Parse(tempStepInfo.SubRecipeStepTime);
+                    durationTIme = _stepInfo[i].EndTime - tempStepInfo.StartTime;
                 }
+                else
+                {
+                    durationTIme = _stepInfo[i + 1].StartTime - _stepInfo[i].StartTime;
+                }
+                var rowCount = Math.Ceiling(durationTIme.TotalSeconds);
 
                 for (int jx = 1; jx < rowCount + 1; jx++)
                 {
@@ -892,7 +896,7 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                     dataRow.CreateCell(cellIndex++).SetCellValue(tempPid);
                     if (pmRow == null && systemRow != null)
                     {
-                        for (int j = 1; j < systemRow.Count; j++)
+                        for (int j = 0; j < systemRow.Count; j++)
                         {
                             WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
                         }
@@ -908,18 +912,18 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                         {
                             WriterCell(dataRow, cellIndex++, workbook, "");
                         }
-                        for (int j = 1; j < pmRow.Count; j++)
+                        for (int j = 0; j < pmRow.Count; j++)
                         {
                             WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
                         }
                     }
                     else if (systemDataTable != null)
                     {
-                        for (int j = 1; j < systemRow.Count; j++)
+                        for (int j = 0; j < systemRow.Count; j++)
                         {
                             WriterCell(dataRow, cellIndex++, workbook, systemRow[j].ToString());
                         }
-                        for (int j = 1; j < pmRow.Count; j++)
+                        for (int j = 0; j < pmRow.Count; j++)
                         {
                             WriterCell(dataRow, cellIndex++, workbook, ConvertBooleanValues(pmRow[j]));
                         }
@@ -1011,8 +1015,14 @@ 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);
+
+
+            if (startTime.TimeOfDay != TimeSpan.Zero)
+                startTime = startTime.AddSeconds(-10);
+
+            if (endTime.TimeOfDay != TimeSpan.FromDays(1).Subtract(TimeSpan.FromSeconds(1)))
+                endTime = endTime.AddSeconds(10);
+
             var tableName = ModuleName.PM1.ToString();
 
             if (type == ModuleName.System)