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.
138 lines
4.9 KiB
138 lines
4.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using MESClassLibrary.Model;
|
|
using MESClassLibrary.BLL.BasicInfo;
|
|
using MESClassLibrary.BLL.Log;
|
|
|
|
namespace MESClassLibrary.DAL.painting
|
|
{
|
|
public class InspectResultDAL
|
|
{
|
|
public static string TableName = "tb_InspectResult";
|
|
|
|
public bool AddInfo(InspectResultModel md)
|
|
{
|
|
try
|
|
{
|
|
#region 添加数据
|
|
string sql = "";
|
|
SqlParameter[] param = null;
|
|
sql = "INSERT INTO " + TableName + " ([ID] ,[barcode] ,[side],[stationNo],[workClass],[inspectResult],[productInfo],[productOption] ,[InspectTimes],[createTime]";
|
|
sql += ") VALUES (";
|
|
sql += "@ID,";
|
|
sql += "@barcode,";
|
|
sql += "@side,";
|
|
sql += "@stationNo,";
|
|
sql += "@workClass,";
|
|
sql += "@inspectResult,";
|
|
sql += "@productInfo,";
|
|
sql += "@productOption,";
|
|
sql += "@InspectTimes,";
|
|
sql += "@createTime)";
|
|
|
|
#region 添加参数
|
|
param = new SqlParameter[10];
|
|
param[0] = new SqlParameter("@ID", SqlDbType.VarChar);
|
|
param[0].Value = md.ID;
|
|
|
|
param[1] = new SqlParameter("@barcode", SqlDbType.VarChar);
|
|
param[1].Value = md.barcode;
|
|
|
|
param[2] = new SqlParameter("@side", SqlDbType.VarChar);
|
|
param[2].Value = md.side;
|
|
|
|
param[3] = new SqlParameter("@stationNo", SqlDbType.VarChar);
|
|
param[3].Value = md.stationNo;
|
|
|
|
param[4] = new SqlParameter("@workClass", SqlDbType.VarChar);
|
|
param[4].Value = md.workClass;
|
|
|
|
param[5] = new SqlParameter("@inspectResult", SqlDbType.VarChar);
|
|
param[5].Value = md.inspectResult;
|
|
|
|
param[6] = new SqlParameter("@productInfo", SqlDbType.VarChar);
|
|
param[6].Value = md.productInfo;
|
|
|
|
param[7] = new SqlParameter("@productOption", SqlDbType.VarChar);
|
|
param[7].Value = md.productOption;
|
|
|
|
param[8] = new SqlParameter("@InspectTimes", SqlDbType.VarChar);
|
|
param[8].Value = md.InspectTimes;
|
|
|
|
param[9] = new SqlParameter("@createTime", SqlDbType.DateTime);
|
|
param[9].Value = md.createTime;
|
|
|
|
#endregion
|
|
|
|
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
|
|
#endregion
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public DataTable SearchInfoByBarcode(string barcode)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"SELECT top 1 [barcode]
|
|
,[position]
|
|
,[stationNo]
|
|
,[inspectResult]
|
|
,[productInfo]
|
|
,[createTime]
|
|
,[InspectTimes]
|
|
FROM [BBMPT].[dbo].[tb_InspectResult]
|
|
where barcode='" + barcode + @"'
|
|
order by createTime desc";
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public string OneBarCode(string barcode)
|
|
{
|
|
string res = barcode;
|
|
try
|
|
{
|
|
string sql = @"
|
|
SELECT TOP 1 OneBarCode FROM tb_BarCode WHERE BarCode = '" + barcode + @"'
|
|
";
|
|
object aa = SqlHelper.ExecuteScalar(SqlHelper.GetConnSting(), CommandType.Text, sql, null);
|
|
if (aa != null)
|
|
{
|
|
res = aa.ToString();
|
|
}
|
|
else
|
|
{
|
|
string sql2 = @" SELECT TOP 1 OneBarCode FROM [10.60.101.60].[BBMPT1].[dbo].[v_Code] where BarCode = '" + barcode + @"' ";
|
|
object bb = SqlHelper.ExecuteScalar(SqlHelper.GetConnSting(), CommandType.Text, sql2, null);
|
|
if (bb != null)
|
|
{
|
|
res = bb.ToString();
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
return res;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|