예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MesDBAccess.Model.ProcessStepModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProcessStep set ");
            strSql.Append("processSeq=@processSeq,");
            strSql.Append("processStepName=@processStepName,");
            strSql.Append("stepCata=@stepCata,");
            strSql.Append("tag1=@tag1,");
            strSql.Append("tag2=@tag2,");
            strSql.Append("tag3=@tag3,");
            strSql.Append("tag4=@tag4,");
            strSql.Append("tag5=@tag5");
            strSql.Append(" where processStepID=@processStepID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@processSeq",      SqlDbType.Int,       4),
                new SqlParameter("@processStepName", SqlDbType.NVarChar, 50),
                new SqlParameter("@stepCata",        SqlDbType.NVarChar, 50),
                new SqlParameter("@tag1",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag2",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag3",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag4",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag5",            SqlDbType.NVarChar, 50),
                new SqlParameter("@processStepID",   SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.processSeq;
            parameters[1].Value = model.processStepName;
            parameters[2].Value = model.stepCata;
            parameters[3].Value = model.tag1;
            parameters[4].Value = model.tag2;
            parameters[5].Value = model.tag3;
            parameters[6].Value = model.tag4;
            parameters[7].Value = model.tag5;
            parameters[8].Value = model.processStepID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 public bool LoadCfg(XElement root, ref string reStr)
 {
     try
     {
         MesDBAccess.BLL.ProcessStepBll processBll = new MesDBAccess.BLL.ProcessStepBll();
         IEnumerable <XElement>         stepCfgXES = root.Elements("ProcStep");
         if (stepCfgXES == null)
         {
             reStr = "立库流程配置错误,没有配置数据";
             return(false);
         }
         foreach (XElement stepXE in stepCfgXES)
         {
             ProcStep stepCfg = new ProcStep();
             if (!stepCfg.LoadCfg(stepXE, ref reStr))
             {
                 return(false);
             }
             asrsStepCfgDic[stepCfg.StepNO] = stepCfg;
             MesDBAccess.Model.ProcessStepModel processModel = processBll.GetModel(stepCfg.StepNO);
             if (processModel == null)
             {
                 continue;
             }
             float  storeHours = float.Parse(processModel.tag1);
             string strArea    = stepCfg.AsrsArea;
             foreach (string houseName in stepCfg.asrsPortCfgDic.Keys)
             {
                 string strKey = houseName + "-" + strArea;
                 asrsStoreTimeDic[strKey] = storeHours;
             }
         }
         stepList.AddRange(asrsStepCfgDic.Keys.ToArray());
         foreach (int step in stepList)
         {
             areaList.Add(asrsStepCfgDic[step].AsrsArea);
         }
         return(true);
     }
     catch (Exception ex)
     {
         reStr = ex.ToString();
         return(false);
     }
 }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesDBAccess.Model.ProcessStepModel DataRowToModel(DataRow row)
 {
     MesDBAccess.Model.ProcessStepModel model = new MesDBAccess.Model.ProcessStepModel();
     if (row != null)
     {
         if (row["processSeq"] != null && row["processSeq"].ToString() != "")
         {
             model.processSeq = int.Parse(row["processSeq"].ToString());
         }
         if (row["processStepID"] != null)
         {
             model.processStepID = row["processStepID"].ToString();
         }
         if (row["processStepName"] != null)
         {
             model.processStepName = row["processStepName"].ToString();
         }
         if (row["stepCata"] != null)
         {
             model.stepCata = row["stepCata"].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
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MesDBAccess.Model.ProcessStepModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProcessStep(");
            strSql.Append("stepNO,processStepName,stepCata,tag1,tag2,tag3,tag4,tag5)");
            strSql.Append(" values (");
            strSql.Append("@stepNO,@processStepName,@stepCata,@tag1,@tag2,@tag3,@tag4,@tag5)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@stepNO",          SqlDbType.Int,       4),

                new SqlParameter("@processStepName", SqlDbType.NVarChar, 50),
                new SqlParameter("@stepCata",        SqlDbType.NVarChar, 50),
                new SqlParameter("@tag1",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag2",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag3",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag4",            SqlDbType.NVarChar, 50),
                new SqlParameter("@tag5",            SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.stepNO;

            parameters[2].Value = model.processStepName;
            parameters[3].Value = model.stepCata;
            parameters[4].Value = model.tag1;
            parameters[5].Value = model.tag2;
            parameters[6].Value = model.tag3;
            parameters[7].Value = model.tag4;
            parameters[8].Value = model.tag5;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesDBAccess.Model.ProcessStepModel GetModel(int stepNO)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 stepNO,processStepName,stepCata,tag1,tag2,tag3,tag4,tag5 from ProcessStep ");
            strSql.Append(" where stepNO=@stepNO ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@stepNO", SqlDbType.Int, 4)
            };
            parameters[0].Value = stepNO;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesDBAccess.Model.ProcessStepModel GetModel(string processStepID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 processSeq,processStepID,processStepName,stepCata,tag1,tag2,tag3,tag4,tag5 from ProcessStep ");
            strSql.Append(" where processStepID=@processStepID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@processStepID", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = processStepID;

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

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