一厂MES,含注塑,喷涂,冲孔
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.
 
 
 
 
 

177 lines
6.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 System.Threading.Tasks;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.Model;
namespace MESClassLibrary.DAL.ExchangeCenter
{
public class TESBomDAL
{
public static string TableName = "TES_BOM";
public bool AddInfo(TESBomModel md)
{
try
{
#region 添加数据
string sql = "";
SqlParameter[] param = null;
sql = "INSERT INTO " + TableName + " (ParentPart,ComponentPart,Reference,StartEffective,QuantityPer,StructureType,EndEffective,Remarks,Scrap,LeadTimeOffset,Operation,SequenceNumber,FporecastPercent,OptionGroup,Process,GUID,UID,CreateUser,CreateTime,Remark,TaskID,CommandType,DataID,Domain,Site";
sql += ") VALUES (";
sql += "@ParentPart,";
sql += "@ComponentPart,";
sql += "@Reference,";
sql += "@StartEffective,";
sql += "@QuantityPer,";
sql += "@StructureType,";
sql += "@EndEffective,";
sql += "@Remarks,";
sql += "@Scrap,";
sql += "@LeadTimeOffset,";
sql += "@Operation,";
sql += "@SequenceNumber,";
sql += "@FporecastPercent,";
sql += "@OptionGroup,";
sql += "@Process,";
sql += "@GUID,";
sql += "@UID,";
sql += "@CreateUser,";
sql += "@CreateTime,";
sql += "@Remark,";
sql += "@TaskID,";
sql += "@CommandType,";
sql += "@DataID,";
sql += "@Domain,";
sql += "@Site)";
#region 添加参数
param = new SqlParameter[25];
param[0] = new SqlParameter("@ParentPart", SqlDbType.VarChar);
param[0].Value = md.ParentPart;
param[1] = new SqlParameter("@ComponentPart", SqlDbType.VarChar);
param[1].Value = md.ComponentPart;
param[2] = new SqlParameter("@Reference", SqlDbType.VarChar);
param[2].Value = md.Reference;
param[3] = new SqlParameter("@StartEffective", SqlDbType.VarChar);
param[3].Value = md.StartEffective;
param[4] = new SqlParameter("@QuantityPer", SqlDbType.VarChar);
param[4].Value = md.QuantityPer;
param[5] = new SqlParameter("@StructureType", SqlDbType.VarChar);
param[5].Value = md.StructureType;
param[6] = new SqlParameter("@EndEffective", SqlDbType.VarChar);
param[6].Value = md.EndEffective;
param[7] = new SqlParameter("@Remarks", SqlDbType.VarChar);
param[7].Value = md.Remarks;
param[8] = new SqlParameter("@Scrap", SqlDbType.VarChar);
param[8].Value = md.Scrap;
param[9] = new SqlParameter("@LeadTimeOffset", SqlDbType.VarChar);
param[9].Value = md.LeadTimeOffset;
param[10] = new SqlParameter("@Operation", SqlDbType.VarChar);
param[10].Value = md.Operation;
param[11] = new SqlParameter("@SequenceNumber", SqlDbType.VarChar);
param[11].Value = md.SequenceNumber;
param[12] = new SqlParameter("@FporecastPercent", SqlDbType.VarChar);
param[12].Value = md.FporecastPercent;
param[13] = new SqlParameter("@OptionGroup", SqlDbType.VarChar);
param[13].Value = md.OptionGroup;
param[14] = new SqlParameter("@Process", SqlDbType.VarChar);
param[14].Value = md.Process;
param[15] = new SqlParameter("@GUID", SqlDbType.VarChar);
param[15].Value = md.GUID;
param[16] = new SqlParameter("@UID", SqlDbType.VarChar);
param[16].Value = md.UID;
param[17] = new SqlParameter("@CreateUser", SqlDbType.VarChar);
param[17].Value = md.CreateUser;
param[18] = new SqlParameter("@CreateTime", SqlDbType.VarChar);
param[18].Value = md.CreateTime;
param[19] = new SqlParameter("@Remark", SqlDbType.VarChar);
param[19].Value = md.Remark;
param[20] = new SqlParameter("@TaskID", SqlDbType.VarChar);
param[20].Value = md.TaskID;
param[21] = new SqlParameter("@CommandType", SqlDbType.VarChar);
param[21].Value = md.CommandType;
param[22] = new SqlParameter("@DataID", SqlDbType.VarChar);
param[22].Value = md.DataID;
param[23] = new SqlParameter("@Domain", SqlDbType.VarChar);
param[23].Value = md.Domain;
param[24] = new SqlParameter("@Site", SqlDbType.VarChar);
param[24].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;
}
}
public DataTable Search()
{
try
{
string sql = "select * from " + TableName + " where ParentPart like '%-P' and ComponentPart like 'ROH%' and Flag=0";
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return null;
}
}
public bool UpdateFlag(string TaskID)
{
try
{
string sql = "update " + TableName + " set Flag=1 where TaskID=@TaskID";
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@TaskID", SqlDbType.VarChar);
param[0].Value = TaskID;
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);
return true;
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return false;
}
}
}
}