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

            strSql.Append("update AsrsPortBuffer set ");
            strSql.Append("houseName=@houseName,");
            strSql.Append("palletBuffers=@palletBuffers,");
            strSql.Append("tag1=@tag1,");
            strSql.Append("tag2=@tag2,");
            strSql.Append("tag3=@tag3,");
            strSql.Append("tag4=@tag4,");
            strSql.Append("tag5=@tag5");
            strSql.Append(" where nodeID=@nodeID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@houseName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@palletBuffers", SqlDbType.VarChar,   -1),
                new SqlParameter("@tag1",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag2",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag3",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag4",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag5",          SqlDbType.NVarChar, 250),
                new SqlParameter("@nodeID",        SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.houseName;
            parameters[1].Value = model.palletBuffers;
            parameters[2].Value = model.tag1;
            parameters[3].Value = model.tag2;
            parameters[4].Value = model.tag3;
            parameters[5].Value = model.tag4;
            parameters[6].Value = model.tag5;
            parameters[7].Value = model.nodeID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 public bool ClearBufPallets(ref string reStr)
 {
     try
     {
         this.palletBuffer.Clear();
         MesDBAccess.BLL.AsrsPortBufferBll     bufBll = new MesDBAccess.BLL.AsrsPortBufferBll();
         MesDBAccess.Model.AsrsPortBufferModel buf    = bufBll.GetModel(this.nodeID);
         if (buf != null)
         {
             buf.palletBuffers = "";
             bufBll.Update(buf);
         }
         return(true);
     }
     catch (Exception ex)
     {
         reStr = ex.ToString();
         return(false);
     }
 }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesDBAccess.Model.AsrsPortBufferModel DataRowToModel(DataRow row)
 {
     MesDBAccess.Model.AsrsPortBufferModel model = new MesDBAccess.Model.AsrsPortBufferModel();
     if (row != null)
     {
         if (row["nodeID"] != null)
         {
             model.nodeID = row["nodeID"].ToString();
         }
         if (row["houseName"] != null)
         {
             model.houseName = row["houseName"].ToString();
         }
         if (row["palletBuffers"] != null)
         {
             model.palletBuffers = row["palletBuffers"].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
 public override bool DevStatusRestore()
 {
     MesDBAccess.BLL.AsrsPortBufferBll     bufBll = new MesDBAccess.BLL.AsrsPortBufferBll();
     MesDBAccess.Model.AsrsPortBufferModel buf    = bufBll.GetModel(this.nodeID);
     this.palletBuffer = new List <string>();
     if (buf != null)
     {
         if (!string.IsNullOrWhiteSpace(buf.palletBuffers))
         {
             string[] strArray = buf.palletBuffers.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
             if (strArray != null && strArray.Count() > 0)
             {
                 this.palletBuffer.AddRange(strArray);
             }
         }
     }
     if (!base.DevStatusRestore())
     {
         return(false);
     }
     return(true);
 }
예제 #5
0
 public void PushPalletID(string palletID)
 {
     lock (portBufLock)
     {
         if (this.palletBuffer.Contains(palletID))
         {
             return;
         }
         if (this.palletBuffer.Count() >= PortinBufCapacity)
         {
             this.palletBuffer.RemoveAt(0);
         }
         this.palletBuffer.Add(palletID);
         string strPallets = "";
         for (int i = 0; i < this.palletBuffer.Count(); i++)
         {
             strPallets += this.palletBuffer[i];
             if (palletBuffer.Count() > 1 && i < this.palletBuffer.Count() - 1)
             {
                 strPallets += ",";
             }
         }
         MesDBAccess.BLL.AsrsPortBufferBll     bufBll = new MesDBAccess.BLL.AsrsPortBufferBll();
         MesDBAccess.Model.AsrsPortBufferModel buf    = bufBll.GetModel(this.nodeID);
         if (buf == null)
         {
             buf               = new MesDBAccess.Model.AsrsPortBufferModel();
             buf.houseName     = this.AsrsCtl.HouseName;
             buf.nodeID        = this.nodeID;
             buf.palletBuffers = strPallets;
             bufBll.Add(buf);
         }
         else
         {
             buf.palletBuffers = strPallets;
             bufBll.Update(buf);
         }
     }
 }
예제 #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MesDBAccess.Model.AsrsPortBufferModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AsrsPortBuffer(");
            strSql.Append("nodeID,houseName,palletBuffers,tag1,tag2,tag3,tag4,tag5)");
            strSql.Append(" values (");
            strSql.Append("@nodeID,@houseName,@palletBuffers,@tag1,@tag2,@tag3,@tag4,@tag5)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@nodeID",        SqlDbType.NVarChar,  50),
                new SqlParameter("@houseName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@palletBuffers", SqlDbType.VarChar,   -1),
                new SqlParameter("@tag1",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag2",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag3",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag4",          SqlDbType.NVarChar, 250),
                new SqlParameter("@tag5",          SqlDbType.NVarChar, 250)
            };
            parameters[0].Value = model.nodeID;
            parameters[1].Value = model.houseName;
            parameters[2].Value = model.palletBuffers;
            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;

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

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

            strSql.Append("select  top 1 nodeID,houseName,palletBuffers,tag1,tag2,tag3,tag4,tag5 from AsrsPortBuffer ");
            strSql.Append(" where nodeID=@nodeID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@nodeID", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = nodeID;

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

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