sc 4 years ago
parent
commit
f9a9bb1723
  1. 7
      Models/DyelotsBulkedRecipeProvider.cs
  2. 22
      Models/DyelotsProvider.cs
  3. 2
      Models/IProvider.cs
  4. 4
      Models/MachinesProvider.cs
  5. 5
      Models/ProductProvider.cs
  6. 4
      Models/UserAccountProvide.cs
  7. 2
      View/QueryView.xaml
  8. 39
      View/QueryView.xaml.cs
  9. 2
      View/StuffView.xaml.cs
  10. 35
      ViewModel/QueryViewModel.cs

7
Models/DyelotsBulkedRecipeProvider.cs

@ -25,11 +25,16 @@ namespace Models
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<DyelotsBulkedRecipe> Selectsql(DyelotsBulkedRecipe t)
{
string sqlselect = "select * from DyelotsBulkedRecipe Where Dyelot = "+"'"+ t.Dyelot.ToString()+"'";
return db.DyelotsBulkedRecipe.SqlQuery(sqlselect).ToList();//查询前100条
}
public List<DyelotsBulkedRecipe> Select() public List<DyelotsBulkedRecipe> Select()
{ {
return db.DyelotsBulkedRecipe.SqlQuery("select TOP (100) * from DyelotsBulkedRecipe").ToList();//查询前100条 return db.DyelotsBulkedRecipe.SqlQuery("select TOP (100) * from DyelotsBulkedRecipe").ToList();//查询前100条
} }
public int Update(DyelotsBulkedRecipe t) public int Update(DyelotsBulkedRecipe t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

22
Models/DyelotsProvider.cs

@ -32,9 +32,29 @@ namespace Models
public List<Dyelots> Select() public List<Dyelots> Select()
{ {
return db.Dyelots.SqlQuery("select TOP (100) * from Dyelots").ToList();//查询前100条 string sqlselect= "select TOP (300) * from Dyelots Where CreationTime > '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList();
} }
public List<Dyelots> Selectsql(Dyelots t)
{
string sqlselect = "select * from Dyelots Where Dyelot = " + "'" + t.Dyelot.ToString() + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList();
}
public List<Dyelots> Selecttime(Dyelots t)
{
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
+ "' and CreationTime > '" + t.StartTime.ToString() + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList();
}
public List<Dyelots> SelectMachine(Dyelots t)
{
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
+ "' and CreationTime > '" + t.StartTime.ToString() + "' and Machine = '" + t.Machine.ToString() + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList();
}
public int Update(Dyelots t) public int Update(Dyelots t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

2
Models/IProvider.cs

@ -23,7 +23,7 @@ namespace Models
/// </summary> /// </summary>
/// <param name="t"></param> /// <param name="t"></param>
/// <returns></returns> /// <returns></returns>
//int Select(T t); List<T> Selectsql(T t);
/// <summary> /// <summary>
/// 插入一条记录 /// 插入一条记录

4
Models/MachinesProvider.cs

@ -25,6 +25,10 @@ namespace Models
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<Machines> Selectsql(Machines t)
{
throw new NotImplementedException();
}
public int Update(Machines t) public int Update(Machines t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

5
Models/ProductProvider.cs

@ -46,6 +46,11 @@ namespace Models
{ {
return db.Product.SqlQuery("select * from Product where ProductType = 2").ToList();//查询 return db.Product.SqlQuery("select * from Product where ProductType = 2").ToList();//查询
} }
public List<Product> Selectsql(Product t)
{
throw new NotImplementedException();
}
public int Update(Product t) public int Update(Product t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

4
Models/UserAccountProvide.cs

@ -25,6 +25,10 @@ namespace Models
return db.UserAccount.ToList(); return db.UserAccount.ToList();
} }
public List<UserAccount> Selectsql(UserAccount t)
{
throw new NotImplementedException();
}
public int Update(UserAccount t) public int Update(UserAccount t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

2
View/QueryView.xaml

@ -99,7 +99,7 @@
</Style> </Style>
</DatePicker.Resources> </DatePicker.Resources>
</DatePicker> </DatePicker>
<DatePicker x:Name="query_date_end" HorizontalAlignment="Left" Height="30" Margin="715,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="15" Padding="1,1,0,1"> <DatePicker x:Name="query_date_end" HorizontalAlignment="Left" Height="30" Margin="715,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="15" Padding="1,1,0,1" DisplayDate="2022-03-08">
<DatePicker.Resources> <DatePicker.Resources>
<Style TargetType="DatePickerTextBox"> <Style TargetType="DatePickerTextBox">
<Setter Property="IsReadOnly" Value="True"/> <Setter Property="IsReadOnly" Value="True"/>

39
View/QueryView.xaml.cs

@ -29,6 +29,10 @@ namespace Audit.View
InitializeComponent(); InitializeComponent();
} }
//public static string Dyelots_Button = null;
public static int sqlButton_Click=0;
public static Dyelots Dyelots_Button = new Dyelots();
public static DyelotsBulkedRecipe DyelotsBulkedRecipe_Button = new DyelotsBulkedRecipe();
private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件 private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件
{ {
string DataGridDyelots_Button = this.Dyelots_Dyelot.Text;//传递工单输入框 string DataGridDyelots_Button = this.Dyelots_Dyelot.Text;//传递工单输入框
@ -37,12 +41,13 @@ namespace Audit.View
string query_end = this.query_date_end.Text;//传递结束时间 string query_end = this.query_date_end.Text;//传递结束时间
if (string.IsNullOrWhiteSpace(DataGridDyelots_Button))//工单为空进入下一步判断 if (string.IsNullOrWhiteSpace(DataGridDyelots_Button))//工单为空进入下一步判断
{ {
if (string.IsNullOrWhiteSpace(query_start) || string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在 if (string.IsNullOrWhiteSpace(query_start) && string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在
{ {
MessageBox.Show("SC:无效查询信息", "错误");//返回无效信息弹窗 sqlButton_Click = 0;
} }
else else
{ {
query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1 int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1
if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效 if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效
{ {
@ -50,25 +55,32 @@ namespace Audit.View
} }
else else
{ {
if (string.IsNullOrWhiteSpace(DataGridMachine_Button))//查询时间及机台 if (string.IsNullOrWhiteSpace(DataGridMachine_Button))//查询机台
{ {
MessageBox.Show("SC:查询时间"); Dyelots_Button.StartTime = Convert.ToDateTime(query_start);
Dyelots_Button.EndTime = Convert.ToDateTime(query_end);
sqlButton_Click = 3;//传递按钮信息以时间查询
} }
else else
{ {
MessageBox.Show("SC:查询机台"); Dyelots_Button.StartTime = Convert.ToDateTime(query_start);
Dyelots_Button.EndTime = Convert.ToDateTime(query_end);
Dyelots_Button.Machine = DataGridMachine_Button;
sqlButton_Click = 4;//传递按钮信息以时间机台查询
} }
} }
} }
} }
else else
{ {
MessageBox.Show("SC:查询工单");//有单号查询 DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_Button;//传递单号
Dyelots_Button.Dyelot = DataGridDyelots_Button;
sqlButton_Click = 1;//发生按钮状态单号查询
} }
} }
private void DataGridDyelot_MouseDoubleClick(object sender, MouseButtonEventArgs e)// DataGridDyelot表格双击事件 private void DataGridDyelot_MouseDoubleClick(object sender, MouseButtonEventArgs e)// DataGridDyelot表格双击事件
{ {
int rownum = this.DataGridDyelots.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = this.DataGridDyelots.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1) if (rownum != -1)
{ {
@ -76,16 +88,13 @@ namespace Audit.View
string DataGridReDye_value = (DataGridDyelots.Columns[1].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第1列选中行单元格,重染 string DataGridReDye_value = (DataGridDyelots.Columns[1].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第1列选中行单元格,重染
string DataGridMachine_value = (DataGridDyelots.Columns[2].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第2列选中行单元格,机台 string DataGridMachine_value = (DataGridDyelots.Columns[2].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第2列选中行单元格,机台
string DataGridCreationTime_value = (DataGridDyelots.Columns[3].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第3列选中行单元格,开单时间 string DataGridCreationTime_value = (DataGridDyelots.Columns[3].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第3列选中行单元格,开单时间
Dyelots_Dyelot.Text = DataGridDyelots_value.ToString();//获取工单单元格字符串填入工单输入框 //Dyelots_Dyelot.Text = DataGridDyelots_value.ToString();//获取工单单元格字符串填入工单输入框
Dyelots_ReDye.Text = DataGridReDye_value.ToString(); //获取重染单元格字符串填入重染框 Dyelots_ReDye.Text = DataGridReDye_value.ToString(); //获取重染单元格字符串填入重染框
Dyelots_Machine.Text = DataGridMachine_value.ToString();//获取机台单元格字符串填入机台输入框 //Dyelots_Machine.Text = DataGridMachine_value.ToString();//获取机台单元格字符串填入机台输入框
Dyelots_CreationTime.Text = DataGridCreationTime_value.ToString();//获取开单时间单元格字符串填入开单时间框 Dyelots_CreationTime.Text = DataGridCreationTime_value.ToString();//获取开单时间单元格字符串填入开单时间框
if (string.IsNullOrWhiteSpace(DataGridDyelots_value)) //工单为空进入下一步判断 DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_value;//传递工单信息至sql实例
{ } sqlButton_Click = 2;//传递按钮信息以查询
else
{
}
} }
} }

2
View/StuffView.xaml.cs

@ -120,7 +120,7 @@ namespace Audit.View
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{ {
product.ProductCode = this.stuff_ProductCode.Text;//原料代码 product.ProductCode = this.stuff_ProductCode.Text;//原料代码
string ShowProductName = "是否删除" + this.stuff_ProductCode.Text + "" + this.stuff_ProductName.Text;//获取原料信息并拼接提示字符串 string ShowProductName = "是否删除原料【" + this.stuff_ProductName.Text + "" + this.stuff_ProductCode.Text;//获取原料信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料 MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料 if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
{ {

35
ViewModel/QueryViewModel.cs

@ -1,4 +1,5 @@
using GalaSoft.MvvmLight; using Audit.View;
using GalaSoft.MvvmLight;
using Models; using Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -52,8 +53,8 @@ namespace Audit.ViewModel
/// </summary> /// </summary>
public QueryViewModel() public QueryViewModel()
{ {
dyelots = new DyelotsProvider().Select();//显示单号
dyelots = new DyelotsProvider().Select(); // dyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Select();//显示明显
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{ {
Interval = TimeSpan.FromSeconds(0.1) Interval = TimeSpan.FromSeconds(0.1)
@ -65,8 +66,32 @@ namespace Audit.ViewModel
int a = 0;//计数器用变量 int a = 0;//计数器用变量
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件 void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{ {
if (QueryView.sqlButton_Click == 0)
if (a == 20)// {
dyelots = new DyelotsProvider().Select();//显示单号
}
if (QueryView.sqlButton_Click == 2)
{
DyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Selectsql(QueryView.DyelotsBulkedRecipe_Button);//根据单号查询明细
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 1)
{
DyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Selectsql(QueryView.DyelotsBulkedRecipe_Button);//根据单号查询明细
Dyelots = new DyelotsProvider().Selectsql(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 3)
{
Dyelots = new DyelotsProvider().Selecttime(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 4)
{
Dyelots = new DyelotsProvider().SelectMachine(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (a == 20)//
{ {
a = 0; a = 0;

Loading…
Cancel
Save