//查询单笔数据,通过名称
        public line_info SelectSingleByName(string line_name)
        {
            string sql = "SELECT  *FROM fimp.line_info where line_name_en='{0}'";

            sql = string.Format(sql, line_name);
            return(PostgreHelper.GetSingleEntity <line_info>(sql));
        }
        /// <summary>
        /// 获取指定配置
        /// </summary>
        /// <param name="system_tag_code">系统标签类型</param>
        /// <param name="unit_no">制程</param>
        /// <param name="line_id">线别,=-1则不启用</param>
        /// <returns>配置列表</returns>
        public error_config GetErrorConfigByCode(string system_tag_code, String unit_no, int line_id = -1)
        {
            error_config obj     = new error_config();
            string       command = string.Empty;

            if (system_tag_code != null && line_id >= 0 && unit_no != null && unit_no.Length > 0)
            {
                command = string.Format("Select * from andon.error_config where system_tag_code='{0}' and unit_no='{1}' and line_id='{2}'", system_tag_code, unit_no, line_id);
                obj     = PostgreHelper.GetSingleEntity <error_config>(command);
                if (obj == null)//查找不到,再向上一级查找
                {
                    command = string.Format("Select * from andon.error_config where system_tag_code='{0}' and unit_no='{1}'", system_tag_code, unit_no);
                }
            }
            else if (system_tag_code != null && unit_no != null && unit_no.Length > 0)
            {
                command = string.Format("Select * from andon.error_config where system_tag_code='{0}' and unit_no='{1}'", system_tag_code, unit_no);
            }

            if (command != string.Empty)
            {
                obj = PostgreHelper.GetSingleEntity <error_config>(command);

                return(obj);
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询时间是否在休息时间列表中
        /// </summary>
        /// <param name="time">时间</param>
        /// <returns></returns>
        public bool SelectCount(string time, string unit_no)
        {
            try
            {
                bool   result = false;
                string sql    = "select * from fimp.rest_time where start_time<='{0}' and end_time>='{1}' and unit_no='{2}' and state='A'";
                sql = string.Format(sql, time, time, unit_no);
                rest_time obj = PostgreHelper.GetSingleEntity <rest_time>(sql);

                if (obj != null)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public rest_time_row IsUpdate(string machine_code, string start_time, string end_time)
        {
            try
            {
                rest_time_row obj = new rest_time_row();
                string        sql = "select * from fimp.rest_time_row where machine_code='{0}' and start_time<='{1}' and end_time>='{2}'";
                sql = string.Format(sql, machine_code, start_time, start_time);
                obj = PostgreHelper.GetSingleEntity <rest_time_row>(sql);

                if (obj != null)
                {
                }
                else
                {
                    sql = "select * from fimp.rest_time_row where machine_code='{0}' and start_time<='{1}' and end_time>='{2}'";
                    sql = string.Format(sql, machine_code, end_time, end_time);
                    obj = PostgreHelper.GetSingleEntity <rest_time_row>(sql);
                }

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public error_config_person SelectSingle(string class_no, int id)
        {
            try
            {
                error_config_person obj = new error_config_person();
                string sql = null;
                if (!string.IsNullOrEmpty(class_no))
                {
                    sql = "select * from andon.error_config_person where class_no='{0}' order by class_no";
                    sql = string.Format(sql, class_no);
                }
                else
                {
                    sql = "select * from andon.error_config_person where id={0} order by class_no";
                    sql = string.Format(sql, id);
                }
                obj = PostgreHelper.GetSingleEntity <error_config_person>(sql);

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 获取最后一笔数据
        /// </summary>
        /// <param name="machine_code">设备编号</param>
        /// <param name="end_time">结束时间</param>
        /// <returns></returns>
        public CT SelectSingle(string machine_code, string date_time)
        {
            try
            {
                CT     obj  = new CT();
                string comm = null;
                if (string.IsNullOrEmpty(date_time))
                {
                    comm = "select  id,machine_code,station_id,pn,wo,start_time,end_time,value,tag_code from fimp.ct where machine_code='{0}' order by end_time desc limit 1";
                    comm = string.Format(comm, machine_code);
                }
                else
                {
                    string end_time = Convert.ToDateTime(date_time).ToString("yyyy-MM-dd HH:mm:ss.999");
                    comm = "select  id,machine_code,station_id,pn,wo,start_time,end_time,value,tag_code from fimp.ct where machine_code='{0}' and end_time>'{1}' order by end_time desc limit 1";
                    comm = string.Format(comm, machine_code, end_time);
                }
                obj = PostgreHelper.GetSingleEntity <CT>(comm);

                return(obj);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
        /// <summary>
        /// 根据id查询人员
        /// </summary>
        /// <param name="Id">人员id</param>
        /// <returns></returns>
        public person GetPersonById(int Id)
        {
            string command = string.Format("Select * from fimp.Person where id='{0}'", Id);

            person Person = PostgreHelper.GetSingleEntity <person>(command);

            return(Person);
        }
        /// <summary>
        /// 根据id查询人员
        /// </summary>
        /// <param name="card_num">员工卡号</param>
        /// <returns></returns>
        public person GetPersonByCardId(string card_num)
        {
            string command = string.Format("Select * from fimp.Person where card_num='{0}'", card_num);

            person Person = PostgreHelper.GetSingleEntity <person>(command);

            return(Person);
        }
Ejemplo n.º 9
0
        public Attendance SelectById(int id)
        {
            Attendance attItem = new Attendance();
            string     command = string.Format("Select * from fimp.attendance where id= {0}", id);

            attItem = PostgreHelper.GetSingleEntity <Attendance>(command);
            return(attItem);
        }
        /// <summary>
        /// 根据id获取单个对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public error_config GetErrorConfigById(int id)
        {
            string command = string.Empty;

            command = string.Format("Select * from andon.error_config where id='{0}'", id);

            return(PostgreHelper.GetSingleEntity <error_config>(command));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 根据code获取单个对象
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public srp_inner_log GetInnerLogByCode(string code)
        {
            string command = string.Empty;

            command = string.Format("Select * from fimp.srp_inner_log where srp_code='{0}'", code);

            return(PostgreHelper.GetSingleEntity <srp_inner_log>(command));
        }
        public SystemConfigs Get(string config_code)
        {
            SystemConfigs obj = new SystemConfigs();
            string        sql = " select * from {0} where config_code='{1}' ";

            sql = string.Format(sql, SystemConfigs.TableName, config_code);
            obj = PostgreHelper.GetSingleEntity <SystemConfigs>(sql);
            return(obj);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 加载指定的异常记录
        /// </summary>
        /// <param name="MachineCode">设备编码</param>
        /// <returns></returns>
        public error_log GetErrorLogById(int id)
        {
            error_log logItem = new error_log();
            string    command = string.Format("Select * from andon.error_log where id='{0}'", id);

            logItem = PostgreHelper.GetSingleEntity <error_log>(command);

            return(logItem);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 加载指定的异常记录
        /// </summary>
        /// <param name="StationId">站位id</param>
        /// <returns></returns>
        public error_log GetUnAckLogByDeviceId(int device_id, string system_tag_code)
        {
            error_log obj = new error_log();
            string    command;

            command = "Select * from andon.error_log where station_id='{0}' and system_tag_code='{1}' and (release_time<='{2}' OR release_time is NULL) limit 1";
            command = string.Format(command, device_id, system_tag_code, "2001-01-01 00:00:00");

            obj = PostgreHelper.GetSingleEntity <error_log>(command);

            return(obj);
        }
 public CT_Log SelectNewsLog(string machine_code, string ts)
 {
     try
     {
         string comm  = "select * from fimp.ct_log where machine_code='{0}' order by insert_time desc limit 1";
         CT_Log ctlog = PostgreHelper.GetSingleEntity <CT_Log>(comm);
         return(ctlog);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //查询单笔数据,通过厂区id
 public plant_info SelectSingle(int id)
 {
     try
     {
         plant_info obj = new plant_info();
         string     sql = "SELECT * FROM fimp.plant_info where plant_id='{0}' order by city_id,plant_id";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <plant_info>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 根据ID查询,查询结果为一笔数据
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Company SelectSingleByName(string company_name, int company_type)
 {
     try
     {
         Company obj = new Company();
         string  sql = "select * from jinchen.company_info where company_name='{0}' and company_type={1} ";
         sql = string.Format(sql, company_name, company_type);
         obj = PostgreHelper.GetSingleEntity <Company>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 根据ID查询,查询结果为一笔数据
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Company SelectSingle(int id)
 {
     try
     {
         Company obj = new Company();
         string  sql = "select * from jinchen.company_info where id={0}";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <Company>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public area_info SelectSingleID(int area_id)
 {
     try
     {
         area_info obj = new area_info();
         string    sql = "select * from fimp.area_info where area_id={0}";
         sql = string.Format(sql, area_id);
         obj = PostgreHelper.GetSingleEntity <area_info>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 20
0
 public material_category SelectSingleID(int area_id)
 {
     try
     {
         material_category obj = new material_category();
         string            sql = "select * from fimp.material_category where id={0}";
         sql = string.Format(sql, area_id);
         obj = PostgreHelper.GetSingleEntity <material_category>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 查询单笔数
 /// </summary>
 /// <param name="id">用户id</param>
 /// <returns></returns>
 public Contact SelectById(int id)
 {
     try
     {
         Contact obj = new Contact();
         string  sql = "select * from jinchen.customer_info where id={0}";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <Contact>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 查询单笔数
 /// </summary>
 /// <param user_name="user_user_name">用户名</param>
 /// <returns></returns>
 public person SelectSingle(string user_name)
 {
     try
     {
         person obj = new person();
         string sql = "select * from fimp.person where user_name=N'{0}'";
         sql = string.Format(sql, user_name);
         obj = PostgreHelper.GetSingleEntity <person>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 23
0
 public rest_time SelectTime(string unit_no)
 {
     try
     {
         string sql = "select * from fimp.rest_time where unit_no={0}";
         sql = string.Format(sql, unit_no);
         rest_time obj = new rest_time();
         obj = PostgreHelper.GetSingleEntity <rest_time>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 通过id返回视图里面的人员及部门对象
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public PersonDept SelectPersonByID(int id)
 {
     try
     {
         PersonDept obj = new PersonDept();
         string     sql = "select * from fimp.person_dept_view where id={0}";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <PersonDept>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public rest_time_row SelectSingle(string machine_code, string ts)
 {
     try
     {
         rest_time_row obj = new rest_time_row();
         string        sql = "select * from fimp.rest_time_row where machine_code='{0}' and start_time<='{1}' and end_time>='{2}'";
         sql = string.Format(sql, machine_code, ts, ts);
         obj = PostgreHelper.GetSingleEntity <rest_time_row>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public person SelectSingleByID(int id)
 {
     try
     {
         person obj = new person();
         string sql = "select * from fimp.person where id={0}";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <person>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //查询单笔数据
 public city_info SelectSingle(int id)
 {
     try
     {
         city_info obj = new city_info();
         string    sql = "SELECT * FROM fimp.city_info where city_id={0} order by area_id,city_id";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <city_info>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 28
0
 public client_config_info SelectSingle(string client_mac)
 {
     try
     {
         client_config_info obj = new client_config_info();
         string             sql = "select * from fimp.client_config_info where client_mac='{0}'";
         sql = string.Format(sql, client_mac);
         obj = PostgreHelper.GetSingleEntity <client_config_info>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 根据id_num   查询信息
 /// </summary>
 /// <param user_name="user_name"></param>
 /// <returns></returns>
 public person Selectnum(string card_num)
 {
     try
     {
         person obj = new person();
         string sql = "select * from fimp.person where card_num=N'{0}'";
         sql = string.Format(sql, card_num);
         obj = PostgreHelper.GetSingleEntity <person>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 30
0
 //查询所有material_request_info
 public material_request_info SelectById(int id)
 {
     try
     {
         material_request_info obj = new material_request_info();
         string sql = "SELECT id, material_id,station_id,request_person_id,work_order,part_num,request_count,take_person_id,take_time,remark,createtime FROM fimp.material_request_info where id ={0}";
         sql = string.Format(sql, id);
         obj = PostgreHelper.GetSingleEntity <material_request_info>(sql);
         return(obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }