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.
104 lines
3.5 KiB
104 lines
3.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Reflection;
|
|
using MESClassLibrary.BLL.Log;
|
|
using MESClassLibrary.Model;
|
|
|
|
namespace MESClassLibrary.DAL.Injection
|
|
{
|
|
public class InjectionBoxDAL
|
|
{
|
|
public static string TableName = "tb_Injection_BoxRecord";
|
|
|
|
public bool AddInfo(InjectionBoxModel md)
|
|
{
|
|
try
|
|
{
|
|
#region 添加数据
|
|
string sql = "";
|
|
SqlParameter[] param = null;
|
|
sql = "INSERT INTO " + TableName + " (ID,BoxNo,BoxCount,IsFlag,BoxType";
|
|
sql += ") VALUES (";
|
|
sql += "@ID,";
|
|
sql += "@BoxNo,";
|
|
sql += "@BoxCount,";
|
|
sql += "@IsFlag,";
|
|
sql += "@BoxType)";
|
|
|
|
#region 添加参数
|
|
param = new SqlParameter[5];
|
|
param[0] = new SqlParameter("@ID", SqlDbType.VarChar);
|
|
param[0].Value = md.ID;
|
|
|
|
param[1] = new SqlParameter("@BoxNo", SqlDbType.VarChar);
|
|
param[1].Value = md.BoxNo;
|
|
|
|
param[2] = new SqlParameter("@BoxCount", SqlDbType.Int);
|
|
param[2].Value = md.BoxCount;
|
|
|
|
param[3] = new SqlParameter("@IsFlag", SqlDbType.Int);
|
|
param[3].Value = md.IsFlag;
|
|
|
|
param[4] = new SqlParameter("@BoxType", SqlDbType.Int);
|
|
param[4].Value = md.BoxType;
|
|
|
|
#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 SeachInfoByBox(string partNo,string batchNo)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"select top 1 * from " + TableName + " where substring(BoxNo,0,CHARINDEX('.',BoxNo))=@partNo and SUBSTRING(SUBSTRING(BoxNo,CHARINDEX('.',BoxNo)+1,LEN(BoxNo)),0,CHARINDEX('.',SUBSTRING(BoxNo,CHARINDEX('.',BoxNo)+1,LEN(BoxNo))))=@batchNo and IsFlag=0 order by [CreateTime] desc";
|
|
|
|
SqlParameter[] param = new SqlParameter[2];
|
|
param[0] = new SqlParameter("@partNo", SqlDbType.VarChar);
|
|
param[0].Value = partNo;
|
|
|
|
param[1] = new SqlParameter("@batchNo", SqlDbType.VarChar);
|
|
param[1].Value = batchNo;
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0];
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public DataTable SearchBox(string BoxNo)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"select * from " + TableName + " where BoxNo=@BoxNo";
|
|
|
|
SqlParameter[] param = new SqlParameter[1];
|
|
param[0] = new SqlParameter("@BoxNo", SqlDbType.VarChar);
|
|
param[0].Value = BoxNo;
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0];
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|