Browse Source

修改新建工艺细节

master
sc 10 months ago
parent
commit
62b448ccee
  1. 5
      View/ProductionPlanningEdit.xaml
  2. 41
      View/ProductionPlanningEdit.xaml.cs

5
View/ProductionPlanningEdit.xaml

@ -9,10 +9,11 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="900" d:DesignWidth="550"> d:DesignHeight="900" d:DesignWidth="550">
<Grid Background="White" Cursor=""> <Grid Background="White" Cursor="">
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" BorderBrush="#FF673AB7" IsReadOnly="True" /> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" IsReadOnly="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<Button Content="{x:Static lang:Resources.Multi}" Height="35" Margin="450,30,0,0" VerticalAlignment="Top" Width="80" Click="Multi_Click" HorizontalAlignment="Left"/> <Button Content="{x:Static lang:Resources.Multi}" Height="35" Margin="450,30,0,0" VerticalAlignment="Top" Width="80" Click="Multi_Click" HorizontalAlignment="Left"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,80,0,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"/> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,80,0,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="270" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7"
DropDownClosed="comboBoxProgram_DropDownClosed" TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}" <DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"

41
View/ProductionPlanningEdit.xaml.cs

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -37,7 +38,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
SQLiteHelpers.Close(); //关闭连接 SQLiteHelpers.Close(); //关闭连接
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台 comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramID")).ToList();//转换工艺代码 comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
} }
private void Multi_Click(object sender, RoutedEventArgs e) private void Multi_Click(object sender, RoutedEventArgs e)
{ {
@ -56,15 +57,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void comboBoxProgram_DropDownClosed(object sender, EventArgs e)//工艺选择事件 private void comboBoxProgram_DropDownClosed(object sender, EventArgs e)//工艺选择事件
{ {
if (!string.IsNullOrEmpty(comboBoxProgram.SelectedValue.ToString())) if (!string.IsNullOrEmpty(comboBoxProgram.Text))
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 SQLiteHelpers.Open(); //打开数据库
DataTable dat = SQLiteHelpers.ExecuteDataSet( DataTable dat = SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where ProgramID='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接 SQLiteHelpers.Close(); //关闭连接
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
} }
} }
private void comboBoxProgram_TextChanged(object sender, TextChangedEventArgs e)
{
string text = comboBoxProgram.Text;
if (!string.IsNullOrEmpty(text))
{
// try
{
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
DataTable dat = new DataTable();
for (int i = 0; i < sArray.Length; i++)
{
DataTable temp = SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
if (dat.Columns.Count == 0) dat = temp.Clone();
foreach (DataRow dr in temp.Rows)
{
dat.Rows.Add(dr.ItemArray);
}
//dat = temp.Copy();
}
SQLiteHelpers.Close(); //关闭连接
Grid_data.ItemsSource = dat.DefaultView;
}
// catch (Exception) { }
}
}
} }
} }

Loading…
Cancel
Save