sc 2 years ago
parent
commit
7fae8d82be
  1. 28
      MainWindow.xaml
  2. 55
      MainWindow.xaml.cs

28
MainWindow.xaml

@ -31,7 +31,7 @@
<MenuItem Header="其它...">
<MenuItem Header="_布种" FontSize="16"/>
<MenuItem Header="_品名" FontSize="16"/>
<MenuItem Header="_色" FontSize="16"/>
<MenuItem Header="_色" FontSize="16"/>
<MenuItem Header="_客户" FontSize="16"/>
</MenuItem>
</MenuItem>
@ -45,38 +45,38 @@
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="物料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,140,0,0" TextWrapping="Wrap" Text="机台:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,140,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20"/>
<TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" Focusable ="False"/>
<TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" Focusable ="False" KeyUp="SearchBox_OnKeyDownd"/>
<TextBox x:Name="Anew" HorizontalAlignment="Left" Height="30" Margin="300,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20" MaxLines="1" MaxLength="2" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Focusable ="False"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" Focusable ="False"/>
<ComboBox x:Name="Machine" HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" IsEditable="True"/>
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="305,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="80" FontSize="20" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" Focusable ="False" KeyUp="SearchBox_OnKeyDownd"/>
<ComboBox x:Name="Machine" HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" IsEditable="True" KeyUp="SearchBox_OnKeyDownd"/>
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="305,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="80" FontSize="20" KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,140,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False"/>
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,155,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_dow" IsTabStop="False" Focusable ="False"/>
<Grid Height="150" Width="405" Margin="5,170,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7">
<Button Content="..." HorizontalAlignment="Left" Margin="370,40,0,0" Height="30" VerticalAlignment="Top" Width="30" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Formula"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,5,0,0" TextWrapping="Wrap" Text="步序:" VerticalAlignment="Top" Width="70" FontSize="20"/>
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20" KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,5,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepUp" Focusable ="False"/>
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,20,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepDow" Focusable ="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="70" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="220,5,0,0" Text="" VerticalAlignment="Top" Width="180" FontSize="20" IsEditable="True" Focusable ="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,40,0,0" TextWrapping="Wrap" Text="配方代码:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" KeyUp="SearchBox_OnKeyDownd"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="220,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="145" FontSize="20" Focusable ="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,75,0,0" TextWrapping="Wrap" Text="重量(KG):" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"/>
<TextBox x:Name="list_Weight" HorizontalAlignment="Left" Height="30" Margin="90,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" KeyUp="SearchBox_OnKeyDownd" TextChanged="Weight" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,75,0,0" TextWrapping="Wrap" Text="浴比:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="270,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20"/>
<TextBox x:Name="list_Proportion" HorizontalAlignment="Left" Height="30" Margin="270,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20" KeyUp="SearchBox_OnKeyDownd" TextChanged="Proportion" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,110,0,0" TextWrapping="Wrap" Text="浴量(L):" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="产品:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="270,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False" IsEditable="True"/>
<TextBox x:Name="list_Total" HorizontalAlignment="Left" Height="30" Margin="90,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="修正:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="270,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False"/>
</Grid>
<DataGrid x:Name="DetailedGrid" AlternationCount="2" IsReadOnly="False" InitializingNewItem="DataGrid_InitializingNewItem"

55
MainWindow.xaml.cs

@ -15,6 +15,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
//using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace formula_manage
{
@ -28,6 +29,17 @@ namespace formula_manage
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
{
if (e.Key == Key.Enter)
{
//SendKeys.SendWait("{Tab}");
UserClass.PressKey.PressKeys(Keys.Tab, false);
UserClass.PressKey.PressKeys(Keys.Tab, true);
}
}
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
string Prepose; //料单前置
@ -43,10 +55,17 @@ namespace formula_manage
}
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//正则表达式只允许数字
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
{
//Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[0-9]+(.[0-9]{1,3})?$");// 非零的正整数
e.Handled = !re.IsMatch(e.Text);
}
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
{
//Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[0-9]+(.[0-9]{1,3})?$");
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text) ;
}
@ -166,5 +185,37 @@ namespace formula_manage
{
e.Row.Header = e.Row.GetIndex() + 1;
}
private void Weight(object sender, TextChangedEventArgs e) //重量输入框
{
float a, b, c;
a = float.Parse(list_Weight.Text);
if (list_Proportion.Text != "") //判断比例是否有效
{
b = float.Parse(list_Proportion.Text);
c = a * b;
string listtotal = c.ToString();
list_Total.Text = listtotal;
}
}
private void Proportion(object sender, TextChangedEventArgs e)
{
float a, b, c;
b = float.Parse(list_Proportion.Text);
if (list_Weight.Text != "") //判断比例是否有效
{
a = float.Parse(list_Weight.Text);
c = a * b;
string listtotal = c.ToString();
list_Total.Text = listtotal;
}
}
}
}

Loading…
Cancel
Save