Exemple #1
0
        /// <summary>
        ///
        /// 获取广报版信息
        /// </summary>
        /// <returns></returns>
        public string GetNoticeInfo()
        {
            string ret = string.Empty;

            object obj = null;


            try
            {
                string strSql = "select content from notice order by update_time";

                obj = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (obj != null)
                {
                    ret = Convert.ToString(obj);
                }

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(string.Empty);
            }
        }
Exemple #2
0
        public string GetTIDByDataTime(string planid, DateTime startTime, DateTime endTime)
        {
            try
            {
                object nvalue = null;

                string ret = string.Empty;

                string strSql = "select tid from production_plan where plan_id='{0}' and start_time = '{1}' and end_time ='{2}'";
                string sDate  = String.Format("{0:yyyy-MM-dd HH:mm:ss}", startTime); //4-10-2010 17:16:50\
                string eDate  = String.Format("{0:yyyy-MM-dd HH:mm:ss}", endTime);
                strSql = string.Format(strSql, planid, sDate, eDate);


                nvalue = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (nvalue == null)
                {
                    return(string.Empty);
                }

                ret = Convert.ToInt32(nvalue).ToString();

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(string.Empty);
            }
        }
Exemple #3
0
        public bool UpdateProductNameByKeyCode(string keyFieldName, string barCode, string productType)
        {
            object obj2   = null;
            string format = string.Empty;
            string str2   = string.Empty;
            bool   flag   = false;

            try
            {
                format = "select productname from process_parameter where productid='{0}' limit 1";
                format = string.Format(format, productType);
                obj2   = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if (obj2 != null)
                {
                    str2 = obj2.ToString();
                }
                format = "update result_line2 set productname='{0}' where {1}='{2}'";
                format = string.Format(format, str2, keyFieldName, barCode);
                if (MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, format, null) > 0)
                {
                    flag = true;
                }
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                flag = false;
            }
            return(flag);
        }
Exemple #4
0
        public bool Exist(string keyName, string keyValue)
        {
            string format = string.Empty;

            try
            {
                format = "select count({0}) from result_line2 where {0}='{1}'";
                format = string.Format(format, keyName, keyValue);
                return(Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, format, null)) > 0);
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                return(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// 判断文档是否存在
        /// </summary>
        /// <returns></returns>
        public int ContentIsExsit()
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(tid) from notice;";
                ret    = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));
                //return Convert.ToInt32(MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null));
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
Exemple #6
0
        /// <summary>
        /// 计划是否存在
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public int PlanExists(string planid)
        {
            int ret = 0;

            try
            {
                string strSql = "SELECT COUNT(*) FROM tlb_product_plan WHERE PLANID='{0}'";

                strSql = string.Format(strSql, planid);

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #7
0
        /// <summary>
        /// 获取产品个数
        /// </summary>
        /// <returns></returns>
        public int GeProductCount()
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(PN) from tlb_product;";

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
Exemple #8
0
 public string GetFieldValueByKeyCode(string fieldName, string keyName, string keyValue)
 {
     try
     {
         object obj2   = null;
         string format = string.Empty;
         format = "select {0} from result_line2 where {1}='{2}' order by tid desc limit 1";
         format = string.Format(format, fieldName, keyName, keyValue);
         obj2   = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, format, null);
         if (obj2 != null)
         {
             return(obj2.ToString());
         }
         return("");
     }
     catch (Exception exception)
     {
         CLog.WriteErrLogInTrace(exception.Message);
         return("");
     }
 }
Exemple #9
0
 public string GetCaliperByBrakeCode(string brakeCode)
 {
     try
     {
         object obj2   = null;
         string format = string.Empty;
         format = "select calipercode from result_line2 where length(calipercode)>0 and calipercode is not null and brakecode='{0}' order by updatetime desc limit 1";
         format = string.Format(format, brakeCode);
         obj2   = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, format, null);
         if (obj2 != null)
         {
             return(obj2.ToString());
         }
         return("");
     }
     catch (Exception exception)
     {
         CLog.WriteErrLogInTrace(exception.Message);
         return("");
     }
 }
Exemple #10
0
        /// <summary>
        /// 获取产线数量
        /// </summary>
        /// <param name="linekey"></param>
        /// <returns></returns>
        public int GetProductCount(string linekey)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(*) from tlb_product where PLID='{0}';";

                strSql = string.Format(strSql, linekey);

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #11
0
        public string GetPNCodeByLineEMS(string lineID, int ems)
        {
            string ret = string.Empty;

            string strSql = string.Empty;

            try
            {
                strSql = "select PN from tlb_product where PLID='{0}' and EMS={1}";

                strSql = string.Format(strSql, lineID, ems);

                ret = Convert.ToString(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #12
0
        /// <summary>
        /// 获取产品编码
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public string GetPNbyEMSCode(string code)
        {
            string ret = string.Empty;

            string strSql = string.Empty;

            try
            {
                strSql = "select PN from tlb_product where NAME='{0}'";

                strSql = string.Format(strSql, code);

                ret = Convert.ToString(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #13
0
        /// <summary>
        /// 是否是唯一的采集单元
        /// </summary>
        /// <param name="unitID"></param>
        /// <returns></returns>
        public int IsUionCOUint(string unitID, string plineid)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(*) from tlb_line_change where UNITID='{0}' and PLID='{1}'";

                strSql = string.Format(strSql, unitID, plineid);

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #14
0
        public int ProductIsExist(string lineID, string ems)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(*) from tlb_product where PLID='{0}' and EMS='{1}'";

                strSql = string.Format(strSql, lineID, ems);

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
Exemple #15
0
        /// <summary>
        /// 当前产品是否存在
        /// </summary>
        /// <param name="strKey"></param>
        /// <returns></returns>
        public int IsExist(string strKey)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select * from tlb_product where PN={0}";

                strSql = string.Format(strSql, strKey);

                ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }