private void TabControl1_SelectedIndexChanged(object sender, EventArgs e) { Btn_ParBackup.Enabled = false; Btn_ParKeyboard.Enabled = false; //Btn_ParSave.Enabled = False FileLog.OperateLog("参数备份"); }
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, "提示"); } }
public void Btn_Pause_Click(object sender, EventArgs e) { if (GoHome.Instance.Reset.Result == true) { if (PVar.AutoRunFlag) { if (PVar.MacHold == true) { if (Interaction.MsgBox("确定【继续运行】吗?", (int)Constants.vbInformation + Constants.vbOKCancel, "【继续运行】") == Constants.vbCancel) { return; } PVar.IsSystemOnPauseMode = false; AddList("暂停运行已解除"); ContinuRun(); //继续运行 FileLog.OperateLog("继续运行"); } else { AddList("设备已暂停"); PVar.IsSystemOnPauseMode = true; StopRun(); //暂停运行 FileLog.OperateLog("暂停运行"); } } else { Btn_Pause.Enabled = false; } } }
private void Btn_Start_Click(object sender, EventArgs e) { if (GoHome.Instance.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.Instance.Reset.Result == true && PVar.IsLoadFrmEngineering == true) { if (PVar.AutoRunFlag == false) { if (Interaction.MsgBox("确定【是否自动运行】?", (int)Constants.vbInformation + Constants.vbOKCancel, "【自动运行】") == Constants.vbCancel) { return; } Frm_Engineering.fEngineering.TabControl1.SelectedIndex = 0; Frm_Engineering.fEngineering.Auto_Assemble(); FileLog.OperateLog("自动运行"); } else { } } }
/// <summary> /// pause /// </summary> private void On_Pause() { if (GoHome.Instance.Reset.Result && PVar.AutoRunFlag) { if (PVar.MacHold) { if (Interaction.MsgBox("确定【继续运行】吗?", (int)Constants.vbInformation + Constants.vbOKCancel, "【继续运行】") == Constants.vbCancel) { return; } PVar.IsSystemOnPauseMode = false; this.Btn_Pause.BackColor = Mycolor.None; Globals.addList("暂停运行已解除", Mycolor.None); ContinuRun(); //继续运行 FileLog.OperateLog("继续运行"); this.Btn_Start.Enabled = false; this.Btn_Stop.Enabled = true; this.Btn_Pause.Enabled = true; } else { Globals.addList("设备已暂停", Mycolor.ErrorRed); PVar.IsSystemOnPauseMode = true; this.Btn_Pause.BackColor = Mycolor.SelectedBtn; StopRun(); //暂停运行 FileLog.OperateLog("暂停运行"); this.Btn_Start.Enabled = false; this.Btn_Stop.Enabled = false; this.Btn_Pause.Enabled = true; } } }
private void Btn_ClearCount_Click(object sender, EventArgs e) { if (Interaction.MsgBox(" 确定要清零吗?", (int)MsgBoxStyle.Question + Constants.vbYesNo, "清零提示") == Constants.vbNo) { return; } Par_Clear(); FileLog.OperateLog("清除统计"); }
private void btn_ExitCPK_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模式"); } }
private void DataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { short Rowindex = (short)e.RowIndex; short ColumnIndex = (short)e.ColumnIndex; Frm_Engineering.fEngineering.Text_BlogoNo.Text = System.Convert.ToString(DataGridView1[ColumnIndex, Rowindex].Value); Frm_Engineering.fEngineering.TextM_BlogoNo.Text = System.Convert.ToString(DataGridView1[ColumnIndex, Rowindex].Value); PVar.Blogo.MaterialCnt = System.Convert.ToInt32(DataGridView1[ColumnIndex, Rowindex].Value); BVar.FileRorW.WriteINI("Material_index", "Blogo", PVar.Blogo.MaterialCnt.ToString(), PVar.PublicParPath); this.Close(); FileLog.OperateLog("选择料的索引6*2"); }
private void btn_ExitCPK_Click(object sender, EventArgs e) { if (MessageBox.Show("请确认是否【退出】CPK模式?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PVar.CPKDoneCounts = 0; //PVar.WorkMode = 0; mode = MachineModeType.Production; Panel_CPK.Visible = false; FileLog.OperateLog("退出CPK模式"); DataManager.Instance.chartData.CleanData();//清除内存中的所有数据 Globals.settingFunc.启用CPK模式 = false; Globals.settingFunc.SaveSetting(); } }
private void Btn_Start_Click(object sender, EventArgs e) { this.Btn_Start.BackColor = Mycolor.UnselectedBtn;; this.Btn_Pause.BackColor = Mycolor.None; this.Btn_Stop.BackColor = Mycolor.None; if (GoHome.Instance.Reset.Result) { if (MessageBox.Show("确定开始自动运行?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { FileLog.OperateLog("自动运行"); XTaskManager.Instance.FindTaskById((int)TasksId.Manchine).TaskStart(StationRunMode.自动准备);//first run the thread this.Btn_Start.Enabled = false; this.Btn_Stop.Enabled = true; this.Btn_Pause.Enabled = true; } } else { if (PVar.AutoRunFlag == false) { if (MessageBox.Show("确定开始复位?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (Gg.GetDi(0, Gg.InPutMMS0.紧急停止) == 1) { Globals.PostAlarmMachine(XAlarmLevel.STOP, (int)AlarmCode.急停, AlarmCategory.SYSTEM.ToString(), "急停中,复位异常结束!!"); Globals.addList("急停中,复位异常结束!!", Mycolor.ErrorRed); return; } XTaskManager.Instance.FindTaskById((int)TasksId.Manchine).TaskReset(); if (Globals.settingMachineInfo.什么机器 == WhichMachine.MMS) { XTaskManager.Instance.FindTaskById((int)TasksId.MMS测试).TaskReset(); } else { XTaskManager.Instance.FindTaskById((int)TasksId.测试).TaskReset(); } FileLog.OperateLog("初始化"); this.Btn_Start.Enabled = true; this.Btn_Stop.Enabled = false; this.Btn_Pause.Enabled = false; } } } PVar.IsSysEmcStop = false; }
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; } }
private void Button3_Click(object sender, EventArgs e) { Mod_ErrorCode.WriteCsvErrorCodeOK(); FileLog.OperateLog("ErrorCode OK"); }
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 + "*BAM*.rar"; if (System.IO.File.Exists(Filestr) != false) { System.IO.File.Copy(Filestr, PVar.FileDirectoryDes + Timestr + "\\" + "*BAM*.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 + "\\" + "*BAM*.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, "提示"); } }
private void Btn_Stop_Click(object sender, EventArgs e) { Btn_StopFun(); FileLog.OperateLog("停止按钮"); }
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_Login.fLogin.ShowDialog(); if (Temp) { 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 || PVar.Stop_Flag) { if (IsNotShow("Frm_Parameter")) { if (Frm_Parameter.fPar == null || Frm_Parameter.fPar.IsDisposed) { Frm_Parameter.fPar = new Frm_Parameter(); } Frm_Parameter.fPar.Show(this); } } else { ShowList("设备运行中,请先暂停设备!"); Btn_OpenDataFile.BZ_BackColor = Color.White; return; } } break; case "Btn_CCDSetting": //Frm_Login.fLogin.ShowDialog(); 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 (Temp) { 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); if (Frm_Laser.fPar_Laser == null || Frm_Laser.fPar_Laser.IsDisposed) { Frm_Laser.fPar_Laser = new Frm_Laser(); } Frm_Laser.fPar_Laser.Show(this); } } else { return; } } 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\\BAM\\CheckData\\" + DateTime.Now.ToString("yyyyMM")); if (System.IO.File.Exists("E:\\BZ-Data\\BAM\\CheckData\\" + DateTime.Now.ToString("yyyyMM")) == false) { System.IO.Directory.CreateDirectory("E:\\BZ-Data\\BAM\\CheckData\\" + DateTime.Now.ToString("yyyyMM")); } if (SFinal_D.Exists) { try { System.Diagnostics.Process.Start("explorer.exe", "E:\\BZ-Data\\BAM\\CheckData\\" + DateTime.Now.ToString("yyyyMM")); } catch { } } else { } break; } }