注塑喷涂
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.

111 lines
3.9 KiB

6 months ago
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.BLL.Log;
using MESClassLibrary.Model;
namespace MESClassLibrary.DAL.ExchangeCenter
{
public class PartMstrDAL
{
public static string TableName = "TES_PART_MSTR";
public bool AddInfo(PartMstrModel md)
{
try
{
#region 添加数据
string sql = "";
SqlParameter[] param = null;
sql = "INSERT INTO " + TableName + " (GUID,PartCode,Desc1,Desc2,Um,ProdLine,AddDate,PartType,Status,Qgrade,InventoryCode,UID,Remark,TaskID,CommandType,Domain,Site";
sql += ") VALUES (";
sql += "@GUID,";
sql += "@PartCode,";
sql += "@Desc1,";
sql += "@Desc2,";
sql += "@Um,";
sql += "@ProdLine,";
sql += "@AddDate,";
sql += "@PartType,";
sql += "@Status,";
sql += "@Qgrade,";
sql += "@InventoryCode,";
sql += "@UID,";
sql += "@Remark,";
sql += "@TaskID,";
sql += "@CommandType,";
sql += "@Domain,";
sql += "@Site)";
#region 添加参数
param = new SqlParameter[17];
param[0] = new SqlParameter("@GUID", SqlDbType.VarChar);
param[0].Value = md.GUID;
param[1] = new SqlParameter("@PartCode", SqlDbType.VarChar);
param[1].Value = md.PartCode;
param[2] = new SqlParameter("@Desc1", SqlDbType.VarChar);
param[2].Value = md.Desc1;
param[3] = new SqlParameter("@Desc2", SqlDbType.VarChar);
param[3].Value = md.Desc2;
param[4] = new SqlParameter("@Um", SqlDbType.VarChar);
param[4].Value = md.Um;
param[5] = new SqlParameter("@ProdLine", SqlDbType.VarChar);
param[5].Value = md.ProdLine;
param[6] = new SqlParameter("@AddDate", SqlDbType.VarChar);
param[6].Value = md.AddDate;
param[7] = new SqlParameter("@PartType", SqlDbType.VarChar);
param[7].Value = md.PartType;
param[8] = new SqlParameter("@Status", SqlDbType.VarChar);
param[8].Value = md.Status;
param[9] = new SqlParameter("@Qgrade", SqlDbType.VarChar);
param[9].Value = md.Qgrade;
param[10] = new SqlParameter("@InventoryCode", SqlDbType.VarChar);
param[10].Value = md.InventoryCode;
param[11] = new SqlParameter("@UID", SqlDbType.VarChar);
param[11].Value = md.UID;
param[12] = new SqlParameter("@Remark", SqlDbType.VarChar);
param[12].Value = md.Remark;
param[13] = new SqlParameter("@TaskID", SqlDbType.VarChar);
param[13].Value = md.TaskID;
param[14] = new SqlParameter("@CommandType", SqlDbType.VarChar);
param[14].Value = md.CommandType;
param[15] = new SqlParameter("@Domain", SqlDbType.VarChar);
param[15].Value = md.Domain;
param[16] = new SqlParameter("@Site", SqlDbType.VarChar);
param[16].Value = md.Site;
#endregion
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
#endregion
return true;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}