예제 #1
0
        /// <summary>
        /// 插入文本文本内容
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private int InsertNoticeInfo(string info)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                //DateTime theDate = DateTime.Now;
                //theDate.ToString("yyyy-MM-dd HH:mm:ss");

                strSql = "insert into  notice (tid,content,update_time) values(1,'{0}','{1}')";

                strSql = string.Format(strSql, info, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #2
0
        /// <summary>
        /// 插入单项产品计划
        /// </summary>
        /// <param name="mdl"></param>
        /// <returns></returns>
        public int InsertAcqCountItem(AcqCountMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "insert into  acq_count_list (tagName,StartTime,EndTime,CurrentCount,Remark)" +
                         "values('{0}','{1}','{2}','{3}','{4}')";
                //2015-05-11 08:30:00
                string startTime = String.Format("{0:yyyy-MM-dd HH:mm:ss}", mdl.StartTime);  //4-10-2010 17:16:50\
                string endTime   = String.Format("{0:yyyy-MM-dd HH:mm:ss}", mdl.EndTime);
                strSql = string.Format(strSql, mdl.TagName, startTime, endTime, mdl.CurrentCount, mdl.Remark);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #3
0
        /// <summary>
        /// 插入产品信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int InsertProduction(ProductionMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                ///DateTime theDate = DateTime.Now;
                // theDate.ToString("yyyy-MM-dd HH:mm:ss");
                string dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                strSql = "insert into  production (lineid,brakename,brakeid,brakecode,createtime,factory,remark)" +
                         "values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')";

                // strSql = string.Format(strSql, mdl.LineNum, mdl.ProductName, mdl.ProductID, mdl.ProductCode, dateTime, mdl.Factory, mdl.Remark);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #4
0
        /// <summary>
        /// 插入单项产品计划
        /// </summary>
        /// <param name="mdl"></param>
        /// <returns></returns>
        public int InsertProductionPlanItem(ProductionPlanMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "insert into  production_plan (plan_id,pline_id,station_id,start_time,end_time,brakeid,plan_num,actual_num,shift,create_time,remark)" +
                         "values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')";

                strSql = string.Format(strSql, mdl.PlanID, mdl.Pline_ID, mdl.Station_ID, mdl.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                       mdl.EndTime.ToString("yyyy-MM-dd HH:mm:ss"), mdl.BreakeID, mdl.PlanNum, mdl.Actual_num, mdl.Shift, mdl.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), mdl.Remark);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);


                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #5
0
        /// <summary>
        /// 获取产品名称
        /// </summary>
        /// <returns></returns>
        public ArrayList GetProductionNames()
        {
            try
            {
                ArrayList list = new ArrayList();

                DataSet dataSet = null;

                string strSql = "select * from production order by createtime asc";

                // dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);

                foreach (DataRow dr in dataSet.Tables[0].Rows)
                {
                    list.Add(Convert.ToString(dr["brakename"]));
                }

                if (list.Count <= 0)
                {
                    return(null);
                }

                return(list);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #6
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);
                nvalue = SQLiteDBHelper.ExecuteScalar(strSql);

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

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

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(string.Empty);
            }
        }
예제 #7
0
        public int UpdateActualPlan(string tid, int actualNum)
        {
            try
            {
                int ret = 0;

                string strSql = "update production_plan set actual_num='{0}' where tid='{1}'";

                strSql = string.Format(strSql, actualNum, tid);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);

                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);



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

            return(0);
        }
예제 #8
0
        /// <summary>
        /// 获取产品计划通过产品ID和时间
        /// </summary>
        /// <param name="planid"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public DataTable GetProductionPalnByDateTime(string planid, DateTime startTime, DateTime endTime)
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select * from production_plan where plan_id='{0}' and create_time between '{1}' and '{2}'  order by start_time desc";

                strSql = string.Format(strSql, planid);

                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #9
0
        /// <summary>
        /// 通过计划ID获取产线计划
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public DataTable GetProductionPalnByPlanID2(string planid)
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select * from production_plan where planid='{0}' ";

                strSql = string.Format(strSql, planid);


                //dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);
                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);
                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #10
0
        /// <summary>
        /// 获取产品计划通过序号ID
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public ProductionPlanMDL GetProductionPalnByID(int tid)
        {
            try
            {
                ProductionPlanMDL mdl = new ProductionPlanMDL();


                DataSet dataSet = null;

                string strSql = "select * from production_plan where tid='{0}' ";

                strSql = string.Format(strSql, tid);


                //dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);
                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);



                if (dataSet != null)
                {
                    DataRow row = dataSet.Tables[0].Rows[0];

                    mdl.Prase(row);

                    return(mdl);
                }
                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #11
0
        /// <summary>
        ///获取生产线信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetProductionInfos()
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select * from production order by createtime asc";

                //dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #12
0
        /// <summary>
        /// 获取采集记录列表的当前采集时间
        /// </summary>
        /// <returns></returns>
        public DateTime GetCurrentTime()
        {
            try
            {
                DateTime curTime;

                object ret = null;

                string strSql = "select StartTime from acq_count_list where tagName=0";

                //ret = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteScalar(strSql);
                DateTime.TryParse(ret.ToString(), out curTime);
                if (curTime != null)
                {
                    return(curTime);
                }
                else
                {
                    return(DateTime.Now);
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);

                return(DateTime.Now);
            }
        }
예제 #13
0
        /// <summary>
        /// 获取一个范围内的数量总和
        /// </summary>
        /// <returns></returns>
        public int GetRangeItemCount(string tagName)
        {
            try
            {
                object ret = null;

                string strSql = "select StartCount from acq_count_list where tagName=" + tagName;

                //ret = MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteScalar(strSql);
                if (ret != null)
                {
                    int itemCount = -1;

                    Int32.TryParse(ret.ToString(), out itemCount);


                    if (itemCount < 0)
                    {
                        itemCount = 0;
                    }

                    return(itemCount);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #14
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);
                obj = SQLiteDBHelper.ExecuteScalar(strSql);
                if (obj != null)
                {
                    ret = Convert.ToString(obj);
                }

                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(string.Empty);
            }
        }
예제 #15
0
        /// <summary>
        /// 更新产品计划信息
        /// </summary>
        /// <param name="info"></param>
        public int UpdateAcqCountItem(AcqCountMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                string startTime = String.Format("{0:yyyy-MM-dd HH:mm:ss}", mdl.StartTime);  //4-10-2010 17:16:50\
                string endTime   = String.Format("{0:yyyy-MM-dd HH:mm:ss}", mdl.EndTime);

                //(plan_id,pline_id,station_id,start_time,end_time,brakeid,plan_num,actual_num,shift,create_time,remark)
                strSql = "update acq_count_list set tagName='{0}',StartTime='{1}',EndTime='{2}',CurrentCount='{3}',Remark='{4}' "
                         + " where tid='{5}'";
                strSql = string.Format(strSql, mdl.TagName, startTime, endTime, mdl.StartTime,
                                       mdl.CurrentCount, mdl.Remark);

                // ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #16
0
        /// <summary>
        /// 获取产品计划通过计划ID
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public DataTable GetAcqCountUnits()
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select CurrentCount from acq_count_list ";

                // strSql = string.Format(strSql, tid);


                //dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);
                dataSet = SQLiteDBHelper.ExecuteDataset(strSql);
                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
예제 #17
0
        public int RemoveAllAcqCountItem()
        {
            try
            {
                int ret = 0;

                string strSql = "delete from acq_count_list;";

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #18
0
        /// <summary>
        /// 获取产品个数
        /// </summary>
        /// <returns></returns>
        public int GetRowCount()
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "select count(tid) from acq_count_list;";
                //ret = Convert.ToInt32(MySqlDBHelper.ExecuteScalar(MySqlDBHelper.Conn, CommandType.Text, strSql, null));
                ret = Convert.ToInt32(SQLiteDBHelper.ExecuteScalar(strSql));
                //return Convert.ToInt32(MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null));
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #19
0
        /// <summary>
        /// 删除产品
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteProduction(int id)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "delete from production where tid=" + id.ToString();

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);

                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #20
0
        /// <summary>
        /// 更新插入单项的起始采集总数
        /// </summary>
        /// <param name="mdl"></param>
        /// <returns></returns>
        public int UpdateItemStartCountValue(int startCount, string tagName)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                strSql = "update acq_count_list set StartCount='{0}' "
                         + " where tagName='{1}'";
                strSql = string.Format(strSql, startCount, tagName);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #21
0
        public int UpdateAcqCountValue(AcqCountMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                //(plan_id,pline_id,station_id,start_time,end_time,brakeid,plan_num,actual_num,shift,create_time,remark)
                strSql = "update acq_count_list set CurrentCount='{0}' "
                         + " where tagName='{1}'";
                strSql = string.Format(strSql, mdl.CurrentCount, mdl.TagName);

                //ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql, null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }
예제 #22
0
        /// <summary>
        /// 更新产品信息
        /// </summary>
        /// <param name="info"></param>
        public int UpdateProduction(ProductionMDL mdl)
        {
            int ret = 0;

            string strSql = string.Empty;

            try
            {
                //DateTime theDate = DateTime.Now;
                //theDate.ToString("yyyy-MM-dd HH:mm:ss");
                string dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                strSql = "update production set lineid='{0}',brakename='{1}',brakeid='{2}',brakecode='{3}',factory='{4}',remark='{5}' where tid='{6}'";
                //   strSql = string.Format(strSql, mdl.LineNum, mdl.ProductName, mdl.ProductID, mdl.ProductCode, mdl.Factory, mdl.Remark, mdl.TID);

                //  ret = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, strSql,null);
                ret = SQLiteDBHelper.ExecuteNonQuery(strSql);
                return(ret);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(0);
            }
        }