示例#1
0
 public Main_From()
 {
     InitializeComponent();
     string Url = AH.ReadConfig("appSettings", "NetCheck");
     IsInOANet IsOANet = new IsInOANet();
     if (IsOANet.IsCanConnect(Url))
     {
         this.FormClosed += new FormClosedEventHandler(Main_From_FormClosed);
         
         //this.label1.Text = AH.ReadConfig("appSettings", "connectionstring");
         string CmdText = AH.ReadConfig("appSettings", "Data_for_Product");
         DataSet ds = new DataSet();
         ds = Func.DBbind(CmdText);
         // ds = Func.DBbind("select '甲' as name,50 as value union all select '乙',60 union all select '丙',70 union all select '丁',80");
         Func.DrawingChart("HPIMES 生產出貨即時報表(未來3天)", this.panel1, ds, ChartType.Histogram, 0, 100, 10, "");
         this.dataGridView1.DataSource = ds.Tables[0];
         for (int i = 0; i < 10; i++)
         {
             this.dataGridView1.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
         }
     }
     else
     {
         MessageBox.Show("無法連接到OA 網絡請檢查網絡連接","系統提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
         this.Close();
     }
 }
示例#2
0
        public void Input_Output_Load(object sender, EventArgs ex)
        {
            IsInOANet IsOANet = new IsInOANet();
            string Url = AH.ReadConfig("appSettings", "NetCheck");
            if (IsOANet.IsCanConnect(Url))
            {

                Form_Reflash();
                ContextMenuStrip docMenu = new ContextMenuStrip();
                ToolStripMenuItem ExitLable = new ToolStripMenuItem();
                ExitLable.Text = "刷新";
                ExitLable.Click += new EventHandler(Reflash_Click);
                docMenu.Items.AddRange(new ToolStripMenuItem[] { ExitLable });
                this.ContextMenuStrip = docMenu;
            }
            else
            {
                MessageBox.Show("無法連接到OA 網絡請檢查網絡連接", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
示例#3
0
 public QC_Reports()
 {
     InitializeComponent();
     AppHelper AH = new AppHelper();
    
                 IsInOANet IsOANet = new IsInOANet();
     string Url = AH.ReadConfig("appSettings", "NetCheck");
     if (IsOANet.IsCanConnect(Url))
     {
         string CamText = AH.ReadConfig("appSettings", "Data_for_QCReports");
         DataSet ds = new DataSet();
         ds = Func.DBbind(CamText);
         // ds = Func.DBbind("select '甲' as name,50 as value union all select '乙',60 union all select '丙',70 union all select '丁',80");
         Func.DrawingChart("品質不良報表", this.panel1, ds, ChartType.Histogram, 0, 100, 10, "");
     }
     else
     {
         MessageBox.Show("無法連接到OA 網絡請檢查網絡連接", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
示例#4
0
void WorkDoneHandler_forNet()
{
    //Do something other.
    //Change_Message();
    while (true)
    {
        try
        {
            Thread.Sleep(5000);
            try
            {
               IsInOANet IsOANet = new IsInOANet();
                            string Url = AH.ReadConfig("appSettings", "NetCheck");
                            if (IsOANet.IsCanConnect(Url))
                            {
                               
                                if (t1 != null)
                                {
                                    //MessageBox.Show(t1.ThreadState.ToString());
                                    if (t1.ThreadState.ToString().IndexOf("Suspended")>1)
                                       t1.Resume();
                                }
                                else
                                {
                                    Change_Message();
                                }
                                t3.Suspend();
                            }

            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString());
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

}
示例#5
0
       void Change_Message()
        {

                //Change_Show("出货达成率", "100%");
                delayTime(1);
                try
                {
   
                              IsInOANet IsOANet = new IsInOANet();
                            string Url = AH.ReadConfig("appSettings", "NetCheck");
                            if (IsOANet.IsCanConnect(Url))
                            {
                                string ComStr = "";
                                string ConStr = AH.ReadConfig("appSettings", "connectionstring");
                                if (Flag == "1")
                                {
                                    ComStr = AH.ReadConfig("appSettings", "Data_for_Delivery");
                                    if (AH.ReadConfig("appSettings", "Data_for_QC") != "")
                                    {
                                        Flag = "2";
                                    }
                                    else if (AH.ReadConfig("appSettings", "Data_for_WIP") != "")
                                    {
                                        Flag = "3";
                                    }
                                    else if (AH.ReadConfig("appSettings", "Data_for_Input") != "")
                                    {
                                        Flag = "4";
                                    }
                                }
                                else if (Flag == "2")
                                {
                                    ComStr = AH.ReadConfig("appSettings", "Data_for_QC");
                                    if (AH.ReadConfig("appSettings", "Data_for_WIP") != "")
                                    {
                                        Flag = "3";
                                    }
                                    else if (AH.ReadConfig("appSettings", "Data_for_Input") != "")
                                    {
                                        Flag = "4";
                                    }
                                    else
                                    {
                                        Flag = "1";
                                    }

                                }
                                else if (Flag == "3")
                                {
                                    ComStr = AH.ReadConfig("appSettings", "Data_for_WIP");

                                    if (AH.ReadConfig("appSettings", "Data_for_Input") != "")
                                    {
                                        Flag = "4";
                                    }
                                    else { Flag = "1"; }
                                }
                                else if (Flag == "4")
                                {
                                    ComStr = AH.ReadConfig("appSettings", "Data_for_Input");
                                    Flag = "1";
                                }

                                string[] resultStrSp = StrSp.StringSprint(ConStr, ComStr, "^");
                                Application.DoEvents();
                                string Rate = "";
                                string Title = "";
                                //Rate = (float.Parse(resultStrSp[0]) * 10).ToString() + "%";

                                Rate = resultStrSp[0].ToString() + "%";
                                if (resultStrSp[0].ToString() == "No Data")
                                {
                                    //MessageBox.Show(resultStrSp[0].ToString());
                                    Change_Show("No Data", "    0");
                                }
                                //Rate = (1 * 10).ToString() + "%";
                                else
                                {
                                    Title = resultStrSp[1];
                                    Change_Show(Title, Rate);
                                }
                            }
                            else
                            {
                                Change_Show("未連到IMESDB", "0");
                                //this.L_Title.Text = "未連到IMESDB";
                                //this.L_Rate.Text = "0";
                                MessageBox.Show("無法連接到OA 網絡請檢查網絡連接", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                if (t1 != null)
                                {
                                    if (t3 != null)
                                    {
                                        if (!t3.IsAlive)
                                            t3.Start();
                                        if (t3.ThreadState.ToString().IndexOf("Suspended") > 1)
                                            t3.Resume();
                                    }
                                    else
                                    {
                                        WorkDone callBack = new WorkDone(WorkDoneHandler_forNet);
                                        Working_3(callBack);
                                    }
                                    t1.Suspend();
                                }
                                else
                                {
                                    if (t3 != null)
                                    {
                                        if (!t3.IsAlive)
                                            t3.Start();
                                        if (t3.ThreadState.ToString().IndexOf("Suspended") > 1)
                                            t3.Resume();
                                    }
                                    else
                                    {
                                        WorkDone callBack = new WorkDone(WorkDoneHandler_forNet);
                                        Working_3(callBack);
                                    }
                                }

                                    
                              
                            }

                }
                catch(Exception e)
                {
                    MessageBox.Show(e.ToString());
                }
               
               // Change_Show("出货达成率", "90%");


        }