|
@@ -25,6 +25,10 @@ using System.Windows.Forms;
|
|
|
using ExcelLibrary.BinaryFileFormat;
|
|
|
using Aitex.Core.UI.View.Common;
|
|
|
using Aitex.Core.RT.DataCenter;
|
|
|
+using System.Xml;
|
|
|
+using System.Security.Cryptography.X509Certificates;
|
|
|
+using System.Reflection;
|
|
|
+using Newtonsoft.Json;
|
|
|
|
|
|
namespace Venus_MainPages.ViewModels
|
|
|
{
|
|
@@ -36,8 +40,8 @@ namespace Venus_MainPages.ViewModels
|
|
|
RealtimeProvider _provider = new RealtimeProvider();
|
|
|
private ObservableCollection<ParameterNode> _ParameterNodes;
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
|
|
- ObservableCollection<PdKeyData>_PdKeyDataObservation= new ObservableCollection<PdKeyData>();
|
|
|
- public List<string> RecipesAdd=new List<string>();
|
|
|
+ ObservableCollection<PdKeyData> _PdKeyDataObservation = new ObservableCollection<PdKeyData>();
|
|
|
+ public List<string> RecipesAdd = new List<string>();
|
|
|
public List<SolidColorBrush> solidColorBrushes = new List<SolidColorBrush>();
|
|
|
DateTime currentTime;
|
|
|
private RecipeItem selectedRecipeItem;
|
|
@@ -47,13 +51,15 @@ namespace Venus_MainPages.ViewModels
|
|
|
#region 属性
|
|
|
public List<HistoryDataItem> ProcessData { get; set; }
|
|
|
public List<Recipeslist> CheboxRecipes { get; set; }
|
|
|
- public ProcessDataChartDataItem ProcessChartData{ get; set; }
|
|
|
+ public ProcessDataChartDataItem ProcessChartData { get; set; }
|
|
|
public DateTime StartDateTime { get; set; }
|
|
|
public DateTime EndDateTime { get; set; }
|
|
|
public string SelectedValuePM { get; set; }
|
|
|
public string RecipeName { get; set; }
|
|
|
+
|
|
|
+ public ObservableCollection<PdKeyData> OldPdKeyDataCollection { get; set; }
|
|
|
public ObservableCollection<RecipeItem> Recipes { get; set; }
|
|
|
-
|
|
|
+
|
|
|
public class Recipeslist
|
|
|
{
|
|
|
public string BoxName { get; set; }
|
|
@@ -71,7 +77,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
public ObservableCollection<PdKeyData> PdKeyDataCollection
|
|
|
{
|
|
|
get { return _PdKeyDataObservation; }
|
|
|
- set { SetProperty(ref _PdKeyDataObservation,value); }
|
|
|
+ set { SetProperty(ref _PdKeyDataObservation, value); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -83,8 +89,8 @@ namespace Venus_MainPages.ViewModels
|
|
|
public DelegateCommand SearchRecipeCommand =>
|
|
|
_SearchRecipeCommand ?? (_SearchRecipeCommand = new DelegateCommand(SearchRecipes));
|
|
|
private DelegateCommand<object> _PdParameterCheckCommand;
|
|
|
- public DelegateCommand<object> PdParameterCheckCommand=>
|
|
|
- _PdParameterCheckCommand??(_PdParameterCheckCommand=new DelegateCommand<object>(OnParameterCheck));
|
|
|
+ public DelegateCommand<object> PdParameterCheckCommand =>
|
|
|
+ _PdParameterCheckCommand ?? (_PdParameterCheckCommand = new DelegateCommand<object>(OnParameterCheck));
|
|
|
|
|
|
|
|
|
private DelegateCommand<object> _DataGridSelectionChangedCommand;
|
|
@@ -100,6 +106,8 @@ namespace Venus_MainPages.ViewModels
|
|
|
private DelegateCommand _ClearDataCommand;
|
|
|
public DelegateCommand ClearDataCommand =>
|
|
|
_ClearDataCommand ?? (_ClearDataCommand = new DelegateCommand(OnClearData));
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 构造函数
|
|
@@ -108,6 +116,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
ProcessChartData = new ProcessDataChartDataItem(60000);
|
|
|
Recipes = new ObservableCollection<RecipeItem>();
|
|
|
timer.Interval = TimeSpan.FromSeconds(0.5);
|
|
|
+ OldPdKeyDataCollection = new ObservableCollection<PdKeyData>();
|
|
|
CheboxRecipes = new List<Recipeslist>();
|
|
|
solidColorBrushes.Add(new SolidColorBrush(Colors.Green));
|
|
|
solidColorBrushes.Add(new SolidColorBrush(Colors.Red));
|
|
@@ -132,7 +141,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
}
|
|
|
private void LoadRecipeCheckBox()
|
|
|
{
|
|
|
- List<string> chamber = new List<string>() { "PMA","PMB","PMC","PMD"};
|
|
|
+ List<string> chamber = new List<string>() { "PMA", "PMB", "PMC", "PMD" };
|
|
|
CheboxRecipes.Clear();
|
|
|
foreach (string item in chamber)
|
|
|
{
|
|
@@ -156,7 +165,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
Recipes.Clear();
|
|
|
try
|
|
|
{
|
|
|
- string sql1 = string.Format($"SELECT * FROM \"lot_wafer_data\" where guid ='{id}'; ") ;
|
|
|
+ string sql1 = string.Format($"SELECT * FROM \"lot_wafer_data\" where guid ='{id}'; ");
|
|
|
DataTable dbData1 = QueryDataClient.Instance.Service.QueryData(sql1);
|
|
|
string lot_data_guid = dbData1.Rows[0]["wafer_data_guid"].ToString();
|
|
|
string sql = string.Format($"SELECT * FROM \"process_data\" where guid ='{lot_data_guid}'");
|
|
@@ -211,7 +220,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
LOG.WriteExeption(e);
|
|
|
}
|
|
|
}
|
|
|
- public void SearchRecipe(DateTime start,DateTime end )
|
|
|
+ public void SearchRecipe(DateTime start, DateTime end)
|
|
|
{
|
|
|
this.StartDateTime = start;
|
|
|
this.EndDateTime = end;
|
|
@@ -240,7 +249,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
sql += string.Format(" and lower(\"recipe_name\") like '%{0}%'", RecipeName.ToLower());
|
|
|
}
|
|
|
sql += " order by \"process_begin_time\" ASC;";
|
|
|
-
|
|
|
+
|
|
|
DataTable dbData = QueryDataClient.Instance.Service.QueryData(sql);
|
|
|
|
|
|
|
|
@@ -263,7 +272,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
item.StartTime = ((DateTime)dbData.Rows[i]["process_begin_time"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (!dbData.Rows[i]["process_end_time"].Equals(DBNull.Value))
|
|
|
item.EndTime = ((DateTime)dbData.Rows[i]["process_end_time"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- Recipes.Add(item);
|
|
|
+ Recipes.Add(item);
|
|
|
}
|
|
|
}));
|
|
|
}
|
|
@@ -421,6 +430,13 @@ namespace Venus_MainPages.ViewModels
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ public static T DeepCopyJson<T>(T obj)
|
|
|
+ {
|
|
|
+ // 序列化
|
|
|
+ string json = JsonConvert.SerializeObject(obj);
|
|
|
+ // 反序列化
|
|
|
+ return JsonConvert.DeserializeObject<T>(json);
|
|
|
+ }
|
|
|
private void OnParameterCheck(object obj)
|
|
|
{
|
|
|
ParameterNode node = obj as ParameterNode;
|
|
@@ -432,7 +448,6 @@ namespace Venus_MainPages.ViewModels
|
|
|
{
|
|
|
RefreshTreeStatusToParent(node);
|
|
|
}
|
|
|
-
|
|
|
keys.Clear();
|
|
|
for (int i = 0; i < ParameterNodes.Count; i++)
|
|
|
{
|
|
@@ -443,6 +458,8 @@ namespace Venus_MainPages.ViewModels
|
|
|
WPFMessageBox.ShowWarning("最多显示10个数据");
|
|
|
return;
|
|
|
}
|
|
|
+ OldPdKeyDataCollection.Clear();
|
|
|
+ OldPdKeyDataCollection = DeepCopyJson(PdKeyDataCollection);
|
|
|
PdKeyDataCollection.Clear();
|
|
|
for (int i = 0; i < keys.Count; i++)
|
|
|
{
|
|
@@ -450,9 +467,34 @@ namespace Venus_MainPages.ViewModels
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
- PdKeyDataCollection.Add(new PdKeyData() { Key = keys[i], Color = solidColorBrushes[i] });
|
|
|
+ PdKeyDataCollection.Add(new PdKeyData() { Key = keys[i], Color = solidColorBrushes[i], UniqueId = i });
|
|
|
}
|
|
|
+ Compare(OldPdKeyDataCollection, PdKeyDataCollection);
|
|
|
+ PdKeyDataCollection = DeepCopyJson(OldPdKeyDataCollection);
|
|
|
+ }
|
|
|
|
|
|
+ public void Compare(ObservableCollection<PdKeyData> olddata, ObservableCollection<PdKeyData> newdata)
|
|
|
+ {
|
|
|
+ if (newdata != null)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < newdata.Count; i++)
|
|
|
+ {
|
|
|
+ var lists = olddata.ToList().Find(t => t.Key == newdata[i].Key);
|
|
|
+ if (lists == null)
|
|
|
+ {
|
|
|
+ olddata.Add(new PdKeyData() { Key = newdata[i].Key, Color = solidColorBrushes[i], UniqueId = olddata.Count + 1 });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < olddata.Count; i++)
|
|
|
+ {
|
|
|
+ var lists = newdata.ToList().Find(t => t.Key == olddata[i].Key);
|
|
|
+ if (lists == null)
|
|
|
+ {
|
|
|
+ olddata.Remove(olddata[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
public void UpdateData(RecipeItem dataLog)
|
|
|
{
|
|
@@ -517,14 +559,14 @@ namespace Venus_MainPages.ViewModels
|
|
|
|
|
|
public void OnDataGridSelectionChanged(object obj)
|
|
|
{
|
|
|
- selectedRecipeItem = obj as RecipeItem;
|
|
|
+ selectedRecipeItem = obj as RecipeItem;
|
|
|
ParameterNodes = new ObservableCollection<ParameterNode>(_provider.GetParameters().Where(x => x.Name == selectedRecipeItem?.Chamber));
|
|
|
}
|
|
|
- private void OnSearchData()
|
|
|
+ public void OnSearchData()
|
|
|
{
|
|
|
this.view.MyDrawGraphicsControl.ClearPlotPoints();
|
|
|
var Keys = new List<string>();
|
|
|
- PdKeyDataCollection.ToList().ForEach(key =>
|
|
|
+ PdKeyDataCollection.ToList().ForEach(key =>
|
|
|
{
|
|
|
Keys.Add(key.Key);
|
|
|
});
|
|
@@ -532,7 +574,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- var result = GetData(Keys.Distinct().ToList(), Convert.ToDateTime(selectedRecipeItem?.StartTime) , Convert.ToDateTime(selectedRecipeItem?.EndTime) );
|
|
|
+ var result = GetData(Keys.Distinct().ToList(), Convert.ToDateTime(selectedRecipeItem?.StartTime), Convert.ToDateTime(selectedRecipeItem?.EndTime));
|
|
|
if (result == null)
|
|
|
{
|
|
|
return;
|
|
@@ -550,33 +592,58 @@ namespace Venus_MainPages.ViewModels
|
|
|
cls.Add(points);
|
|
|
}
|
|
|
this.view.MyDrawGraphicsControl.PointCollections = cls;
|
|
|
+
|
|
|
this.view.MyDrawGraphicsControl.FitControl();
|
|
|
}
|
|
|
+ private void CloseAll(ObservableCollection<ParameterNode> parameterNodes)
|
|
|
+ {
|
|
|
+ foreach (var item in parameterNodes)
|
|
|
+ {
|
|
|
+ item.Selected = false;
|
|
|
+ if (item.ChildNodes.Count > 0)
|
|
|
+ {
|
|
|
+ CloseAll(item.ChildNodes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
private void OnClearData()
|
|
|
- {
|
|
|
-
|
|
|
+ {
|
|
|
+ PdKeyDataCollection.Clear();
|
|
|
+ this.view.MyDrawGraphicsControl.ClearPlotPoints();
|
|
|
+ CloseAll(ParameterNodes);
|
|
|
}
|
|
|
}
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
#region 数据类
|
|
|
- public class RecipeItem
|
|
|
- {
|
|
|
- public bool Selected { get; set; }
|
|
|
- public string Recipe { get; set; }
|
|
|
- public string Guid { get; set; }
|
|
|
- public string RecipeRunGuid { get; set; }
|
|
|
- public string Chamber { get; set; }
|
|
|
- public string Status { get; set; }
|
|
|
- public string StartTime { get; set; }
|
|
|
- public string EndTime { get; set; }
|
|
|
- public string LotID { get; set; }
|
|
|
- public string SlotID { get; set; }
|
|
|
- }
|
|
|
- public class PdKeyData
|
|
|
- {
|
|
|
- public string Key { get; set; }
|
|
|
- public SolidColorBrush Color { get; set; }
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ public class RecipeItem : BindableBase
|
|
|
+ {
|
|
|
+ public bool Selected { get; set; }
|
|
|
+ public string Recipe { get; set; }
|
|
|
+ public string Guid { get; set; }
|
|
|
+ public string RecipeRunGuid { get; set; }
|
|
|
+ public string Chamber { get; set; }
|
|
|
+ public string Status { get; set; }
|
|
|
+ public string StartTime { get; set; }
|
|
|
+ public string EndTime { get; set; }
|
|
|
+ public string LotID { get; set; }
|
|
|
+ public string SlotID { get; set; }
|
|
|
+ }
|
|
|
+ public class PdKeyData : BindableBase, ICloneable
|
|
|
+ {
|
|
|
+ public string Key { get; set; }
|
|
|
+ public SolidColorBrush _Color;
|
|
|
+ public SolidColorBrush Color
|
|
|
+ {
|
|
|
+ get { return _Color; }
|
|
|
+ set { SetProperty(ref _Color, value); }
|
|
|
+ }
|
|
|
+ public int UniqueId { get; set; }
|
|
|
+ public object Clone()
|
|
|
+ {
|
|
|
+ return MemberwiseClone();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|