修改新建工单逻辑添加领料单输入
This commit is contained in:
commit
4d101da1ff
3 files changed
+95
-18
No files matched your search
@@ -9,15 +9,18 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="900" d:DesignWidth="550">
|
||||
<Grid Background="White" Cursor="">
|
||||
<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" />
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7"
|
||||
DropDownClosed="comboBoxMachine_DropDownClosed" 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"/>
|
||||
<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="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"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,200,0,60" >
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -18,7 +19,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using TouchSocket.Core;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.MachineSelection;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
@@ -30,6 +31,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
DataTable ProgramName;
|
||||
DataTable dat = new DataTable();
|
||||
public ProductionPlanningEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -42,55 +44,79 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
||||
}
|
||||
private void comboBoxMachine_DropDownClosed(object sender, EventArgs e)//机台选择
|
||||
{
|
||||
string[] sArray = Regex.Split(comboBoxMachine.Text, @"\+", RegexOptions.IgnoreCase);
|
||||
if (sArray.Length <= 1)
|
||||
{
|
||||
comboBoxDyelot.IsEnabled = true;
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
DataTable DatDyelot = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
|
||||
}
|
||||
}
|
||||
private void Multi_Click(object sender, RoutedEventArgs e)//机台组
|
||||
{
|
||||
MachineSelection machineSelection = new MachineSelection();
|
||||
machineSelection.AddressUpdated += new MachineSelection.AddressUpdateHandler(Address_ButtonClicked);
|
||||
machineSelection.AddressUpdated += new MachineSelection.AddressUpdateHandler(Address_Multi_Click);
|
||||
//machineSelection.data = "ID";
|
||||
machineSelection.ShowDialog();
|
||||
}
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//机台组返回结果
|
||||
private void Address_Multi_Click(object sender, MachineSelection.AddressUpdateEventArgs e)//机台组返回结果
|
||||
{
|
||||
if(!string.IsNullOrEmpty(e.Groups)) comboBoxMachine.Text = e.Groups;
|
||||
comboBoxDyelot.Text = null;
|
||||
comboBoxDyelot.IsEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void Button_Quit(object sender, RoutedEventArgs e)
|
||||
private void Button_Quit(object sender, RoutedEventArgs e)//退出
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
public void DatSteps(DataTable db)//行号刷新
|
||||
{
|
||||
int a = db.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = db.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
}
|
||||
}
|
||||
private void comboBoxProgram_DropDownClosed(object sender, EventArgs e)//工艺选择事件
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxProgram.Text))
|
||||
{
|
||||
dat.Clear();
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
DataTable dat = SQLiteHelpers.ExecuteDataSet(
|
||||
dat = SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxProgram_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
dat.Clear();
|
||||
string text = comboBoxProgram.Text;
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
// try
|
||||
try
|
||||
{
|
||||
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
|
||||
|
||||
DataTable dat = new DataTable();
|
||||
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
for (int i = 0; i < sArray.Length; i++)
|
||||
{
|
||||
DataTable temp = SQLiteHelpers.ExecuteDataSet(
|
||||
@@ -103,12 +129,59 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
//dat = temp.Copy();
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
// catch (Exception) { }
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
string ProgramID;
|
||||
string ProgramNAME;
|
||||
string Numder = null;
|
||||
string ID = null;
|
||||
string P1, P2, P3, P4, P5;
|
||||
|
||||
private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid_data.Columns[3].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid_data.Columns[6].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid_data.Columns[7].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid_data.Columns[8].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid_data.Columns[9].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid_data.Columns[10].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = dat.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
int i = dat.Rows.Count;
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
|
||||
DataRow dr = dat.Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
dr["StepName"] = e.StepNAME;
|
||||
dr["ParameterName"] = e.PNAME;
|
||||
dr["Parameter1"] = e.P1;
|
||||
dr["Parameter2"] = e.P2;
|
||||
dr["Parameter3"] = e.P3;
|
||||
dr["Parameter4"] = e.P4;
|
||||
dr["Parameter5"] = e.P5;
|
||||
dr.EndEdit();
|
||||
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user