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.
72 lines
2.2 KiB
72 lines
2.2 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.Model;
|
|
|
|
namespace MESClassLibrary.DAL.ZPPlan
|
|
{
|
|
public class ZPBoxDAL
|
|
{
|
|
public bool AddInfo(ZPBoxModel md)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"insert into tb_ZPBox (ID,BoxNo,PartNo) values(@ID,@BoxNo,@PartNo)";
|
|
|
|
SqlParameter[] param=new SqlParameter[3];
|
|
|
|
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("@PartNo", SqlDbType.VarChar);
|
|
param[2].Value = md.PartNo;
|
|
|
|
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public DataTable SearchBoxByPartNo(string partNo)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"select top 1 * from tb_ZPBox where PartNo='" + partNo + @"' and Flag <> 2 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 DataTable SearchCountByBoxNo(string boxNo)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"select top 1 * from tb_ZPBox where BoxNo='" + boxNo + @"' and Flag <> 2 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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|