Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_Batch_IndexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_Batch_Index set ");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_TrayCount=@Tf_TrayCount,");
            strSql.Append("Tf_CellCount=@Tf_CellCount");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,     4),
                new SqlParameter("@Tf_TrayCount", SqlDbType.Int,     4),
                new SqlParameter("@Tf_CellCount", SqlDbType.Int,     4),
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32)
            };
            parameters[0].Value = model.Tf_Batchtype;
            parameters[1].Value = model.Tf_TrayCount;
            parameters[2].Value = model.Tf_CellCount;
            parameters[3].Value = model.Tf_BatchID;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string Tf_TrayId, int usingState)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TB_Tray_index ");
            strSql.Append(" where Tf_TrayId=@Tf_TrayId and tf_traystat=@tf_traystat ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_TrayId",   SqlDbType.VarChar, 32),
                new SqlParameter("@tf_traystat", SqlDbType.Int)
            };
            parameters[0].Value = Tf_TrayId;
            parameters[1].Value = usingState;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TB_Batch_IndexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_Batch_Index(");
            strSql.Append("Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount)");
            strSql.Append(" values (");
            strSql.Append("@Tf_BatchID,@Tf_Batchtype,@Tf_TrayCount,@Tf_CellCount)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayCount", SqlDbType.Int,      4),
                new SqlParameter("@Tf_CellCount", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_TrayCount;
            parameters[3].Value = model.Tf_CellCount;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string batchID, string Tf_TrayId, string Tf_CellSn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TB_After_GradeData ");
            strSql.Append(" where Tf_BatchID =@Tf_BatchID and Tf_TrayId=@Tf_TrayId and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_TrayId",  SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",  SqlDbType.VarChar, 32)
            };
            parameters[0].Value = batchID;
            parameters[1].Value = Tf_TrayId;
            parameters[2].Value = Tf_CellSn;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_After_GradeDataModel GetModel(string batchID, string Tf_TrayId, string Tf_CellSn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag from TB_After_GradeData ");
            strSql.Append(" where Tf_BatchID =@Tf_BatchID and Tf_TrayId=@Tf_TrayId and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_TrayId",  SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",  SqlDbType.VarChar, 32)
            };
            parameters[0].Value = batchID;
            parameters[1].Value = Tf_TrayId;
            parameters[2].Value = Tf_CellSn;

            //TB_After_GradeDataModel model = new TB_After_GradeDataModel();
            DataSet ds = DbHelperSQL2.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount ");
            strSql.Append(" FROM TB_Batch_Index ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemple #7
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string Tf_BatchID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from TB_Batch_Index");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = Tf_BatchID;

            return(DbHelperSQL2.Exists(strSql.ToString(), parameters));
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag ");
            strSql.Append(" FROM TB_After_GradeData ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by Tf_ChannelNo ");
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemple #9
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string Tf_TrayId, int usingState)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from TB_Tray_index");
            strSql.Append(" where Tf_TrayId=@Tf_TrayId and tf_traystat=@tf_traystat");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_TrayId",   SqlDbType.VarChar, 32),
                new SqlParameter("@tf_traystat", SqlDbType.Int)
            };
            parameters[0].Value = Tf_TrayId;
            parameters[1].Value = usingState;
            return(DbHelperSQL2.Exists(strSql.ToString(), parameters));
        }
Exemple #10
0
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string Tf_BatchIDlist)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TB_Batch_Index ");
            strSql.Append(" where Tf_BatchID in (" + Tf_BatchIDlist + ")  ");
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString());

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string batchID, string Tf_TrayId, string Tf_CellSn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from TB_After_GradeData");
            strSql.Append(" where Tf_BatchID =@Tf_BatchID and Tf_TrayId=@Tf_TrayId and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_TrayId",  SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",  SqlDbType.VarChar, 32)
            };
            parameters[0].Value = batchID;
            parameters[1].Value = Tf_TrayId;
            parameters[2].Value = Tf_CellSn;

            return(DbHelperSQL2.Exists(strSql.ToString(), parameters));
        }
Exemple #12
0
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount ");
            strSql.Append(" FROM TB_Batch_Index ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemple #13
0
        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) FROM TB_Batch_Index ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL2.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_After_GradeDataModel model, string oldTrayID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_After_GradeData set ");
            strSql.Append("Tf_TrayId=@Tf_TrayId,");
            strSql.Append("Tf_BatchID=@Tf_BatchID,");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_ChannelNo=@Tf_ChannelNo,");
            strSql.Append("Tf_CellSn=@Tf_CellSn,");
            strSql.Append("Tf_Pick=@Tf_Pick,");
            strSql.Append("Tf_Tag=@Tf_Tag");
            strSql.Append(" where Tf_TrayId='" + oldTrayID + "' and Tf_CellSn=@Tf_CellSn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_ChannelNo", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayId",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_CellSn",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Pick",      SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Tag",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_ChannelNo;
            parameters[3].Value = model.Tf_TrayId;
            parameters[4].Value = model.Tf_CellSn;
            parameters[5].Value = model.Tf_Pick;
            parameters[6].Value = model.Tf_Tag;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #15
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string Tf_BatchID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from TB_Batch_Index ");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = Tf_BatchID;

            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #16
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.Tf_BatchID desc");
            }
            strSql.Append(")AS Row, T.*  from TB_Batch_Index T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return(DbHelperSQL2.Query(strSql.ToString()));
        }
Exemple #17
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_Tray_indexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_Tray_index set ");
            strSql.Append("Tf_BatchID=@Tf_BatchID,");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_CellCount=@Tf_CellCount,");
            strSql.Append("tf_CheckInTime=@tf_CheckInTime,");
            strSql.Append("tf_traystat=@tf_traystat");
            strSql.Append(" where Tf_TrayId=@Tf_TrayId and tf_traystat=1");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",     SqlDbType.VarChar,   32),
                new SqlParameter("@Tf_Batchtype",   SqlDbType.Int,        4),
                new SqlParameter("@Tf_CellCount",   SqlDbType.Int,        4),
                new SqlParameter("@tf_CheckInTime", SqlDbType.DateTime),
                new SqlParameter("@Tf_TrayId",      SqlDbType.VarChar,   32),
                new SqlParameter("@tf_traystat",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_CellCount;
            parameters[3].Value = model.tf_CheckInTime;
            parameters[4].Value = model.Tf_TrayId;
            parameters[5].Value = model.tf_traystat;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TB_After_GradeDataModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_After_GradeData(");
            strSql.Append("Tf_BatchID,Tf_Batchtype,Tf_TrayId,Tf_ChannelNo,Tf_CellSn,Tf_Pick,Tf_Tag)");
            strSql.Append(" values (");
            strSql.Append("@Tf_BatchID,@Tf_Batchtype,@Tf_TrayId,@Tf_ChannelNo,@Tf_CellSn,@Tf_Pick,@Tf_Tag)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",   SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype", SqlDbType.Int,      4),
                new SqlParameter("@Tf_TrayId",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_ChannelNo", SqlDbType.Int,      4),
                new SqlParameter("@Tf_CellSn",    SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Pick",      SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Tag",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_TrayId;
            parameters[3].Value = model.Tf_ChannelNo;
            parameters[4].Value = model.Tf_CellSn;
            parameters[5].Value = model.Tf_Pick;
            parameters[6].Value = model.Tf_Tag;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #19
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_Batch_IndexModel GetModel(string Tf_BatchID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tf_BatchID,Tf_Batchtype,Tf_TrayCount,Tf_CellCount from TB_Batch_Index ");
            strSql.Append(" where Tf_BatchID=@Tf_BatchID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = Tf_BatchID;

            TB_Batch_IndexModel model = new TB_Batch_IndexModel();
            DataSet             ds    = DbHelperSQL2.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }