sc 2 years ago
parent
commit
fa7882c34a
  1. 6
      MainWindow.xaml
  2. 36
      MainWindow.xaml.cs

6
MainWindow.xaml

@ -180,7 +180,8 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}" <TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
BorderBrush="{x:Null}" Background="{x:Null}" KeyDown="CP_CONC_KeyUp"/> BorderBrush="{x:Null}" Background="{x:Null}"
KeyDown="CP_CONC_KeyUp"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@ -188,7 +189,8 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox x:Name="CP_SHIFT" BorderThickness="0,0,0,0" Text="{Binding SHIFT}" <ComboBox x:Name="CP_SHIFT" BorderThickness="0,0,0,0" Text="{Binding SHIFT}"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False"> BorderBrush="{x:Null}" Background="{x:Null}"
IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False">
<ComboBoxItem Content="%"></ComboBoxItem> <ComboBoxItem Content="%"></ComboBoxItem>
<ComboBoxItem Content="g/L"></ComboBoxItem> <ComboBoxItem Content="g/L"></ComboBoxItem>
</ComboBox> </ComboBox>

36
MainWindow.xaml.cs

@ -450,19 +450,46 @@ namespace formula_manage
} }
} }
private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) string Type_;
string Conc_;
double Weight_=0;
private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//原料代码输入
{ {
double ang;
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
string a = curComboBox.Text; string a = curComboBox.Text;
if (a == "") return; if (a == "") return;
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + a + "'");
if (!r.Any())
{
System.Windows.MessageBox.Show("原料不存在");
curComboBox.Text = "";
return;
}
string Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
if (double.TryParse(list_Weight.Text, out ang))
{
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100;
}
//RRODUCTdataTable.Load(r.ElementAt(1).ToString());
PressKey.PressKeys(Keys.Right, false); PressKey.PressKeys(Keys.Right, false);
PressKey.PressKeys(Keys.Right, true); PressKey.PressKeys(Keys.Right, true);
PressKey.PressKeys(Keys.Tab, false); PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true); PressKey.PressKeys(Keys.Tab, true);
} }
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
@ -491,7 +518,6 @@ namespace formula_manage
curTextBox.Text = ""; curTextBox.Text = "";
return; return;
} }
PressKey.PressKeys(Keys.Left, false); PressKey.PressKeys(Keys.Left, false);
PressKey.PressKeys(Keys.Left, true); PressKey.PressKeys(Keys.Left, true);
PressKey.PressKeys(Keys.Tab, false); PressKey.PressKeys(Keys.Tab, false);
@ -513,7 +539,7 @@ namespace formula_manage
private void CP_PRODUCT_CODE_LostFocus(object sender, RoutedEventArgs e) private void CP_PRODUCT_CODE_LostFocus(object sender, RoutedEventArgs e)
{ {
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; /* System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
string a = curComboBox.Text; string a = curComboBox.Text;
DataTable data = null; DataTable data = null;
@ -522,7 +548,7 @@ namespace formula_manage
data = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + a + "'").CopyToDataTable(); data = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + a + "'").CopyToDataTable();
//Grid_RRODUCT.ItemsSource = data.Columns.//Add("ProductName").ToString(); //Grid_RRODUCT.ItemsSource = data.Columns.//Add("ProductName").ToString();
} }*/
} }
} }
} }

Loading…
Cancel
Save