private void Frm_load_Tick() { Frm_LoadProcess.Ex = "正在加载参数配置文件... 10%"; Application.DoEvents(); PVar.ReDimSpassWord(); //定义用户 Frm_Engineering.fEngineering.DataGridView_par.RowCount = 12; ArrayInit(); //数组重新定义 for (short i = 0; i <= 99; i++) { PVar.BarcodeArrayList[i] = BVar.FileRorW.ReadINI((i).ToString(), "SN", "", PVar.ListDataIniPath); } Frm_Engineering.ReadParAxis(PVar.ParAxisPath, PVar.ParAxis);//读取机械参数 Frm_Par FrmPar = new DAB.Frm_Par(); FrmPar.Par_Normal("Read"); //加载参数界面参数 if (!PVar.IsReadParData) { if (Interaction.MsgBox("ReadParData()函数读取数据失败,程序拒绝加载!", Constants.vbExclamation, "重要参数文件") == Constants.vbOK) { ProjectData.EndApp(); } } mFunction.ReDimData(); mFunction.ReadPosData(PVar.BZ_ParameterPath + "\\PosData.dat", mFunction.Pos); if (!PVar.IsReadPosData) { if (Interaction.MsgBox("ReadPosData()函数读取数据失败,程序拒绝加载!", Constants.vbExclamation, "重要参数文件") == Constants.vbOK) { ProjectData.EndApp(); } } Frm_LoadProcess.Ex = "正在初始化工程界面... 70%"; Application.DoEvents(); MainUserNameDisplay(); //新用户添加到主界面 if (MainUserName.Items.Count <= 0) { PVar.Login.NewGroup[1] = "Engineering"; PVar.Login.NewUser[0] = "Engineering"; PVar.Login.NewPassword[0] = "BZ"; PVar.Login.NewUserAuthority[0] = 2; MainUserName.Items.Add(PVar.Login.NewUser[0]); Frm_Login.fLogin.MainUserName.Items.Add(PVar.Login.NewUser[0]); FileRw.WriteDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login); } PVar.LampStatus = 10; Btn_Stop.BZ_BackColor = PVar.BZColor_SelectedEndBtn; Frm_Engineering.fEngineering.Show(this); Frm_Engineering.fEngineering.Visible = false; Frm_Production FrmProduction = new Frm_Production(); FrmProduction.Show(this); Frm_Production.fProduction.Visible = false; Btn_Pause.Enabled = false; Btn_Stop.Enabled = false; PVar.IsOpenFrmEngineering = false; PVar.IsOpenFrmProduction = false; Frm_Engineering.fEngineering.TestDataGridInit(); //加载表格数据 Frm_LoadProcess.Ex = "正在初始化运动控制卡... 95%"; Application.DoEvents(); Gg.GTS_MotionInit(0, 8, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\GTS800-00.cfg"); Gg.GTS_ExtmdlInit(1, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\ExtModule.cfg"); Command.Com3_Send("LMD,4SPLN,00" + ",000,000,000,000,"); //关闭所有光源 Frm_LoadProcess.Ex = "加载完成... 100%"; Application.DoEvents(); PVar.WorkMode = 0; //WriteCsvErrorCodePRE(); this.Show(); }
public Frm_Production() { InitializeComponent(); fProduction = this; }
public static void Write_FinalData() { TimeOut = API.GetTickCount(); System.EventArgs Write_FinalData_e = default(System.EventArgs); string fileFinalData = "E:\\BZ-Data\\DAB\\CheckData\\" + DateTime.Now.ToString("yyyyMM") + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".csv"; if (BVar.ProData[4, 30] == "OK") { PVar.OKCounts++; } else { PVar.NGCounts++; } PVar.ProductCounts++; Frm_Engineering.fEngineering.Product_Num.Text = System.Convert.ToString(PVar.ProductCounts); BVar.FileRorW.WriteINI("Product", "Counts", Convert.ToString(PVar.ProductCounts), PVar.BZ_YieldDataFileName); BVar.FileRorW.WriteINI("Product", "OKCounts", Convert.ToString(PVar.OKCounts), PVar.BZ_YieldDataFileName); BVar.FileRorW.WriteINI("Product", "NGCounts", Convert.ToString(PVar.NGCounts), PVar.BZ_YieldDataFileName); Frm_Production.ExchangeCpkData(); PVar.tmpCpkData.X[0] = Convert.ToDouble(BVar.ProData[4, 26]); PVar.tmpCpkData.Y[0] = Convert.ToDouble(BVar.ProData[4, 27]); PVar.tmpCpkData.CC[0] = Convert.ToDouble(BVar.ProData[4, 29]); PVar.tmpCpkData.A[0] = Convert.ToDouble(BVar.ProData[4, 28]); PVar.tmpCpkData.ProTime[0] = DateTime.Now; Frm_Production.fProduction.Cpk_X_Click(Frm_Production.fProduction.Cpk_X, Write_FinalData_e); Frm_Production.fProduction.BTN_X_Click(Frm_Production.fProduction.BTN_X, Write_FinalData_e); BVar.FileRorW.WriteDAT(PVar.tmpCpkData, PVar.BZ_CPKDataFilePath); PVar.TotalLifeCycles++; Frm_MachineInfo.fMachineInfo.Label_TotalLifeCycle.Text = Convert.ToString(PVar.TotalLifeCycles); BVar.FileRorW.WriteINI("Product", "TotalLifeCycles", Convert.ToString(PVar.TotalLifeCycles), PVar.BZ_YieldDataFileName); if (BVar.ProData[4, 30] == "NG") { PVar.TotalLifeRejects++; } Frm_MachineInfo.fMachineInfo.Label_TotalLifeRejects.Text = Convert.ToString(PVar.TotalLifeRejects); BVar.FileRorW.WriteINI("Product", "TotalLifeRejects", Convert.ToString(PVar.TotalLifeRejects), PVar.BZ_YieldDataFileName); Frm_Production.fProduction.UPH.BZ_BigText = Convert.ToString(Frm_Production.fProduction.CalculateUPH()); Frm_Production.fProduction.CalculateYield(); CheckData = DateTime.Now.ToString("yyyy/MM/dd") + "," + Convert.ToString(DateAndTime.TimeOfDay.TimeOfDay) + "," + BVar.ProData[4, 1] + "," + BVar.ProData[4, 2] + "," + BVar.ProData[4, 3] + "," + BVar.ProData[4, 7] + "," + BVar.ProData[4, 30] + "," + BVar.ProData[4, 26] + "," + BVar.ProData[4, 27] + "," + BVar.ProData[4, 29] + "," + BVar.ProData[4, 28] + "," + BVar.ProData[4, 4] + "," + BVar.ProData[4, 5] + "," + BVar.ProData[4, 6] + "," + CCD_Vale[2].Up + "," + CCD_Vale[2].Down + "," + CCD_Vale[2].Left + "," + CCD_Vale[2].Right; BVar.FileRorW.WriteCheckDataCsv(CheckData, fileFinalData); PVar.DataCount++; //数据计数 PVar.DataCount = PVar.DataCount % 100; BVar.FileRorW.WriteINI("Data100Count", "Count", System.Convert.ToString(PVar.DataCount), PVar.ListDataIniPath); //向工程界面数据表格添加数据 //1:日期 2:时间 3:载具号 4:产品颜色 5:周期时间 6:结果 7:X值 8:Y值 9:角度 10:同心度 ShowData = new[] { DateTime.Now.ToString("yyyy/MM/dd"), Convert.ToString(DateAndTime.TimeOfDay.TimeOfDay), BVar.ProData[4, 1], BVar.ProData[4, 2], BVar.ProData[4, 3], BVar.ProData[4, 30], BVar.ProData[4, 26], BVar.ProData[4, 27], BVar.ProData[4, 29], BVar.ProData[4, 28] }; for (int col = 1; col <= PVar.DataGrid_CheckDataHeadName.Length; col++) { BVar.FileRorW.WriteINI(PVar.DataCount.ToString(), PVar.DataGrid_CheckDataHeadName[col - 1], ShowData[col - 1], PVar.ListDataIniPath); //:FunctionSub.Grid_TestData_Show(Frm_Engineering.fEngineering.DataGrid_CheckData, Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1, col - 1, BVar.ProData[4, 30]); } try { Frm_Engineering.fEngineering.DataGrid_CheckData.Rows.Add(ShowData); Frm_Engineering.fEngineering.DataGrid_CheckData.FirstDisplayedScrollingRowIndex = Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1; Frm_Engineering.fEngineering.DataGrid_CheckData.CurrentCell = Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[0]; Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Selected = true; //:更新数据界面背景颜色 if (Convert.ToString(Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[5].Value) == "NG") { Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[5].Style.ForeColor = Color.Red; Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[5].Style.BackColor = Color.FromArgb(175, 218, 150); } else { Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[5].Style.ForeColor = Color.Black; Frm_Engineering.fEngineering.DataGrid_CheckData.Rows[Frm_Engineering.fEngineering.DataGrid_CheckData.RowCount - 1].Cells[5].Style.BackColor = Color.White; } //:判断界面数据是否增加新的一行 if (Frm_Engineering.fEngineering.DataGrid_CheckData.Rows.Count >= 100) { Frm_Engineering.fEngineering.DataGrid_CheckData.Rows.RemoveAt(0); } int TimeOut1 = 0; TimeOut1 = API.GetTickCount() - TimeOut; } catch (Exception) { ShowList("工程界面添加数据异常!"); } }