Bladeren bron

fix 优化process log导出

jiangjy 1 maand geleden
bovenliggende
commit
b0094d5105

+ 4 - 0
FrameworkLocal/UIClient/CenterViews/DataLogs/ProcessHistory/ProcessDetailViewModel.cs

@@ -1558,5 +1558,9 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                 InvokePropertyChanged(nameof(RecipeSettingTime));
             }
         }
+
+        public string RecipeType { get; set; }
+
+        public string RecipeExeEntry { get; set; }
     }
 }

+ 32 - 12
FrameworkLocal/UIClient/CenterViews/DataLogs/ProcessHistory/ProcessExportAllViewModel.cs

@@ -5,6 +5,7 @@ using Caliburn.Micro;
 using Caliburn.Micro.Core;
 using DocumentFormat.OpenXml.Spreadsheet;
 using MECF.Framework.Common.CommonData;
+using MECF.Framework.Common.CommonData.EnumData;
 using MECF.Framework.Common.ControlDataContext;
 using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.Utilities;
@@ -327,6 +328,10 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                     item.ProcessStatus = dbData.Rows[i]["process_status"].ToString();
                     item.WaferDataGUID = dbData.Rows[i]["wafer_data_guid"].ToString();
                     item.ProcessIn = dbData.Rows[i]["process_in"].ToString();
+
+                    item.RecipeType = dbData.Rows[i]["recipe_type"].ToString();
+                    item.RecipeExeEntry = dbData.Rows[i]["recipe_exec_entry"].ToString();
+
                     if (!dbData.Rows[i]["process_begin_time"].Equals(DBNull.Value))
                     {
                         item.ProcessBeginTime = (DateTime)dbData.Rows[i]["process_begin_time"];
@@ -336,10 +341,21 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                     {
                         item.ProcessEndTime = (DateTime)dbData.Rows[i]["process_end_time"];
                     }
+
+
+
                     ProcessDataLotList.Add(item);
                 }
                 if (ProcessDataLotList.Count == 0) { LOG.Warning($"QueryStep:No process data({sql})"); return; }
 
+                historyLot.ProcessStartTime = ProcessDataLotList[0].ProcessBeginTime;
+                historyLot.ProcessEndTime = ProcessDataLotList[0].ProcessEndTime;
+
+                if (int.TryParse(ProcessDataLotList[0].RecipeType, out int type))
+                    historyLot.RecipeType = (RecipeTypeEnum)type;
+
+                if (int.TryParse(ProcessDataLotList[0].RecipeExeEntry, out int entry))
+                    historyLot.RecipeExecEntry = (RecipeExecEntryEnum)entry;
 
                 //   Annotations.Add(VerLine(Media.Brushes.Blue, ProcessDataLotList[0].ProcessBeginTime, Media.Brushes.Blue, $"{ProcessDataLotList[0].RecipeName}"));
 
@@ -755,7 +771,6 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
 
             int rowIndex = 4;
             int cellIndex = 0;
-            List<string> headers = new List<string>();
             if (!firstHeader)
             {
                 firstHeader = true;
@@ -769,10 +784,8 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                             colAttributeName = "DisplayName";
                         }
                         var tempStr = _processProcessDetailAttributeDict[x.ColumnName].ContainsKey("DisplayName") && !string.IsNullOrEmpty(_processProcessDetailAttributeDict[x.ColumnName]["DisplayName"]) ? _processProcessDetailAttributeDict[x.ColumnName]["DisplayName"] : x.ColumnName;
-                        headers.Add(tempStr.EndsWith("Enable") ? tempStr.Replace("Valve.", "") : tempStr);
                         return string.IsNullOrEmpty(_processProcessDetailAttributeDict[x.ColumnName][colAttributeName]) ? x.ColumnName : _processProcessDetailAttributeDict[x.ColumnName][colAttributeName];
                     }
-                    headers.Add(x.ColumnName.EndsWith("Enable") ? x.ColumnName.Replace("Valve.", "") : x.ColumnName);
                     return x.ColumnName;
                 });
 
@@ -786,10 +799,8 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                             colAttributeName = "DisplayName";
                         }
                         var tempStr = _processProcessDetailAttributeDict[x.ColumnName].ContainsKey("DisplayName") && !string.IsNullOrEmpty(_processProcessDetailAttributeDict[x.ColumnName]["DisplayName"]) ? _processProcessDetailAttributeDict[x.ColumnName]["DisplayName"] : x.ColumnName;
-                        headers.Add(tempStr.EndsWith("Enable") ? tempStr.Replace("Valve.", "") : tempStr);
                         return string.IsNullOrEmpty(_processProcessDetailAttributeDict[x.ColumnName][colAttributeName]) ? x.ColumnName : _processProcessDetailAttributeDict[x.ColumnName][colAttributeName];
                     }
-                    headers.Add(x.ColumnName.EndsWith("Enable") ? x.ColumnName.Replace("Valve.", "") : x.ColumnName);
                     return x.ColumnName;
                 });
 
@@ -831,6 +842,8 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                 { "Recipe Info",recipeInfo.RecipeName},
                 { "Recipe StartTime",recipeInfo.ProcessStartTime.ToString("yyyy-MM-dd HH:mm:ss")},
                 { "Recipe EndTime",recipeInfo.ProcessEndTime.ToString("yyyy-MM-dd HH:mm:ss")},
+                { "Recipe Type",recipeInfo.RecipeType.ToString()},
+                { "Recipe ExecEntry",recipeInfo.RecipeExecEntry.ToString()},
             };
             rowIndex = 0;
             cellIndex = 0;
@@ -917,9 +930,12 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                     for (int j = 1; j < pmRow.ItemArray.Length; j++)
                     {
                         ICell cell = dataRow.CreateCell(cellIndex++);
-                        if ((headers.Count > cellIndex - 1 - columnIndex) && headers[cellIndex - 1 - columnIndex].StartsWith("Valve."))//TiN需求164
-                            cell.SetCellValue(pmRow[j].ToString() == bool.TrueString ? "Open" : "Close");
-                        else cell.SetCellValue(pmRow[j].ToString());
+
+                        var setValueData = pmRow[j].ToString();
+                        if (bool.TryParse(pmRow[j].ToString(), out var avData))
+                            setValueData = pmRow[j].ToString() == bool.TrueString ? "Open" : "Close";
+
+                        cell.SetCellValue(setValueData);
                         cell.CellStyle = GetICellStyle(workbook);
                     }
                 }
@@ -934,14 +950,18 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
                     for (int j = 1; j < pmRow.ItemArray.Length; j++)
                     {
                         ICell cell = dataRow.CreateCell(cellIndex++);
-                        if ((headers.Count > cellIndex - 1 - columnIndex) && headers[cellIndex - 1 - columnIndex].StartsWith("Valve."))
-                            cell.SetCellValue(pmRow[j].ToString() == bool.TrueString ? "Open" : "Close");
-                        else cell.SetCellValue(pmRow[j].ToString());
+                        var setValueData = pmRow[j].ToString();
+                        if (bool.TryParse(pmRow[j].ToString(), out var avData))
+                            setValueData = pmRow[j].ToString() == bool.TrueString ? "Open" : "Close";
+
+                        cell.SetCellValue(setValueData);
                         cell.CellStyle = GetICellStyle(workbook);
                     }
                 }
             }
-
+            sheet.SetColumnWidth(0, keyValuePairs.LastOrDefault().Key.Length * 256);
+            sheet.SetColumnWidth(3, keyValuePairs.LastOrDefault().Key.Length * 256);
+            sheet.SetColumnWidth(4, keyValuePairs.LastOrDefault().Key.Length * 256);
             // Write the output to a file
             using (FileStream file = new FileStream(fileName, FileMode.Create, FileAccess.Write))
             {

+ 4 - 0
FrameworkLocal/UIClient/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTwoViewModel.cs

@@ -3,6 +3,7 @@ using Aitex.Sorter.Common;
 using Caliburn.Micro;
 using Caliburn.Micro.Core;
 using MECF.Framework.Common.CommonData;
+using MECF.Framework.Common.CommonData.EnumData;
 using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.Utilities;
 using MECF.Framework.UI.Client.CenterViews.DataLogs.Event;
@@ -463,5 +464,8 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
         }
         public DateTime ProcessStartTime { get; set; }
         public DateTime ProcessEndTime { get; set; }
+
+        public RecipeTypeEnum RecipeType { get; set; }
+        public RecipeExecEntryEnum RecipeExecEntry { get; set; }
     }
 }