修改recipe默认值
This commit is contained in:
+86
-66
@@ -46,6 +46,9 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
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 NAME_ATTR_DEFAULT = "Default";
|
||||
private const string NAME_ATTR_MAX = "Max";
|
||||
private const string NAME_ATTR_MIN = "Min";
|
||||
|
||||
private const string PATH_GROUP = $"{NAME_NODE_TABLE_RECIPE_FORMAT}/{NAME_NODE_CATALOG}/{NAME_NODE_GROUP}";
|
||||
|
||||
@@ -234,6 +237,15 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public double GetDoubleValueByName(string name)
|
||||
{
|
||||
if (double.TryParse(name, out var d))
|
||||
{
|
||||
return d;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public double GetDoubleValueByName(string module, string name)
|
||||
{
|
||||
var value = SystemConfigProvider.Instance.GetValueByName(module, name);
|
||||
@@ -483,7 +495,10 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
IsEnable = defaultCellEnable,
|
||||
MaxSets = 3
|
||||
};
|
||||
|
||||
if (step.Attributes[NAME_ATTR_DEFAULT] != null)
|
||||
{
|
||||
col.Default = step.Attributes[NAME_ATTR_DEFAULT].Value;
|
||||
}
|
||||
break;
|
||||
|
||||
case "TextInput":
|
||||
@@ -551,29 +566,22 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
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";
|
||||
var displayText = new Regex(@"\(M\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value).Value;
|
||||
var defaultConfig = "";
|
||||
if (displayText.Contains("M"))
|
||||
{
|
||||
maxConfig =
|
||||
$"PM.{module}.MFC.Mfc{displayText.Replace("(M", "").Replace(")", "")}.N2Scale";
|
||||
defaultConfig =
|
||||
$"PM.{module}.MFC.Mfc{displayText.Replace("(M", "").Replace(")", "")}.DefaultSetPoint";
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = new Regex(@"\(PC\d+\)").Match(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value)
|
||||
.Value;
|
||||
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";
|
||||
defaultConfig =
|
||||
$"PM.{module}.PC.PC{displayText.Replace("(PC", "").Replace(")", "")}.DefaultSetPoint";
|
||||
}
|
||||
}
|
||||
|
||||
col = new DoubleColumn()
|
||||
{
|
||||
ModuleName = step.Attributes[NAME_ATTR_MODULE_NAME].Value,
|
||||
@@ -581,10 +589,8 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
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"),
|
||||
Maximun = GetDoubleValueByName(step.Attributes[NAME_ATTR_MAX].Value),
|
||||
Minimun = GetDoubleValueByName(step.Attributes[NAME_ATTR_MIN].Value),
|
||||
StringCellTemplate = "CellTemplateDisplay",
|
||||
StringCellEditingTemplate = "CellTemplateNumber",
|
||||
StringHeaderTemplate = "ColumnHeaderTemplateCommon",
|
||||
@@ -594,13 +600,23 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
Convert.ToBoolean(step.Attributes["EnableTolerance"].Value),
|
||||
IsEnable = defaultCellEnable,
|
||||
};
|
||||
|
||||
//strAbc此函数去除了括号及括号中的内容,所以在此处重新赋值,保留括号及其内容*********************
|
||||
if (displayText.Contains("M")|| displayText.Contains("PC"))
|
||||
if (defaultConfig != "")
|
||||
{
|
||||
col.Default = GetStringValueByName("PM",
|
||||
$"PM.RecipeConfig.{strAbc(node.Attributes[NAME_ATTR_DISPLAY_NAME].Value)}.{strAbc(step.Attributes[NAME_ATTR_DISPLAY_NAME].Value, false)}.Default");
|
||||
col.Default = GetStringValueByName("PM", defaultConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (step.Attributes[NAME_ATTR_DEFAULT]!=null)
|
||||
{
|
||||
col.Default = GetDoubleValueByName(step.Attributes[NAME_ATTR_DEFAULT].Value).ToString();
|
||||
}
|
||||
}
|
||||
//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");
|
||||
//}
|
||||
//******************************************************************************************
|
||||
|
||||
|
||||
@@ -610,49 +626,49 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
//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;
|
||||
// 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":
|
||||
@@ -678,6 +694,10 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel
|
||||
|
||||
|
||||
};
|
||||
if (step.Attributes[NAME_ATTR_DEFAULT] != null)
|
||||
{
|
||||
col.Default = step.Attributes[NAME_ATTR_DEFAULT].Value;
|
||||
}
|
||||
var items = step.SelectNodes("Item");
|
||||
foreach (XmlNode item in items)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user