Преглед изворни кода

1revise pm counter box input ” “ solution
2revise sequence Recipe wafersize view bug

chenzk пре 2 дана
родитељ
комит
abe0c8ec12

+ 10 - 0
CyberX8_MainPages/ViewModels/SequenceRecipeViewModel.cs

@@ -126,6 +126,10 @@ namespace CyberX8_MainPages.ViewModels
         /// Selected CrsType
         /// </summary>
         private string _selectedCrsType = "";
+        /// 选中Sequncen尺寸
+        /// </summary>
+        private int _selectedRecipeSubstrateSize = 0;
+        /// <summary>
         #endregion
         #region 属性
         public ObservableCollection<RecipeNode> RecipeNodes
@@ -233,6 +237,11 @@ namespace CyberX8_MainPages.ViewModels
             get { return _crsTypeLst; }
             set { SetProperty(ref _crsTypeLst, value); }
         }
+        public int SelectedRecipeSubstrateSize
+        {
+            get { return _selectedRecipeSubstrateSize; }
+            set { SetProperty(ref _selectedRecipeSubstrateSize, value); }
+        }
         /// <summary>
         /// PlatType集合
         /// </summary>
@@ -415,6 +424,7 @@ namespace CyberX8_MainPages.ViewModels
                     }
                     SelectedPlatType = (PlatType)Recipe.PlatType;
                     SelectedCrsType = CrsTypeLst.FirstOrDefault(O => O.Contains(Recipe.CrsType));
+                    SelectedRecipeSubstrateSize = Recipe.SubstrateSize;
                 }
                 else
                 {

+ 1 - 1
CyberX8_MainPages/Views/SequenceRecipeView.xaml

@@ -127,7 +127,7 @@
                     <RowDefinition/>
                 </Grid.RowDefinitions>
                 <GroupBox Header="Substrate Size" IsEnabled="{Binding Enable}">
-                    <ComboBox Height="30" Margin="0,0,20,0" ItemsSource="{Binding WaferSizeLst}" SelectedItem="{Binding Recipe.SubstrateSize, Mode=TwoWay}">
+                    <ComboBox Height="30" Margin="0,0,20,0" ItemsSource="{Binding WaferSizeLst}" SelectedItem="{Binding SelectedRecipeSubstrateSize, Mode=TwoWay}">
                     </ComboBox>
                 </GroupBox>
                 <GroupBox Grid.Row="1" Header="LS Type" IsEnabled="{Binding Enable}">

+ 30 - 6
Framework/UICore/Control/PMCounterValueTextBox.xaml.cs

@@ -125,29 +125,53 @@ namespace MECF.Framework.UI.Core.Control
             {
                 if (KeyOperation != null)
                 {
-                    if (txtInput.Text.IsNullOrEmpty())
+                    if (txtInput.Text.Trim().IsNullOrEmpty())
                     {
                         txtInput.Text = "0";
                     }
+                    if (txtInput.Text.Trim().Last() == '.')
+                    {
+                        txtInput.Text = txtInput.Text.Trim().Substring(0, txtInput.Text.Trim().Length - 1);
+                    }
                     Value = txtInput.Text;
-                    KeyOperation.Execute(new object[] { PMCounterNodeName, CounterNodeName , txtInput.Text });
+                    KeyOperation.Execute(new object[] { PMCounterNodeName, CounterNodeName, txtInput.Text });
                 }
             }
         }
 
         private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
         {
-            e.Handled = !IsTextAllowed(e.Text, ((TextBox)sender).Text);
+            var textBox = (TextBox)sender;
+            e.Handled = !IsTextAllowed(textBox.Text, e.Text[0]);
         }
 
-        private bool IsTextAllowed(string key, string text)
+        private bool IsTextAllowed(string input, char? newChar = null)
         {
-            Regex regex = new Regex("[^0-9.]+"); //regex that matches disallowed text
-            return !regex.IsMatch(key);
+            //regex that matches disallowed text
+            //Regex regex = new Regex("[^0-9.]+"); 
+            //return !regex.IsMatch(key);
+            // 检查是否包含空格
+            if ((newChar.HasValue && char.IsWhiteSpace(newChar.Value)) ||
+                (!string.IsNullOrEmpty(input) && input.Any(char.IsWhiteSpace)))
+            {
+                return false;
+            }
+
+            // 允许空字符串(用于删除操作)
+            if (string.IsNullOrEmpty(input) && newChar == null)
+                return true;
+
+            // 组合完整字符串
+            string fullText = newChar.HasValue ? input + newChar : input;
+
+            // 正则表达式验证(允许数字和单个小数点,禁止空格)
+            return Regex.IsMatch(fullText, @"^-?\d*\.?\d*$") &&
+                   fullText.Count(c => c == '.') <= 1;
         }
 
 
 
+
         private void TextBox_LostFocus(object sender, RoutedEventArgs e)
         {
             TextBox textBox = sender as TextBox;