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\\BAM\\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] = 0; PVar.tmpCpkData.Y[0] = 0; PVar.tmpCpkData.CC[0] = 0; PVar.tmpCpkData.A[0] = 0;//double.Parse(BVar.ProData[4, 10]); 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, 28] == "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, 28] + "," + BVar.ProData[4, 14] + "," + BVar.ProData[4, 7] + "," + BVar.ProData[4, 8] + "," + BVar.ProData[4, 9] + "," + BVar.ProData[4, 10] + "," + System.Convert.ToString(Conversion.Val(BVar.ProData[4, 11])) + "," + System.Convert.ToString(Conversion.Val(BVar.ProData[4, 12])) + "," + System.Convert.ToString(Conversion.Val(BVar.ProData[4, 13])) + "," + System.Convert.ToString(Conversion.Val(BVar.ProData[4, 14])) + "," + BVar.ProData[4, 15] + "," + BVar.ProData[4, 16] + "," + BVar.ProData[4, 17] + "," + BVar.ProData[4, 18] + "," + BVar.ProData[4, 19] + "," + BVar.ProData[4, 20] + "," + System.Convert.ToString(Conversion.Val(BVar.ProData[4, 21])); BVar.FileRorW.WriteCheckDataCsv(CheckData, fileFinalData); //向工程界面数据表格添加数据 //1:日期 2:时间 3:HSG条码 4:返回条码 5:判断结果 6:CT 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, 1], BVar.ProData[4, 1], BVar.ProData[4, 1], BVar.ProData[4, 1], BVar.ProData[4, 1], BVar.ProData[4, 1], BVar.ProData[4, 1] }; 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 (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("工程界面添加数据异常!"); } }
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 BZGUI.Frm_Par(); Frm_Parameter FrmParameter = new Frm_Parameter(); 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_MotionInit(1, 4, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\GTS400-01.cfg"); Gg.GTS_ExtmdlInit(2, (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.DirectoryPath + "\\GTS_Config\\ExtModule.cfg"); Command.Com3_Send("LMD,4SPLN,00" + ",000,000,000,000,"); //关闭所有光源 if (PVar.IsCOM3_Working == false) { AddList("光源控制器通信异常!"); ShowList("光源控制器通信异常!"); } else { AddList("光源控制器通信OK!"); } Frm_LoadProcess.Ex = "加载完成... 100%"; Application.DoEvents(); PVar.WorkMode = 0; //WriteCsvErrorCodePRE(); this.Show(); }