Exemplo n.º 1
0
        private void onSuscribe_RobotsStatus_Basic()
        {
            try
            {
                if (Data.Instance.isConnected)
                {
                    int cnt = 0;
                    cnt = Data.Instance.Robot_RegInfo_list.Count;
                    if (cnt > 0)
                    {
                        foreach (KeyValuePair <string, Robot_RegInfo> info in Data.Instance.Robot_RegInfo_list)
                        {
                            string        strrobotid = info.Key;
                            Robot_RegInfo value      = info.Value;

                            commBridge.onSelectRobotStatus_Basic_subscribes(strrobotid);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("onSuscribe_RobotsStatus_Basic err :={0}", ex.Message.ToString());
            }
        }
Exemplo n.º 2
0
 public void onRobots_WorkInfo_InitSet()
 {
     try
     {
         Data.Instance.Robot_work_info.Clear();
         //foreach (KeyValuePair<string, string> info in Data.Instance.Robot_status_info)
         int cnt = 0;
         cnt = Data.Instance.Robot_RegInfo_list.Count;
         if (cnt > 0)
         {
             foreach (KeyValuePair <string, Robot_RegInfo> info in Data.Instance.Robot_RegInfo_list)
             {
                 string        strrobotid = info.Key;
                 Robot_RegInfo value      = info.Value;
                 Invoke(new MethodInvoker(delegate()
                 {
                     textBox2.AppendText(strrobotid + " Work info check finish...\r\n");
                 }));
                 Data.Instance.Robot_work_info.Add(strrobotid, commBridge.onNewRobotWorkInfo_initial(strrobotid, "", 1, 0, "", ""));
             }
         }
     }
     catch (Exception ex)
     {
         Console.Out.WriteLine("onRobots_WorkInfo_InitSet err :={0}", ex.Message.ToString());
     }
 }
Exemplo n.º 3
0
        private void onRobotlistRead(string strgroup)
        {
            try
            {
                if (strgroup == "All")
                {
                    int cnt = Data.Instance.Robot_RegInfo_list.Count();
                    listBox_robotlist.Items.Clear();

                    for (int i = 0; i < cnt; i++)
                    {
                        string        strtmp    = "";
                        Robot_RegInfo robotinfo = Data.Instance.Robot_RegInfo_list.ElementAt(i).Value;
                        strtmp = string.Format("{0}({1})", robotinfo.robot_name, robotinfo.robot_id);

                        listBox_robotlist.Items.Add(strtmp);
                    }
                }
                else
                {
                    string strgroupid = "";
                    int    cnt        = Data.Instance.robotgroup_list.robotgroup.Count;
                    for (int i = 0; i < cnt; i++)
                    {
                        if (Data.Instance.robotgroup_list.robotgroup[i].robot_group_name == strgroup)
                        {
                            strgroupid = Data.Instance.robotgroup_list.robotgroup[i].robot_group_id;
                            break;
                        }
                    }
                    if (strgroupid == "")
                    {
                        return;
                    }

                    cnt = Data.Instance.Robot_RegInfo_list.Count();

                    listBox_robotlist.Items.Clear();

                    for (int i = 0; i < cnt; i++)
                    {
                        string        strtmp    = "";
                        Robot_RegInfo robotinfo = Data.Instance.Robot_RegInfo_list.ElementAt(i).Value;
                        if (robotinfo.robot_group == strgroupid)
                        {
                            strtmp = string.Format("{0}({1})", robotinfo.robot_name, robotinfo.robot_id);

                            listBox_robotlist.Items.Add(strtmp);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("TaskEdit_Ctrl ..onRobotlistRead err" + ex.Message.ToString());
            }
        }
Exemplo n.º 4
0
        public void onInitSet()
        {
            try
            {
                mainform.onDBRead_Robotlist("all");
                mainform.onDBRead_RobotStatus();
                mainform.onDBRead_Maplist();

                onCtrlEnable(false);

                dataGridView_robotreg.Rows.Clear();

                List <string> strrobotlist = new List <string>();

                int cnt = mainform.Robot_RegInfo_list.Count();

                for (int i = 0; i < cnt; i++)
                {
                    string        strtmp    = "";
                    Robot_RegInfo robotinfo = mainform.Robot_RegInfo_list.ElementAt(i).Value;
                    strtmp = string.Format("{0},{1},{2},{3},{4}({5})", robotinfo.robot_id, robotinfo.robot_name, robotinfo.robot_ip, robotinfo.robot_group, robotinfo.map_name, robotinfo.map_id);

                    if (mainform.Robot_Status_list.ContainsKey(robotinfo.robot_id))
                    {
                        strtmp = string.Format("{0},{1}", mainform.Robot_Status_list[robotinfo.robot_id].work_status, strtmp);
                    }
                    else
                    {
                        strtmp = string.Format("wait,{0}", strtmp);
                    }

                    string[] strtmpbuf = strtmp.Split(',');
                    dataGridView_robotreg.Rows.Add(strtmpbuf);
                }

                if (mainform.Map_list.Count > 0)
                {
                    for (int j = 0; j < mainform.Map_list.Count; j++)
                    {
                        Map_list maplist = new Map_list();
                        maplist = mainform.Map_list.ElementAt(j).Value;
                        string strmap = string.Format("{0}({1})", maplist.map_name, maplist.map_id);
                        cboMap.Items.Add(strmap);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("robotreg_Ctrl ..onInitSet err" + ex.Message.ToString());
            }
        }
Exemplo n.º 5
0
        private void btnAllStop_Click(object sender, EventArgs e)
        {
            int nrobotcnt = mainform.Robot_RegInfo_list.Count;

            if (nrobotcnt > 0)
            {
                for (int i = 0; i < nrobotcnt; i++)
                {
                    Robot_RegInfo robotreginfo = mainform.Robot_RegInfo_list.ElementAt(i).Value;

                    var task = Task.Run(() => mainform.worker.onWorkCancel_publish(robotreginfo.robot_id, ""));

                    Thread.Sleep(100);
                }
            }
        }
Exemplo n.º 6
0
        public void onInitSet()
        {
            int idx = cboRobotID.SelectedIndex;

            cboRobotID.Items.Clear();

            int cnt = mainform.Robot_RegInfo_list.Count();

            for (int i = 0; i < cnt; i++)
            {
                string        strtmp    = "";
                Robot_RegInfo robotinfo = mainform.Robot_RegInfo_list.ElementAt(i).Value;
                strtmp = string.Format("{0}({1})", robotinfo.robot_name, robotinfo.robot_id);

                cboRobotID.Items.Add(strtmp);
            }

            cboRobotID.SelectedIndex   = idx;
            progressBar_capacity.Value = 0;
        }
Exemplo n.º 7
0
        private void onRobotlistRead(string strgroup)
        {
            try
            {
                mainform.onDBRead_Robotlist(strgroup);
                int cnt = mainform.Robot_RegInfo_list.Count();

                listBox_robotlist.Items.Clear();

                for (int i = 0; i < cnt; i++)
                {
                    string        strtmp    = "";
                    Robot_RegInfo robotinfo = mainform.Robot_RegInfo_list.ElementAt(i).Value;
                    strtmp = string.Format("{0}({1})", robotinfo.robot_name, robotinfo.robot_id);

                    listBox_robotlist.Items.Add(strtmp);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("jobreg_Ctrl ..onRobotlistRead err" + ex.Message.ToString());
            }
        }
Exemplo n.º 8
0
        private void onSuscribe_RobotsStatus_Basic()
        {
            try
            {
                if (Data.Instance.isConnected)
                {
                    //Dictionary<string, string> robotinfo = Data.Instance.Robot_status_info;
                    //foreach (KeyValuePair<string, string> info in robotinfo)
                    int cnt = 0;
                    cnt = Data.Instance.Robot_RegInfo_list.Count;
                    if (cnt > 0)
                    {
                        foreach (KeyValuePair <string, Robot_RegInfo> info in Data.Instance.Robot_RegInfo_list)
                        {
                            string        strrobotid = info.Key;
                            Robot_RegInfo value      = info.Value;

                            commBridge.onSelectRobotStatus_Basic_subscribes(strrobotid); // 로봇 기본 상태
                            Thread.Sleep(Data.Instance.nSubscribeDelayTime);
                            commBridge.onControllerstate_subscribe(strrobotid);          // CPU, RAM 상태
                            Thread.Sleep(Data.Instance.nSubscribeDelayTime);
                            commBridge.onTaskResult_subscribe(strrobotid);               // TASK RESULT SUBS
                            Thread.Sleep(Data.Instance.nSubscribeDelayTime);
                            Invoke(new MethodInvoker(delegate()
                            {
                                textBox2.AppendText(strrobotid + " Subscribe...\r\n");
                            }));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("onSuscribe_RobotsStatus_Basic err :={0}", ex.Message.ToString());
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 등록된 로봇의 워크 정보를 초기화 한다.
        /// </summary>
        public void onRobots_WorkInfo_InitSet()
        {
            try
            {
                Data.Instance.Robot_work_info.Clear();
                //foreach (KeyValuePair<string, string> info in Data.Instance.Robot_status_info)
                int cnt = 0;
                cnt = Data.Instance.Robot_RegInfo_list.Count;
                if (cnt > 0)
                {
                    foreach (KeyValuePair <string, Robot_RegInfo> info in Data.Instance.Robot_RegInfo_list)
                    {
                        string        strrobotid = info.Key;
                        Robot_RegInfo value      = info.Value;

                        Data.Instance.Robot_work_info.Add(strrobotid, commBridge.onNewRobotWorkInfo_initial(strrobotid, "", 1, 0, "", ""));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine("onRobots_WorkInfo_InitSet err :={0}", ex.Message.ToString());
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 등록된 로봇 리스트 읽어오기
        /// </summary>
        public void onDBRead_Robotlist(string strgroup)
        {
            string sql     = "";
            bool   bdataok = false;

            try
            {
                G_robotList.Clear();

                if (strgroup == "all")
                {
                    sql = string.Format("SELECT * FROM robot_list_t ");
                }
                else
                {
                    sql = string.Format("SELECT * FROM robot_list_t where robot_group='{0}'", strgroup);
                }

                DataSet          ds = new DataSet();
                MySqlDataAdapter da = new MySqlDataAdapter(sql, G_SqlCon);
                da.Fill(ds);

                Robot_RegInfo_list.Clear();

                int ncnt = ds.Tables[0].Rows.Count;
                if (ncnt > 0)
                {
                    for (int i = 0; i < ncnt; i++)
                    {
                        string strrobotid    = ds.Tables[0].Rows[i]["robot_id"].ToString();
                        string strrobotname  = ds.Tables[0].Rows[i]["robot_name"].ToString();
                        string strrobotip    = ds.Tables[0].Rows[i]["robot_ip"].ToString();
                        string strrobotgroup = ds.Tables[0].Rows[i]["robot_group"].ToString();
                        string strmapid      = ds.Tables[0].Rows[i]["map_id"].ToString();
                        string strmapname    = "";
                        sql = string.Format("SELECT * FROM map_t where map_id='{0}'", strmapid);

                        DataSet          ds2 = new DataSet();
                        MySqlDataAdapter da2 = new MySqlDataAdapter(sql, G_SqlCon);
                        da2.Fill(ds2);

                        int ncnt2 = ds2.Tables[0].Rows.Count;
                        if (ncnt2 > 0)
                        {
                            strmapname = ds2.Tables[0].Rows[0]["map_name"].ToString();
                        }


                        G_robotList.Add(strrobotid);

                        Robot_RegInfo robotreginfo = new Robot_RegInfo();
                        robotreginfo.robot_id    = strrobotid;
                        robotreginfo.robot_name  = strrobotname;
                        robotreginfo.robot_ip    = strrobotip;
                        robotreginfo.robot_group = strrobotgroup;
                        robotreginfo.map_id      = strmapid;
                        robotreginfo.map_name    = strmapname;
                        Robot_RegInfo_list.Add(strrobotid, robotreginfo);
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("onDBRead_Robotlist err" + ex.Message.ToString());
            }
            catch (Exception ex2)
            {
                MessageBox.Show("onDBRead_Robotlist err" + ex2.Message.ToString());
            }
        }