sc 4 years ago
parent
commit
ee4118c361
  1. 10
      ConvertMoels/GramsSQLConvert.cs
  2. 8
      Models/DyelotsBulkedRecipeProvider.cs
  3. 6
      Models/DyelotsProvider.cs
  4. 6
      Models/ProductProvider.cs
  5. 2
      View/QueryView.xaml.cs

10
ConvertMoels/GramsSQLConvert.cs

@ -8,18 +8,22 @@ using System.Windows.Data;
namespace Audit.ConvertMoels namespace Audit.ConvertMoels
{ {
/// <summary>
/// 零值标红转换器
/// DispenseGrams为零的单元格文本标红返回
/// </summary>
internal class GramsSQLConvert : IValueConverter internal class GramsSQLConvert : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
string G = value.ToString(); string G = value.ToString();
if (G == "0") if (G == "0")//判断单元格值是否为零
{ {
return "red"; return "red";//零返回红色
} }
else else
{ {
return "black"; return "black";//非零返回黑色
} }
} }

8
Models/DyelotsBulkedRecipeProvider.cs

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

6
Models/DyelotsProvider.cs

@ -36,20 +36,20 @@ namespace Models
return db.Dyelots.SqlQuery(sqlselect).ToList(); return db.Dyelots.SqlQuery(sqlselect).ToList();
} }
public List<Dyelots> Selectsql(Dyelots t) public List<Dyelots> Selectsql(Dyelots t)//以单号查询
{ {
string sqlselect = "select * from Dyelots Where Dyelot = " + "'" + t.Dyelot.ToString() + "'"; string sqlselect = "select * from Dyelots Where Dyelot = " + "'" + t.Dyelot.ToString() + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList(); return db.Dyelots.SqlQuery(sqlselect).ToList();
} }
public List<Dyelots> Selecttime(Dyelots t) public List<Dyelots> Selecttime(Dyelots t)//以时间查询
{ {
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString() string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
+ "' and CreationTime > '" + t.StartTime.ToString() + "'"; + "' and CreationTime > '" + t.StartTime.ToString() + "'";
return db.Dyelots.SqlQuery(sqlselect).ToList(); return db.Dyelots.SqlQuery(sqlselect).ToList();
} }
public List<Dyelots> SelectMachine(Dyelots t) public List<Dyelots> SelectMachine(Dyelots t)//以时间及机台查询
{ {
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString() string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
+ "' and CreationTime > '" + t.StartTime.ToString() + "' and Machine = '" + t.Machine.ToString() + "'"; + "' and CreationTime > '" + t.StartTime.ToString() + "' and Machine = '" + t.Machine.ToString() + "'";

6
Models/ProductProvider.cs

@ -35,16 +35,16 @@ namespace Models
public List<Product> Selects0() public List<Product> Selects0()
{ {
return db.Product.SqlQuery("select * from Product where ProductType = 0").ToList();//查询 return db.Product.SqlQuery("select * from Product where ProductType = 0").ToList();//类型0查询
} }
public List<Product> Selects1() public List<Product> Selects1()
{ {
return db.Product.SqlQuery("select * from Product where ProductType = 1").ToList();//查询 return db.Product.SqlQuery("select * from Product where ProductType = 1").ToList();//类型1查询
} }
public List<Product> Selects2() public List<Product> Selects2()
{ {
return db.Product.SqlQuery("select * from Product where ProductType = 2").ToList();//查询 return db.Product.SqlQuery("select * from Product where ProductType = 2").ToList();//类型2查询
} }
public List<Product> Selectsql(Product t) public List<Product> Selectsql(Product t)

2
View/QueryView.xaml.cs

@ -74,7 +74,7 @@ namespace Audit.View
else else
{ {
DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_Button;//传递单号 DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_Button;//传递单号
Dyelots_Button.Dyelot = DataGridDyelots_Button; Dyelots_Button.Dyelot = DataGridDyelots_Button;//传递单号
sqlButton_Click = 1;//发生按钮状态单号查询 sqlButton_Click = 1;//发生按钮状态单号查询
} }
} }

Loading…
Cancel
Save