コード例 #1
0
        /// <summary>
        /// 增加工位生产记录
        /// </summary>
        public virtual void AddProduceRecord(string containerID, string comment)
        {
            //throw new NotImplementedException();
            string strSql = string.Format(@"palletID='{0}' and palletBinded=1 ", containerID);
            List <MesDBAccess.Model.ProductOnlineModel> products = productOnlineBll.GetModelList(strSql);

            //string nextStepID = GetNextStepID(containerID);
            MesDBAccess.Model.ProduceRecordModel record = new MesDBAccess.Model.ProduceRecordModel();
            record.recordID    = System.Guid.NewGuid().ToString("N");
            record.productID   = containerID;
            record.recordTime  = System.DateTime.Now;
            record.productCata = "料框";
            record.stationID   = nodeID;
            record.tag1        = comment;
            productRecordBll.Add(record);
            if (products != null && products.Count() > 0)
            {
                foreach (MesDBAccess.Model.ProductOnlineModel product in products)
                {
                    record             = new MesDBAccess.Model.ProduceRecordModel();
                    record.recordID    = System.Guid.NewGuid().ToString("N");
                    record.productID   = product.productID;
                    record.productCata = product.productCata;
                    record.recordTime  = System.DateTime.Now;
                    record.stationID   = nodeID;
                    record.checkResult = product.checkResult;
                    record.tag1        = comment;
                    record.tag2        = product.palletID;
                    productRecordBll.Add(record);
                }
            }
        }
コード例 #2
0
ファイル: ProduceRecordDal.cs プロジェクト: xdpcxq/MingMeiMES
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MesDBAccess.Model.ProduceRecordModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProduceRecord set ");
            strSql.Append("productID=@productID,");
            strSql.Append("productCata=@productCata,");
            strSql.Append("stationID=@stationID,");
            strSql.Append("recordCata=@recordCata,");
            strSql.Append("recordTime=@recordTime,");
            strSql.Append("checkResult=@checkResult,");
            strSql.Append("tag1=@tag1,");
            strSql.Append("tag2=@tag2,");
            strSql.Append("tag3=@tag3,");
            strSql.Append("tag4=@tag4,");
            strSql.Append("tag5=@tag5");
            strSql.Append(" where recordID=@recordID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@productID",   SqlDbType.NVarChar,    50),
                new SqlParameter("@productCata", SqlDbType.NVarChar,    50),
                new SqlParameter("@stationID",   SqlDbType.NVarChar,    50),
                new SqlParameter("@recordCata",  SqlDbType.NVarChar,    50),
                new SqlParameter("@recordTime",  SqlDbType.DateTime),
                new SqlParameter("@checkResult", SqlDbType.NVarChar,    50),
                new SqlParameter("@tag1",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag2",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag3",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag4",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag5",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@recordID",    SqlDbType.NVarChar, 255)
            };
            parameters[0].Value  = model.productID;
            parameters[1].Value  = model.productCata;
            parameters[2].Value  = model.stationID;
            parameters[3].Value  = model.recordCata;
            parameters[4].Value  = model.recordTime;
            parameters[5].Value  = model.checkResult;
            parameters[6].Value  = model.tag1;
            parameters[7].Value  = model.tag2;
            parameters[8].Value  = model.tag3;
            parameters[9].Value  = model.tag4;
            parameters[10].Value = model.tag5;
            parameters[11].Value = model.recordID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: ProduceRecordDal.cs プロジェクト: xdpcxq/MingMeiMES
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesDBAccess.Model.ProduceRecordModel DataRowToModel(DataRow row)
 {
     MesDBAccess.Model.ProduceRecordModel model = new MesDBAccess.Model.ProduceRecordModel();
     if (row != null)
     {
         if (row["recordID"] != null)
         {
             model.recordID = row["recordID"].ToString();
         }
         if (row["productID"] != null)
         {
             model.productID = row["productID"].ToString();
         }
         if (row["productCata"] != null)
         {
             model.productCata = row["productCata"].ToString();
         }
         if (row["stationID"] != null)
         {
             model.stationID = row["stationID"].ToString();
         }
         if (row["recordCata"] != null)
         {
             model.recordCata = row["recordCata"].ToString();
         }
         if (row["recordTime"] != null && row["recordTime"].ToString() != "")
         {
             model.recordTime = DateTime.Parse(row["recordTime"].ToString());
         }
         if (row["checkResult"] != null)
         {
             model.checkResult = row["checkResult"].ToString();
         }
         if (row["tag1"] != null)
         {
             model.tag1 = row["tag1"].ToString();
         }
         if (row["tag2"] != null)
         {
             model.tag2 = row["tag2"].ToString();
         }
         if (row["tag3"] != null)
         {
             model.tag3 = row["tag3"].ToString();
         }
         if (row["tag4"] != null)
         {
             model.tag4 = row["tag4"].ToString();
         }
         if (row["tag5"] != null)
         {
             model.tag5 = row["tag5"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
ファイル: ProduceRecordDal.cs プロジェクト: xdpcxq/MingMeiMES
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MesDBAccess.Model.ProduceRecordModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProduceRecord(");
            strSql.Append("recordID,productID,productCata,stationID,recordCata,recordTime,checkResult,tag1,tag2,tag3,tag4,tag5)");
            strSql.Append(" values (");
            strSql.Append("@recordID,@productID,@productCata,@stationID,@recordCata,@recordTime,@checkResult,@tag1,@tag2,@tag3,@tag4,@tag5)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@recordID",    SqlDbType.NVarChar,   255),
                new SqlParameter("@productID",   SqlDbType.NVarChar,    50),
                new SqlParameter("@productCata", SqlDbType.NVarChar,    50),
                new SqlParameter("@stationID",   SqlDbType.NVarChar,    50),
                new SqlParameter("@recordCata",  SqlDbType.NVarChar,    50),
                new SqlParameter("@recordTime",  SqlDbType.DateTime),
                new SqlParameter("@checkResult", SqlDbType.NVarChar,    50),
                new SqlParameter("@tag1",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag2",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag3",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag4",        SqlDbType.NVarChar,  1024),
                new SqlParameter("@tag5",        SqlDbType.NVarChar, 1024)
            };
            parameters[0].Value  = model.recordID;
            parameters[1].Value  = model.productID;
            parameters[2].Value  = model.productCata;
            parameters[3].Value  = model.stationID;
            parameters[4].Value  = model.recordCata;
            parameters[5].Value  = model.recordTime;
            parameters[6].Value  = model.checkResult;
            parameters[7].Value  = model.tag1;
            parameters[8].Value  = model.tag2;
            parameters[9].Value  = model.tag3;
            parameters[10].Value = model.tag4;
            parameters[11].Value = model.tag5;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: ProduceRecordDal.cs プロジェクト: xdpcxq/MingMeiMES
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesDBAccess.Model.ProduceRecordModel GetModel(string recordID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 recordID,productID,productCata,stationID,recordCata,recordTime,checkResult,tag1,tag2,tag3,tag4,tag5 from ProduceRecord ");
            strSql.Append(" where recordID=@recordID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@recordID", SqlDbType.NVarChar, 255)
            };
            parameters[0].Value = recordID;

            MesDBAccess.Model.ProduceRecordModel model = new MesDBAccess.Model.ProduceRecordModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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