注塑喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

169 lines
5.6 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.DAL;
using MESClassLibrary.EFModel;
namespace MESClassLibrary.BLL.MistakeGratings
{
public class GratingsBll
{
public DataTable SearchAll()
{
DataTable res = null;
try
{
string sql = @"select * from tb_Mistake_Gratings";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
}
return res;
}
public DataTable SearchAllByPartNo1(string partNo1)
{
DataTable res = null;
try
{
string sql = @"select * from tb_Mistake_Gratings where PartNo1='" + partNo1 + @"'";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
public DataTable SearchInfoByBarCode2(string barCode2)
{
DataTable res = null;
try
{
string sql = @"select * from tb_Record_Gratings where BarCode2='"+ barCode2 +@"'";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
public DataTable SearchInfoByBarCode1(string barCode1)
{
DataTable res = null;
try
{
string sql = @"select * from tb_Record_Gratings where BarCode1='" + barCode1 + @"'";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
public DataTable SearchMath(string partNo1, string partNo2)
{
DataTable res = null;
try
{
string sql = @"select * from tb_Mistake_Gratings where PartNo1='" + partNo1 + @"' and PartNo2='" + partNo2 + @"'";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
private BasicBLL<tb_Record_Gratings> db = new BasicBLL<tb_Record_Gratings>();
private BasicBLL<tb_Mistake_Gratings> db1 = new BasicBLL<tb_Mistake_Gratings>();
public bool AddRecord(tb_Record_Gratings md)
{
bool result;
try
{
string sql =
@"insert into tb_Record_Gratings (BarCode1,BarCode2,ZcCode,CreateTime,Flag) values(@BarCode1,@BarCode2,@ZcCode,@CreateTime,@Flag)";
SqlParameter[] param = null;
param = new SqlParameter[5];
param[0] = new SqlParameter("@BarCode1", SqlDbType.VarChar);
param[0].Value = md.BarCode1;
param[1] = new SqlParameter("@BarCode2", SqlDbType.VarChar);
param[1].Value = md.BarCode2;
param[2] = new SqlParameter("@ZcCode", SqlDbType.VarChar);
param[2].Value = md.ZcCode;
param[3] = new SqlParameter("@CreateTime", SqlDbType.DateTime);
param[3].Value = md.CreateTime;
param[4] = new SqlParameter("@Flag", SqlDbType.Int);
param[4].Value = md.Flag;
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
result = true;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
result = false;
}
return result;
}
public DataTable SearchInfoLast(string zcCode)
{
DataTable res = null;
try
{
string sql = @"select top 1 * from tb_Record_Gratings where ZcCode like '%" + zcCode + @"%'
and Flag=0 order by ID desc";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
public DataTable SearchInfoLastByCode1(string barCode1)
{
DataTable res = null;
try
{
string sql = @"select top 1 * from tb_Record_Gratings where BarCode1 = '" + barCode1 + @"' order by ID desc";
res = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
return res;
}
}
}