Ejemplo n.º 1
0
 private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     Btn_ParBackup.Enabled   = false;
     Btn_ParKeyboard.Enabled = false;
     //Btn_ParSave.Enabled = false;
     FileLog.OperateLog("参数备份");
 }
Ejemplo n.º 2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     string[] ERRData = new string[3];
     try
     {
         if (RadioButton1.Checked == true)
         {
             ERRData    = Strings.Split(Com_ErrorCode1.Text, ",");
             ERRData[0] = ERRData[0].Replace("\u0022", ""); //把字符串双引号替换掉
             ERRData[1] = ERRData[1].Replace("\u0022", "");
             Mod_ErrorCode.WriteErrorCode(ERRData[0], int.Parse(ERRData[1]));
             FileLog.OperateLog("ErrorCode测试");
         }
         else if (RadioButton2.Checked == true)
         {
             ERRData    = Strings.Split(Com_ErrorCode2.Text, ",");
             ERRData[0] = ERRData[0].Replace("\u0022", "");
             ERRData[1] = ERRData[1].Replace("\u0022", "");
             Mod_ErrorCode.WriteErrorCode(ERRData[0], int.Parse(ERRData[1]));
             FileLog.OperateLog("ErrorCode测试");
         }
         else
         {
             Interaction.MsgBox("-->请选择测试项", (int)MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "提示");
         }
     }
     catch (Exception)
     {
         Interaction.MsgBox("-->请选择测试项", (int)MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "提示");
     }
 }
Ejemplo n.º 3
0
        private void Btn_Start_Click(object sender, EventArgs e)
        {
            if (GoHome.Reset.Result == false && PVar.IsLoadFrmEngineering == true)
            {
                if (Interaction.MsgBox("确定【是否初始化】?", (int)Constants.vbInformation + Constants.vbOKCancel, "【初始化】") == Constants.vbCancel)
                {
                    return;
                }
                FileLog.OperateLog("初始化");
                Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                Frm_Engineering.fEngineering.MacReset();
            }
            else if (GoHome.Reset.Result == true && PVar.IsLoadFrmEngineering == true)
            {
                if (PVar.AutoRunFlag == false)
                {
                    if (PVar.IsOpenFrmManual)
                    {
                        AddList("手动调试界面打开中…请先关闭!");
                        ShowList("手动调试界面打开中…请先关闭!");
                        Frm_Main.fMain.Btn_Start.Enabled = true;
                        return;
                    }
                    if (PVar.ParList.CheckSts[17])
                    {
                        string strin = "";
                        strin = Interaction.InputBox("\r\n" + "\r\n" + "\r\n" + "提示:即将空跑,密码1234,取消则不空跑!" + "\r\n" + "\r\n" + "-->请输入空跑密码:", "◆权限◆");

                        if (strin.Length > 0)
                        {
                            if (strin == "1234")
                            {
                                if (Interaction.MsgBox("确定【是否自动运行】?", (int)Constants.vbInformation + Constants.vbOKCancel, "【自动运行】") == Constants.vbCancel)
                                {
                                    return;
                                }
                            }
                            else
                            {
                                Interaction.MsgBox("     密码错误!", Constants.vbOKOnly, "提示");
                                return;
                            }
                        }
                        else
                        {
                            //AddList("取消开始空跑!");
                            //ShowList("取消开始空跑!");
                            return;
                        }
                    }

                    Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0;
                    Frm_Engineering.fEngineering.Auto_Assemble();
                    FileLog.OperateLog("自动运行");
                }
                else
                {
                }
            }
        }
Ejemplo n.º 4
0
 private void Btn_ClearCount_Click(object sender, EventArgs e)
 {
     if (Interaction.MsgBox("    确定要清零吗?", (int)MsgBoxStyle.Question + Constants.vbYesNo, "清零提示") == Constants.vbNo)
     {
         return;
     }
     Par_Clear();
     FileLog.OperateLog("清除统计");
 }
Ejemplo n.º 5
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (Interaction.MsgBox("请确认是否【退出】CPK模式?", (int)Constants.vbInformation + Constants.vbYesNo, "CPK信息") == Constants.vbYes)
     {
         PVar.CPKDoneCounts = 0;
         PVar.WorkMode      = 0;
         Panel_CPK.Visible  = false;
         FileLog.OperateLog("退出CPK模式");
     }
 }
Ejemplo n.º 6
0
        private void Btn_ParSave_Click(object sender, EventArgs e)
        {
            if (CheeckPar() == false)
            {
                Par_Normal("Read");
                FileLog.OperateLog("保存参数按钮,失败");
                return;
            }

            Par_Normal("Write");
            FileLog.OperateLog("保存参数按钮,成功");
            TableLayoutPanel1.Enabled = false;
            TableLayoutPanel3.Enabled = false;
            TableLayoutPanel4.Enabled = false;
            Par_Normal("Read");
            FunctionSub.Init_Serial1(); //重新加载串口
            FunctionSub.Init_Serial2(); //重新加载串口
            FunctionSub.Init_Serial3(); //重新加载串口

            if (Interaction.MsgBox("参数保存OK!", Constants.vbOKOnly, "提示") == Constants.vbOK)
            {
                return;
            }
        }
Ejemplo n.º 7
0
 private void Button3_Click(object sender, EventArgs e)
 {
     Mod_ErrorCode.WriteCsvErrorCodeOK();
     FileLog.OperateLog("ErrorCode OK");
 }
Ejemplo n.º 8
0
        private void Btn_UpadeSoft_Click(object sender, EventArgs e)
        {
            string Timestr = "";
            string Filestr = "";

            Btn_UpadeSoft.Enabled = false;
            Btn_UpadeSoft.Text    = "网络链接中";
            FileLog.OperateLog("Mini下载软件");
            try
            {
                Frm_Engineering.fEngineering.Tcp_PDCA.StopConnect(); //关闭PDCA
                WinAPI.Wait(100);
                if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart == false)
                {
                    Frm_Engineering.fEngineering.Tcp_PDCA.StartConnect(); //PDCA网络链接
                    WinAPI.Wait(2000);
                }

                if (Frm_Engineering.fEngineering.Tcp_PDCA.IsStart == false)
                {
                    Btn_UpadeSoft.Enabled = true;
                    Btn_UpadeSoft.Text    = "Mini下载软件";
                    Interaction.MsgBox("网络未连接", (int)MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "提示");
                    return;
                }

                Timestr = DateTime.Now.ToString("yyyyMMddHHmmss");
                System.IO.Directory.CreateDirectory(PVar.FileDirectoryDes + Timestr);

                Filestr = PVar.FileDirectorySrc + "*DAB*.rar";
                if (System.IO.File.Exists(Filestr) != false)
                {
                    System.IO.File.Copy(Filestr, PVar.FileDirectoryDes + Timestr + "\\" + "*DAB*.rar", true);
                    Btn_UpadeSoft_Click_UpdatetTime = System.Convert.ToDouble(API.GetTickCount());
                }
                else
                {
                    Interaction.MsgBox("目标源文件不存在", MsgBoxStyle.OkOnly, null);
                    Btn_UpadeSoft.Text    = "Mini下载软件";
                    Btn_UpadeSoft.Enabled = true;
                    return;
                }
                Btn_UpadeSoft.Text = "正在下载中";
                do
                {
                    if (Btn_UpadeSoft_Click_UpdatetTime - API.GetTickCount() > 10000)
                    {
                        Interaction.MsgBox("下载不成功", MsgBoxStyle.OkOnly, null);
                        Btn_UpadeSoft.Enabled = true;
                        Btn_UpadeSoft.Text    = "Mini下载软件";
                        return;
                    }
                    Application.DoEvents();
                } while (!(File.Exists(PVar.FileDirectoryDes + Timestr + "\\" + "*DAB*.rar")));

                Interaction.MsgBox("下载成功", MsgBoxStyle.OkOnly, null);
            }
            catch (Exception ex)
            {
                Btn_UpadeSoft.Enabled = true;
                Btn_UpadeSoft.Text    = "Mini下载软件";
                Interaction.MsgBox(ex.Message, (int)MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "提示");
            }
        }
Ejemplo n.º 9
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;
                //}
            }
        }
Ejemplo n.º 10
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;
            }
        }
Ejemplo n.º 11
0
 private void Btn_Stop_Click(object sender, EventArgs e)
 {
     Btn_StopFun();
     FileLog.OperateLog("停止按钮");
 }