/// <summary>
        /// 用于销售管理:模糊查询,查询结果为一笔或多笔数据
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <DuiZhang> SelectForInvoice(string dz_start_time, string dz_end_time, string deliver_company_head, string dz_index)
        {
            try
            {
                List <DuiZhang> objList = new List <DuiZhang>();
                string          sql     = null;
                if (!string.IsNullOrEmpty(deliver_company_head))
                {
                    deliver_company_head = deliver_company_head.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "select a.dz_index,max(a.dui_time) as dui_time,max(a.company_name) as company_name," +
                      " sum(a.dui_num) as dui_num,sum(a.dui_all_price) as dui_all_price" +
                      " from jinchen.duizhang_info a, jinchen.sale_info b" +
                      " where a.sale_id = b.id and company_name ~*'{0}'" +
                      " and to_char(a.dui_time,'yyyy-MM-dd')>= '{1}' and to_char(a.dui_time,'yyyy-MM-dd')<= '{2}'" +
                      " and dz_index ~*'{3}'" +
                      " and a.invoice_time is null" +
                      " group by a.dz_index" +
                      " order by a.dz_index desc";
                sql = string.Format(sql, deliver_company_head, dz_start_time, dz_end_time, dz_index);

                objList = PostgreHelper.GetEntityList <DuiZhang>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        /// <summary>
        /// 查询异常配置所关联的机种信息
        /// </summary>
        /// <param name="config_id">配置id</param>
        /// <param name="class_no">班别</param>
        /// <param name="part_num">机种编号</param>
        /// <returns></returns>
        public List <error_config_pn> GetCfgPartNum(int config_id, string class_no = null, string part_num = null)
        {
            List <error_config_pn> list = new List <error_config_pn>();
            string command = string.Empty;

            if (config_id > 0 && class_no != null && part_num != null)
            {
                command = string.Format("Select * from andon.error_config_pn where error_config_id='{0}' and class_no='{1}' and part_num='{2}'", config_id, class_no, part_num);
            }
            else if (config_id > 0 && class_no != null)
            {
                command = string.Format("Select * from andon.error_config_pn where error_config_id='{0}' and class_no='{1}'", config_id, class_no);
            }
            else if (config_id > 0 && part_num != null)
            {
                command = string.Format("Select * from andon.error_config_pn where error_config_id='{0}'and part_num='{1}'", config_id, part_num);
            }
            else if (config_id > 0)
            {
                command = string.Format("Select * from andon.error_config_pn where error_config_id='{0}'", config_id);
            }
            else
            {
                command = string.Format("Select * from andon.error_config_pn ");
            }
            if (command != string.Empty)
            {
                list = PostgreHelper.GetEntityList <error_config_pn>(command);
            }

            return(list);
        }
Example #3
0
        /// <summary>
        /// 用于销售结款和历史销售结款
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <Sale> SelectMoneyAll(string start_time, string end_time, string deliver_index, string deliver_company_head, string order_name, string purchase_person)
        {
            try
            {
                List <Sale> objList = new List <Sale>();
                string      sql     = null;
                if (!string.IsNullOrEmpty(deliver_company_head))
                {
                    deliver_company_head = deliver_company_head.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "select a.id, b.company_order_index,a.deliver_index,a.deliver_company_head,real_num,deliver_price,deliver_all_price," +
                      "a.money_way,order_name,unit,purchase_person,a.insert_time,a.seq_id,a.money_onoff,c.tui_num,a.return_flag,a.dz_num " +
                      " from jinchen.sale_info a,jinchen.order_info b,jinchen.orderseq_info c " +
                      "where a.order_id=b.id and a.seq_id=c.seq_id and a.order_id=c.order_id and deliver_index ~*'{0}' and deliver_company_head ~*'{1}' and to_char(a.insert_time,'yyyy-MM-dd')>='{2}' and " +
                      "to_char(a.insert_time,'yyyy-MM-dd')<='{3}' and order_name ~* '{4}' and purchase_person ~* '{5}' and a.flag=0 and c.flag=0 " +
                      "order by deliver_index desc,deliver_company_head";
                sql = string.Format(sql, deliver_index, deliver_company_head, start_time, end_time, order_name, purchase_person);

                objList = PostgreHelper.GetEntityList <Sale>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 用于销售结款和历史销售结款
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <DuiZhang> SelectHistory(string deliver_start_time, string deliver_end_time, string dz_start_time, string dz_end_time,
                                             string company_order_index, string company_name, string order_name, string dz_index, string invoice_index, string deliver_index)
        {
            try
            {
                List <DuiZhang> objList = new List <DuiZhang>();
                string          sql     = null;
                if (!string.IsNullOrEmpty(company_name))
                {
                    company_name = company_name.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "select a.id, a.company_order_index,a.company_name,a.dui_num,a.dui_price,a.dui_all_price," +
                      "a.order_name,a.unit,a.dz_index,a.invoice_index,a.deliver_time,dui_time,b.deliver_index " +
                      "from (select * " +
                      " from jinchen.duizhang_info a " +
                      "where company_order_index ~*'{0}' and company_name ~*'{1}' and to_char(a.deliver_time,'yyyy-MM-dd')>='{2}' and " +
                      "to_char(a.deliver_time,'yyyy-MM-dd')<='{3}' and to_char(a.dui_time,'yyyy-MM-dd')>='{4}' and to_char(a.dui_time,'yyyy-MM-dd')<='{5}' and " +
                      "order_name ~* '{6}' and dz_index ~* '{7}' and invoice_index ~* '{8}' ) a " +
                      "inner join (select * from jinchen.sale_info) b on a.sale_id=b.id and deliver_index ~* '{9}' " +
                      "order by a.dui_time desc, b.deliver_index desc,a.company_name";
                sql = string.Format(sql, company_order_index, company_name, deliver_start_time, deliver_end_time, dz_start_time, dz_end_time,
                                    order_name, dz_index, invoice_index, deliver_index);

                objList = PostgreHelper.GetEntityList <DuiZhang>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        /// <summary>
        /// 退单统计数据(待确认和已确认)
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <SaleReturn> SelectAll(int return_status, string start_time, string end_time, string return_index, string order_name)
        {
            try
            {
                List <SaleReturn> objList = new List <SaleReturn>();
                string            sql     = null;

                sql = "select a.return_index,a.return_num,a.return_price,a.return_all_price,a.insert_time,b.deliver_index,c.order_name,c.unit," +
                      "d.company_order_index,b.deliver_company_head,a.seq_id,a.confirm_time " +
                      "from jinchen.salereturn_info a,jinchen.sale_info b,jinchen.orderseq_info c,jinchen.order_info d " +
                      " where a.deliver_index=b.deliver_index and a.seq_id=b.seq_id " +
                      "and b.seq_id=c.seq_id and b.order_id=c.order_id and c.order_id=d.id and " +
                      " return_index ~*'{0}' and to_char(a.insert_time,'yyyy-MM-dd') >='{1}' and " +
                      "to_char(a.insert_time,'yyyy-MM-dd') <='{2}' and return_status={3} and c.order_name ~* '{4}' " +
                      "order by return_index desc";
                sql = string.Format(sql, return_index, start_time, end_time, return_status, order_name);

                objList = PostgreHelper.GetEntityList <SaleReturn>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
        //查询所有
        public List <material_info> SelectAll(string material_name)
        {
            try
            {
                List <material_info> objList = new List <material_info>();
                string sql = null;
                if (string.IsNullOrEmpty(material_name))
                {
                    sql = "SELECT a.id,a.category_id,b.type_name,a.material_code,a.material_name,a.material_type,a.material_inventory,a.remark,a.createtime FROM fimp.material_info a,fimp.material_category b where a.category_id=b.id order by a.material_code, a.material_code";
                    sql = string.Format(sql);
                }
                else
                {
                    sql = "SELECT a.id,a.category_id,b.type_name,a.material_code,a.material_name,a.material_type,a.material_inventory,a.remark,a.createtime FROM fimp.material_info a,fimp.material_category b where a.category_id=b.id and a.material_name like '%{0}%' or a.material_code like '%{0}%' order by a.material_code, a.material_code";
                    sql = string.Format(sql, material_name);
                }

                objList = PostgreHelper.GetEntityList <material_info>(sql);
                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        /// <summary>
        /// 根据名称、税号、账户和开户行对公司模糊查询,查询结果为一笔或多笔数据
        /// </summary>
        /// <param name="invoice_index"></param>
        /// <param name="company_name"></param>
        /// <returns></returns>
        public List <Invoice> SelectAll(int status, string start_time, string end_time, string confirm_start_time, string confirm_end_time,
                                        string invoice_index, string company_name, string invoice_company)
        {
            try
            {
                List <Invoice> objList = new List <Invoice>();
                string         sql     = null;
                //if (!string.IsNullOrEmpty(company_name))
                //{
                //    company_name = company_name.Replace("(", "\\(").Replace(")", "\\)");
                //}
                sql = "select a.id,a.company_name,a.invoice_company,a.invoice_type,a.invoice_index," +
                      "a.invoice_time,a.invoice_price,a.invoice_real_price,a.invoice_prepay,a.pay_type,a.remark,confirm_time " +
                      "from jinchen.invoice_info a " +
                      "where a.invoice_index ~* '{0}' and a.company_name ~* '{1}' and a.status={2} and to_char(invoice_time,'yyyy-MM-dd')>='{3}' " +
                      "and to_char(invoice_time,'yyyy-MM-dd')<='{4}' and to_char(confirm_time,'yyyy-MM-dd')>='{5}' and to_char(confirm_time,'yyyy-MM-dd')<='{6}' and invoice_company ~* '{7}' " +
                      "order by a.invoice_time desc";
                sql = string.Format(sql, invoice_index, company_name, status, start_time, end_time, confirm_start_time, confirm_end_time, invoice_company);

                objList = PostgreHelper.GetEntityList <Invoice>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 用于订单管理:根据联系人名模糊查询,查询结果为一笔或多笔数据
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <Order> SelectAll(int order_status, string start_time, string end_time, string deliver_start_time, string deliver_end_time, string company_name,
                                      string order_index, string company_order_index, string purchase_person, string order_name)
        {
            try
            {
                List <Order> objList = new List <Order>();
                string       sql     = null;
                if (!string.IsNullOrEmpty(company_name))
                {
                    company_name = company_name.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "select c.id,c.company_order_index,c.order_index,b.company_name,a.order_time,a.order_name,a.deliver_time," +
                      " order_num,order_price,order_all_price,tui_num, open_num,remain_num,purchase_person,a.seq_id,a.order_picture,a.remark,a.unit " +
                      "from jinchen.orderseq_info a,jinchen.company_info b,jinchen.order_info c where a.order_id=c.id and c.customer_id=b.id and a.flag=0 and " +
                      " b.company_name ~* '{0}' and c.order_index ~* '{1}' and c.company_order_index ~*'{2}' and to_char(a.order_time,'yyyy-MM-dd')>='{3}' and to_char(a.order_time,'yyyy-MM-dd')<='{4}' and a.order_status={5} " +
                      " and to_char(a.deliver_time,'yyyy-MM-dd')>='{6}' and to_char(a.deliver_time,'yyyy-MM-dd')<='{7}' and purchase_person ~*'{8}' and order_name ~*'{9}' " +
                      " order by a.order_time desc,c.order_index desc,order_name";
                sql = string.Format(sql, company_name, order_index, company_order_index, start_time, end_time, order_status, deliver_start_time,
                                    deliver_end_time, purchase_person, order_name);

                objList = PostgreHelper.GetEntityList <Order>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        /// <summary>
        /// 查询指定时间段内的记录
        /// </summary>
        /// <param name="start_time">开始时间</param>
        /// <param name="end_time">结束时间</param>
        /// <param name="device_code">装置编号</param>
        /// <returns></returns>
        public List <error_log> GetAllLogByTime(DateTime start_time, DateTime end_time, string device_code = null)
        {
            List <error_log> list = new List <error_log>();

            try
            {
                string sql;
                if (string.IsNullOrEmpty(device_code) == false)
                {
                    sql = "select * from andon.error_log where start_time>='{0}' and start_time<='{1}' and machine_code='{2}'";
                    sql = string.Format(sql, start_time, end_time, device_code);
                }
                else
                {
                    sql = "select * from andon.error_log where start_time>='{0}' and start_time<='{1}'";
                    sql = string.Format(sql, start_time, end_time);
                }
                list = PostgreHelper.GetEntityList <error_log>(sql);
                return(list);
            }
            catch (Exception ex)
            {
                return(list);
            }
        }
        /// <summary>
        /// 查询所有C/T,或者指定设备的
        /// </summary>
        /// <returns></returns>
        public List <CT> SelectAllByWorkOrder(string device_code, string work_order, string pn, string tag_code)
        {
            try
            {
                List <CT> objList = new List <CT>();
                string    comm;
                if (string.IsNullOrEmpty(tag_code) == false)
                {
                    comm = "SELECT * FROM fimp.ct where machine_code='{0}' and wo='{1}' and pn='{2}' and tag_code='{3}' order by end_time desc";
                    comm = string.Format(comm, device_code, work_order, pn, tag_code);
                }
                else
                {
                    comm = "SELECT * FROM fimp.ct where machine_code='{0}' and wo='{1}' and pn='{2}' order by end_time desc";
                    comm = string.Format(comm, device_code, work_order, pn);
                }

                objList = PostgreHelper.GetEntityList <CT>(comm);
                return(objList);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Example #11
0
        public List <error_log_person> GetErrorLogPersonByLogId(int LogId)
        {
            string command = string.Format("Select * from andon.error_log_person where error_log_id='{0}'", LogId);
            var    list    = PostgreHelper.GetEntityList <error_log_person>(command);

            return(list);
        }
Example #12
0
        /// <summary>
        /// 用于销售管理:模糊查询,查询结果为一笔或多笔数据
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <Sale> SelectAll(string start_time, string end_time, string deliver_index, string deliver_company_head)
        {
            try
            {
                List <Sale> objList = new List <Sale>();
                string      sql     = null;
                if (!string.IsNullOrEmpty(deliver_company_head))
                {
                    deliver_company_head = deliver_company_head.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "select deliver_index,deliver_company_head,sum(real_num) as real_num,sum(deliver_all_price) as deliver_all_price,max(insert_time) as insert_time " +
                      "from jinchen.sale_info a " +
                      "where deliver_index ~*'{0}' and deliver_company_head ~*'{1}' and to_char(insert_time,'yyyy-MM-dd')>='{2}' and to_char(insert_time,'yyyy-MM-dd')<='{3}' and a.flag=0 " +
                      "group by deliver_index,deliver_company_head order by deliver_index desc";
                sql = string.Format(sql, deliver_index, deliver_company_head, start_time, end_time);

                objList = PostgreHelper.GetEntityList <Sale>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #13
0
        /// <summary>
        /// 查询入库单中尚未确认结款的单子(物料购入流水账和供应商结款共用一个)
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <Purchase> SelectDeliverAll(string start_time, string end_time, string company_name, string purchase_index, string material_name, string deliver_index, string category)
        {
            try
            {
                List <Purchase> objList = new List <Purchase>();
                string          sql     = null;
                if (!string.IsNullOrEmpty(company_name))
                {
                    company_name = company_name.Replace("(", "\\(").Replace(")", "\\)");
                }
                sql = "SELECT a.id, b.company_name, a.purchase_index, a.category,a.deliver_index,a.deliver_time, a.material_name, a.material_spec, " +
                      "a.material_num, a.material_unit, a.material_price, a.material_all_price,money_onoff,money_way,status,confirm_time " +
                      "FROM jinchen.purchase_info a, jinchen.company_info b " +
                      " where a.supplier_id = b.id and a.purchase_index ~* '{0}' and b.company_name ~* '{1}' and a.material_name ~* '{2}' and flag=0 and " +
                      "a.deliver_index ~* '{3}' and a.status =0 and to_char(a.deliver_time,'yyyy-MM-dd')>='{4}' and to_char(a.deliver_time,'yyyy-MM-dd')<='{5}' and a.category ~* '{6}' " +
                      "order by a.purchase_index desc ";
                sql = string.Format(sql, purchase_index, company_name, material_name, deliver_index, start_time, end_time, category);

                objList = PostgreHelper.GetEntityList <Purchase>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 查询订单下的序号,只用于判断该订单下的序号有多少个
        /// </summary>
        /// <param name="id">用户id</param>
        /// <returns></returns>
        public List <Order> SelectOrderSeqList(int order_id, string company_name)
        {
            try
            {
                List <Order> objList = new List <Order>();
                string       sql     = null;
                if (order_id == 0)
                {
                    sql = "select a.id,c.order_id,a.order_index,b.company_name, c.seq_id,c.order_time,c.order_name,c.unit,c.deliver_time," +
                          "c.order_num,c.open_num,c.tui_num,c.remain_num,c.order_price,c.order_all_price,c.purchase_person,c.remark,a.company_order_index " +
                          "from jinchen.order_info a,jinchen.company_info b,jinchen.orderseq_info c " +
                          "where a.customer_id=b.id and a.id=c.order_id and b.company_name='{0}' and c.flag=0 order by c.order_name";
                    sql = string.Format(sql, company_name);
                }
                else
                {
                    sql = "select a.id,c.order_id,a.order_index,b.company_name, c.seq_id,c.order_time,c.order_name,c.unit,c.deliver_time," +
                          "c.order_num,c.open_num,c.tui_num,c.remain_num,c.order_price,c.order_all_price,c.purchase_person,c.remark,a.company_order_index " +
                          "from jinchen.order_info a,jinchen.company_info b,jinchen.orderseq_info c " +
                          "where a.customer_id=b.id and a.id=c.order_id and a.id={0} and b.company_name='{1}' and c.flag=0 order by c.order_name";
                    sql = string.Format(sql, order_id, company_name);
                }



                objList = PostgreHelper.GetEntityList <Order>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <error_config> SelectAll(int line_id, string unit_no = null, string part_num = null)
        {
            List <error_config> list = new List <error_config>();
            string command           = string.Empty;

            if (line_id > 0 && unit_no != null && part_num != null)
            {
                command = string.Format("Select * from andon.error_config where line_id='{0}' and unit_no='{1}' and part_num='{2}' order by id", line_id, unit_no, part_num);
            }
            else if (line_id > 0 && unit_no != null)
            {
                command = string.Format("Select * from andon.error_config where line_id='{0}' and unit_no='{1}'  order by id", line_id, unit_no);
            }
            else if (line_id > 0)
            {
                command = string.Format("Select * from andon.error_config where line_id='{0}'  order by id", line_id);
            }
            else if (unit_no != null)
            {
                command = string.Format("Select * from andon.error_config where line_id='{0}' and unit_no='{1}' order by id", line_id, unit_no);
            }
            else
            {
                command = string.Format("Select * from andon.error_config  order by id");
            }

            if (command != string.Empty)
            {
                list = PostgreHelper.GetEntityList <error_config>(command);
            }

            return(list);
        }
        public List <rest_time_row> SelectAll(string start_time, string end_time)
        {
            try
            {
                List <rest_time_row> objList = new List <rest_time_row>();
                string sql = null;
                if (!string.IsNullOrEmpty(start_time) && !string.IsNullOrEmpty(end_time))
                {
                    sql = "select * from fimp.rest_time_row where start_time>='{0}' and end_time<='{1}' order by start_time desc,machine_code";
                    sql = string.Format(sql, start_time, end_time);
                }
                else
                {
                    string sys_time = System.DateTime.Now.AddHours(GlobalDefine.SysTimeZone).ToString("yyyy-MM-dd HH:mm:ss");
                    sql = "select * from fimp.rest_time_row where end_time>='{0}' order by start_time desc,machine_code";
                    sql = string.Format(sql, sys_time);
                }
                objList = PostgreHelper.GetEntityList <rest_time_row>(sql);

                return(objList);
                //string sql="select * from rest_time_row where "
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <dept_info> SelectAllid(int id)
        {
            try
            {
                List <dept_info> objList = new List <dept_info>();
                string           sql     = null;
                if (id > 0)
                {
                    sql = "SELECT  * FROM fimp.dept_info where dept_id={0} order by dept_id";
                    sql = string.Format(sql, id);
                }
                else
                {
                    sql = "SELECT  * FROM fimp.dept_info  order by plant_id";
                }

                objList = PostgreHelper.GetEntityList <dept_info>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #18
0
        /// <summary>
        /// 检查是否已经存在异常
        /// </summary>
        /// <param name="SysTagCode"></param>
        /// <param name="MachineCode"></param>
        /// <param name="StationId"></param>
        /// <returns></returns>
        public bool CheckMaterialRequireExist(String SysTagCode, int MaterialId, string MachineCode = "", int StationId = -1)
        {
            string sql;

            if (StationId > 0)
            {
                sql = "select * from andon.error_log where station_id={0} and system_tag_code='{1}' and error_type_id='{2}' and (release_time<='2001-01-01 00:00:00' or release_time is null)";
                sql = string.Format(sql, StationId, SysTagCode, MaterialId);
            }
            else
            {
                sql = "select * from andon.error_log where machine_code='{0}' and system_tag_code='{1}' and error_type_id='{2}' and (release_time<='2001-01-01 00:00:00' or release_time is null)";
                sql = string.Format(sql, MachineCode, SysTagCode, MaterialId);
            }

            var list = PostgreHelper.GetEntityList <error_log>(sql);

            if (list == null || list.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #19
0
        /// <summary>
        /// 查找未完成的物料请求
        /// </summary>
        /// <param name="MaterialId"></param>
        /// <param name="StationId"></param>
        /// <returns></returns>
        public List <material_request_info> SelectUnfinishedRequestInfo(int MaterialId, int StationId)
        {
            List <material_request_info> list = new List <material_request_info>();
            string command = string.Format(" Select * from fimp.material_request_info where material_id='{0}' and station_id='{1}' and (take_time is null or take_time<='2001-01-01 00:00:00')", MaterialId, StationId);

            list = PostgreHelper.GetEntityList <material_request_info>(command);
            return(list);
        }
Example #20
0
        public List <station_info> SelectAllByUnit(string unit_no)
        {
            List <station_info> objList = new List <station_info>();
            string sql = null;

            sql     = "select * from fimp.station_info where unit_no='{0}'";
            sql     = string.Format(sql, unit_no);
            objList = PostgreHelper.GetEntityList <station_info>(sql);
            return(objList);
        }
        //判断当前时间是否在班别中,属于哪里班别,班别的开始时间与结束时间
        public class_info SelectClass(string date_time, string date)
        {
            try
            {
                class_info obj = null;
                //转换为时间
                string time = Convert.ToDateTime(date_time).ToString("HH:mm:ss");
                //查询
                string            sql     = "SELECT * FROM fimp.class_info order by start_time";
                List <class_info> objList = PostgreHelper.GetEntityList <class_info>(sql);

                foreach (var classItem in objList)
                {
                    string start_time = classItem.start_time;
                    string end_time   = classItem.end_time;
                    if (Convert.ToDateTime(start_time) > Convert.ToDateTime(end_time))
                    {
                        DateTime start_time1 = Convert.ToDateTime("23:59:59");
                        DateTime end_time1   = Convert.ToDateTime("00:00:00");

                        if (Convert.ToDateTime(start_time) <= Convert.ToDateTime(time) && Convert.ToDateTime(time) <= Convert.ToDateTime(start_time1))
                        {
                            classItem.start_time = date + " " + classItem.start_time;
                            classItem.end_time   = Convert.ToDateTime(date).AddDays(1).ToString("yyyy-MM-dd") + " " + classItem.end_time;
                            obj = classItem;
                            break;
                        }
                        else if (Convert.ToDateTime(end_time1) <= Convert.ToDateTime(time) && Convert.ToDateTime(time) <= Convert.ToDateTime(end_time))
                        {
                            classItem.start_time = date + " " + classItem.start_time;
                            classItem.end_time   = Convert.ToDateTime(date).AddDays(1).ToString("yyyy-MM-dd") + " " + classItem.end_time;
                            obj = classItem;
                            break;
                        }
                    }
                    else
                    {
                        //获取当前时间对应的班别及时间
                        if (Convert.ToDateTime(start_time) <= Convert.ToDateTime(time) && Convert.ToDateTime(time) <= Convert.ToDateTime(end_time))
                        {
                            classItem.start_time = date + " " + classItem.start_time;
                            classItem.end_time   = date + " " + classItem.end_time;
                            obj = classItem;
                            break;
                        }
                    }
                }

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 查询异常配置所关联的人员
        /// </summary>
        /// <param name="config_id">配置id</param>
        /// <returns></returns>
        public List <error_config_person> GetCfgPersons(int config_id)
        {
            List <error_config_person> list = new List <error_config_person>();
            string command = string.Empty;

            command = string.Format("Select * from andon.error_config_person where error_config_id='{0}'", config_id);

            if (command != string.Empty)
            {
                list = PostgreHelper.GetEntityList <error_config_person>(command);
            }

            return(list);
        }
Example #23
0
 /// <summary>
 /// 查询用户信息列表
 /// </summary>
 /// <param name="user_name">根据用户名查询,可为空</param>
 /// <returns></returns>
 public List <material_info> SelectAllcol()
 {
     try
     {
         List <material_info> objList = new List <material_info>();
         string sql = null;
         sql     = "select * from fimp.material_info order by id";
         objList = PostgreHelper.GetEntityList <material_info>(sql);
         return(objList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #24
0
 /// <summary>
 /// 获取站别信息
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public List <MachineInfo> SelectMachineNameByStaion(int id)
 {
     try
     {
         List <MachineInfo> objList = new List <MachineInfo>();
         string             sql     = null;
         sql     = "SELECT mqtt_no,machine_id,area_id,city_id,plant_id,unit_no,line_id,machine_code,machine_name_en,machine_name_tw,machine_name_cn,status_no,station_id,set_up FROM fimp.machine_info where station_id={0}  order by machine_name_cn";
         sql     = string.Format(sql, id);
         objList = PostgreHelper.GetEntityList <MachineInfo>(sql);
         return(objList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #25
0
        /// <summary>
        /// 查询单笔数据,通过line
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <station_info> SelectByLine(int line_id)
        {
            try
            {
                string sql = "select a.station_id,c.station_name_en,c.station_name_cn,c.station_name_tw from fimp.machine_info a, fimp.line_info b, fimp.station_info c where a.line_id=b.line_id and a.station_id = c.station_id and a.unit_no=b.unit_no and b.unit_no=c.unit_no and a.line_id={0}";
                sql = string.Format(sql, line_id);
                List <station_info> objList = new List <station_info>();
                objList = PostgreHelper.GetEntityList <station_info>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #26
0
 //查询所有material_request_info
 public List <material_request_info> SelectAll()
 {
     try
     {
         List <material_request_info> objList = new List <material_request_info>();
         string sql = null;
         sql     = "SELECT * FROM fimp.material_request_info order by createtime";
         sql     = string.Format(sql);
         objList = PostgreHelper.GetEntityList <material_request_info>(sql);
         return(objList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #27
0
        /// <summary>
        /// 加载记录
        /// </summary>
        /// <returns></returns>
        public List <Attendance> GetAllAttendance()
        {
            try
            {
                List <Attendance> objList = new List <Attendance>();
                string            sql     = null;
                sql     = "select * from fimp.attendance ";
                objList = PostgreHelper.GetEntityList <Attendance>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 查询异常配置所关联的人员
        /// </summary>
        /// <param name="config_id">配置id</param>
        /// <returns></returns>
        public List <ErrorCfgPersonView> GetCfgPersonsView(int config_id)
        {
            List <ErrorCfgPersonView> list = new List <ErrorCfgPersonView>();
            string command = string.Empty;

            if (config_id > 0)
            {
                command = string.Format("SELECT * from andon.error_config_person_view where error_config_id='{0}' ", config_id);
            }

            if (command != string.Empty)
            {
                list = PostgreHelper.GetEntityList <ErrorCfgPersonView>(command);
            }

            return(list);
        }
Example #29
0
        public List <MachineInfo> SelectByLine(int line_id)
        {
            try
            {
                List <MachineInfo> objList = new List <MachineInfo>();
                string             sql     = null;

                sql     = "SELECT * FROM fimp.machine_info where line_id={0}  ";
                sql     = string.Format(sql, line_id);
                objList = PostgreHelper.GetEntityList <MachineInfo>(sql);
                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List <Setting> SelectConfigList(int all_type)
        {
            try
            {
                List <Setting> objList = new List <Setting>();
                string         sql     = null;
                sql = "select id,config_list from jinchen.setting where all_type={0} order by config_list";
                sql = string.Format(sql, all_type);

                objList = PostgreHelper.GetEntityList <Setting>(sql);

                return(objList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }