首次上传

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,159 @@
using System.Collections.Generic;
using System.Windows.Media;
using ExtendedGrid.Microsoft.Windows.Controls;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public interface IParam
{
#region Properties
/// <summary>
/// 返回当前参数所属列名称。
/// </summary>
string DisplayName { get; }
/// <summary>
/// 设置或返回当前参数的控制名称。
/// <remarks>
/// 对应RecipeFormat.xml文件中的ControlName。
/// </remarks>
/// </summary>
string ControlName { get; }
/// <summary>
/// 返回当前参数所属的配方步骤。
/// </summary>
RecipeStep Parent { get; }
/// <summary>
/// 当前参数在表格中的所属行。
/// </summary>
DataGridRow RowOwner { get; set; }
/// <summary>
/// 当前参数在表格中的所属列。
/// </summary>
DataGridColumn ColumnOwner { get; set; }
/// <summary>
/// 返回前序参数。
/// </summary>
IParam Previous { get; set; }
/// <summary>
/// 返回后序参数。
/// </summary>
IParam Next { get; set; }
/// <summary>
/// 设置或返回当前参数所属步骤的访问权限。
/// </summary>
public MenuPermissionEnum StepPermission { get; set; }
/// <summary>
/// 设置或返回当前参数所属列的访问权限。
/// </summary>
public MenuPermissionEnum ColumnPermission { get; set; }
/// <summary>
/// 设置或返回当前参数的访问权限。
/// </summary>
/// <remarks>
/// 访问权限由当前参数所在的列和步骤共同决定。权限数值越小优先级越高。
/// </remarks>
public MenuPermissionEnum Permission { get; }
/// <summary>
/// 设置或返回是否在编辑器中隐藏参数值。
/// </summary>
public bool IsHideValue { get; set; }
/// <summary>
/// 设置或返回参数值隐藏时的替代符号。
/// </summary>
public string HiddenValueMasking { get; set; }
/// <summary>
/// 设置或返回当前参数是否被禁用。
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// 返回当前参数是否已保存。
/// </summary>
bool IsSaved { get; }
/// <summary>
/// 设置或返回当前参数的数值是否和前序参数的数值相等。
/// </summary>
/// <remarks>
/// 该属性用于渲染DataGrid单元格文本颜色,当不等于前序参数数值时,当前参数显示为绿色。
/// </remarks>
bool IsEqualsToPrevious { get; }
/// <summary>
/// 返回当前参数是否校验成功。
/// </summary>
bool IsValid { get; }
/// <summary>
/// 返回当前参数校验错误信息。
/// </summary>
string ValidationError { get; }
/// <summary>
/// 返回计算器是否校验成功。
/// </summary>
bool IsCalculatorError { get; }
/// <summary>
/// 返回是否高亮显示当前参数。
/// </summary>
bool IsHighlighted { get; }
#endregion
#region Methods
/// <summary>
/// 将参数链表转换为数组。
/// </summary>
/// <returns></returns>
List<IParam> Flatten();
/// <summary>
/// 校验用户输入值。
/// </summary>
void Validate();
/// <summary>
/// 设置为已保存状态。
/// </summary>
void Save();
/// <summary>
/// 高亮显示当前参数。
/// </summary>
void Highlight();
/// <summary>
/// 取消高亮显示。
/// </summary>
void ResetHighlight();
/// <summary>
/// 设置当前参数错误
/// </summary>
void SetCalculatorError();
/// <summary>
/// 取消当前参数错误
/// </summary>
void ResetCalculatorError();
#endregion
}
}
@@ -0,0 +1,20 @@
using System;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
public interface IValueParam
{
event EventHandler<object> OnValueChanged;
/// <summary>
/// 获取当前参数的数值。
/// </summary>
/// <returns></returns>
object GetValue();
/// <summary>
/// 设置新参数。
/// </summary>
/// <param name="value"></param>
void SetValue(object value);
}
@@ -0,0 +1,91 @@
using System.Collections.Generic;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public abstract class NumParamBase<TValue> : ParamBaseWithGenericValue<TValue>
{
#region Variables
protected TValue _minimun;
protected TValue _maximun;
#endregion
#region Constructors
protected NumParamBase()
{
}
protected NumParamBase(TValue initValue) : base(initValue)
{
}
protected NumParamBase(TValue initValue, TValue minimum, TValue maximum) : base(initValue)
{
if (minimum.GetType() != typeof(TValue))
minimum = default;
if (maximum.GetType() != typeof(TValue))
maximum = default;
_minimun = minimum;
_maximun = maximum;
}
#endregion
public TValue Minimun
{
get => _minimun;
set => Set(ref _minimun, value);
}
public TValue Maximun
{
get => _maximun;
set => Set(ref _maximun, value);
}
#region Methods
public override void Validate()
{
var ret = Comparer<TValue>.Default.Compare(_minimun, _maximun);
if (ret > 0)
{
IsValid = false;
ValidationError = "Config error: minimum value is greater than maximum value";
return;
}
if (double.TryParse(Value.ToString(), out var dblValue))
{
var retV2Min = Comparer<TValue>.Default.Compare(Value, _minimun);
var retV2Max = Comparer<TValue>.Default.Compare(Value, _maximun);
if (retV2Min < 0 || retV2Max > 0)
{
IsValid = false;
ValidationError = $"actual value ({_value}) is outside the range of {_minimun} to {_maximun}";
}
else
{
IsValid = true;
ValidationError = null;
}
}
else
{
IsValid = false;
ValidationError = "Format error: not a number";
}
}
#endregion
}
}
@@ -0,0 +1,325 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
using ExtendedGrid.Microsoft.Windows.Controls;
using MECF.Framework.Common.Account.Permissions;
using Sicentury.Core;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public abstract class Param : BindableBase, IParam
{
#region Variables
protected string _controlName;
protected string _displayName;
protected string _unitName;
protected MenuPermissionEnum _permStep;
protected MenuPermissionEnum _permColumn;
protected bool _isEnabled;
protected bool _isHideValue;
protected string _hiddenValueMasking;
protected bool _isSaved;
protected bool _isColumnSelected;
protected Visibility _visibility;
protected bool _isValid;
protected string _validationError;
protected bool _isEqualsToPrevious;
protected bool _isHighlighted;
protected bool _isCalculatorError;
protected bool _isCompareDifferent;
protected SolidColorBrush _stepColorBrush;
#endregion
#region Constructors
protected Param()
{
_isSaved = true;
IsEnabled = true;
_isValid = true;
_validationError = null;
_isEqualsToPrevious = true;
_visibility = Visibility.Visible;
_isHighlighted = false;
_hiddenValueMasking = "-";
StepDoneCallback = (value) =>
{
IsEnabled = !value;
};
}
#endregion
#region Properties
/// <summary>
/// 设置或返回当前参数所在的列的访问权限变更时,执行的回调函数。
/// </summary>
public Action<Param> ColumnPermChangedCallback { get; set; }
/// <summary>
/// 当step的执行状态变更时,执行的回调函数。
/// </summary>
public Action<bool> StepDoneCallback { get; set; }
public Func<Param, bool> Check { get; set; }
/// <inheritdoc />
public RecipeStep Parent { get; set; }
/// <inheritdoc />
public DataGridRow RowOwner { get; set; }
/// <inheritdoc />
public DataGridColumn ColumnOwner { get; set; }
/// <inheritdoc />
public virtual IParam Previous { get; set; }
/// <inheritdoc />
public virtual IParam Next { get; set; }
/// <inheritdoc />
public string ControlName
{
get => _controlName;
set => Set(ref _controlName, value);
}
/// <inheritdoc />
public string DisplayName
{
get => _displayName;
set => Set(ref _displayName, value);
}
/// <summary>
/// 设置或返回当前参数的单位。
/// </summary>
public string UnitName
{
get => _unitName;
set => Set(ref _unitName, value);
}
/// <inheritdoc />
public MenuPermissionEnum StepPermission
{
get => _permStep;
set => Set(ref _permStep, value);
}
/// <inheritdoc />
public MenuPermissionEnum ColumnPermission
{
get => _permColumn;
set => Set(ref _permColumn, value);
}
/// <inheritdoc />
public virtual MenuPermissionEnum Permission => (MenuPermissionEnum)Math.Min((int)StepPermission, (int)ColumnPermission);
/// <inheritdoc />
public bool IsHideValue
{
get => _isHideValue;
set => Set(ref _isHideValue, value);
}
/// <inheritdoc />
public string HiddenValueMasking
{
get => _hiddenValueMasking;
set => Set(ref _hiddenValueMasking, value);
}
/// <inheritdoc />
public bool IsEnabled
{
get => _isEnabled;
set => Set(ref _isEnabled, value);
}
/// <inheritdoc />
public virtual bool IsSaved
{
get => _isSaved;
set => Set(ref _isSaved, value);
}
/// <inheritdoc />
public bool IsEqualsToPrevious
{
get => _isEqualsToPrevious;
set => Set(ref _isEqualsToPrevious, value);
}
/// <inheritdoc />
public bool IsValid
{
get => _isValid;
internal set => Set(ref _isValid, value);
}
/// <inheritdoc />
public string ValidationError
{
get => _validationError;
protected set => Set(ref _validationError, value);
}
/// <inheritdoc />
public bool IsHighlighted
{
get => _isHighlighted;
private set => Set(ref _isHighlighted, value);
}
/// <inheritdoc />
public bool IsCalculatorError
{
get => _isCalculatorError;
private set => Set(ref _isCalculatorError, value);
}
/// <summary>
/// Recipe对比的不同参数部分属性标志,未添加到IParam接口中
/// </summary>
public bool IsCompareDifferent
{
get => _isCompareDifferent;
private set
{
_isCompareDifferent = value;
StepBackgroundColorBrush =
value ? new SolidColorBrush(Colors.LightSalmon) : new SolidColorBrush(Colors.Transparent);
Set(ref _isCompareDifferent, value);
}
}
public bool IsColumnSelected
{
get => _isColumnSelected;
set => Set(ref _isColumnSelected, value);
}
public Visibility Visible
{
get => _visibility;
set => Set(ref _visibility, value);
}
public bool EnableConfig { get; set; }
public bool EnableTolerance { get; set; }
public Visibility StepCheckVisibility { get; set; }
/// <summary>
/// 差异对比时单个参数栏的背景
/// </summary>
public SolidColorBrush StepBackgroundColorBrush
{
get => _stepColorBrush;
set => Set(ref _stepColorBrush, value);
}
#region Methods
/// <summary>
/// 高亮显示当前参数。
/// </summary>
public void Highlight()
{
IsHighlighted = true;
}
public void SetCalculatorError()
{
StepBackgroundColorBrush = new SolidColorBrush(Colors.Red);
IsCalculatorError = true;
}
public void ResetCalculatorError()
{
StepBackgroundColorBrush = new SolidColorBrush(Colors.Transparent);
IsCalculatorError = false;
}
/// <summary>
/// 高亮背景色显示,Recipe对比的不同参数部分。未添加到IParam接口中,IsCompareDifferent属性是参数对比标志位
/// </summary>
public void CompareDifferent()
{
IsCompareDifferent = true;
}
/// <summary>
/// 取消高亮显示。
/// </summary>
public void ResetHighlight()
{
IsHighlighted = false;
}
/// <summary>
/// 将当前参数所对应的前序、后续参数链表转换为数组。
/// </summary>
/// <returns></returns>
public virtual List<IParam> Flatten()
{
if (Previous != null)
return Previous.Flatten();
var list = new List<IParam>();
IParam p = this;
while (p != null)
{
list.Add(p);
p = p.Next;
}
return list;
}
/// <summary>
/// 校验当前参数的数值。
/// </summary>
/// <returns></returns>
public virtual void Validate()
{
IsValid = true;
ValidationError = "";
}
/// <summary>
/// 复位当前参数数值
/// </summary>
public virtual void Reset()
{
IsSaved = true;
}
/// <summary>
/// 将当前参数标记为已保存状态。
/// </summary>
public virtual void Save()
{
IsSaved = true;
}
public override string ToString()
{
return $"{DisplayName}, ControlName={ControlName}";
}
#endregion
#endregion
}
}
@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public abstract class ParamBaseWithGenericValue<TValue> : Param, IValueParam
{
#region Variables
public event EventHandler<object> OnValueChanged;
protected TValue _value;
protected TValue _valueSnapshot;
protected IParam _previous;
#endregion
#region Constructors
protected ParamBaseWithGenericValue()
{
}
protected ParamBaseWithGenericValue(TValue initValue) : this()
{
if (initValue.GetType() != typeof(TValue))
initValue = default;
_value = initValue;
_valueSnapshot = initValue;
}
#endregion
#region Properties
public virtual TValue Value
{
get => _value;
set
{
Set(ref _value, value);
ColumnPermChangedCallback?.Invoke(this);
_isSaved = _value.Equals(_valueSnapshot);
OnPropertyChanged(nameof(IsSaved));
// 当Value发生变化时,要办一下事项,以及时刷新UI状态。
CheckValueEqualityWithPrevious();
Validate();
}
}
public override IParam Previous
{
get => _previous;
set
{
//! 如果前序参数的Value发生了变化,则需要通知我进行比较,以确定我的Value是否和前序参数的Value相等。
// 注销之前注册的事件。
if (_previous is Param preParam)
preParam.PropertyChanged -= OnPreviousParamValueChanged;
_previous = value;
// 注册事件.
if (_previous is Param p)
{
p.PropertyChanged += OnPreviousParamValueChanged;
// 立即执行一次比较
CheckValueEqualityWithPrevious();
}
}
}
public override IParam Next { get; set; }
#endregion
#region Methods
/// <summary>
/// 判断Value属性是否相等。
/// </summary>
/// <param name="v1"></param>
/// <param name="v2"></param>
/// <returns></returns>
protected static bool IsTValueEqual(TValue v1, TValue v2)
{
return Comparer<TValue>.Default.Compare(v1, v2) == 0;
}
/// <summary>
/// 检查我的Value是否和前序参数的Value相等。
/// </summary>
private void CheckValueEqualityWithPrevious()
{
if (_previous is ParamBaseWithGenericValue<TValue> valuedParam)
{
IsEqualsToPrevious = IsTValueEqual(_value, valuedParam.Value);
}
}
/// <summary>
/// 当前序参数的Value发生变化时,判断其是否和我的Value属性相等。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnPreviousParamValueChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(Value) && _previous is ParamBaseWithGenericValue<TValue> valuedParam)
{
IsEqualsToPrevious = IsTValueEqual(_value, valuedParam.Value);
}
}
/// <summary>
/// 复位当前数据
/// </summary>
public override void Reset()
{
Value = _valueSnapshot;
base.Reset();
}
/// <summary>
/// 保存数据。
/// </summary>
public override void Save()
{
_valueSnapshot = _value;
base.Save();
}
/// <inheritdoc />
public virtual object GetValue()
{
if (Permission == MenuPermissionEnum.MP_NONE)
//throw new PermissionException(Permission);
return null;
return Value;
}
public void SetValue(object value)
{
if (Permission != MenuPermissionEnum.MP_READ_WRITE)
//throw new PermissionException(Permission);
return;
HandleSetValue(value);
OnValueChanged?.Invoke(this, value);
}
protected virtual void HandleSetValue(object value)
{
Debug.Assert(value.GetType() == typeof(TValue), "The type of value does not match to my type.");
Value = (TValue)value;
}
public override string ToString()
{
return $"{base.ToString()}, Value={_value}";
}
#endregion
}
}
@@ -0,0 +1,17 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class BoolParam : ParamBaseWithGenericValue<bool>
{
#region Constructors
public BoolParam()
{
}
public BoolParam(bool initValue) : base(initValue)
{
}
#endregion
}
}
@@ -0,0 +1,102 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Aitex.Core.RT.Device.PmDevices;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class ComboxParam : ParamBaseWithGenericValue<ComboxColumn.Option>
{
#region Constructors
public ComboxParam(IEnumerable<ComboxColumn.Option> options, string controlName, string initValue, string defaultValue)
{
// options 参数不能为null,或没有项目
var enumerable = options as ComboxColumn.Option[] ?? options.ToArray();
Debug.Assert(enumerable != null);
Debug.Assert(enumerable.Any());
ControlName = controlName;
Options = enumerable;
// 修复兼容性问题
initValue = CorrectValue(initValue);
// 检查Recipe中保存的值是否在Options中定义?
// 如果没有定义,则取默认值。
ComboxColumn.Option selected;
if (!string.IsNullOrEmpty(initValue) &&
Options.FirstOrDefault(x => x.Equals(initValue)) != null)
{
// 注意:Recipe中保存的是ControlName,编辑器中应显示DisplayName
selected = Options.First(x => x.Equals(initValue));
}
else
{
if (!string.IsNullOrEmpty(defaultValue) &&
Options.Any(x => x.Equals(defaultValue)))
selected = Options.First(x => x.Equals(defaultValue));
else
selected = Options.First();
}
_value = selected;
}
#endregion
#region Properties
public IEnumerable<ComboxColumn.Option> Options { get; }
private bool _isEditable;
public bool IsEditable
{
get => _isEditable;
set => Set(ref _isEditable, value);
}
private string _foreground = "Black";
public string Foreground
{
get => _foreground;
set => Set(ref _foreground, value);
}
public string LoopBackground => "Transparent";
public bool IsLoopItem => false;
#endregion
#region Methods
/// <summary>
/// 修正当前参数的值,解决兼容性问题。
/// <para>
/// 1、PSU和SCR控制策略为Pyro时,变更为PyroFollow。
/// </para>
/// </summary>
/// <param name="initValue"></param>
/// <returns></returns>
private string CorrectValue(string initValue)
{
if (ControlName == "TC1.SetHeaterMode" || ControlName == "TC2.SetHeaterMode2")
{
// 处理TC兼容性问题
if (initValue == "Pyro" || initValue == HeatStrategy.PyroFollow.ToString() || initValue == "1")
return "Follow";
if (initValue == HeatStrategy.PyroAuto.ToString() || initValue == "2")
return "Auto";
if (initValue == HeatStrategy.Power.ToString() || initValue == "0")
return "Power";
}
return initValue;
}
#endregion
}
}
@@ -0,0 +1,51 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class DoubleParam : NumParamBase<double>
{
#region Variables
private int _resolution;
#endregion
#region Constructors
public DoubleParam()
{
Placeholder = "*";
}
public DoubleParam(double initValue) : base(initValue)
{
Placeholder = "*";
}
public DoubleParam(double initValue, string placeholder) : base(initValue)
{
Placeholder = placeholder;
}
public DoubleParam(double initValue, double minimum, double maximum) : base(initValue, minimum, maximum)
{
Placeholder = "*";
}
public DoubleParam(double initValue, double minimum, double maximum, string placeholder) : base(initValue, minimum, maximum)
{
Placeholder = placeholder;
}
#endregion
/// <summary>
/// 返回当Value不可用时的占位符。
/// </summary>
public string Placeholder { get; }
public int Resolution
{
get => _resolution;
set => Set(ref _resolution, value);
}
}
}
@@ -0,0 +1,7 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class ExpanderParam : Param
{
}
}
@@ -0,0 +1,154 @@
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class FlowModeParam : ComboxParam
{
#region Variables
public enum FlowModeEnum
{
Vent,
Purge,
Run
}
#endregion
#region Constructors
public FlowModeParam(IEnumerable<ComboxColumn.Option> options, string controlName, string initValue, string defaultValue) :
base(options, controlName, initValue, defaultValue)
{
}
#endregion
#region Properties
public override ComboxColumn.Option Value
{
get => _value;
set
{
var isSwitchToVent = false;
if (value.Equals(FlowModeEnum.Purge))
{
if (Previous is FlowModeParam pp)
{
if (pp.Value.Equals(FlowModeEnum.Run))
{
isSwitchToVent = true;
}
}
if (Next is FlowModeParam np)
{
if (np.Value.Equals(FlowModeEnum.Run))
{
isSwitchToVent = true;
}
}
}
else if (value.Equals(FlowModeEnum.Run))
{
if (Previous is FlowModeParam pp)
{
if (pp.Value.Equals(FlowModeEnum.Purge))
{
isSwitchToVent = true;
}
}
if (Next is FlowModeParam np)
{
if (np.Value.Equals(FlowModeEnum.Purge))
{
isSwitchToVent = true;
}
}
}
if (isSwitchToVent)
MessageBox.Show("Flow mode cannot be switched directly between 'Purge' and 'Run'.", "Error",
MessageBoxButton.OK, MessageBoxImage.Error);
_value = isSwitchToVent
? Options.FirstOrDefault(x => x.Equals(FlowModeEnum.Vent)) ?? Options.First()
: value;
ColumnPermChangedCallback?.Invoke(this);
_isSaved = _value.Equals(_valueSnapshot);
OnPropertyChanged();
OnPropertyChanged(nameof(IsSaved));
}
}
#endregion
#region Methods
private void InnerValidate()
{
// 判断Flow Mode是否直接在Purge和Run之间切换。
var currentStepOption = Value;
var flowModeValid = true;
if (Previous != null)
{
var previousStepOption = ((ComboxParam)Previous).Value;
if ((previousStepOption.Equals(FlowModeEnum.Purge) && currentStepOption.Equals(FlowModeEnum.Run))
|| (previousStepOption.Equals(FlowModeEnum.Run) && currentStepOption.Equals(FlowModeEnum.Purge)))
{
flowModeValid = false;
}
}
if (Next != null)
{
var nextStepOption = ((ComboxParam)Next).Value;
if ((nextStepOption.Equals(FlowModeEnum.Purge) && currentStepOption.Equals(FlowModeEnum.Run))
|| (nextStepOption.Equals(FlowModeEnum.Run) && currentStepOption.Equals(FlowModeEnum.Purge)))
{
flowModeValid = false;
}
}
IsValid = flowModeValid;
ValidationError = !flowModeValid
? "Flow mode cannot be switched directly between 'Purge' and 'Run'"
: null;
}
public override void Validate()
{
var linkedList = Flatten();
foreach (var param in linkedList)
{
if(param is FlowModeParam p)
p.InnerValidate();
}
//TODO 如果当前参数是TMA或TCS,当设备未安装,流量模式必须为Purge
//Issue TCS没有对应的系统参数;TMA要区分PM腔,但Recipe不分PM腔,此处不好判断
if (ControlName == RecipeControlNames.TMA_FLOW_MODE)
{
}
if (ControlName == RecipeControlNames.TCS_FLOW_MODE)
{
}
}
#endregion
}
}
@@ -0,0 +1,22 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class IntParam : NumParamBase<int>
{
#region Constructors
public IntParam()
{
}
public IntParam(int initValue) : base(initValue)
{
}
public IntParam(int initValue, int minimum, int maximum) : base(initValue, minimum, maximum)
{
}
#endregion
}
}
@@ -0,0 +1,57 @@
using System.Collections.ObjectModel;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class LoopComboxParam : ParamBaseWithGenericValue<string>
{
#region Constructors
public LoopComboxParam()
{
}
public LoopComboxParam(string initValue) : base(initValue)
{
}
#endregion
public ObservableCollection<LoopComboxColumn.Option> Options { get; set; }
private bool _isEditable;
public bool IsEditable
{
get => _isEditable;
set => Set(ref _isEditable, value);
}
private bool _isLoopStep;
public bool IsLoopStep
{
get => _isLoopStep;
set
{
Set(ref _isLoopStep, value);
OnPropertyChanged(nameof(LoopBackground));
}
}
private bool _isValidLoop;
public bool IsValidLoop
{
get => _isValidLoop;
set
{
Set(ref _isValidLoop, value);
OnPropertyChanged(nameof(LoopBackground));
}
}
public string LoopBackground => IsLoopStep ? (IsValidLoop ? "#90EE90" : "#FFC0CB") : "Transparent";
public bool IsLoopItem { get; set; }
}
}
@@ -0,0 +1,17 @@
using System.Collections.ObjectModel;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class MultipleSelectParam : Param
{
public MultipleSelectParam(MultipleSelectColumn col)
{
this.Options = new ObservableCollection<MultipleSelectColumn.Option>();
col.CloneOptions(this).ForEach(opt => this.Options.Add(opt));
IsSaved = true;
}
public ObservableCollection<MultipleSelectColumn.Option> Options { get; set; }
}
}
@@ -0,0 +1,66 @@
using System;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class PathFileParam : ParamBaseWithGenericValue<string>
{
//TODO 系统所有的配方文件保存在“Sic\xxx\”路径下,"Sic"前缀可以通过系统配置设置,此处为了省事写死。
private const string SYS_NAME = "Sic";
#region Constructors
public PathFileParam()
{
}
public PathFileParam(string name, bool isEnabled, string prefixPath)
{
ControlName = name;
IsEnabled = isEnabled;
PrefixPath = prefixPath;
}
#endregion
public override string Value
{
get => _value;
set
{
Set(ref _value, value);
ColumnPermChangedCallback?.Invoke(this);
if (string.IsNullOrEmpty(_value))
{
FileName = "";
}
else
{
// Remove the prefix "Sic\xxx\", and leave the folder name of the recipe/seq file.
var index = _value.LastIndexOf("\\", StringComparison.Ordinal);
FileName = index > -1 ? _value.Replace($"{PrefixWithSysName}\\", "") : _value;
}
IsSaved = false;
}
}
public string PrefixWithSysName => $"{SYS_NAME}\\{PrefixPath}";
private string _fileName;
public string FileName
{
get => _fileName;
set => Set(ref _fileName, value);
}
private string _prefixPath;
public string PrefixPath
{
get => _prefixPath;
set => Set(ref _prefixPath, value);
}
}
}
@@ -0,0 +1,6 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class PopSettingParam : ParamBaseWithGenericValue<string>
{
}
}
@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
using SciChart.Charting2D.Interop;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class PositionParam : ParamBaseWithGenericValue<string>
{
public override string Value
{
get => _value;
set
{
OptionChanged(value);
Set(ref _value, value);
}
}
public ObservableCollection<ComboxColumn.Option> Options { get; set; }
private void OptionChanged(string value)
{
IEnumerable<ComboxColumn.Option> opts = Options.Where(op => op.ControlName == value);
if (opts.Count() > 0)
{
string[] relatedparams = opts.ToList()[0].RelatedParameters.Split(',');
Parent.ToList().ForEach(param =>
{
if (relatedparams.Contains(param.ControlName) || param.ControlName == "Position" || param.ControlName == "StepNo" || param.ControlName == "Module")
param.Visible = Visibility.Visible;
else
param.Visible = Visibility.Hidden;
});
}
else
{
Parent.ToList().ForEach(param =>
{
if (param.ControlName == "Position" || param.ControlName == "StepNo" || param.ControlName == "Module")
param.Visible = Visibility.Visible;
else
param.Visible = Visibility.Hidden;
});
}
}
}
}
@@ -0,0 +1,98 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class Sets3RatioParam : ParamBaseWithGenericValue<string>
{
#region Variables
#endregion
#region Constructors
public Sets3RatioParam()
{
_value = "1:1:1";
Ratio = new [] { 1.0, 1.0, 1.0 };
}
public Sets3RatioParam(string initValue) : base(initValue)
{
Ratio = new[] { 1.0, 1.0, 1.0 };
ParseRatio(initValue);
}
#endregion
#region Properties
public override string Value
{
get => _value;
set
{
Set(ref _value, value);
ColumnPermChangedCallback?.Invoke(this);
_isSaved = _value.Equals(_valueSnapshot);
OnPropertyChanged(nameof(IsSaved));
Validate();
ParseRatio(value);
}
}
public double[] Ratio { get; private set; }
#endregion
#region Methods
private void ParseRatio(string value)
{
var nums = value.Split(':');
if (nums.Length == 3
&& double.TryParse(nums[0], out var r1)
&& double.TryParse(nums[1], out var r2)
&& double.TryParse(nums[2], out var r3))
{
Ratio[0] = r1;
Ratio[1] = r2;
Ratio[2] = r3;
}
else
{
Ratio[0] = double.NaN;
Ratio[1] = double.NaN;
Ratio[2] = double.NaN;
}
}
public override void Validate()
{
if (ValidateRatioString(_value))
{
IsValid = true;
ValidationError = null;
}
else
{
IsValid = false;
ValidationError = "Format error";
}
}
#endregion
public static bool ValidateRatioString(string value)
{
var nums = value.Split(':');
return nums.Length == 3
&& double.TryParse(nums[0], out _)
&& double.TryParse(nums[1], out _)
&& double.TryParse(nums[2], out _);
}
}
}
@@ -0,0 +1,38 @@
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class StepParam : ParamBaseWithGenericValue<int>
{
#region Variables
private bool _checked;
#endregion
#region Constructors
public StepParam()
{
}
public StepParam(int initValue) : base(initValue)
{
}
#endregion
#region Properties
public override MenuPermissionEnum Permission => MenuPermissionEnum.MP_READ_WRITE;
public bool IsChecked
{
get => _checked;
set => Set(ref _checked, value);
}
#endregion
}
}
@@ -0,0 +1,17 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
{
public class StringParam : ParamBaseWithGenericValue<string>
{
#region Constructors
public StringParam()
{
}
public StringParam(string initValue) : base(initValue)
{
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,890 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Windows;
using System.Xml;
using Aitex.Core.RT.Log;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.Common.Equipment;
using MECF.Framework.UI.Client.CenterViews.Configs.Roles;
using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
using MECF.Framework.UI.Client.CenterViews.Editors;
using MECF.Framework.UI.Client.ClientBase;
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using MECF.Framework.UI.Core.Accounts;
using Sicentury.Core;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeFormatBuilder
{
/// <summary>
/// 步骤起始编号。
/// </summary>
public const int STEP_INDEX_BASE = 1;
public const string SPEC_COL_STEPNO = "StepNo";
public const string SPEC_COL_STEPUID = "StepUid";
public const string SPEC_COL_NAME = "Name";
#region RecipeFormat.xml模板文件中使用的Node、Attribute名称
private const string NAME_NODE_TABLE_RECIPE_FORMAT = "TableRecipeFormat";
private const string NAME_NODE_CATALOG = "Catalog";
private const string NAME_NODE_GROUP = "Group";
private const string NAME_NODE_STEP = "Step";
private const string NAME_ATTR_CHAMBER_TYPE = "RecipeChamberType";
private const string NAME_ATTR_VERSION = "RecipeVersion";
private const string NAME_ATTR_MODULE_NAME = "ModuleName";
private const string NAME_ATTR_CONTROL_NAME = "ControlName";
private const string NAME_ATTR_DISPLAY_NAME = "DisplayName";
private const string NAME_ATTR_UNIT_NAME = "UnitName";
private const string NAME_ATTR_DESC = "Description";
private const string PATH_GROUP = $"{NAME_NODE_TABLE_RECIPE_FORMAT}/{NAME_NODE_CATALOG}/{NAME_NODE_GROUP}";
#endregion
#region Variables
private readonly RecipeProvider _recipeProvider = new();
#endregion
#region Properties
public List<PermissionControlItem> RecipeColumnPermSource
{
get;
set;
}
public List<PermissionControlItem> RecipeStepPermSource
{
get;
set;
}
public List<PermissionControlItem> ContentPermSource
{
get;
set;
}
public RecipeStep Configs
{
get;
set;
}
public RecipeStep OesConfig
{
get;
set;
}
public RecipeStep VatConfig
{
get;
set;
}
public RecipeStep BrandConfig
{
get;
set;
}
public RecipeStep FineTuningConfig
{
get;
set;
}
public string RecipeChamberType
{
get;
set;
}
public string RecipeVersion
{
get;
set;
}
public List<EditorDataGridTemplateColumnBase> Columns
{
get;
set;
}
#endregion
#region Methods
private RecipeStep GetConfig(XmlNodeList nodes)
{
var configs = new RecipeStep(null);
foreach (XmlNode node in nodes)
{
var childNodes = node.SelectNodes("Config");
foreach (XmlNode configNode in childNodes)
{
switch (configNode.Attributes["InputType"].Value)
{
case "TextInput":
var text = new StringParam(configNode.Attributes["Default"].Value)
{
ControlName = configNode.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = configNode.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
};
configs.Add(text);
break;
case "Set3RatioInput":
var param = new Sets3RatioParam()
{
ControlName = configNode.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = configNode.Attributes[NAME_ATTR_DISPLAY_NAME].Value
};
configs.Add(param);
break;
case "DoubleInput":
var config = new DoubleParam(GlobalDefs.TryParseToDouble(configNode.Attributes["Default"].Value))
{
ControlName = configNode.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = configNode.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
};
if (double.TryParse(configNode.Attributes["Max"].Value, out var max))
{
(config as DoubleParam).Maximun = max;
}
if (double.TryParse(configNode.Attributes["Min"].Value, out var min))
{
(config as DoubleParam).Minimun = min;
}
configs.Add(config);
break;
case "ReadOnlySelection":
var defValue = configNode.Attributes["Default"] != null
? configNode.Attributes["Default"].Value
: "";
var xmlOptionList = configNode.SelectNodes("Item");
var listOption = new List<ComboxColumn.Option>();
foreach (XmlNode xmlOption in xmlOptionList)
{
var controlName = xmlOption.Attributes[NAME_ATTR_CONTROL_NAME].Value;
var displayName = xmlOption.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var opt = new ComboxColumn.Option(displayName, controlName, string.Empty);
listOption.Add(opt);
}
var comb = new ComboxParam(listOption, configNode.Attributes[NAME_ATTR_CONTROL_NAME].Value, string.Empty, defValue)
{
DisplayName = configNode.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
IsEditable = configNode.Attributes["InputType"].Value != "ReadOnlySelection",
EnableTolerance = configNode.Attributes["EnableTolerance"] != null && Convert.ToBoolean(configNode.Attributes["EnableTolerance"].Value),
};
configs.Add(comb);
break;
}
}
}
return configs;
}
/// <summary>
/// 去除小数点、箭头、括号(含括号里的内容)、横杠
/// </summary>
/// <param name="displayName"></param>
/// <param name="bracket">新增参数,括号及其内容可以不去除</param>
/// <returns></returns>
private string strAbc(string displayName, bool bracket = true)
{
if (Regex.IsMatch(displayName.Substring(0, 1), @"^[+-]?\d*[.]?\d*$"))
{
displayName = displayName.Remove(0, displayName.IndexOf(".") + 1); //去除序号
}
displayName = displayName.Trim().Replace(" ", "").Replace(".", "").Replace("->", "_").Replace("-", "");
if (bracket)
{
if (displayName.Contains("(") && displayName.Contains(")"))
{
displayName = displayName.Remove(displayName.IndexOf("("),
displayName.IndexOf(")") - displayName.IndexOf("(") + 1);
}
}
return displayName;
}
public double GetDoubleValueByName(string module, string name)
{
var value = SystemConfigProvider.Instance.GetValueByName(module, name);
double returnValue = 0;
if (string.IsNullOrEmpty(value))
{
if (name.EndsWith(".Default"))
{
returnValue = 0;
}
else if (name.EndsWith(".Min"))
{
returnValue = 0;
}
else if (name.EndsWith(".Max"))
{
returnValue = 10000;
}
}
else
{
returnValue = double.Parse(value);
}
return returnValue;
}
public string GetStringValueByName(string module, string name)
{
return SystemConfigProvider.Instance.GetValueByName(module, name);
}
/// <summary>
/// 获取RecipInfo的Name信息
/// </summary>
/// <param name="path"></param>
/// <param name="module"></param>
/// <param name="defaultCellEnable"></param>
/// <returns></returns>
public List<PermissionControlItem> GetRecipeColumnPermSource(string path, string module = "PM1", bool defaultCellEnable = true)
{
var str = _recipeProvider.GetRecipeFormatXml(path, module);
var doc = new XmlDocument();
try
{
doc.LoadXml(str);
var nodeRoot = doc.SelectSingleNode(NAME_NODE_TABLE_RECIPE_FORMAT);
RecipeChamberType = nodeRoot.Attributes[NAME_ATTR_CHAMBER_TYPE].Value;
RecipeVersion = nodeRoot.Attributes[NAME_ATTR_VERSION].Value;
}
catch (Exception ex)
{
LOG.Write(ex);
return null;
}
RecipeColumnPermSource = new List<PermissionControlItem>();
var nodes = doc.SelectNodes(PATH_GROUP);
foreach (XmlNode node in nodes)
{
var childNodes = node.SelectNodes(NAME_NODE_STEP);
foreach (XmlNode step in childNodes)
{
var name = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var id = step.Attributes[NAME_ATTR_CONTROL_NAME].Value;
RecipeColumnPermSource.Add(new PermissionControlItem(name, RolePermissionMapper.None, id));
}
}
return RecipeColumnPermSource;
}
/// <summary>
/// 获取StepInfo的No信息
/// </summary>
/// <returns></returns>
public List<PermissionControlItem> GetRecipeStepPermSource()
{
RecipeStepPermSource = new ();
for (var i = 0; i < 50; i++)
{
var name = "Step" + (i + 1);
var id = (i + 1).ToString();
RecipeStepPermSource.Add(new PermissionControlItem(name, RolePermissionMapper.None, id));
}
return RecipeStepPermSource;
}
/// <summary>
/// 获取ContentInfo的Name信息
/// </summary>
/// <param name="path"></param>
/// <param name="module"></param>
/// <param name="defaultCellEnable"></param>
/// <returns></returns>
public List<PermissionControlItem> GetContentPermSource(string path,string module = "PM1", bool defaultCellEnable = true)
{
var str = _recipeProvider.GetRecipeFormatXml(path, module);
var doc = new XmlDocument();
try
{
doc.LoadXml(str);
var nodeRoot = doc.SelectSingleNode(NAME_NODE_TABLE_RECIPE_FORMAT);
RecipeChamberType = nodeRoot.Attributes[NAME_ATTR_CHAMBER_TYPE].Value;
RecipeVersion = nodeRoot.Attributes[NAME_ATTR_VERSION].Value;
}
catch (Exception ex)
{
LOG.Write(ex);
return null;
}
ContentPermSource = new List<PermissionControlItem>();
var nodesCatalog = doc.SelectNodes("TableRecipeFormat/Catalog");
Debug.Assert(nodesCatalog != null, "No catalog nodes defined.");
foreach (XmlNode catalog in nodesCatalog)
{
var catalogName = catalog.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var nodeGroups = catalog.SelectNodes(NAME_NODE_GROUP);
foreach (XmlNode group in nodeGroups)
{
var groupName = group.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var nodeContents = group.SelectNodes("Content");
foreach (XmlNode content in nodeContents)
{
var name = catalogName + "." + groupName + "." +
content.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var description = content.Attributes[NAME_ATTR_DESC]?.Value ?? "";
ContentPermSource.Add(new PermissionControlItem(name, RolePermissionTrueFalseMapper.No,
description: description));
}
}
}
return ContentPermSource;
}
/// <summary>
/// 从指定的RecipeFormat.xml文件创建Recipe格式。
/// </summary>
/// <param name="path"></param>
/// <param name="module"></param>
/// <param name="defaultCellEnable"></param>
/// <returns></returns>
public List<EditorDataGridTemplateColumnBase> Build(string chamberId, string module, bool defaultCellEnable = true, RecipeType recipeType = RecipeType.Process)
{
//XML文档读取格式由 $"PM.{module}.RecipeConfig 改为 $"RecipeConfig ,RecipeConfig参数放在Sic层级下,和PM同级别
var str = _recipeProvider.GetRecipeFormatXml(chamberId, module);
var doc = new XmlDocument();
try
{
doc.LoadXml(str);
var nodeRoot = doc.SelectSingleNode(NAME_NODE_TABLE_RECIPE_FORMAT);
RecipeChamberType = nodeRoot.Attributes[NAME_ATTR_CHAMBER_TYPE].Value;
RecipeVersion = nodeRoot.Attributes[NAME_ATTR_VERSION].Value;
}
catch (Exception ex)
{
LOG.Write(ex);
return null;
}
var role = BaseApp.Instance.UserContext.Role;
var columns = new List<EditorDataGridTemplateColumnBase>();
EditorDataGridTemplateColumnBase col = null;
var nodes = doc.SelectNodes(PATH_GROUP);
foreach (XmlNode node in nodes)
{
var colExpander = new ExpanderColumn()
{
DisplayName = node.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
StringCellTemplate = "CellTemplateExpander",
StringHeaderTemplate = "ColumnHeaderTemplateExpander"
};
colExpander.Header = colExpander;
columns.Add(colExpander);
var childNodes = node.SelectNodes(NAME_NODE_STEP);
foreach (XmlNode step in childNodes)
{
//step number
if (step.Attributes[NAME_ATTR_CONTROL_NAME].Value == SPEC_COL_STEPNO)
{
col = new StepColumn()
{
DisplayName = "Step",
UnitName = "",
ControlName = "StepNo",
StringCellTemplate = "CellTemplateStepNo",
StringHeaderTemplate = "ColumnHeaderTemplateStepNo",
IsEnable = defaultCellEnable,
IsReadOnly = true
};
}
else if (step.Attributes[NAME_ATTR_CONTROL_NAME].Value == SPEC_COL_STEPUID)
{
col = new TextBoxColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
IsReadOnly = true,
IsEnable = defaultCellEnable,
Visibility = Visibility.Collapsed
};
}
else
{
switch (step.Attributes["InputType"].Value)
{
case "Set3RatioInput":
col = new RatioColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Default"),
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateSets3Ratio",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
MaxSets = 3
};
break;
case "TextInput":
col = new TextBoxColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Default"),
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateText",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
break;
case "ReadOnly":
col = new TextBoxColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateText",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
IsReadOnly = true,
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
break;
case "NumInput":
col = new NumColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
InputMode = step.Attributes["InputMode"].Value,
//Minimun = double.Parse(step.Attributes["Min"].Value),
Minimun = GetDoubleValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Min"),
//Maximun = double.Parse(step.Attributes["Max"].Value),
Maximun = GetDoubleValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Max"),
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateNumber",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
break;
case "DoubleInput":
//MFC和PC的最大值读取MFC的设定
var displayText = new Regex(@"\(M\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)
.Value;
var maxConfig =
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Max";
var minConfig =
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Min";
if (displayText.Contains("M"))
{
maxConfig =
$"PM.{module}.MFC.Mfc{displayText.Replace("(M", "").Replace(")", "")}.N2Scale";
}
else
{
displayText = new Regex(@"\(PC\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)
.Value;
if (displayText.Contains("PC"))
{
maxConfig =
$"PM.{module}.PC.PC{displayText.Replace("(PC", "").Replace(")", "")}.Scale";
}
}
col = new DoubleColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
InputMode = step.Attributes["InputMode"].Value,
Maximun = GetDoubleValueByName("PM", maxConfig),
Minimun = GetDoubleValueByName("PM", minConfig),
Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Default"),
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateNumber",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
//strAbc此函数去除了括号及括号中的内容,所以在此处重新赋值,保留括号及其内容*********************
if (displayText.Contains("M")|| displayText.Contains("PC"))
{
col.Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value, false)}.Default");
}
//******************************************************************************************
if (displayText.Contains("M"))
{
((DoubleColumn)col).Minimun = ((DoubleColumn)col).Maximun *GetDoubleValueByName("PM", $"PM.{module}.MFC.MinScale") / 100.0;
}
break;
case "DoubleTextInput":
//MFC和 PC 的最大值读取MFC的设定
displayText = new Regex(@"\(M\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value).Value;
maxConfig =
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Max";
minConfig =
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Min";
if (displayText.Contains("M"))
{
maxConfig =
$"PM.{module}.MFC.Mfc{displayText.Replace("(M", "").Replace(")", "")}.N2Scale";
}
else
{
displayText = new Regex(@"\(PC\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)
.Value;
if (displayText.Contains("PC"))
{
maxConfig =
$"PM.{module}.PC.PC{displayText.Replace("(PC", "").Replace(")", "")}.Scale";
}
}
col = new DoubleColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
InputMode = step.Attributes["InputMode"].Value,
Minimun = GetDoubleValueByName("PM", minConfig),
Maximun = GetDoubleValueByName("PM", maxConfig),
Default = "Hold",
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateNumberText",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
break;
case "EditableSelection":
case "ReadOnlySelection":
col = new ComboxColumn()
{
//IsReadOnly = step.Attributes["InputType"].Value == "ReadOnlySelection",
IsEditable = step.Attributes["InputType"].Value != "ReadOnlySelection",
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
//Default = step.Attributes["Default"] != null ? step.Attributes["Default"].Value : "",
Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Default"),
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateComboBoxEx",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
var items = step.SelectNodes("Item");
foreach (XmlNode item in items)
{
var controlName = item.Attributes[NAME_ATTR_CONTROL_NAME].Value;
var displayName = item.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var opt = new ComboxColumn.Option(displayName, controlName);
((ComboxColumn)col).Options.Add(opt);
}
break;
case "FlowModeSelection":
col = new FlowModeColumn()
{
//IsReadOnly = step.Attributes["InputType"].Value == "ReadOnlySelection",
IsEditable = false,
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
//Default = step.Attributes["Default"] != null ? step.Attributes["Default"].Value : "",
Default = GetStringValueByName("PM",
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.Default"),
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateComboBoxEx",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
var flowMode = step.SelectNodes("Item");
foreach (XmlNode item in flowMode)
{
var controlName = item.Attributes[NAME_ATTR_CONTROL_NAME].Value;
var displayName = item.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
var opt = new ComboxColumn.Option(displayName, controlName);
((ComboxColumn)col).Options.Add(opt);
}
break;
case "LoopSelection":
col = new LoopComboxColumn()
{
IsReadOnly = false,
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplateComboBoxEx",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
var options = step.SelectNodes("Item");
foreach (XmlNode item in options)
{
var opt = new LoopComboxColumn.Option();
opt.ControlName = item.Attributes[NAME_ATTR_CONTROL_NAME].Value;
opt.DisplayName = item.Attributes[NAME_ATTR_DISPLAY_NAME].Value;
((LoopComboxColumn)col).Options.Add(opt);
}
break;
case "PopSetting":
col = new PopSettingColumn()
{
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
ControlName = step.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = step.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
UnitName = step.Attributes[NAME_ATTR_UNIT_NAME].Value,
StringCellTemplate = "CellTemplateDisplay",
StringCellEditingTemplate = "CellTemplatePopSetting",
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
EnableConfig = step.Attributes["EnableConfig"] != null &&
Convert.ToBoolean(step.Attributes["EnableConfig"].Value),
EnableTolerance = step.Attributes["EnableTolerance"] != null &&
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
IsEnable = defaultCellEnable,
};
break;
}
}
// Header属性指向列对象,使用HeaderTemplate模板渲染Header
col.Header = col;
// 单元格是否可编辑?
var isCellEditable = step.Attributes["IsColumnEditable"]?.Value;
if (string.IsNullOrEmpty(isCellEditable) == false && isCellEditable.ToLower() == "false")
{
col.IsEditable = false;
col.IsReadOnly = true;
col.StringCellEditingTemplate = "";
}
// 默认情况下当前Col具有访问权限 StepUid不需要显示
col.Permission = col.ControlName != SPEC_COL_STEPUID ? MenuPermissionEnum.MP_READ_WRITE : MenuPermissionEnum.MP_NONE;
// 如果当前Recipe类型为Process,则根据配置设置访问权限 2025-3-13HQQ, 取消权限功能,显示所有Step
//if (recipeType == RecipeType.Process)
// SetPermission(col, role);
colExpander.ChildColumns.Add(col); // 将本列追加到Expander中
columns.Add(col);
}
}
Columns = columns;
var configs = new RecipeStep(null);
nodes = doc.SelectNodes("TableRecipeFormat/ProcessConfig/Configs");
foreach (XmlNode node in nodes)
{
var childNodes = node.SelectNodes("Config");
foreach (XmlNode configNode in childNodes)
{
switch (configNode.Attributes["InputType"].Value)
{
case "DoubleInput":
var config = new DoubleParam(GlobalDefs.TryParseToDouble(configNode.Attributes["Default"].Value))
{
ControlName = configNode.Attributes[NAME_ATTR_CONTROL_NAME].Value,
DisplayName = configNode.Attributes[NAME_ATTR_DISPLAY_NAME].Value,
EnableConfig = configNode.Attributes["EnableConfig"] != null && Convert.ToBoolean(configNode.Attributes["EnableConfig"].Value),
EnableTolerance = configNode.Attributes["EnableTolerance"] != null && Convert.ToBoolean(configNode.Attributes["EnableTolerance"].Value),
};
if (double.TryParse(configNode.Attributes["Max"].Value, out var max))
{
(config as DoubleParam).Maximun = max;
}
if (double.TryParse(configNode.Attributes["Min"].Value, out var min))
{
(config as DoubleParam).Minimun = min;
}
configs.Add(config);
break;
}
}
}
Configs = configs;
BrandConfig = GetConfig(doc.SelectNodes("TableRecipeFormat/BrandConfig/Configs"));
OesConfig = GetConfig(doc.SelectNodes("TableRecipeFormat/OesConfig/Configs"));
VatConfig = GetConfig(doc.SelectNodes("TableRecipeFormat/VatConfig/Configs"));
FineTuningConfig = GetConfig(doc.SelectNodes("TableRecipeFormat/FineTuningConfig/Configs"));
return Columns;
}
/// <summary>
/// 重新加载指定角色的列访问权限。
/// </summary>
/// <param name="role">指定的角色。</param>
public void UpdateColumnsPermission(Role role)
{
foreach (var col in Columns)
{
SetPermission(col, role);
}
}
/// <summary>
/// 设置列权限。
/// </summary>
/// <remarks>
/// 以下时机对列访问权限进行设置:
/// <br/>
/// 调用<see cref="RecipeFormatBuilder.Build"/>方法构建配方编辑器表格格式时;
/// <br/>
/// 当配方编辑器视图被激活时,可能列权限发生了变更,调用<see cref="UpdateColumnsPermission"/>方法更新列权限。
/// </remarks>
/// <param name="column"></param>
/// <param name="role"></param>
/// <returns></returns>
public static void SetPermission(EditorDataGridTemplateColumnBase column, Role role)
{
if (column == null)
throw new ArgumentNullException(nameof(column));
// StepNo列和StepUid列不受权限控制
if (column.ControlName == SPEC_COL_STEPUID)
{
column.Permission = MenuPermissionEnum.MP_NONE;
}
else if (column.ControlName == SPEC_COL_STEPNO)
{
column.Permission = MenuPermissionEnum.MP_READ;
}
else
{
var mpKey = column.DisplayName.Trim(' ');
column.Permission = role.PermissionControlItems.TryGetValue(mpKey, out var perm)
? perm
: MenuPermissionEnum.MP_NONE;
}
}
#endregion
}
}
@@ -0,0 +1,26 @@
using MECF.Framework.Common.Equipment;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
/// <summary>
/// Recipe工艺步骤气体流量计算器接口。
/// </summary>
public interface IRecipeGasFlowCalculator
{
/// <summary>
/// 计算指定工艺步骤的气体流量。
/// </summary>
/// <param name="step">工艺步骤对象。</param>
/// <param name="chamberName">
/// 当前配方步骤所属反应腔的名称,可用的名称请参考<see cref="ModuleName"/>。
/// <remarks>
/// 为什么需要传入反应腔名称?
/// <br/>
/// 计算Vent Flow时,需要使用TCS、TMA的气体流量参数;而上述两个流量的计算需要使用
/// 系统配置中PM.{chamberName}.Efficiency.TCS-Eff或TMA-Eff的配置值。因此计算
/// 配方气体流量时需要传入反应腔名称以获取这两个配置参数的数值。
/// </remarks>
/// </param>
void Calculate(RecipeStep step, string chamberName);
}
}
@@ -0,0 +1,15 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_10GasFlow: RecipeGasFlowM1ToM17
{
public override string NameN2HighFlowMode => "N2NH3_10HighFlowMode.SetValve";
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_11GasFlow : RecipeGasFlowM1ToM17
{
public override string NameN2HighFlowMode => "N2NH3_11HighFlowMode.SetValve";
}
}
@@ -0,0 +1,77 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_12GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2FlowMode => "NH3_2Dilution.SetValve";
public override string NameN2HighFlowMode => "N2NH3_2Doping.SetValve";
public override string NameN2ActualFlow => "NH3_2ActualFlow";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,19 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_13GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2HighFlowMode => "N2NH3_8HighFlowMode.SetValve";
public override string NameN2FlowMode => "N2NH3_13Doping.SetValve";
public override string NameTmaFlowMode => "TMANH3_13.SetValve";
}
}
@@ -0,0 +1,45 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_14GasFlow: RecipeGasFlowM1ToM17_NoneSiH4
{
protected override void CalVentFlow(RecipeStep currentStep, string chamberName)
{
var currentTotalVentFlow = ((DoubleParam)currentStep.FindParamByControlName(NameTotalVentFlow)).Value;
var currentHClFlow = ((DoubleParam)currentStep.FindParamByControlName(NameHclFlow)).Value;
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var m30Flow = ((DoubleParam)currentStep.FindParamByControlName(Mfc30Flow)).Value;
var v47Value = ((ComboxParam)currentStep.FindParamByControlName(V47Value)).Value;
var currentTcsFlowMode = (currentStep.FindParamByControlName(NameTcsFlowMode) as ComboxParam)?.Value;
var currentHClFlowMode = (currentStep.FindParamByControlName(NameHclFlowMode) as ComboxParam)?.Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var tcsFlow = GetTcsFlow(currentStep, chamberName);
var currentSiSourTotalFlowForPurge = (currentTcsFlowMode != null && currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tcsFlow
: 0d) +
(currentHClFlowMode != null && currentHClFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentHClFlow
: 0d);
var currentCSourTotalFlowForPurge =
currentC2H4FlowMode != null && currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentC2H4Flow
: 0d;
m30Flow = v47Value.ToString() == "false" ? m30Flow : 0d;
var currentVentPushFlow = currentTotalVentFlow - currentSiSourTotalFlowForPurge - currentCSourTotalFlowForPurge - m30Flow;
((DoubleParam)currentStep.FindParamByControlName(NameVentPushFlow_M17)).Value = Math.Round(currentVentPushFlow, 1);
}
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.RecipeGasFlowCalculators
{
public class NH3_15GasFlow : RecipeGasFlowM1ToM17
{
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_16GasFlow : RecipeGasFlowM1ToM17
{
public override string NameN2HighFlowMode => "N2NH3_16HighFlowMode.SetValve";
}
}
@@ -0,0 +1,77 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_17GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2FlowMode => "NH3_2Dilution.SetValve";
public override string NameN2HighFlowMode => "N2NH3_2Doping.SetValve";
public override string NameN2ActualFlow => "NH3_2ActualFlow";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,77 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_18GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2FlowMode => "NH3_2Dilution.SetValve";
public override string NameN2HighFlowMode => "N2NH3_2Doping.SetValve";
public override string NameN2ActualFlow => "NH3_2ActualFlow";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,72 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_1GasFlow : RecipeGasFlowM1ToM17
{
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow ;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,84 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.MECF.Framework.Common.Utilities;
using Aitex.Core.RT.SCCore;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
/// <summary>
/// 配方步骤气体流量计算器基类。
/// <br/>
/// 同时,该类也作为默认计算器使用;如果构造<see cref="RecipeData"/>时没有指定
/// 计算器对象实例,则默认使用此计算器。
/// </summary>
public class NH3_2GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2FlowMode => "NH3_2Dilution.SetValve";
public override string NameN2HighFlowMode => "N2NH3_2Doping.SetValve";
public override string NameN2ActualFlow => "NH3_2ActualFlow";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_3GasFlow : RecipeGasFlowM1ToM17
{
}
}
@@ -0,0 +1,63 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_4GasFlow : RecipeGasFlowM1ToM17
{
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,13 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_5GasFlow: RecipeGasFlowM1ToM17
{
}
}
@@ -0,0 +1,111 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_6GasFlow: NH3_1GasFlow
{
public string V100 => "V100Value.SetValve";
public string M21 => "Mfc21.Ramp";
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var v100 = ((ComboxParam)currentStep.FindParamByControlName(V100)).Value;
double currentDilutedN2Flow = 0;
//if (v100.ToString() == "Open")
//{
// var m7 = ((DoubleParam)currentStep.FindParamByControlName(NameTmaBubbleFlow)).Value;
// var m8 = ((DoubleParam)currentStep.FindParamByControlName(NameTmaPushFlow)).Value;
// var m21 = ((DoubleParam)currentStep.FindParamByControlName(M21)).Value;
// currentN2LowFlow = m7 + m8 + m21;
//}
currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalVentFlow(RecipeStep currentStep, string chamberName)
{
var currentTotalVentFlow = ((DoubleParam)currentStep.FindParamByControlName(NameTotalVentFlow)).Value;
var currentHClFlow = ((DoubleParam)currentStep.FindParamByControlName(NameHclFlow)).Value;
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var currentTcsFlowMode = (currentStep.FindParamByControlName(NameTcsFlowMode) as ComboxParam)?.Value;
var currentHClFlowMode = (currentStep.FindParamByControlName(NameHclFlowMode) as ComboxParam)?.Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var tcsFlow = GetTcsFlow(currentStep, chamberName);
var currentSiSourTotalFlowForPurge = (currentTcsFlowMode != null && currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tcsFlow
: 0d) +
(currentHClFlowMode != null && currentHClFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentHClFlow
: 0d);
var currentCSourTotalFlowForPurge =
currentC2H4FlowMode != null && currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentC2H4Flow
: 0d;
var currentVentPushFlow = currentTotalVentFlow - currentSiSourTotalFlowForPurge - currentCSourTotalFlowForPurge;
((DoubleParam)currentStep.FindParamByControlName(NameVentPushFlow_M17)).Value = Math.Round(currentVentPushFlow, 1);
}
}
}
@@ -0,0 +1,78 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_7GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2FlowMode => "NH3_2Dilution.SetValve";
public override string NameN2HighFlowMode => "N2NH3_2Doping.SetValve";
public override string NameN2ActualFlow => "NH3_2ActualFlow";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,15 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_8GasFlow : RecipeGasFlowM1ToM17_NoneSiH4
{
public override string NameN2HighFlowMode => "N2NH3_8HighFlowMode.SetValve";
}
}
@@ -0,0 +1,72 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class NH3_9GasFlow : RecipeGasFlowM1ToM17
{
public override string NameN2HighFlowMode => "N2NH3_10HighFlowMode.SetValve";
protected override void CalDopeFlow(RecipeStep currentStep)
{
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow = (currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
}
protected override void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
}
}
@@ -0,0 +1,578 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.MECF.Framework.Common.Utilities;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
/// <summary>
/// 配方步骤气体流量计算器基类。
/// <br/>
/// 同时,该类也作为默认计算器使用;如果构造<see cref="RecipeData"/>时没有指定
/// 计算器对象实例,则默认使用此计算器。
/// </summary>
public class RecipeGasFlowCalculatorBase : IRecipeGasFlowCalculator
{
#region Properties
/// <summary>
/// Mfc11.Ramp, 流量控制
/// </summary>
public virtual string NameTcsBubbleLowFlow => "Mfc11.Ramp";
/// <summary>
/// Mfc10.Ramp, 流量控制
/// </summary>
public virtual string NameTcsBubbleHighFlow => "Mfc10.Ramp";
/// <summary>
/// Mfc12.Ramp, 流量控制
/// </summary>
public virtual string NameTcsPushFlow => "Mfc12.Ramp";
/// <summary>
/// TCS.SetValve, 控制阀门模式
/// </summary>
public virtual string NameTcsFlowMode => "TCS.SetValve";
/// <summary>
/// Mfc7.Ramp, 流量控制
/// </summary>
public virtual string NameTmaBubbleFlow => "Mfc7.Ramp";
/// <summary>
/// Mfc8.Ramp, 流量控制
/// </summary>
public virtual string NameTmaPushFlow => "Mfc8.Ramp";
/// <summary>
/// TMA.SetValve, 控制阀门模式
/// </summary>
public virtual string NameTmaFlowMode => "TMA.SetValve";
/// <summary>
/// SiSourSplitRatio, 源分流比
/// </summary>
public virtual string NameSiSourceSplitRatio => "SiSourSplitRatio";
/// <summary>
/// SiSourTotalFlow, 源总流量
/// </summary>
public virtual string NameSiSourceTotalFlow => "SiSourTotalFlow";
/// <summary>
/// Mfc23.Ramp, 流量控制
/// </summary>
public virtual string NameSiSourceInnerFlow => "Mfc23.Ramp";
/// <summary>
/// Mfc22.Ramp, 流量控制
/// </summary>
public virtual string NameSiSourceMiddleFlow => "Mfc22.Ramp";
/// <summary>
/// Mfc9.Ramp, 流量控制
/// </summary>
public virtual string NameSiSourceOuterFlow => "Mfc9.Ramp";
/// <summary>
/// Mfc16.Ramp, 流量控制
/// </summary>
public virtual string NameCxHxFlow => "Mfc16.Ramp";
/// <summary>
/// C2H4.SetValve, 控制阀门模式
/// </summary>
public virtual string NameCxHxFlowMode => "C2H4.SetValve";
/// <summary>
/// CSourSplitRatio, 源分流比
/// </summary>
public virtual string NameCSourceSplitRatio => "CSourSplitRatio";
/// <summary>
/// CSourTotalFlow, 源总流量
/// </summary>
public virtual string NameCSourceTotalFlow => "CSourTotalFlow";
/// <summary>
/// Mfc15.Ramp, 流量控制
/// </summary>
public virtual string NameCSourcePushFlow => "Mfc15.Ramp";
/// <summary>
/// Mfc26.Ramp, 流量控制
/// </summary>
public virtual string NameCSourceInnerFlow => "Mfc26.Ramp";
/// <summary>
/// Mfc25.Ramp, 流量控制
/// </summary>
public virtual string NameCSourceMiddleFlow => "Mfc25.Ramp";
/// <summary>
/// Mfc15.Ramp, 流量控制
/// </summary>
public virtual string NameCSourceOuterFlow => "Mfc15.Ramp";
/// <summary>
/// DopeTotalFlow, 涂料总流量
/// </summary>
public virtual string NameDopeTotalFlow => "DopeTotalFlow";
/// <summary>
/// DopeSplitRatio, 涂料分流比
/// </summary>
public virtual string NameDopeSplitRatio => "DopeSplitRatio";
/// <summary>
/// Mfc20.Ramp, 流量控制
/// </summary>
public virtual string NameDopeInnerFlow => "Mfc20.Ramp";
/// <summary>
/// Mfc19.Ramp, 流量控制
/// </summary>
public virtual string NameDopeMiddleFlow => "Mfc19.Ramp";
/// <summary>
/// Mfc2.Ramp, 流量控制
/// </summary>
public virtual string NameDopeOuterFlow => "Mfc2.Ramp";
/// <summary>
/// N2ActualFlow, 氮气实际流量
/// </summary>
public virtual string NameN2ActualFlow => "N2ActualFlow";
/// <summary>
/// Mfc4.Ramp, 流量控制
/// </summary>
public virtual string NameN2LowFlow => "Mfc4.Ramp";
/// <summary>
/// Mfc3.Ramp, 稀释流量控制
/// </summary>
public virtual string NameDilutionFlowForN2 => "Mfc3.Ramp";
/// <summary>
/// Mfc6.Ramp, 稀释后的氮气流量控制
/// </summary>
public virtual string NameDilutedN2Flow => "Mfc6.Ramp";
/// <summary>
/// SHTotalFlow, 总流量
/// </summary>
public virtual string NameShTotalFlow => "SHTotalFlow";
/// <summary>
/// SHTotalFlowSplitRatio, 总流量分流比
/// </summary>
public virtual string NameShTotalFlowSplitRatio => "SHTotalFlowSplitRatio";
/// <summary>
/// SHSuppTotalFlow, 支持流量
/// </summary>
public virtual string NameShPushTotalFlow => "SHSuppTotalFlow";
/// <summary>
/// SHInnerFlow, 内部流量
/// </summary>
public virtual string NameShInnerFlow => "SHInnerFlow";
/// <summary>
/// SHMidFlow, 中间流量
/// </summary>
public virtual string NameShMiddleFlow => "SHMidFlow";
/// <summary>
/// SHOutterFlow, 外部流量
/// </summary>
public virtual string NameShOuterFlow => "SHOutterFlow";
/// <summary>
/// Mfc29.Ramp, 内部推送流量控制
/// </summary>
public virtual string NameInnerPushFlow => "Mfc29.Ramp";
/// <summary>
/// Mfc30.Ramp, 流量控制
/// </summary>
public virtual string Mfc30Flow => "Mfc30.Ramp";
public virtual string V47Value => "V47Value.SetValve";
/// <summary>
/// Mfc31.Ramp, 中间推送流量控制
/// </summary>
public virtual string NameMiddlePushFlow => "Mfc31.Ramp";
/// <summary>
/// Mfc28.Ramp, 外部推送流量控制
/// </summary>
public virtual string NameOuterPushFlow => "Mfc28.Ramp";
/// <summary>
/// Mfc40.Ramp, 输送气体流量控制
/// </summary>
public virtual string NameCarryGasFlow => "Mfc40.Ramp";
/// <summary>
/// Mfc14.Ramp, SiH4流量控制
/// </summary>
public virtual string NameSiH4Flow => "Mfc14.Ramp";
/// <summary>
/// SiH4.SetValve, 控制SiH4阀门模式
/// </summary>
public virtual string NameSiH4FlowMode => "SiH4.SetValve";
/// <summary>
/// Mfc1.Ramp, 排气推送流量控制
/// </summary>
public virtual string NameVentPushFlow => "Mfc1.Ramp";
/// <summary>
/// TotalVentFlow, 总排气流量
/// </summary>
public virtual string NameTotalVentFlow => "TotalVentFlow";
/// <summary>
/// Mfc13.Ramp, HCl流量控制
/// </summary>
public virtual string NameHclFlow => "Mfc13.Ramp";
/// <summary>
/// HCl.SetValve, 控制HCl阀门模式
/// </summary>
public virtual string NameHclFlowMode => "HCl.SetValve";
/// <summary>
/// Mfc5.Ramp, 高流量氮气控制
/// </summary>
public virtual string NameN2HighFlow => "Mfc5.Ramp";
/// <summary>
/// N2Dilution.SetValve, 控制氮气稀释阀门模式
/// </summary>
public virtual string NameN2FlowMode => "N2Dilution.SetValve";
/// <summary>
/// N2HighDoping.SetValve, 控制高流量氮气掺杂阀门模式
/// </summary>
public virtual string NameN2HighFlowMode => "N2HighDoping.SetValve";
#endregion
/// <summary>
/// 计算指定工艺步骤的气体流量。
/// </summary>
/// <param name="step">工艺步骤对象。</param>
/// <param name="chamberName">
/// 当前配方步骤所属反应腔的名称,可用的名称请参考<see cref="ModuleName"/>。
/// <remarks>
/// 为什么需要传入反应腔名称?
/// <br/>
/// 计算Vent Flow时,需要使用TCS、TMA的气体流量参数;而上述两个流量的计算需要使用
/// 系统配置中PM.{chamberName}.Efficiency.TCS-Eff或TMA-Eff的配置值。因此计算
/// 配方气体流量时需要传入反应腔名称以获取这两个配置参数的数值。
/// </remarks>
/// </param>
public void Calculate(RecipeStep step, string chamberName)
{
CalSiSourceFlow(step);
CalCSourceFlow(step);
CalDopeFlow(step);
CalShSupplementFlow(step);
CalVentFlow(step, chamberName);
CheckM3M4M6(step);
}
#region Gas Flow Calculation
protected virtual void CheckM3M4M6(RecipeStep step)
{
var mfc3 = ((DoubleParam)step.FindParamByControlName(NameDilutionFlowForN2)).Value;
var mfc4 = ((DoubleParam)step.FindParamByControlName(NameN2LowFlow)).Value;
var mfc6 = ((DoubleParam)step.FindParamByControlName(NameDilutedN2Flow)).Value;
if (mfc3 + mfc4 > mfc6)
{
step.FindParamByControlName(NameDilutionFlowForN2).ResetCalculatorError();
step.FindParamByControlName(NameN2LowFlow).ResetCalculatorError();
step.FindParamByControlName(NameDilutedN2Flow).ResetCalculatorError();
}
else
{
step.FindParamByControlName(NameDilutionFlowForN2).SetCalculatorError();
step.FindParamByControlName(NameN2LowFlow).SetCalculatorError();
step.FindParamByControlName(NameDilutedN2Flow).SetCalculatorError();
}
}
protected virtual double GetTcsFlow(RecipeStep step, string chamberName)
{
var currentTcsBubbleLowFlow = ((DoubleParam)step.FindParamByControlName(NameTcsBubbleLowFlow)).Value;
var currentTcsBubbleHighFlow = ((DoubleParam)step.FindParamByControlName(NameTcsBubbleHighFlow)).Value;
var currentTcsPushFlow = ((DoubleParam)step.FindParamByControlName(NameTcsPushFlow)).Value;
var currentTcsFlowMode = ((ComboxParam)step.FindParamByControlName(NameTcsFlowMode)).Value;
var tcsFlow = 0d;
var tcsEff =
(double)QueryDataClient.Instance.Service.GetConfig($"PM.{chamberName}.Efficiency.TCS-Eff");
if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run)
|| currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Vent))
{
tcsFlow = (currentTcsBubbleHighFlow + currentTcsBubbleLowFlow) * tcsEff + currentTcsPushFlow;
}
else if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Purge))
{
tcsFlow = currentTcsBubbleHighFlow + currentTcsBubbleLowFlow + currentTcsPushFlow;
}
return tcsFlow;
}
protected virtual double GetTmaFlow(RecipeStep step, string chamberName)
{
var currentTmaBubbleFlow = ((DoubleParam)step.FindParamByControlName(NameTmaBubbleFlow)).Value;
var currentTmaPushFlow = ((DoubleParam)step.FindParamByControlName(NameTmaPushFlow)).Value;
var currentTmaFlowMode = ((ComboxParam)step.FindParamByControlName(NameTmaFlowMode)).Value;
var tmaFlow = 0d;
var tmaEff =
(double)QueryDataClient.Instance.Service.GetConfig($"PM.{chamberName}.Efficiency.TMA-Eff");
if (currentTmaFlowMode.Equals(FlowModeParam.FlowModeEnum.Run)
|| currentTmaFlowMode.Equals(FlowModeParam.FlowModeEnum.Vent))
tmaFlow = currentTmaBubbleFlow * tmaEff + currentTmaPushFlow;
else if (currentTmaFlowMode.Equals(FlowModeParam.FlowModeEnum.Purge))
tmaFlow = currentTmaBubbleFlow + currentTmaPushFlow;
return tmaFlow;
}
protected virtual void CalSiSourceFlow(RecipeStep step)
{
var currentSiSourSplitRatio = new double[3];
if (step.FindParamByControlName(NameSiSourceSplitRatio) is Sets3RatioParam siSourceRatio)
currentSiSourSplitRatio = siSourceRatio.Ratio;
var currentSiSourTotalFlow = ((DoubleParam)step.FindParamByControlName(NameSiSourceTotalFlow)).Value;
//double currentSiSourPushFlow = currentSiSourTotalFlow - (currentSiH4FlowMode == FlowMode.Run.ToString() ? currentSiH4Flow : 0)
// - (currentTCSFlowMode == FlowMode.Run.ToString() ? TCSFlow : 0) - (currentHClFlowMode == FlowMode.Run.ToString() ? currentHClFlow : 0);
//(currentStep[(int)RecipColNo.SiSourceOuterFlow] as DoubleParam).Value = currentSiSourPushFlow.ToString("F1");
double currentSiSourInnerFlow = 0;
double currentSiSourMidFlow = 0;
double currentSiSourOutFlow = 0;
if (currentSiSourSplitRatio.Length == 3)
{
var rationSum = currentSiSourSplitRatio[0] + currentSiSourSplitRatio[1] + currentSiSourSplitRatio[2];
currentSiSourInnerFlow = currentSiSourTotalFlow / rationSum * currentSiSourSplitRatio[0];
currentSiSourMidFlow = currentSiSourTotalFlow / rationSum * currentSiSourSplitRatio[1];
currentSiSourOutFlow = currentSiSourTotalFlow / rationSum * currentSiSourSplitRatio[2];
}
((DoubleParam)step.FindParamByControlName(NameSiSourceInnerFlow)).Value = Math.Round(currentSiSourInnerFlow, 1);
((DoubleParam)step.FindParamByControlName(NameSiSourceMiddleFlow)).Value = Math.Round(currentSiSourMidFlow, 1);
((DoubleParam)step.FindParamByControlName(NameSiSourceOuterFlow)).Value = Math.Round(currentSiSourOutFlow, 1);
}
protected virtual void CalCSourceFlow(RecipeStep currentStep)
{
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var currentCSourSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameCSourceSplitRatio) is Sets3RatioParam cSourceRatio)
currentCSourSplitRatio = cSourceRatio.Ratio;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var currentCSourPushFlow =
currentCSourTotalFlow - (currentC2H4FlowMode != null &&
currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run)
? currentC2H4Flow
: 0d);
((DoubleParam)currentStep.FindParamByControlName(NameCSourcePushFlow)).Value = currentCSourPushFlow.Round(1);
double currentCSourInnerFlow = 0;
double currentCSourMidFlow = 0;
double currentCSourOuterFlow = 0;
if (currentCSourSplitRatio.Length == 3)
{
var ratioSum = currentCSourSplitRatio[0] + currentCSourSplitRatio[1] + currentCSourSplitRatio[2];
currentCSourInnerFlow = currentCSourTotalFlow / ratioSum * currentCSourSplitRatio[0];
currentCSourMidFlow = currentCSourTotalFlow / ratioSum * currentCSourSplitRatio[1];
currentCSourOuterFlow = currentCSourTotalFlow / ratioSum * currentCSourSplitRatio[2];
}
((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value = currentCSourInnerFlow.Round(1);
((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value = currentCSourMidFlow.Round(1);
((DoubleParam)currentStep.FindParamByControlName(NameCSourceOuterFlow)).Value = currentCSourOuterFlow.Round(1);
}
protected virtual void CalDopeFlow(RecipeStep currentStep)
{
var currentDopeTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameDopeTotalFlow)).Value;
var currentN2ActualFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2ActualFlow)).Value;
var currentN2LowFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2LowFlow)).Value;
var currentDiluFlowForN2 = ((DoubleParam)currentStep.FindParamByControlName(NameDilutionFlowForN2)).Value;
var currentDilutedN2Flow =
(currentN2LowFlow + currentDiluFlowForN2) * currentN2ActualFlow / currentN2LowFlow;
((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value = Math.Round(currentDilutedN2Flow, 1);
var currentDopeSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameDopeSplitRatio) is Sets3RatioParam dopRatio)
currentDopeSplitRatio = dopRatio.Ratio;
//double currentDopePushFlow = currentDopeTotalFlow
// - (currentN2FlowMode == FlowMode.Run.ToString() ? currentDilutedN2Flow : 0)
// - (currentN2HighFlowMode == FlowMode.Run.ToString() ? currentN2HighFlow : 0)
// - (currentTMAFlowMode == FlowMode.Run.ToString() ? TMAFlow : 0);
//(currentStep[(int)RecipColNo.DopeOuterFlow] as DoubleParam).Value = currentDopePushFlow.ToString("F1");
double currentDopeInnerFlow = 0;
double currentDopeMidFlow = 0;
double currentDopeOuterFlow = 0;
if (currentDopeSplitRatio.Length == 3)
{
var ratioSum = currentDopeSplitRatio[0] + currentDopeSplitRatio[1] + currentDopeSplitRatio[2];
currentDopeInnerFlow = currentDopeTotalFlow / ratioSum * currentDopeSplitRatio[0];
currentDopeMidFlow = currentDopeTotalFlow / ratioSum * currentDopeSplitRatio[1];
currentDopeOuterFlow = currentDopeTotalFlow / ratioSum * currentDopeSplitRatio[2];
}
((DoubleParam)currentStep.FindParamByControlName(NameDopeInnerFlow)).Value = Math.Round(currentDopeInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameDopeMiddleFlow)).Value = Math.Round(currentDopeMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameDopeOuterFlow)).Value = Math.Round(currentDopeOuterFlow, 1);
}
protected virtual void CalShSupplementFlow(RecipeStep currentStep)
{
var currentSiSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceTotalFlow)).Value;
var currentCSourTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceTotalFlow)).Value;
var currentDopeTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameDopeTotalFlow)).Value;
var currentShTotalFlow = ((DoubleParam)currentStep.FindParamByControlName(NameShTotalFlow)).Value;
var currentSurroundingFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCarryGasFlow)).Value;
var currentSiSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceInnerFlow)).Value;
var currentSiSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameSiSourceMiddleFlow)).Value;
var currentCSourInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceInnerFlow)).Value;
var currentCSourMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameCSourceMiddleFlow)).Value;
var currentDopeInnerFlow = ((DoubleParam)currentStep.FindParamByControlName(NameDopeInnerFlow)).Value;
var currentDopeMidFlow = ((DoubleParam)currentStep.FindParamByControlName(NameDopeMiddleFlow)).Value;
var currentShTotalFlowSplitRatio = new double[3];
if (currentStep.FindParamByControlName(NameShTotalFlowSplitRatio) is Sets3RatioParam shTotalRatio)
currentShTotalFlowSplitRatio = shTotalRatio.Ratio;
var currentShSuppTotalFlow = currentShTotalFlow - currentSurroundingFlow - currentSiSourTotalFlow -
currentCSourTotalFlow - currentDopeTotalFlow;
var sumShTotalFlowSplitRatio = currentShTotalFlowSplitRatio[0] + currentShTotalFlowSplitRatio[1] +
currentShTotalFlowSplitRatio[2];
var currentShInnerFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[0];
var currentShMidFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[1];
var currentShOutterFlow = (currentShTotalFlow - currentSurroundingFlow) / sumShTotalFlowSplitRatio *
currentShTotalFlowSplitRatio[2];
var currentInnerSuppFlow = currentShInnerFlow - currentSiSourInnerFlow - currentCSourInnerFlow -
currentDopeInnerFlow;
var currentMidSuppFlow = currentShMidFlow - currentSiSourMidFlow - currentCSourMidFlow - currentDopeMidFlow;
var currentOutterSuppFlow = currentShSuppTotalFlow - currentInnerSuppFlow - currentMidSuppFlow;
((DoubleParam)currentStep.FindParamByControlName(NameShPushTotalFlow)).Value = Math.Round(currentShSuppTotalFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShInnerFlow)).Value = Math.Round(currentShInnerFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShMiddleFlow)).Value = Math.Round(currentShMidFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameShOuterFlow)).Value = Math.Round(currentShOutterFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameInnerPushFlow)).Value = Math.Round(currentInnerSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameMiddlePushFlow)).Value = Math.Round(currentMidSuppFlow, 1);
((DoubleParam)currentStep.FindParamByControlName(NameOuterPushFlow)).Value = Math.Round(currentOutterSuppFlow, 1);
}
protected virtual void CalVentFlow(RecipeStep currentStep, string chamberName)
{
var currentSiH4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameSiH4Flow)).Value;
var currentTotalVentFlow = ((DoubleParam)currentStep.FindParamByControlName(NameTotalVentFlow)).Value;
var currentHClFlow = ((DoubleParam)currentStep.FindParamByControlName(NameHclFlow)).Value;
var currentN2HighFlow = ((DoubleParam)currentStep.FindParamByControlName(NameN2HighFlow)).Value;
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var currentDilutedN2Flow = ((DoubleParam)currentStep.FindParamByControlName(NameDilutedN2Flow)).Value;
var currentN2FlowMode = ((ComboxParam)currentStep.FindParamByControlName(NameN2FlowMode)).Value;
var currentN2HighFlowMode = ((ComboxParam)currentStep.FindParamByControlName(NameN2HighFlowMode)).Value;
var currentSiH4FlowMode = (currentStep.FindParamByControlName(NameSiH4FlowMode) as ComboxParam)?.Value;
var currentTcsFlowMode = (currentStep.FindParamByControlName(NameTcsFlowMode) as ComboxParam)?.Value;
var currentHClFlowMode = (currentStep.FindParamByControlName(NameHclFlowMode) as ComboxParam)?.Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var currentTmaFlowMode = ((ComboxParam)currentStep.FindParamByControlName(NameTmaFlowMode)).Value;
var tcsFlow = GetTcsFlow(currentStep, chamberName);
var tmaFlow = GetTmaFlow(currentStep, chamberName);
var currentSiSourTotalFlowForPurge =
(currentSiH4FlowMode != null && currentSiH4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentSiH4Flow
: 0d)
+ (currentTcsFlowMode != null && currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tcsFlow
: 0d) +
(currentHClFlowMode != null && currentHClFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentHClFlow
: 0d);
var currentCSourTotalFlowForPurge =
currentC2H4FlowMode != null && currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentC2H4Flow
: 0d;
var n2Flow = (currentN2FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentDilutedN2Flow
: 0d) +
(currentN2HighFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentN2HighFlow
: 0d);
var currentDopeTotalFlowForPurge = n2Flow +
(currentTmaFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tmaFlow
: 0d);
var currentVentPushFlow = currentTotalVentFlow - currentSiSourTotalFlowForPurge -
currentCSourTotalFlowForPurge - currentDopeTotalFlowForPurge;
((DoubleParam)currentStep.FindParamByControlName(NameVentPushFlow)).Value = Math.Round(currentVentPushFlow, 1);
}
#endregion
}
}
@@ -0,0 +1,44 @@
using Caliburn.Micro.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.DataCenter;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public enum EnumGasFlowCalculator
{
Normal,
RecipeGasFlowCalculatorMfc17ChangeToMfc1
}
public static class RecipeGasFlowCalculatorFactory
{
public static IRecipeGasFlowCalculator GetGasFlowCalculator(string module)
{
IRecipeGasFlowCalculator calculator;
var gasFlowCalculator = GetRecipeGasFlowCalculator(module);
//传入参数时,上层需要注册对应服务,
calculator= IoC.Get<IRecipeGasFlowCalculator>(gasFlowCalculator);
return calculator;
}
private static string GetRecipeGasFlowCalculator(string module)
{
var rName = "PN2";
var scValue = (string)QueryDataClient.Instance.Service.GetConfig($"PM.{module}.OperationView");
if (String.IsNullOrEmpty(scValue))
return rName;
return scValue;
}
}
}
@@ -0,0 +1,75 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeGasFlowM1ToM17 : RecipeGasFlowCalculatorBase
{
public virtual string NameVentPushFlow_M17 => "Mfc17.Ramp";
protected override double GetTcsFlow(RecipeStep step, string chamberName)
{
var currentTcsBubbleHighFlow = ((DoubleParam)step.FindParamByControlName(NameTcsBubbleHighFlow)).Value;
var currentTcsPushFlow = ((DoubleParam)step.FindParamByControlName(NameTcsPushFlow)).Value;
var currentTcsFlowMode = ((ComboxParam)step.FindParamByControlName(NameTcsFlowMode)).Value;
var tcsFlow = 0d;
var tcsEff =
(double)QueryDataClient.Instance.Service.GetConfig($"PM.{chamberName}.Efficiency.TCS-Eff");
if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run)
|| currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Vent))
{
tcsFlow = currentTcsBubbleHighFlow * tcsEff + currentTcsPushFlow;
}
else if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Purge))
{
tcsFlow = currentTcsBubbleHighFlow + currentTcsPushFlow;
}
return tcsFlow;
}
protected override void CalVentFlow(RecipeStep currentStep, string chamberName)
{
var currentSiH4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameSiH4Flow)).Value;
var currentTotalVentFlow = ((DoubleParam)currentStep.FindParamByControlName(NameTotalVentFlow)).Value;
var currentHClFlow = ((DoubleParam)currentStep.FindParamByControlName(NameHclFlow)).Value;
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var currentSiH4FlowMode = (currentStep.FindParamByControlName(NameSiH4FlowMode) as ComboxParam)?.Value;
var currentTcsFlowMode = (currentStep.FindParamByControlName(NameTcsFlowMode) as ComboxParam)?.Value;
var currentHClFlowMode = (currentStep.FindParamByControlName(NameHclFlowMode) as ComboxParam)?.Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var tcsFlow = GetTcsFlow(currentStep, chamberName);
var currentSiSourTotalFlowForPurge =
(currentSiH4FlowMode != null && currentSiH4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentSiH4Flow
: 0d)
+ (currentTcsFlowMode != null && currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tcsFlow
: 0d) +
(currentHClFlowMode != null && currentHClFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentHClFlow
: 0d);
var currentCSourTotalFlowForPurge =
currentC2H4FlowMode != null && currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentC2H4Flow
: 0d;
var currentVentPushFlow = currentTotalVentFlow - currentSiSourTotalFlowForPurge - currentCSourTotalFlowForPurge ;
((DoubleParam)currentStep.FindParamByControlName(NameVentPushFlow_M17)).Value = Math.Round(currentVentPushFlow, 1);
}
}
}
@@ -0,0 +1,67 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeGasFlowM1ToM17_NoneSiH4 : RecipeGasFlowCalculatorBase
{
public virtual string NameVentPushFlow_M17 => "Mfc17.Ramp";
protected override double GetTcsFlow(RecipeStep step, string chamberName)
{
var currentTcsBubbleHighFlow = ((DoubleParam)step.FindParamByControlName(NameTcsBubbleHighFlow)).Value;
var currentTcsPushFlow = ((DoubleParam)step.FindParamByControlName(NameTcsPushFlow)).Value;
var currentTcsFlowMode = ((ComboxParam)step.FindParamByControlName(NameTcsFlowMode)).Value;
var tcsFlow = 0d;
var tcsEff =
(double)QueryDataClient.Instance.Service.GetConfig($"PM.{chamberName}.Efficiency.TCS-Eff");
if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run)
|| currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Vent))
{
tcsFlow = currentTcsBubbleHighFlow * tcsEff + currentTcsPushFlow;
}
else if (currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Purge))
{
tcsFlow = currentTcsBubbleHighFlow + currentTcsPushFlow;
}
return tcsFlow;
}
protected override void CalVentFlow(RecipeStep currentStep, string chamberName)
{
var currentTotalVentFlow = ((DoubleParam)currentStep.FindParamByControlName(NameTotalVentFlow)).Value;
var currentHClFlow = ((DoubleParam)currentStep.FindParamByControlName(NameHclFlow)).Value;
var currentC2H4Flow = ((DoubleParam)currentStep.FindParamByControlName(NameCxHxFlow)).Value;
var currentTcsFlowMode = (currentStep.FindParamByControlName(NameTcsFlowMode) as ComboxParam)?.Value;
var currentHClFlowMode = (currentStep.FindParamByControlName(NameHclFlowMode) as ComboxParam)?.Value;
var currentC2H4FlowMode = (currentStep.FindParamByControlName(NameCxHxFlowMode) as ComboxParam)?.Value;
var tcsFlow = GetTcsFlow(currentStep, chamberName);
var currentSiSourTotalFlowForPurge = (currentTcsFlowMode != null && currentTcsFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? tcsFlow
: 0d) +
(currentHClFlowMode != null && currentHClFlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentHClFlow
: 0d);
var currentCSourTotalFlowForPurge =
currentC2H4FlowMode != null && currentC2H4FlowMode.Equals(FlowModeParam.FlowModeEnum.Run) == false
? currentC2H4Flow
: 0d;
var currentVentPushFlow = currentTotalVentFlow - currentSiSourTotalFlowForPurge - currentCSourTotalFlowForPurge;
((DoubleParam)currentStep.FindParamByControlName(NameVentPushFlow_M17)).Value = Math.Round(currentVentPushFlow, 1);
}
}
}
@@ -0,0 +1,127 @@
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
/// <summary>
/// Recipe参数控制名称定义。
/// </summary>
public static class RecipeControlNames
{
public const string STEP_NO = "StepNo";
public const string STEP_NAME = "Name";
public const string STEP_TIME = "Time";
public const string COATING_RATE = "GrowthRate";
public const string TMA_FLOW_MODE = "TMA.SetValve";
public const string TCS_FLOW_MODE = "TCS.SetValve";
}
//Recipe列名编号(名称带_的为组名)
/*public enum RecipColNo
{
Step_Information = 0,
StepUid,
StepNo,
Name,
StepTime,
GrowthRate,
SHFlow_SHTotalFlow,
ArH2Switch,
SHTotalFlow,
CarrayGasFlow,
SHTotalFlowSplitRatio,
FlowSetMode,
Pressure_Rotation,
PressureSet,
RotationSet,
Temperature_ControlMode,
PSUControlMode,
PSUSetMode,
SCRControlMode,
SCRSetMode,
Temperature_TempSetting,
PSUInnerTempSet,
PSUMiddleTempSet,
PSUOuterTempSet,
SCRTempSet,
Temperature_HeaterOutput,
PSUInnerRatioSet,
PSUMiddleRatioSet,
PSUOuterRatioSet,
SCRUpperRatioSet,
SCRMiddleRatioSet,
SCRLowerRatioSet,
SHFlow_SiSourceSi_SourceTotalFlow,
SiSourceTotalFlow,
SHFlow_SiSource_SiH4Flow,
SiH4FlowMode,
SiH4Flow,
SHFlow_SiSource_TCSFlow,
TCSFlowMode,
TCSBubbLowFlow,
TCSBubbHighFlow,
TCSPushFlow,
TCSBubbPressure,
SHFlow_SiSource_HCLFlow,
HCLFlowMode,
HCLFlow,
SHFlow_SiSource_SiSourSplit,
SiSourceSplitRatio,
SiSourcePushPressure,
SiSourceInnerFlow,
SiSourceMiddleFlow,
SiSourceOuterFlow,
SHFlow_CSource_CSourceTotalFlow,
CSourceTotalFlow,
SHFlow_CSource_C2H4Flow,
C2H4FlowMode,
C2H4Flow,
SHFlow_CSource_CSourceSplit,
CSourceSplitRatio,
CSourcePushPressure,
CSourceInnerFlow,
CSourceMiddleFlow,
CSourceOuterFlow,
SHFlow_Dope_DopeTotalFlow,
DopeTotalFlow,
SHFlow_Dope_N2Flow,
N2FlowMode,
N2ActualFlow,
N2LowFlow,
DilutFlowForN2,
DilutedN2Flow,
N2PostDilutPressure,
N2HighFlowMode,
N2HighFlow,
SHFlow_Dope_TMAFlow,
TMAFlowMode,
TMABubbFlow,
TMAPushFlow,
TMABubbPressure,
SHFlow_Dope_DopeSplit,
DopeSplitRatio,
DopePushPressure,
DopeInnerFlow,
DopeMiddleFlow,
DopeOuterFlow,
SHFlow_SHPushFlow,
SHPushTotalFlow,
SHInnerFlow,
SHMiddleFlow,
SHOuterFlow,
InnerPushFlow,
MiddlePushFlow,
OuterPushFlow,
Purge_SHPeripheryPurge,
SHPurgeFlow,
GRPurgeMainFlow,
Purge_ChamberPeripheryPurge,
OpticPurgeMainFlow,
ChamberPurgeFlow,
RotationUpPurgeFlow,
ShutterPurgeFlow,
HeaterWFPurgeFlow,
Purge_VentFlow,
TotalVentFlow,
VentPushFlow,
VentPreExhaustPressure
}*/
}
@@ -0,0 +1,163 @@
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.MECF.Framework.Common.Utilities;
using MECF.Framework.Common.Utilities;
using System;
using System.Collections.Generic;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeHistory
{
/// <summary>
/// GUID编号
/// </summary>
public string StrGuid { get; set; }
/// <summary>
/// 登录的用户名
/// </summary>
public string RoleName { get; set; }
/// <summary>
/// Recipe类型
/// </summary>
public string ProcessType { get; set; }
/// <summary>
/// 快照时Recipe名称
/// </summary>
public string RecipeName { get; set; }
/// <summary>
/// 从XML转成string类型的Recipe内容
/// </summary>
public string RecipeFromXML { get; set; }
/// <summary>
/// Recipe使用GZip压缩
/// </summary>
private string RecipeGZip;
/// <summary>
/// Recipe内容压缩后转成哈希值
/// </summary>
public string HashCode { get; set; }
/// <summary>
/// 保存Receip时记录时间
/// </summary>
public string CreateTime { get; set; }
/// <summary>
/// 预留空白1,默认为null
/// </summary>
public string Spare1 { get; set; }
/// <summary>
/// 预留空白2,默认为null
/// </summary>
public string Spare2 { get; set; }
#region 数据库操作
public bool SaveDB()
{
//只有存储时,才自动给这些属性赋值
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
StrGuid = Guid.NewGuid().ToString();
HashCode = Sha256.EncodeString(RecipeFromXML);
RecipeGZip = StringGZip.CompressString(RecipeFromXML);
return QueryDataClient.Instance.Service.ExcuteTransAction(new List<string> { SaveCmd() });
}
/// <summary>
/// 根据Recipe名称,返回此名称产生的所有历史记录
/// </summary>
/// <param name="recipeName"></param>
/// <returns></returns>
public List<RecipeHistory> QueryDB(string recipeName)
{
string cmd = $"select * from recipe_history_data where recipe_name = '{recipeName}'";
var dt = QueryDataClient.Instance.Service.QueryData(cmd);
if (dt != null && dt.Rows.Count > 0)
{
List<RecipeHistory> recipeMemories = new List<RecipeHistory>();
for (int i = 0; i < dt.Rows.Count; i++)
{
recipeMemories.Add(new RecipeHistory()
{
StrGuid = dt.Rows[i]["str_guid"].ToString(),
RoleName = dt.Rows[i]["role_name"].ToString(),
ProcessType = dt.Rows[i]["process_type"].ToString(),
RecipeName = dt.Rows[i]["recipe_name"].ToString(),
HashCode = dt.Rows[i]["hash_code"].ToString(),
//RecipeFromXML = StringGZip.DecompressString( dt.Rows[0]["recipe_gzip"].ToString()), //一般情况下这个内容都很大,返回集合中不对该属性赋值。
CreateTime = dt.Rows[i]["create_time"].ToString(),
Spare1 = dt.Rows[i]["spare1"].ToString(),
Spare2 = dt.Rows[i]["spare2"].ToString()
});
if (i >= 25)
break;
}
return recipeMemories;
}
return null;
}
/// <summary>
/// 根据Recipe名称+createTime,返回特定记录
/// </summary>
/// <param name="recipeName"></param>
/// <param name="createTime"></param>
/// <returns></returns>
public RecipeHistory QueryDB(RecipeHistory recipeHistory)
{
string cmd = $"select * from recipe_history_data where str_guid = '{recipeHistory.StrGuid}'";
var dt = QueryDataClient.Instance.Service.QueryData(cmd);
if (dt != null && dt.Rows.Count > 0)
{
return new RecipeHistory()
{
StrGuid = dt.Rows[0]["str_guid"].ToString(),
RoleName = dt.Rows[0]["role_name"].ToString(),
ProcessType = dt.Rows[0]["process_type"].ToString(),
RecipeName = dt.Rows[0]["recipe_name"].ToString(),
HashCode = dt.Rows[0]["hash_code"].ToString(),
RecipeFromXML = StringGZip.DecompressString( dt.Rows[0]["recipe_gzip"].ToString()),//数据库查询时返回解压后的正确数据
CreateTime = dt.Rows[0]["create_time"].ToString(),
Spare1 = dt.Rows[0]["spare1"].ToString(),
Spare2 = dt.Rows[0]["spare2"].ToString()
};
}
return null;
}
private string SaveCmd()
{
string cmd_data_insert =
"insert into recipe_history_data" +
"(str_guid,role_name,process_type,recipe_name,hash_code,recipe_gzip, create_time,spare1,spare2)" +
$"values ('{StrGuid}'," +
$"'{RoleName}'," +
$"'{ProcessType}'," +
$"'{RecipeName}'," +
$"'{HashCode}'," +
$"'{RecipeGZip}'," +
$"'{CreateTime}'," +
$"'{Spare1}'," +
$"'{Spare2}')";
return cmd_data_insert;
}
#endregion
}
}
@@ -0,0 +1,76 @@
using System.Collections.Generic;
using System.Linq;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.RecipeCenter;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeProvider
{
public List<string> GetRecipes(string path)
{
return RecipeClient.Instance.Service.GetRecipesByPath(path, false).ToList();
}
public string GetXmlRecipeList(string path)
{
return RecipeClient.Instance.Service.GetXmlRecipeListByPath(path, false);
}
public List<string> GetRecipeLists()
{
return RecipeClient.Instance.Service.GetRecipes(ModuleName.System, true).ToList();
}
public string GetRecipeFormatXml(string chamberId, string module)
{
return RecipeClient.Instance.Service.GetRecipeFormatXmlByPath(chamberId, module);
}
public bool WriteRecipeFile(string recipeName, string recipeContent)
{
return RecipeClient.Instance.Service.SaveRecipe(ModuleName.System, recipeName, recipeContent);
}
public bool WriteRecipeFile(string prefix, string recipeName, string recipeContent)
{
return RecipeClient.Instance.Service.SaveRecipeByPath(prefix, recipeName, recipeContent);
}
public string ReadRecipeFile(string prefix, string recipeName)
{
return RecipeClient.Instance.Service.LoadRecipeByPath(prefix, recipeName);
}
public bool CreateRecipeFolder(string prefix, string foldername)
{
return RecipeClient.Instance.Service.CreateFolderByPath(prefix, foldername);
}
public bool DeleteRecipe(string prefix, string name)
{
return RecipeClient.Instance.Service.DeleteRecipeByPath(prefix, name);
}
public bool DeleteRecipeFolder(string prefix, string foldername)
{
return RecipeClient.Instance.Service.DeleteFolderByPath(prefix, foldername);
}
public bool SaveAsRecipe(string prefix, string recipeName, string recipeContent)
{
return RecipeClient.Instance.Service.SaveAsRecipeByPath(prefix, recipeName, recipeContent);
}
public bool RenameRecipe(string prefix, string beforename, string currentname)
{
return RecipeClient.Instance.Service.RenameRecipeByPath(prefix, beforename, currentname);
}
public bool RenameFolder(string prefix, string beforename, string currentname)
{
return RecipeClient.Instance.Service.RenameFolderByPath(prefix, beforename, currentname);
}
}
}
@@ -0,0 +1,529 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Client.CenterViews.Configs.Roles;
using MECF.Framework.UI.Client.CenterViews.Editors;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeStep : ObservableCollection<Param>
{
#region Variables
private MenuPermissionEnum _permission;
private bool _isHideValue;
private bool _isProcessed;
private bool _isVisible;
/// <summary>
/// 当步骤的任意参数的<see cref="Param.IsSaved"/>属性发生变化时,引发此事件。
/// </summary>
public event EventHandler<bool> SavedStateChanged;
/// <summary>
/// 当步骤完成时,引发此事件。
/// </summary>
public event Action<bool> ProcessStatusChangedCallback;
/// <summary>
/// 当前步骤的选择状态发生变化时,引发此事件。
/// </summary>
public event EventHandler<bool> SelectionStateChanged;
/// <summary>
/// 当前步骤的任意参数高亮状态发生变化时,引发此事件。
/// </summary>
public event EventHandler HighlightStateChanged;
/// <summary>
/// 当前步骤的气体流量计算完成后,引发此事件。
/// </summary>
public event EventHandler GasFlowCalculated;
/// <summary>
/// 当步骤的时长发生变化时,引发此事件。
/// </summary>
public event EventHandler StepTimeChanged;
#endregion
#region Constructors
public RecipeStep(RecipeStep previous)
{
Previous = previous;
IsSaved = true;
IsVisible = true;
}
#endregion
#region Properties
/// <summary>
/// 设置或返回当前步骤的访问权限。
/// </summary>
public MenuPermissionEnum Permission
{
get => _permission;
set
{
_permission = value;
this.ToList().ForEach(x => x.StepPermission = _permission);
}
}
/// <summary>
/// 父级配方集合。
/// </summary>
public RecipeData Parent { get; internal set; }
/// <summary>
/// 返回配方步骤序号参数。
/// </summary>
public StepParam StepNoParam => this.FirstOrDefault(param => param.ControlName == RecipeFormatBuilder.SPEC_COL_STEPNO) as StepParam;
private StringParam UidParam => this.FirstOrDefault(param => param.ControlName == RecipeFormatBuilder.SPEC_COL_STEPUID) as StringParam;
private StringParam NameParam => this.FirstOrDefault(param => param.ControlName == RecipeFormatBuilder.SPEC_COL_NAME) as StringParam;
/// <summary>
/// 返回步骤名称。
/// </summary>
public string Name => NameParam?.Value;
/// <summary>
/// 返回当前步骤是否被选中。
/// </summary>
public bool IsSelected
{
get => StepNoParam?.IsChecked ?? false;
set
{
if (StepNoParam != null)
StepNoParam.IsChecked = value;
}
}
/// <summary>
/// 当前配方步骤的唯一识别码。
/// </summary>
public string StepUid
{
get => UidParam?.Value ?? null;
set
{
var paramUid = UidParam;
if (paramUid != null)
{
paramUid.Value = value;
}
}
}
/// <summary>
/// 返回步骤序号。
/// </summary>
public int? StepNo => StepNoParam?.Value;
/// <summary>
/// 返回步骤执行时长。
/// </summary>
public double StepTime
{
get
{
var param = FindParamByControlName(RecipeControlNames.STEP_TIME);
if(param is DoubleParam dblParam)
return dblParam.Value;
return 0d;
}
}
/// <summary>
/// 返回当前配方步骤是否已保存。
/// </summary>
public bool IsSaved { get; private set; }
/// <summary>
/// 返回当前步骤是否已经跑完工艺。
/// </summary>
public bool IsProcessed
{
get => _isProcessed;
set
{
if (_isProcessed != value)
{
_isProcessed = value;
ProcessStatusChangedCallback?.Invoke(value);
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsProcessed)));
}
}
}
/// <summary>
/// 返回前序配方。
/// </summary>
public RecipeStep Previous { get; private set; }
/// <summary>
/// 返回后序配方。
/// </summary>
public RecipeStep Next { get; private set; }
/// <summary>
/// 设置或返回当前步骤是否在DataGrid中显示。
/// </summary>
public bool IsVisible
{
get => _isVisible;
set
{
_isVisible = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsVisible)));
}
}
#endregion
#region Methods
/// <summary>
/// 当配方中的参数的属性发生变化时,触发此事件。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnParamPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (sender is not IParam param)
return;
switch (e.PropertyName)
{
case nameof(Param.IsSaved):
{
if (param.IsSaved == false)
IsSaved = false;
else
IsSaved = this.ToList().FirstOrDefault(x => x.IsSaved == false) == null;
SavedStateChanged?.Invoke(this, IsSaved);
break;
}
case nameof(StepParam.IsChecked):
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelected)));
SelectionStateChanged?.Invoke(this, IsSelected);
break;
case nameof(Param.IsHighlighted):
HighlightStateChanged?.Invoke(this, EventArgs.Empty);
break;
}
}
/// <summary>
/// 当配方中的参数的值发生变化时,触发此事件。
/// </summary>
/// <remarks>
/// 该事件在DragToFill操作时会被触发。
/// 单元格编辑完成后参数值发生变化不会引发此事件,而是直接在CellEndEditing事件中处理。
/// </remarks>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="NotImplementedException"></exception>
private void OnParamValueChanged(object sender, object e)
{
if (sender is Param para and IValueParam )
{
if (para.ControlName == RecipeControlNames.STEP_TIME)
{
StepTimeChanged?.Invoke(this, EventArgs.Empty);
}
else
{
//TODO 和气体不相关的参数修改后,不应该触发气体流量计算过程
CalculateGasFlow();
}
}
}
/// <summary>
/// 将指定的Param链接到前序Param。
/// </summary>
/// <param name="param">当前Step中的参数。</param>
private void LinkWithPreviousParam(IParam param)
{
var preParam = Previous?.FirstOrDefault(x => x.ControlName == param.ControlName);
param.Previous = preParam;
if (preParam != null)
preParam.Next = param;
}
/// <summary>
/// 将指定的Param链接到后序Param。
/// </summary>
/// <param name="param">当前Step中的参数。</param>
private void LinkWithNextParam(IParam param)
{
var nextParam = Next?.FirstOrDefault(x => x.ControlName == param.ControlName);
param.Next = nextParam;
if (nextParam != null)
nextParam.Previous = param;
}
/// <summary>
/// 从角色配置中加载当前步骤的访问权限。
/// </summary>
/// <param name="step"></param>
/// <param name="role">角色</param>
internal static void SetPermission(RecipeStep step, Role role)
{
Debug.Assert(role != null, "Role can not be null.");
Debug.Assert(step != null, "Recipe Step can not be null.");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (step == null)
return;
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (role == null)
step.Permission = MenuPermissionEnum.MP_NONE;
else
{
var mpKey = $"Step{step.StepNo}";
step.Permission = role.PermissionControlItems.TryGetValue(mpKey, out var perm)
? perm
: MenuPermissionEnum.MP_NONE;
}
}
/// <summary>
/// 在当前步骤中查找指定控制名的参数。
/// </summary>
/// <param name="controlName">
/// 参数控制的名称。
/// </param>
/// <param name="isIgnoreCase">
/// 是否区分大小写。
/// </param>
/// <returns></returns>
public IParam FindParamByControlName(string controlName, bool isIgnoreCase = true)
{
return this.FirstOrDefault(x =>
string.Equals(x.ControlName, controlName,
isIgnoreCase ? StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture));
}
/// <summary>
/// 校验步骤中的所有参数。
/// </summary>
public void Validate()
{
this.ToList().ForEach(x => x.Validate());
}
/// <summary>
/// 计算当前步骤的气体流量。
/// </summary>
public void CalculateGasFlow()
{
if (Parent.RecipeType != RecipeType.Process)
return;
Parent?.CalculateGasFlow(this);
GasFlowCalculated?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// 取消所有参数的Highlight状态。
/// </summary>
public void ResetHighlight()
{
this.ToList().ForEach(x => x.ResetHighlight());
}
/// <summary>
/// 获取高亮显示的参数。
/// </summary>
/// <returns></returns>
public List<Param> GetHighlightedParams()
{
return this.ToList().Where(p => p.IsHighlighted).ToList();
}
/// <summary>
/// 隐藏参数值。
/// </summary>
public void HideValue()
{
this.ToList().ForEach(x => x.IsHideValue = true);
}
/// <summary>
/// 显示参数值。
/// </summary>
public void ShowValue()
{
this.ToList().ForEach(x => x.IsHideValue = false);
}
/// <summary>
/// 设置隐藏的参数值掩膜字符。
/// </summary>
/// <param name="masking"></param>
public void SetHiddenValueMasking(string masking)
{
this.ToList().ForEach(x => x.HiddenValueMasking = masking);
}
/// <summary>
/// 保存当前配方步骤。
/// </summary>
public void Save()
{
this.ToList().ForEach(x => x.Save());
}
/// <summary>
/// 設置前序步驟。
/// </summary>
/// <param name="step"></param>
public void SetPreviousStep(RecipeStep step)
{
Previous = step;
// 调整Step中Param的链接关系
this.ToList().ForEach(LinkWithPreviousParam);
if (Previous == null)
return;
// 将前序步骤的后序步骤链接到我自己。
Previous.Next = this;
}
public void SetNextStep(RecipeStep step)
{
Next = step;
this.ToList().ForEach(LinkWithNextParam);
}
/// <summary>
/// 检查StepNo是否为有效值。
/// </summary>
/// <param name="stepNo"></param>
/// <param name="validatedStepNo"></param>
/// <returns></returns>
public static bool ValidateStepNo(int? stepNo, out int validatedStepNo)
{
validatedStepNo = int.MinValue;
var isValid = stepNo >= RecipeFormatBuilder.STEP_INDEX_BASE;
if (isValid)
validatedStepNo = stepNo.Value;
return isValid;
}
#endregion
#region Override Methods
protected override void InsertItem(int index, Param item)
{
if (item != null)
{
item.Parent = this;
LinkWithPreviousParam(item);
LinkWithNextParam(item);
item.PropertyChanged += OnParamPropertyChanged;
if(item is IValueParam vp)
vp.OnValueChanged += OnParamValueChanged;
}
base.InsertItem(index, item);
}
protected override void SetItem(int index, Param item)
{
throw new NotSupportedException();
}
protected override void RemoveItem(int index)
{
if (Count > 0)
{
if (index >= 0 && index < Count)
{
this[index].PropertyChanged -= OnParamPropertyChanged;
if(this[index] is IValueParam vp)
vp.OnValueChanged -= OnParamValueChanged;
}
}
// 将前后两个Param链接起来
var preParam = this[index].Previous;
var nextParam = this[index].Next;
if (preParam != null && nextParam != null)
{
preParam.Next = nextParam;
nextParam.Previous = preParam;
}
else if (preParam == null && nextParam != null)
{
nextParam.Previous = null;
}
else if (preParam != null)
{
preParam.Next = null;
}
IsSaved = false;
SavedStateChanged?.Invoke(this, true);
base.RemoveItem(index);
}
protected override void ClearItems()
{
this.ToList().ForEach(x =>
{
x.PropertyChanged -= OnParamPropertyChanged;
if(x is IValueParam vp)
vp.OnValueChanged -= OnParamValueChanged;
});
IsSaved = Count <= 0;
SavedStateChanged?.Invoke(this, true);
base.ClearItems();
}
public override string ToString()
{
return Count > 0 ? (StepNoParam == null
? "Recipe Step, Item={Count}" : StepNoParam.ToString())
: "Empty Recipe Step";
}
#endregion
}
}
@@ -0,0 +1,470 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
using Sicentury.Core;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
/// <summary>
/// 配方步骤集合。
/// </summary>
/// <remarks>
/// 该集合继承自<see cref="ObservableCollection{T}"/>。
/// </remarks>
public sealed class RecipeStepCollection : ObservableCollection<RecipeStep>, IDisposable
{
#region Variables
public event EventHandler<bool> OnSavedStateChanged;
public event EventHandler HighlightStateChanged;
public event EventHandler GasFlowCalculated;
public event EventHandler StepTimeChanged;
private bool _isLoadingRecipe;
private bool? _isAllStepsSelected;
private bool _isSaved;
#endregion
#region Constructors
/// <summary>
/// 创建配方步骤集合的实例。
/// </summary>
public RecipeStepCollection()
{
_isSaved = true;
}
/// <summary>
/// 创建配方步骤集合的实例。
/// </summary>
/// <param name="parent">
/// 父级配方对象,请参考<see cref="RecipeData"/>。
/// </param>
public RecipeStepCollection(RecipeData parent) : this()
{
Parent = parent;
}
/// <summary>
/// 创建配方步骤集合的实例。
/// </summary>
/// <param name="steps">配方步骤数组。</param>
/// <param name="parent">
/// 父级配方对象,请参考<see cref="RecipeData"/>。
/// </param>
public RecipeStepCollection(IList<RecipeStep> steps, RecipeData parent)
: base(steps)
{
_isSaved = true;
Parent = parent;
foreach (var step in steps)
step.Parent = parent;
}
#endregion
#region Properties
/// <summary>
/// 返回父级配方对象的实例。
/// </summary>
public RecipeData Parent { get; }
/// <summary>
/// 返回当前配方是否已经被保存。
/// </summary>
public bool IsSaved
{
get => _isSaved;
private set
{
_isSaved = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSaved)));
OnSavedStateChanged?.Invoke(this, _isSaved);
}
}
public bool? IsAllStepsSelected
{
get
{
var groupSelection = this.GroupBy(x => x.IsSelected).ToList();
if (groupSelection.Count == 1)
_isAllStepsSelected = groupSelection[0].Key;
else
_isAllStepsSelected = null;
return _isAllStepsSelected;
}
set
{
if (!_isAllStepsSelected.HasValue || _isAllStepsSelected == true)
DeselectAll();
else
SelectAll();
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsAllStepsSelected)));
}
}
/// <summary>
/// 返回被选中的配方步骤。
/// </summary>
public IReadOnlyList<RecipeStep> SelectedSteps =>
this.ToList().Where(x => x.StepNoParam != null && x.StepNoParam.IsChecked).ToList();
#endregion
#region Methods
private void RegisterEvents(RecipeStep step)
{
step.SavedStateChanged += ItemOnSavedStateChanged;
step.SelectionStateChanged += StepOnSelectionStateChanged;
step.HighlightStateChanged += HighlightStateChanged;
step.GasFlowCalculated += GasFlowCalculated;
step.StepTimeChanged += StepTimeChanged;
}
public void UnRegisterEvents(RecipeStep step)
{
step.SavedStateChanged -= ItemOnSavedStateChanged;
step.SelectionStateChanged -= StepOnSelectionStateChanged;
step.HighlightStateChanged -= HighlightStateChanged;
step.GasFlowCalculated -= GasFlowCalculated;
step.StepTimeChanged -= StepTimeChanged;
}
/// <summary>
/// 当配方中的某步骤的IsSaved状态发生变化时,触发此事件。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ItemOnSavedStateChanged(object sender, bool e)
{
if (e == false)
IsSaved = false;
else
IsSaved = (this.ToList().FirstOrDefault(x => x.IsSaved == false) == null);
}
/// <summary>
/// 当配方步骤的选中状态发生变化时,触发此事件。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void StepOnSelectionStateChanged(object sender, bool e)
{
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsAllStepsSelected)));
}
/// <summary>
/// 更新Step序列号。
/// </summary>
/// <param name="markAsSaved"></param>
public void UpdateStepIndex(bool markAsSaved = false)
{
var step = this.FirstOrDefault();
var stepNo = step?.StepNoParam;
if (stepNo == null)
return;
var index = RecipeFormatBuilder.STEP_INDEX_BASE;
while (true)
{
stepNo.Value = index;
if (markAsSaved)
stepNo.Save();
//! 最后一个步骤的Next应该为Null,此时跳出循环。
if (stepNo.Next is StepParam nextParam)
stepNo = nextParam;
else
break;
index++;
}
}
/// <summary>
/// 开始加载Recipe。
/// </summary>
public IDisposable BeginLoading()
{
_isLoadingRecipe = true;
IsSaved = true;
return this;
}
/// <summary>
/// 结束加载Recipe
/// </summary>
public void EndLoading()
{
_isLoadingRecipe = false;
IsSaved = true;
}
/// <summary>
/// 计算所有步骤的总时长。
/// </summary>
/// <returns></returns>
public double GetTotalTime()
{
return this.Sum(x => x.StepTime);
}
/// <summary>
/// 选择当前集合中的所有配方步骤。
/// </summary>
public void SelectAll()
{
foreach (var step in this)
{
step.IsSelected = true;
}
}
/// <summary>
/// 取消选择当前集合中的所有配方步骤。
/// </summary>
public void DeselectAll()
{
foreach (var step in this)
{
step.IsSelected = false;
}
}
/// <summary>
/// 反向选择当前集合中的所有配方步骤。
/// </summary>
public void ReverseSelection()
{
foreach (var step in this)
{
step.IsSelected = !step.IsSelected;
}
}
/// <summary>
/// 保存当前配方。
/// </summary>
public void Save()
{
this.ToList().ForEach(x => x.Save());
}
/// <summary>
/// 取消所有参数的Highlight状态。
/// </summary>
public void ResetHighlight()
{
this.ToList().ForEach(x => x.ResetHighlight());
}
/// <summary>
/// 校验所有步骤。
/// </summary>
internal void Validate()
{
this.ToList().ForEach(step =>
{
step.Validate();
});
}
public void HideValue()
{
this.ToList().ForEach(step =>
{
step.HideValue();
});
}
public void ShowValue()
{
this.ToList().ForEach(step =>
{
step.ShowValue();
});
}
public void SetHiddenValueMasking(string masking)
{
this.ToList().ForEach(step =>
{
step.SetHiddenValueMasking(masking);
});
}
#endregion
#region Overrided Methods
/// <summary>
///
/// </summary>
/// <param name="previous"></param>
/// <param name="next"></param>
private static void LinkSteps(RecipeStep previous, RecipeStep next)
{
if (previous != null && next != null)
{
previous.SetNextStep(next);
next.SetPreviousStep(previous);
}
else if (previous == null && next != null)
{
next.SetPreviousStep(null);
}
else
{
previous?.SetNextStep(null);
}
}
protected override void SetItem(int index, RecipeStep item)
{
throw new NotSupportedException();
}
protected override void InsertItem(int index, RecipeStep step)
{
if (step != null)
{
// 如果Step没有分配Uid,先分配一个。
if (string.IsNullOrEmpty(step.StepUid))
{
// 尝试20次,如果均重号,则报错。
var retry = 0;
for (retry = 0; retry < 20; retry++)
{
var uid = GlobalDefs.GetShortUid();
if (this.FirstOrDefault(x => x.StepUid == uid) == null)
{
step.StepUid = uid;
break;
}
}
if (retry == 20)
throw new Exception("unable to add recipe step since the exclusive UID can not be assigned.");
}
}
base.InsertItem(index, step);
if (step != null)
{
step.Parent = Parent;
RegisterEvents(step);
if (index > 0 && index < Count - 1)
{
LinkSteps(this[index - 1], this[index]);
LinkSteps(this[index], this[index + 1]);
}
else if (index == 0)
{
if (Count > 1)
{
LinkSteps(null, this[index]);
LinkSteps(this[index], this[index + 1]);
}
else
{
LinkSteps(null, this[index]);
LinkSteps(this[index], null);
}
}
else if (index == Count - 1)
{
LinkSteps(this[index - 1], this[index]);
LinkSteps(this[index], null);
}
}
// 如果不是加载Recipe状态,则为新增步骤,需要校验并更新保存状态
if (!_isLoadingRecipe)
{
UpdateStepIndex();
this[index].Validate();
// 强制标记为为保存状态
IsSaved = false;
}
}
protected override void RemoveItem(int index)
{
if (Count > 0)
{
if (index >= 0 && index < Count)
{
UnRegisterEvents(this[index]);
}
}
IsSaved = false;
// 将前后两个Param链接起来
var preStep = this[index].Previous;
var nextStep = this[index].Next;
LinkSteps(preStep, nextStep);
preStep?.Validate();
nextStep?.Validate();
base.RemoveItem(index);
UpdateStepIndex();
// 强制标记为为保存状态
IsSaved = false;
}
protected override void ClearItems()
{
if (Count > 0)
{
this.ToList().ForEach(UnRegisterEvents);
IsSaved = false;
}
else
{
IsSaved = true;
}
base.ClearItems();
// 强制标记为为保存状态
IsSaved = false;
}
protected override void MoveItem(int oldIndex, int newIndex)
{
throw new NotSupportedException();
}
#endregion
public void Dispose()
{
}
}
}
@@ -0,0 +1,53 @@
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
{
public class RecipeStepValidationInfo
{
#region Constructors
public RecipeStepValidationInfo(RecipeStep step, Param param, string message)
{
Step = step;
Param = param;
Message = message;
RecipeStep.ValidateStepNo(step.StepNo, out var vStepNo);
StepNo = vStepNo;
ParamCaption = param?.DisplayName ?? "Unknown";
if (param is IValueParam vp)
Value = vp.GetValue();
else
Value = "Unknown";
}
#endregion
#region Properties
public RecipeStep Step { get; }
public IParam Param { get; }
public int StepNo { get; }
public string ParamCaption { get; }
public object Value { get; }
public string Message { get; }
#endregion
#region Methdos
public override string ToString()
{
return $"[Step{Step.StepNo}][{Param.DisplayName}] {Message}";
}
#endregion
}
}