Esempio n. 1
0
        public List <search_history_data> search_history(string select, int page, int pageLength)
        {
            int    page_size         = 10000; //一次ajax讀取多少筆資料
            string getDataSizeSqlCmd = "";
            string getDataSqlCmd     = "";

            if (select == "1")
            {
                getDataSizeSqlCmd = "SELECT COUNT(ROWNUM) FROM ROBOT_INFOS";
                getDataSqlCmd     = "SELECT* FROM (SELECT A.*, ROWNUM RN FROM(SELECT * FROM ROBOT_INFOS ORDER BY ROWNUM) A ) WHERE RN BETWEEN ";
            }
            else if (select == "2")
            {
                getDataSizeSqlCmd = "SELECT COUNT(ROWNUM)FROM ROBOT_RPM_INFOS_HISTORY";
                getDataSqlCmd     = "SELECT* FROM (SELECT A.*, ROWNUM RN FROM(SELECT * FROM ROBOT_RPM_INFOS_HISTORY ORDER BY ROWNUM) A ) WHERE RN BETWEEN ";
            }
            else if (select == "3")
            {
                getDataSizeSqlCmd = "SELECT * FROM ROBOT_TORQUE_INFOS_HISTORY";
            }
            else if (select == "4")
            {
                getDataSizeSqlCmd = "SELECT * FROM ROBOT_TEMPATURE_INFOS_HISTORY";
            }



            List <search_history_data> sch_data_list = new List <search_history_data>();


            //  string s = "User Id=foxlinkrobot;Password=foxlink;Data Source=192.168.60.37:1521/robot";   //Data Source格式:IP/SID
            connect_sql connect1 = new connect_sql();

            sch_data_list.Clear();
            connect1.get_HistoryData("foxlinkrobot", "foxlink", "192.168.60.37:1521/robot", getDataSizeSqlCmd, getDataSqlCmd, select, page, page_size, pageLength, sch_data_list);



            /////////////////////////LinQ//////////////////////////
            //var r = from lt in sch_list where Convert.ToInt64(lt.j1_rpm) > 0 && Convert.ToInt64(lt.j2_rpm) > 0 orderby lt.j1_rpm select lt;
            //  var r = from lt in sch_list orderby lt.j1_rpm select lt;
            //     return r.ToList<search_history_data_buf>();
            return(sch_data_list);
        }
Esempio n. 2
0
        public List <online_datas> online_data(string select, int page, int pageLength)
        {
            int    page_size         = 10000; //一次ajax讀取多少筆資料
            string getDataSizeSqlCmd = "";
            string getDataSqlCmd     = "";

            getDataSizeSqlCmd = "SELECT COUNT(ROWNUM) FROM ROBOT_INFOS";
            getDataSqlCmd     = "SELECT* FROM (SELECT A.*, ROWNUM RN FROM(SELECT * FROM ROBOT_INFOS ORDER BY ROWNUM) A ) WHERE RN BETWEEN ";


            List <search_history_data> list1 = new List <search_history_data>();


            //  string s = "User Id=foxlinkrobot;Password=foxlink;Data Source=192.168.60.37:1521/robot";   //Data Source格式:IP/SID
            connect_sql connect1 = new connect_sql();

            list1.Clear();
            list1 = connect1.get_HistoryData("foxlinkrobot", "foxlink", "192.168.60.37:1521/robot", getDataSizeSqlCmd, getDataSqlCmd, "1", page, page_size, pageLength, list1);



            /////////////////////////LinQ//////////////////////////
            //  var r = from lt in sch_list orderby lt.j1_rpm select lt;


            List <online_datas> list_online = new List <online_datas>();

            if (select == "1")      //依BG顯示手臂數量
            {
                var r1 = from lt in list1
                         //                       where Convert.ToInt64(lt.j1_rpm) > 0 && Convert.ToInt64(lt.j2_rpm) > 0
                         group lt by lt.bg_code into _lt
                         select new
                {
                    bg  = _lt.Key,
                    qty = _lt.Count()
                };
                foreach (var l in r1)
                {
                    list_online.Add(new online_datas
                    {
                        _bg     = l.bg,
                        _bg_qty = l.qty.ToString(),
                    });
                }
            }
            else if (select == "2")      //依廠區顯示手臂數量
            {
                var r1 = from lt in list1
                         //                       where Convert.ToInt64(lt.j1_rpm) > 0 && Convert.ToInt64(lt.j2_rpm) > 0
                         group lt by lt.factory_locate into _lt
                         select new
                {
                    factory_locate = _lt.Key,
                    qty            = _lt.Count()
                };
                foreach (var l in r1)
                {
                    list_online.Add(new online_datas
                    {
                        _factory_locate     = l.factory_locate,
                        _factory_locate_qty = l.qty.ToString(),
                    });
                }
            }
            else if (select == "3")     //依產品顯示手臂數量
            {
                var r1 = from lt in list1
                         //                       where Convert.ToInt64(lt.j1_rpm) > 0 && Convert.ToInt64(lt.j2_rpm) > 0
                         group lt by lt.product into _lt
                         select new
                {
                    product = _lt.Key,
                    qty     = _lt.Count()
                };
                foreach (var l in r1)
                {
                    list_online.Add(new online_datas
                    {
                        _product     = l.product,
                        _product_qty = l.qty.ToString(),
                    });
                }
            }
            else if (select == "4")     //依廠區樓層顯示手臂數量
            {
                var r1 = from lt in list1
                         //                       where Convert.ToInt64(lt.j1_rpm) > 0 && Convert.ToInt64(lt.j2_rpm) > 0
                         group lt by new { lt.factory_locate, lt.floor } into _lt
                    select new
                {
                    factory_locate_floor = _lt.Key.factory_locate + "/" + _lt.Key.floor + "樓",
                    qty = _lt.Count()
                };
                foreach (var l in r1)
                {
                    list_online.Add(new online_datas
                    {
                        _factory_locate_floor     = l.factory_locate_floor,
                        _factory_locate_floor_qty = l.qty.ToString()
                    });
                }
            }


            /////  return r.ToList<search_history_data_buf>();


            return(list_online);
        }