首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,105 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
using System.Windows;
using DocumentFormat.OpenXml.Office2010.Excel;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
public class HistoryCoatingManager:Singleton<HistoryCoatingManager>
{
public List<CoatingData> CoatingData { get; set; } = new List<CoatingData>();
HistoryCoatingSqlHelp historyCoatingSqlHelp { get; set; }=new HistoryCoatingSqlHelp();
public HistoryCoatingManager()
{
}
public void Initialize()
{
InitData();
}
private void InitData()
{
OP.Subscribe("HistoryCoatingManager.Grow", (string cmd, object[] args) => Grow(args));
OP.Subscribe("HistoryCoatingManager.GrowCheck", (string cmd, object[] args) => GrowCheck(args));
}
/// <summary>
/// 更新Tray和腔体的厚度,arg0 TrayInnerID arg1生长速率 arg2生长时间 arg3PM腔
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public bool Grow(object[] args)//Process完成后更新生长厚度,操作对象Tray PM
{
try
{
double GrowthRate = Convert.ToDouble(args[1]);
double Seconds = Convert.ToDouble(args[2]);
if (GrowthRate* Seconds==0)
{
return true;
}
historyCoatingSqlHelp.GrowTray(args[0].ToString(), GrowthRate, Seconds);
historyCoatingSqlHelp.GrowPM(args[3].ToString(), GrowthRate, Seconds);
historyCoatingSqlHelp.GrowPMForMaintenance(args[3].ToString(), GrowthRate, Seconds);
return true;
}
catch (Exception ex)
{
EV.PostInfoLog("System", $"CoatingManager.Grow_Error {ex.ToString()}");
return false;
}
}
public bool GrowCheck(object[] args)
{
string lab = "";
if (historyCoatingSqlHelp.CheckExceedTray(args[0].ToString(), args[1].ToString(), out lab))
CheckIsClear(lab);
if (historyCoatingSqlHelp.CheckExceedPM(args[1].ToString(), out lab))
CheckIsClear(lab);
return true;
}
InspectCleanView inspectCleanView = new InspectCleanView();
private void CheckIsClear(string lab) //检查当前厚度是否大于设定厚度,操作对象Tray PM,需要清理时弹窗提示
{
//在异步中弹窗
Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
inspectCleanView.AddToolTip(lab);
//弹窗提示,不关闭时,文本内容递增,关闭后重新提示
var wins = Application.Current.Windows.OfType<InspectCleanView>().ToArray();
if (wins.Any())
{
foreach (InspectCleanView w in wins)
{
if (w.WindowState == WindowState.Minimized)
w.WindowState = WindowState.Normal;
w.Show();
w.Activate();
}
}
else
{
if (!inspectCleanView.IsActive)
{
inspectCleanView = new InspectCleanView();
inspectCleanView.AddToolTip(lab);
inspectCleanView.Show();
}
}
}));
}
}
}
@@ -0,0 +1,430 @@
using Aitex.Core.RT.DBCore;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Math;
using DocumentFormat.OpenXml.Office.Word;
using DocumentFormat.OpenXml.Wordprocessing;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.OperationCenter;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Xml.Linq;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
public class HistoryCoatingSqlHelp
{
private List<string> TrayTabList = new List<string>()
{
"tray_number",
"tray_inner_number",
"ring_inner_number",
"ring_outer_number"
};
public List<TrayCoatingThickness> QueryUpdateAll_Tray()
{
string cmd = $"select * from tray_thickness_main order by create_time desc ";
return QueryTrayCoatingList(cmd);
}
public List<TrayCoatingThickness> QueryUpdateTime_Tray(string starTime, string endTime)
{
string cmd = $"select * from tray_thickness_main where create_time between '{starTime}' and '{endTime}' order by create_time desc";
return QueryTrayCoatingList(cmd);
}
public List<CoatingData> QueryUnitName_Tray(string name, string starTime="", string endTime="")
{
string time = $"and create_time between '{starTime}' and '{endTime}'";
string cmd = $"select * from tray_thickness_main where tray_number = '{name}' {time} order by create_time desc";
return QueryTrayBase(cmd, true);
}
/// <summary>
/// Tray环交叉使用记录
/// </summary>
/// <param name="name"></param>
/// <param name="starTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
public List<TrayCoatingThickness> QueryEntiretyTray(string name, string starTime = "", string endTime = "")
{
//根据TrayID获取对应内外编号
List<TrayCoatingThickness> trayCoatingList = new List<TrayCoatingThickness>();
List<string> rowName = new List<string>();
string cmdAllName = "select * from tray_thickness_data where " +
$"tray_number='{name}' " +
$"or tray_inner_number = '{name}' " +
$"or ring_inner_number = '{name}' " +
$"or ring_outer_number = '{name}'";
var dtAll = QueryDataClient.Instance.Service.QueryData(cmdAllName);
if (dtAll !=null && dtAll.Rows.Count != 0)
{
for (int i = 0; i < dtAll.Rows.Count; i++)
{
for (int j = 0; j < TrayTabList.Count; j++)
{
string value = dtAll.Rows[i][TrayTabList[j]].ToString();
if (!rowName.Contains(value))
rowName.Add(value);
}
}
}
string cmdName1 = "";
for (int i = 0; i < rowName.Count; i++)
{
if (i == rowName.Count - 1)
cmdName1 += $"tray_number = '{rowName[i]}' ";
else
cmdName1 += $"tray_number = '{rowName[i]}' or ";
}
string time = $"and create_time between '{starTime}' and '{endTime}'";
string cmdName = $"select * from tray_thickness_main where {cmdName1} {time} order by create_time desc";
trayCoatingList = QueryTrayCoatingList(cmdName);
return trayCoatingList;
}
public List<PMCoatingThickness> QueryUpdateAll_PM()
{
string cmd = $"select * from pm_thickness_main order by create_time desc ";
return QueryPMCoatingList(cmd);
}
public List<PMCoatingThickness> QueryUpdateTime_PM(string starTime, string endTime)
{
string cmd = $"select * from pm_thickness_main where create_time between '{starTime}' and '{endTime}' order by create_time desc";
return QueryPMCoatingList(cmd);
}
public List<PMCoatingThickness> QueryUnitName_PM(string name, string starTime = "", string endTime = "")
{
string time = $"and create_time between '{starTime}' and '{endTime}'";
string cmd = $"select * from pm_thickness_main where pm_cycle = '{name}' {time} order by create_time desc";
return QueryPMCoatingList(cmd);
}
private List<CoatingData> QueryTrayBase(string cmd, bool isNum = false)
{
List<CoatingData> coatingDataList = new List<CoatingData>();
try
{
var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用
if (dt == null || dt.Rows.Count == 0)
return null;
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i].ItemArray.Length != 0)
{
CoatingData coatingData = new CoatingData()
{
SerialNumber = dt.Rows[i]["tray_number"].ToString(),
MAX = dt.Rows[i]["tray_max_thickness"].ToString(),
PmOwned = dt.Rows[i]["pm_number"].ToString(),
Current = dt.Rows[i]["tray_coating_thickness"].ToString(),
CreatTime = dt.Rows[i]["create_time"].ToString(),
Caption = dt.Rows[i]["tray_label"].ToString(),
Index = $"Tray {i / 4 + 1}"
};
if (isNum)
{
coatingData.Index = (i + 1).ToString();
}
coatingDataList.Add(coatingData);
}
else
coatingDataList.Add(new CoatingData());
}
}
catch (Exception)
{
return null;
}
return coatingDataList;
}
private List<TrayCoatingThickness> QueryTrayCoatingList(string cmd)
{
List<TrayCoatingThickness> trayCoatingList = new List<TrayCoatingThickness>();
try
{
TrayCoatingThickness trayCoatingThickness = new TrayCoatingThickness();
var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用
if (dt == null || dt.Rows.Count == 0)
return null;
for (int i = 0; i < dt.Rows.Count; i++)
{
CoatingData coatingData = new CoatingData()
{
SerialNumber = dt.Rows[i]["tray_number"].ToString(),
MAX = dt.Rows[i]["tray_max_thickness"].ToString(),
PmOwned = dt.Rows[i]["pm_number"].ToString(),
Current = dt.Rows[i]["tray_coating_thickness"].ToString(),
CreatTime = dt.Rows[i]["create_time"].ToString(),
Caption = dt.Rows[i]["tray_label"].ToString(),
Index = $"Tray {i / 4 + 1}"
};
switch (coatingData.Caption)
{
case "石墨托盘":
trayCoatingThickness.Tray = coatingData;
break;
case "内部托架":
trayCoatingThickness.TrayInner = coatingData;
break;
case "中间托架":
trayCoatingThickness.RingInner = coatingData;
break;
case "外部托架":
trayCoatingThickness.RingOuter = coatingData;
break;
default:
break;
}
if ((i % 4) == 3)//Tray是4个数据为一个循环
{
trayCoatingList.Add(trayCoatingThickness);
trayCoatingThickness = new TrayCoatingThickness();
}
}
}
catch (Exception)
{
return null;
}
return trayCoatingList;
}
private List<PMCoatingThickness> QueryPMCoatingList(string cmd)
{
List<PMCoatingThickness> pmCoatingList = new List<PMCoatingThickness>();
try
{
PMCoatingThickness pmCoatingThickness = new PMCoatingThickness();
var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用
if (dt == null || dt.Rows.Count == 0)
return null;
for (int i = 0; i < dt.Rows.Count; i++)
{
CoatingData coatingData = new CoatingData()
{
SerialNumber = dt.Rows[i]["pm_cycle"].ToString(),
MAX = dt.Rows[i]["pm_max_thickness"].ToString(),
PmOwned = dt.Rows[i]["pm_number"].ToString(),
Current = dt.Rows[i]["pm_coating_thickness"].ToString(),
CreatTime = dt.Rows[i]["create_time"].ToString(),
Caption = dt.Rows[i]["pm_label"].ToString(),
Index = $"{i + 1}"
};
if (coatingData.Caption.Contains("小周期"))
pmCoatingThickness.MinorCycle = coatingData;
else
pmCoatingThickness.MajorCycle = coatingData;
if ((i % 2) == 1)//MP是2个数据为一个循环
{
pmCoatingList.Add(pmCoatingThickness);
pmCoatingThickness = new PMCoatingThickness();
}
}
}
catch (Exception)
{
return null;
}
return pmCoatingList;
}
public bool GrowTray(string tray_guid, double GrowthRate, double Seconds)//Tray更新增长厚度
{
//
try
{
string tray_numbers = "";
string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'";
DataSet ds = DB.ExecuteDataSet(sSql);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
tray_numbers = "'" + ds.Tables[0].Rows[0]["tray_number"].ToString() + "','" + ds.Tables[0].Rows[0]["tray_inner_number"].ToString() + "','" +
ds.Tables[0].Rows[0]["ring_inner_number"].ToString() + "','" + ds.Tables[0].Rows[0]["ring_outer_number"].ToString() + "'";
string growthValue = (GrowthRate * Seconds / 3600).ToString("0.000"); //μm
string[] gCmd = { $"update tray_thickness_main set tray_coating_thickness = tray_coating_thickness + {growthValue} " +
$"where create_time = (select create_time FROM tray_thickness_main where tray_number in ({tray_numbers}) " +
$"ORDER BY create_time DESC LIMIT 1 ) " };
List<string> coatingNameList = new List<string>();
coatingNameList.Add(ds.Tables[0].Rows[0]["tray_number"].ToString());
coatingNameList.Add(ds.Tables[0].Rows[0]["tray_inner_number"].ToString());
coatingNameList.Add(ds.Tables[0].Rows[0]["ring_inner_number"].ToString());
coatingNameList.Add(ds.Tables[0].Rows[0]["ring_outer_number"].ToString());
foreach (string name in coatingNameList)
{
OP.DoOperation("GEM_GrowCoating",
name, growthValue);
}
return DB.ExcuteTransAction(gCmd.ToList());
}
catch (Exception ex)
{
LOG.Write($"GrowTray { ex}");
return false;
}
}
public bool GrowPM(string pmName, double GrowthRate, double Seconds)//PM更新增长厚度
{
try
{
string pm_Cmd = "";
string sSql = $"select * from pm_thickness_data where pm_guid like '{pmName}' ";
DataSet ds = DB.ExecuteDataSet(sSql);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
pm_Cmd = $"'{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}','{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'";
//
string growthValue = (GrowthRate * Seconds / 3600).ToString("0.00"); //μm
string[] gCmd = { $"update pm_thickness_main set pm_coating_thickness = pm_coating_thickness + {growthValue} " +
$"where create_time = (select create_time FROM pm_thickness_main where pm_cycle in ({pm_Cmd}) " +
$"ORDER BY create_time DESC LIMIT 1 ) " };
return DB.ExcuteTransAction(gCmd.ToList());
}
catch (Exception ex)
{
LOG.Write($"GrowPM {ex}");
return false;
}
}
public bool GrowPMForMaintenance(string pmName, double GrowthRate, double Seconds)//PM更新增长厚度
{
try
{
string growthValue = (GrowthRate * Seconds / 3600).ToString("0.00"); //μm
string gCmd = $"update pm_thickness_data2 set thickness = thickness + {growthValue} " +
$"where pm_name = '{pmName}';";
return DB.ExecuteNonQuery(gCmd) == 1;
}
catch (Exception ex)
{
LOG.Write($"GrowPM {ex}");
return false;
}
}
public bool CheckExceedTray(string tray_guid,string pmName, out string infor)
{
infor = "";
try
{
string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'";
DataSet ds = DB.ExecuteDataSet(sSql);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
string cmd = "select tray_coating_thickness , tray_max_thickness,tray_label from tray_thickness_main where ";
cmd += $"tray_number='{ds.Tables[0].Rows[0]["tray_number"].ToString()}' " +
$"or tray_number = '{ds.Tables[0].Rows[0]["tray_inner_number"].ToString()}' " +
$"OR tray_number = '{ds.Tables[0].Rows[0]["ring_inner_number"].ToString()}' " +
$"or tray_number = '{ds.Tables[0].Rows[0]["ring_outer_number"].ToString()}'";
string timeCmd = $" ORDER BY create_time DESC LIMIT 4";
ds = DB.ExecuteDataSet(cmd+ timeCmd);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
double coating = double.Parse( ds.Tables[0].Rows[i]["tray_coating_thickness"].ToString());
double max =double.Parse(ds.Tables[0].Rows[i]["tray_max_thickness"].ToString());
if (coating>max)
{
string lab = ds.Tables[0].Rows[i]["tray_label"].ToString();
infor = $"{pmName}腔体 Tray {lab} MAX={max} Coating={coating}";
return true;
}
}
}
catch (Exception ex)
{
LOG.Write($"HistoryCoatingSqlHelp.CheckExceedTray error {ex}");
return false;
}
return false;
}
public bool CheckExceedPM(string pmId, out string infor)
{
infor = "";
try
{
string sSql = $"select * from pm_thickness_data where pm_guid like '{pmId}'";
DataSet ds = DB.ExecuteDataSet(sSql);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
string cmd = "select pm_coating_thickness , pm_max_thickness,pm_label from pm_thickness_main where ";
cmd += $"pm_cycle='{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}' " +
$"or pm_cycle = '{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'";
string timeCmd = $" ORDER BY create_time DESC LIMIT 2";
ds = DB.ExecuteDataSet(cmd + timeCmd);
if (ds == null || ds.Tables[0].Rows.Count == 0)
return false;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
double coating = double.Parse(ds.Tables[0].Rows[i]["pm_coating_thickness"].ToString());
double max = double.Parse(ds.Tables[0].Rows[i]["pm_max_thickness"].ToString());
if (coating > max)
{
string lab = ds.Tables[0].Rows[i]["pm_label"].ToString();
infor = $"{lab} MAX={max} Coating={coating}";
return true;
}
}
}
catch (Exception ex)
{
LOG.Write($"HistoryCoatingSqlHelp.CheckExceedPM error {ex}");
return false;
}
return false;
}
}
}
@@ -0,0 +1,679 @@
<UserControl
x:Class="MECF.Framework.UI.Client.TrayThickness.HistoryData.HistoryDataView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:local="clr-namespace:MECF.Framework.UI.Client.TrayThickness.HistoryData"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
d:DesignHeight="450"
d:DesignWidth="1200"
lex:LocalizeDictionary.DesignCulture="zh"
lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
lex:ResxLocalizationProvider.DefaultDictionary="lang_overview"
mc:Ignorable="d">
<UserControl.Resources>
<local:ColorConverter x:Key="ColorConverter_Current" />
<local:BoolToVisibilityConverter x:Key="BoolToVisibility_Converter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 右侧操作面板 -->
<StackPanel
Height="340"
Margin="10"
VerticalAlignment="Top"
Background="#FFDBE5F1"
Orientation="Vertical">
<StackPanel
Width="260"
Margin="10"
lex:ResxLocalizationProvider.DefaultDictionary="lang_common">
<StackPanel.Resources>
<Style TargetType="xctk:DateTimeUpDown">
<Setter Property="Width" Value="180" />
<Setter Property="Format" Value="Custom" />
<Setter Property="FormatString" Value="yyyy/MM/dd HH:mm:ss" />
</Style>
</StackPanel.Resources>
<StackPanel Margin="3,0" Orientation="Horizontal">
<TextBlock
Width="70"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14"
Text="{lex:Loc ID_TXT_StartTime}" />
<WindowsFormsHost
Width="170"
Height="22"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14">
<forms:DateTimePicker
x:Name="wfTimeFrom"
CustomFormat="yyyy/MM/dd HH:mm:ss"
Format="Custom"
Value="2011-8-1" />
</WindowsFormsHost>
</StackPanel>
<StackPanel Margin="3,0" Orientation="Horizontal">
<TextBlock
Width="70"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14"
Text="{lex:Loc ID_TXT_EndTime}" />
<WindowsFormsHost
Width="170"
Height="22"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14">
<forms:DateTimePicker
x:Name="wfTimeTo"
CustomFormat="yyyy/MM/dd HH:mm:ss"
Format="Custom"
Value="2011-8-1" />
</WindowsFormsHost>
</StackPanel>
</StackPanel>
<StackPanel
Margin="5"
HorizontalAlignment="Right"
Orientation="Horizontal">
<RadioButton
Margin="5"
VerticalAlignment="Center"
Content="{lex:Loc ID_TXT_Tray}"
IsChecked="{Binding IsQueryTray}" />
<RadioButton
Margin="5"
VerticalAlignment="Center"
Content="PM"
IsChecked="{Binding IsQueryPM}"
ToolTip="选中时间段内查询" />
</StackPanel>
<StackPanel lex:ResxLocalizationProvider.DefaultDictionary="lang_common">
<Button
Width="100"
Height="30"
Margin="10"
HorizontalAlignment="Left"
Content="Query All"
ToolTip="查询所有记录"
Visibility="Collapsed">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="QueryAll" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button
x:Name="ID_BTN_Query_Content"
Width="100"
Height="30"
Margin="10"
HorizontalAlignment="Right"
Content="{lex:Loc}"
ToolTip="{lex:Loc}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="QueryTime" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
<StackPanel Visibility="{Binding IsQueryTray, Converter={StaticResource BoolToVisibility_Converter}}">
<StackPanel
Margin="10,30,0,0"
lex:ResxLocalizationProvider.DefaultDictionary="lang_common"
Orientation="Horizontal">
<TextBlock
Width="50"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14"
Text="{lex:Loc ID_TXT_Name}" />
<TextBox
Name="txt_TrayName"
Width="170"
Height="22"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14" />
</StackPanel>
<StackPanel
Margin="10"
HorizontalAlignment="Right"
Orientation="Horizontal">
<RadioButton
x:Name="ID_RAD_Monocycle_Content"
Margin="5"
VerticalAlignment="Center"
Content="{lex:Loc}"
IsChecked="{Binding Unit}"
ToolTip="{lex:Loc}" />
<RadioButton
x:Name="ID_RAD_Entirety_Content"
Margin="5"
VerticalAlignment="Center"
Content="{lex:Loc}"
IsChecked="{Binding Entirety}"
ToolTip="{lex:Loc}" />
</StackPanel>
<Button
Width="100"
Height="30"
Margin="10"
HorizontalAlignment="Right"
lex:ResxLocalizationProvider.DefaultDictionary="lang_common"
Content="{lex:Loc ID_BTN_Query_Content}"
ToolTip="{lex:Loc ID_BTN_Query_Content}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="QueryName">
<micro:ActionMessage.Parameters>
<micro:Parameter Value="{Binding Path=Text, ElementName=txt_TrayName}" />
</micro:ActionMessage.Parameters>
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</StackPanel>
<ScrollViewer
Grid.Column="1"
Width="900"
Margin="10"
HorizontalAlignment="Left"
lex:ResxLocalizationProvider.DefaultDictionary="lang_overview">
<StackPanel>
<!-- Tray信息展示控件包含整体Tray和单环信息两种控件 -->
<StackPanel Visibility="{Binding IsQueryTray, Converter={StaticResource BoolToVisibility_Converter}}">
<!-- 单行信息展示 -->
<ListView
VerticalAlignment="Top"
AlternationCount="2"
ItemsSource="{Binding CoatingData}"
Visibility="{Binding Unit, Converter={StaticResource BoolToVisibility_Converter}}">
<ListView.View>
<GridView>
<GridViewColumn Width="80" Header="{lex:Loc ID_TXT_Index}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Index}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="120" Header="{lex:Loc ID_TXT_Caption}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Caption}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="200" Header="{lex:Loc ID_TXT_Name}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding SerialNumber}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100" Header="{lex:Loc ID_TXT_Max}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MAX}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100" Header="{lex:Loc ID_TXT_Current}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Current, StringFormat=N2}">
<TextBlock.Foreground>
<MultiBinding Converter="{StaticResource ColorConverter_Current}" StringFormat="{}{0}:{1}">
<Binding Path="Current" />
<Binding Path="MAX" />
</MultiBinding>
</TextBlock.Foreground>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="80" Header="{lex:Loc ID_TXT_PM_ID}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding PmOwned}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="220" Header="{lex:Loc ID_TXT_Creat_Time}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CreatTime}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<!-- Tray整体信息展示 -->
<ListView
HorizontalAlignment="Left"
Background="White"
FontSize="12"
ItemsSource="{Binding TrayCoatingList}"
Visibility="{Binding IsNotUnit, Converter={StaticResource BoolToVisibility_Converter}}">
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Label">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightSkyBlue" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn
Width="900"
lex:ResxLocalizationProvider.DefaultDictionary="lang_overview"
Header="{lex:Loc ID_TXT_Tray_Coating_History_Data}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Width="850">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border BorderBrush="Gray" BorderThickness="1,1,0,1">
<Label
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{Binding Tray.PmOwned}"
FontFamily="Bold"
FontSize="18" />
</Border>
<StackPanel Grid.Column="1">
<Border BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding Tray.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding Tray.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding Tray.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding Tray.Current}">
<Label.Foreground>
<MultiBinding Converter="{StaticResource ColorConverter_Current}" StringFormat="{}{0}:{1}">
<Binding Path="Tray.Current" />
<Binding Path="Tray.MAX" />
</MultiBinding>
</Label.Foreground>
</Label>
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding Tray.CreatTime}" />
</StackPanel>
</Border>
<Border BorderBrush="Gray" BorderThickness="1,0,1,1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding TrayInner.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding TrayInner.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding TrayInner.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding TrayInner.Current}">
<Label.Foreground>
<MultiBinding Converter="{StaticResource ColorConverter_Current}" StringFormat="{}{0}:{1}">
<Binding Path="TrayInner.Current" />
<Binding Path="TrayInner.MAX" />
</MultiBinding>
</Label.Foreground>
</Label>
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding TrayInner.CreatTime}" />
</StackPanel>
</Border>
<Border BorderBrush="Gray" BorderThickness="1,0,1,1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingInner.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingInner.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingInner.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingInner.Current}">
<Label.Foreground>
<MultiBinding Converter="{StaticResource ColorConverter_Current}" StringFormat="{}{0}:{1}">
<Binding Path="RingInner.Current" />
<Binding Path="RingInner.MAX" />
</MultiBinding>
</Label.Foreground>
</Label>
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding RingInner.CreatTime}" />
</StackPanel>
</Border>
<Border BorderBrush="Gray" BorderThickness="1,0,1,1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingOuter.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingOuter.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingOuter.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding RingOuter.Current}">
<Label.Foreground>
<MultiBinding Converter="{StaticResource ColorConverter_Current}" StringFormat="{}{0}:{1}">
<Binding Path="RingOuter.Current" />
<Binding Path="RingOuter.MAX" />
</MultiBinding>
</Label.Foreground>
</Label>
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding RingOuter.CreatTime}" />
</StackPanel>
</Border>
</StackPanel>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</StackPanel>
<!-- PM信息展示控件 -->
<ListView
HorizontalAlignment="Left"
Background="White"
FontSize="12"
ItemsSource="{Binding PMCoatingList}"
Visibility="{Binding IsQueryPM, Converter={StaticResource BoolToVisibility_Converter}}">
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Label">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightSkyBlue" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn Width="920" Header="{lex:Loc ID_TXT_PM_Coating_History_Data}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Width="920">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border BorderBrush="Gray" BorderThickness="1,1,0,1">
<Label
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{Binding MinorCycle.PmOwned}"
FontFamily="Bold"
FontSize="18" />
</Border>
<StackPanel Grid.Column="1">
<Border BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="80"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MinorCycle.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MinorCycle.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MinorCycle.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MinorCycle.Current}" />
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding MinorCycle.CreatTime}" />
</StackPanel>
</Border>
<Border BorderBrush="Gray" BorderThickness="1,0,1,1">
<StackPanel Orientation="Horizontal">
<Label>Caption:</Label>
<Label
Width="80"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MajorCycle.Caption}" />
<Label>Name:</Label>
<Label
Width="150"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MajorCycle.SerialNumber}" />
<Label>Max:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MajorCycle.MAX}" />
<Label>Thickness:</Label>
<Label
Width="60"
Margin="0,0,5,0"
HorizontalAlignment="Left"
Content="{Binding MajorCycle.Current}" />
<Label>Time:</Label>
<Label
Width="160"
HorizontalAlignment="Left"
Content="{Binding MajorCycle.CreatTime}" />
</StackPanel>
</Border>
</StackPanel>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
/// <summary>
/// HistoryDataView.xaml 的交互逻辑
/// </summary>
public partial class HistoryDataView : UserControl
{
public HistoryDataView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,217 @@
using Aitex.Core.RT.OperationCenter;
using MECF.Framework.UI.Client.ClientBase;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
public class HistoryDataViewModel : UiViewModelBase, ISupportMultipleSystem
{
/// <summary>
/// 返回ViewModel绑定的视图对象。
/// </summary>
public UserControl View { get; private set; }
public DateTime StartDateTime
{
get => ((HistoryDataView)View).wfTimeFrom.Value;
set
{
((HistoryDataView)View).wfTimeFrom.Value = value;
NotifyOfPropertyChange(nameof(StartDateTime));
}
}
public DateTime EndDateTime
{
get => ((HistoryDataView)View).wfTimeTo.Value;
set
{
((HistoryDataView)View).wfTimeTo.Value = value;
NotifyOfPropertyChange(nameof(EndDateTime));
}
}
private bool isQueryTray = true;
//勾选查询Tray
public bool IsQueryTray
{
get => isQueryTray;
set
{
isQueryTray = value;
Refresh();
}
}
private bool isQueryPM;
//勾选查询PM
public bool IsQueryPM
{
get => isQueryPM;
set
{
isQueryPM = value;
Refresh();
}
}
public bool TimeChecked { get; set; }
public bool Unit { get; set; } = false;
public bool IsNotUnit => !Unit;
public bool Entirety { get; set; } = true;
//数据库查询对象实例
private HistoryCoatingSqlHelp HistoryCoatingSqlHelp = new HistoryCoatingSqlHelp();
//表示单行数据集合,Tray专用
public List<CoatingData> CoatingData { get; set; } = new List<CoatingData>();
//整个Tray对象数据集合,内含4个环
public List<TrayCoatingThickness> TrayCoatingList { get; set; } = new List<TrayCoatingThickness>();
//PM对象数据集合,内含大小周期
public List<PMCoatingThickness> PMCoatingList { get; set; } = new List<PMCoatingThickness>();
protected override void OnViewLoaded(object _view)
{
base.OnViewLoaded(_view);
View = (UserControl)_view;
StartDateTime = DateTime.Now.Date;
EndDateTime = DateTime.Now.Date.AddDays(1).AddTicks(-1);
}
public void QueryTime()
{
if (StartDateTime > EndDateTime)
{
MessageBox.Show("time range invalid, start time should be early than end time.", "Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
return;
}
if (IsQueryTray)
TrayCoatingList = HistoryCoatingSqlHelp.QueryUpdateTime_Tray(GetTime(StartDateTime), GetTime(EndDateTime));
if (IsQueryPM)
PMCoatingList = HistoryCoatingSqlHelp.QueryUpdateTime_PM(GetTime(StartDateTime), GetTime(EndDateTime));
Refresh();
}
public void QueryAll()
{
if (IsQueryTray)
TrayCoatingList = HistoryCoatingSqlHelp.QueryUpdateAll_Tray();
if (IsQueryPM)
PMCoatingList = HistoryCoatingSqlHelp.QueryUpdateAll_PM();
Refresh();
}
public void QueryName(string name)
{
if (name == null || name.Length == 0)
{
MessageBox.Show("输入名称为空");
return;
}
if (TimeChecked)
{
if (StartDateTime > EndDateTime)
{
MessageBox.Show("time range invalid, start time should be early than end time.", "Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
return;
}
}
if (IsQueryTray)
{
if (Unit)
CoatingData = HistoryCoatingSqlHelp.QueryUnitName_Tray(name, GetTime(StartDateTime), GetTime(EndDateTime));
else if (Entirety)
TrayCoatingList = HistoryCoatingSqlHelp.QueryEntiretyTray(name, GetTime(StartDateTime), GetTime(EndDateTime));
else
CoatingData = HistoryCoatingSqlHelp.QueryUnitName_Tray(name, GetTime(StartDateTime), GetTime(EndDateTime));
}
if (IsQueryPM)
PMCoatingList = HistoryCoatingSqlHelp.QueryUnitName_PM(name, GetTime(StartDateTime), GetTime(EndDateTime));
Refresh();
}
private string GetTime(DateTime dt)
{
return dt.ToString("yyyy-MM-dd HH:mm:ss");
}
}
/// <summary>
/// 检测厚度是否大于最大值
/// </summary>
class ColorConverter : IMultiValueConverter
{
public object Convert(object[] value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
if (value[0] == null || value[1] == null)
{
return new SolidColorBrush(Colors.Black);
}
double _current;
if (!double.TryParse(value[0].ToString(), out _current))
return new SolidColorBrush(Colors.Red);
double _max;
if (!double.TryParse(value[1].ToString(), out _max))
return new SolidColorBrush(Colors.Black);
if (_current > _max)
{
return new SolidColorBrush(Colors.Red);
}
else
{
return new SolidColorBrush(Colors.Black);
}
}
catch (Exception)
{
return new SolidColorBrush(Colors.Red);
}
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}
class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value)
return Visibility.Visible;
return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,20 @@
<Window x:Class="MECF.Framework.UI.Client.TrayThickness.HistoryData.InspectCleanView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MECF.Framework.UI.Client.TrayThickness.HistoryData"
mc:Ignorable="d"
WindowState="Normal" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
Window.SizeToContent="Height" Width="400" Topmost="True">
<Grid x:Name="Grid_Content" Margin="3,10,3,5" Height="Auto">
<StackPanel Orientation="Vertical">
<TextBlock Text="Needs Cleaning " HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Red" FontSize="18" FontWeight="Black" />
<TextBlock Name="txt_Coating" Text="" FontSize="12" Foreground="#666666" Margin="0,20,0,5" HorizontalAlignment="Center"
VerticalAlignment="Top" TextAlignment="Left"/>
</StackPanel>
</Grid>
</Window>
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{
/// <summary>
/// InspectCleanView.xaml 的交互逻辑
/// </summary>
public partial class InspectCleanView : Window
{
public InspectCleanView()
{
InitializeComponent();
}
public void AddToolTip(string str)
{
txt_Coating.Text += $"{str}\r\n";
}
}
}