Exemplo n.º 1
0
        private void LoadFormAndSetBtBkColor(BoTech.Button bt)
        {
            this.BackColor = Color.White;
            Btn_Production.BZ_BackColor   = PVar.BZColor_UnselectedBtn;
            Btn_ParSetting.BZ_BackColor   = PVar.BZColor_UnselectedBtn;
            Btn_CCDSetting.BZ_BackColor   = PVar.BZColor_UnselectedBtn;
            Btn_RunInfo.BZ_BackColor      = PVar.BZColor_UnselectedBtn;
            Btn_AlarmHistory.BZ_BackColor = PVar.BZColor_UnselectedBtn;
            Btn_MachineInfo.BZ_BackColor  = PVar.BZColor_UnselectedBtn;

            Btn_OpenDataFile.BZ_BackColor = Color.White;
            Btn_OpenCCDFile.BZ_BackColor  = Color.White;
            Btn_Home.BZ_BackColor         = PVar.BZColor_UnselectedBtn;
            bt.BZ_BackColor = PVar.BZColor_SelectedBtn;

            switch (bt.Name)
            {
            case "Btn_Production":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (PVar.IsOpenFrmProduction == false)
                {
                    PVar.IsOpenFrmProduction = true;
                    Frm_Production.fProduction.Show(this);
                    Frm_Production.fProduction.Visible = true;
                }

                if (bt.Name == "Btn_ProductionMode")
                {
                    Btn_ProductionMode.BZ_BackColor = Color.FromArgb(179, 202, 255);
                    Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_CPKMode.BZ_BackColor        = Color.FromArgb(200, 200, 200);
                }
                break;

            case "Btn_ProductionMode":

                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (PVar.IsOpenFrmProduction == false)
                {
                    PVar.IsOpenFrmProduction = true;
                    Frm_Production.fProduction.Show(this);
                    Frm_Production.fProduction.Visible = true;
                }

                if (bt.Name == "Btn_ProductionMode")
                {
                    Btn_ProductionMode.BZ_BackColor = Color.FromArgb(179, 202, 255);
                    Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_CPKMode.BZ_BackColor        = Color.FromArgb(200, 200, 200);
                }
                break;

            case "Btn_RunInfo":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (IsNotShow("Frm_RunInfo"))
                {
                    if (Frm_RunInfo.fRunInfo == null || Frm_RunInfo.fRunInfo.IsDisposed)
                    {
                        Frm_RunInfo.fRunInfo = new Frm_RunInfo();
                    }
                    Frm_RunInfo.fRunInfo.Show(this);
                }
                break;

            case "Btn_AlarmHistory":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (IsNotShow("Frm_AlarmInfo"))
                {
                    if (Frm_AlarmInfo.fAlarmInfo == null || Frm_AlarmInfo.fAlarmInfo.IsDisposed)
                    {
                        Frm_AlarmInfo.fAlarmInfo = new Frm_AlarmInfo();
                    }
                    Frm_AlarmInfo.fAlarmInfo.Show(this);
                }
                break;

            case "Btn_MachineInfo":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (IsNotShow("Frm_MachineInfo"))
                {
                    if (Frm_MachineInfo.fMachineInfo == null || Frm_MachineInfo.fMachineInfo.IsDisposed)
                    {
                        Frm_MachineInfo.fMachineInfo = new Frm_MachineInfo();
                    }
                    Frm_MachineInfo.fMachineInfo.Show(this);
                }
                break;

            case "Btn_EngneeringMode":
                InitLoginDialog();
                PVar.sOpenTargetForm = "Frm_Engineering";
                if (bt.Name == "Btn_EngneeringMode")
                {
                    Btn_ProductionMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(179, 202, 255);
                    Btn_CPKMode.BZ_BackColor        = Color.FromArgb(200, 200, 200);
                    this.BackColor = Color.FromArgb(252, 223, 222);
                    Btn_OpenDataFile.BZ_BackColor = Color.FromArgb(252, 223, 222);
                    Btn_OpenCCDFile.BZ_BackColor  = Color.FromArgb(252, 223, 222);
                    Btn_Home.BZ_BackColor         = PVar.BZColor_SelectedBtn;
                }
                break;

            case "Btn_CPKMode":
                InitLoginDialog();
                PVar.sOpenTargetForm = "Frm_Engineering";

                if (bt.Name == "Btn_EngneeringMode" || bt.Name == "Btn_Engineering")
                {
                    Btn_ProductionMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(179, 202, 255);
                    Btn_CPKMode.BZ_BackColor        = Color.FromArgb(200, 200, 200);
                    this.BackColor = Color.FromArgb(252, 223, 222);
                    Btn_OpenDataFile.BZ_BackColor = Color.FromArgb(252, 223, 222);
                    Btn_OpenCCDFile.BZ_BackColor  = Color.FromArgb(252, 223, 222);
                    Btn_Home.BZ_BackColor         = PVar.BZColor_SelectedBtn;
                }
                if (bt.Name == "Btn_CPKMode")
                {
                    Btn_ProductionMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                    Btn_CPKMode.BZ_BackColor        = Color.FromArgb(179, 202, 255);
                    if (PVar.ParList.CheckSts[17] == false)
                    {
                        if (PVar.WorkMode == 0)
                        {
                            if (Interaction.MsgBox("请确认是否进入CPK模式?", (int)Constants.vbInformation + Constants.vbYesNo, "CPK信息") == Constants.vbYes)
                            {
                                Frm_Par.fPar.Par_Clear();
                                Panel_CPK.Visible = true;
                                PVar.WorkMode     = 1;
                                FileLog.OperateLog("进入CPK模式");
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }
                break;

            case "Btn_ParSetting":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (IsNotShow("Frm_Par"))
                {
                    if (Frm_Par.fPar == null || Frm_Par.fPar.IsDisposed)
                    {
                        Frm_Par.fPar = new Frm_Par();
                    }
                    Frm_Par.fPar.Show(this);
                }
                Frm_Par.fPar.TableLayoutPanel1.Enabled = false;
                Frm_Par.fPar.TableLayoutPanel3.Enabled = false;
                Frm_Par.fPar.TableLayoutPanel4.Enabled = false;
                Frm_Par.fPar.Btn_ParSave.Enabled       = false;

                break;

            case "Btn_CCDSetting":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (PVar.MacHold == true || PVar.Stop_Flag)
                {
                    if (IsNotShow("Frm_Par_CCD"))
                    {
                        if (Frm_Par_CCD.fPar_CCD == null || Frm_Par_CCD.fPar_CCD.IsDisposed)
                        {
                            Frm_Par_CCD.fPar_CCD = new Frm_Par_CCD();
                        }
                        Frm_Par_CCD.fPar_CCD.Show(this);
                    }
                }
                else
                {
                    ShowList("设备运行中,请先暂停设备!");
                    Btn_OpenDataFile.BZ_BackColor = Color.White;
                    return;
                }
                break;

            case "Btn_Home":
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl2.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl3.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl4.SelectedIndex = 0;
                Frm_Engineering.fEngineering.TabControl5.SelectedIndex = 0;
                if (IsNotShow("Frm_Main"))
                {
                }
                Btn_ProductionMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                Btn_EngneeringMode.BZ_BackColor = Color.FromArgb(200, 200, 200);
                Btn_CPKMode.BZ_BackColor        = Color.FromArgb(200, 200, 200);
                break;

            case "Btn_OpenCCDFile":
                if (System.IO.File.Exists(PVar.BZ_CCD_ImagePath) == false)
                {
                    System.IO.Directory.CreateDirectory(PVar.BZ_CCD_ImagePath);
                }
                System.IO.DirectoryInfo SFile = new System.IO.DirectoryInfo(PVar.BZ_CCD_ImagePath);
                if (SFile.Exists)
                {
                    try
                    {
                        System.Diagnostics.Process.Start("explorer.exe", PVar.BZ_CCD_ImagePath);
                    }
                    catch { }
                }
                else
                {
                }
                break;

            case "Btn_OpenDataFile":
                System.IO.DirectoryInfo SFinal_D = new System.IO.DirectoryInfo("E:\\BZ-Data\\DAB\\CheckData\\" + DateTime.Now.ToString("yyyyMM"));
                if (System.IO.File.Exists("E:\\BZ-Data\\DAB\\CheckData\\" + DateTime.Now.ToString("yyyyMM")) == false)
                {
                    System.IO.Directory.CreateDirectory("E:\\BZ-Data\\DAB\\CheckData\\" + DateTime.Now.ToString("yyyyMM"));
                }

                if (SFinal_D.Exists)
                {
                    try
                    {
                        System.Diagnostics.Process.Start("explorer.exe", "E:\\BZ-Data\\DAB\\CheckData\\" + DateTime.Now.ToString("yyyyMM"));
                    }
                    catch { }
                }
                else
                {
                }
                break;
            }
        }
Exemplo n.º 2
0
        public void Btn_Pause_Click(object sender, EventArgs e)
        {
            if (GoHome.Reset.Result == true)
            {
                //if ((PVar.Sta_Work[0].Step > 10 && PVar.Sta_Work[0].Step < 500) || PVar.Sta_Work[1].Step > 10 || PVar.Sta_Work[2].Step > 10 || PVar.Sta_Work[3].Step > 10 || PVar.Sta_Work[4].Step > 10)   //PVar.AutoRunFlag
                //{

                if (PVar.MacHold == true)
                {
                    if (Interaction.MsgBox("确定【继续运行】吗?", (int)Constants.vbInformation + Constants.vbOKCancel, "【继续运行】") == Constants.vbCancel)
                    {
                        return;
                    }
                    if (Gg.GetDi(0, Gg.InPut0.机械手准备好) == 0)
                    {
                        ShowList("安全光幕被触发!");
                        return;
                    }


                    if (PVar.ParList.CheckSts[1])
                    {
                        string tempStr = "";
                        if (Gg.GetDi(0, Gg.InPut0.安全门) == 0)
                        {
                            tempStr = "安全门";
                        }

                        if (!string.IsNullOrEmpty(tempStr))
                        {
                            AddList("请关闭" + tempStr + "!");
                            ShowList("请关闭" + tempStr + "!");
                            return;
                        }
                    }

                    PVar.IsSystemOnPauseMode = false;
                    AddList("暂停运行已解除");
                    if ((PVar.Sta_Work[0].Step > 10 && PVar.Sta_Work[0].Step < 500) || PVar.Sta_Work[1].Step > 10 || PVar.Sta_Work[2].Step > 10 || PVar.Sta_Work[3].Step > 10 || PVar.Sta_Work[4].Step > 10) //PVar.AutoRunFlag
                    {
                        ContinuRun();                                                                                                                                                                        //继续运行
                        FileLog.OperateLog("继续运行");
                    }
                    else
                    {
                        PVar.MacHold           = false;
                        Btn_Pause.BZ_BackColor = PVar.BZColor_UnselectedBtn;
                        Btn_Pause.Enabled      = false;
                    }
                }
                else
                {
                    AddList("设备已暂停");
                    PVar.IsSystemOnPauseMode = true;
                    StopRun(); //暂停运行
                    FileLog.OperateLog("暂停运行");
                }
                //}
                //else
                //{
                //    //Btn_Pause.Enabled = false;
                //}
            }
        }
Exemplo n.º 3
0
 private void Btn_Stop_Click(object sender, EventArgs e)
 {
     Btn_StopFun();
     FileLog.OperateLog("停止按钮");
 }