private void Stop_Click(object sender, EventArgs e) { try { this.ExitlistViewEx.Items[m_CurrentItemIndex].BackColor = Color.White; this.ExitlistViewEx.Items[m_CurrentItemIndex].Font = new Font("宋体", 9, FontStyle.Regular);//ChengSk if (GlobalDataInterface.global_IsTestMode) { stVolveTest stop_VolveTest = new stVolveTest(true); //停止电磁阀测试 if (this.chkSidebySideTest.Checked) //Modify by ChengSk - 20190726 { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_ALL_LANE_VOLVE, stop_VolveTest); } else { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, stop_VolveTest); } } m_CurrentItemIndex = -1; m_IsVolveTesting = false; } catch (Exception ex) { Trace.WriteLine("VolveTestFormExit中函数Stop_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数Stop_Click出错" + ex); #endif } }
/// <summary> /// 开始/停止捕捉按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Capturedbutton_Click(object sender, EventArgs e) { try { m_IsWaveCapturing = !m_IsWaveCapturing; if (m_IsWaveCapturing) { this.Capturedbutton.Text = m_resourceManager.GetString("Capturedbutton.Text"); this.WaveCapturehScrollBar.Enabled = false; this.WaveCapturehScrollBar.Value = this.WaveCapturehScrollBar.Maximum; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_ON, null);//关闭波形捕捉 } } else { this.Capturedbutton.Text = m_resourceManager.GetString("StartCapturedlabel.Text"); this.WaveCapturehScrollBar.Enabled = true; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_OFF, null);//关闭波形捕捉 } } } catch (Exception ex) { Trace.WriteLine("WaveCaptureForm中函数Capturedbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("WaveCaptureForm中函数Capturedbutton_Click出错" + ex); #endif } }
/// <summary> /// 波形捕捉窗口关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WaveCaptureForm_FormClosing(object sender, FormClosingEventArgs e) { if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_OFF, null);//关闭波形捕捉 } }
/// <summary> /// 开始烧写 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Startbutton_Click(object sender, EventArgs e) { try { byte[] data = new byte[m_file.Length + sizeof(int)];//下传参数 byte[] datalength = new byte[sizeof(int)]; if (this.DataLenghthnumericUpDown.Text == "0") { //MessageBox.Show("0x30001032 Please input the data length!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("0x30001032 " + LanguageContainer.BootFlashBurnFormMessagebox1Text[GlobalDataInterface.selectLanguageIndex], LanguageContainer.BootFlashBurnFormMessageboxInformationCaption[GlobalDataInterface.selectLanguageIndex], MessageBoxButtons.OK, MessageBoxIcon.Information); return; } datalength = BitConverter.GetBytes(int.Parse(this.DataLenghthnumericUpDown.Text)); Array.Copy(datalength, 0, data, 0, datalength.Length); Array.Copy(m_FileData, 0, data, datalength.Length - 1, m_FileData.Length); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(Common.Commonfunction.EncodeSubsys(0), (int)HC_FSM_COMMAND_TYPE.HC_CMD_BOOT_FLASH_BURN, data);//只给16发送 } this.Startbutton.Enabled = false; } catch (Exception ex) { Trace.WriteLine("BootFlashBurnForm中函数Startbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("BootFlashBurnForm中函数Startbutton_Click出错" + ex); #endif } }
private void WaveCaptureForm_Load(object sender, EventArgs e) { try { this.WaveCapturehScrollBar.Enabled = false;//波形捕捉时不许查看之前数据 m_fTransRatio = (float)this.WeightWavepictureBox.Height / (4096.0f * 2.0f); this.WaveCapturehScrollBar.Value = this.WaveCapturehScrollBar.Maximum; lock (this) { GlobalDataInterface.globalIn_wavelist.Clear(); } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_ON, null);//开启波形捕捉 } this.IntervaltextBox1.Text = m_waveInterval[0].ToString(); this.IntervaltextBox2.Text = m_waveInterval[1].ToString(); } catch (Exception ex) { Trace.WriteLine("WaveCaptureForm中函数WaveCaptureForm_Load出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("WaveCaptureForm中函数WaveCaptureForm_Load出错" + ex); #endif } }
/// <summary> /// 窗口关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VolveTestForm_FormClosed(object sender, FormClosedEventArgs e) { try { //if (m_ChannelcomboBoxSelectedIndex >= 0) //{ // if (this.StartTestbutton.Text == m_resourceManager.GetString("StopTestlabel.Text")) // { // if (GlobalDataInterface.global_IsTestMode) // { // stVolveTest VolveTest = new stVolveTest(true);//电磁阀测试参数 // VolveTest.ExitId = 255; // GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); // } // //this.StartTestbutton.Text = "开始测试"; // } //} if (GlobalDataInterface.global_IsTestMode) //Modify by ChengSk - 20180704 { stVolveTest VolveTest = new stVolveTest(true); //电磁阀测试参数 VolveTest.ExitId = 255; GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); } } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数VolveTestForm_FormClosed出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数VolveTestForm_FormClosed出错" + ex); #endif } }
private void ChannelSeleccomboBox_SelectionChangeCommitted(object sender, EventArgs e) { try { ComboBox combobox = (ComboBox)sender; if (m_ChannelSeleccomboBoxSelectedIndex != combobox.SelectedIndex) { if (m_VolveTest.ExitId != 255) { if (m_VolveTest.ExitId <= 100) { this.ExitlistViewEx.Items[m_VolveTest.ExitId].BackColor = Color.White; } m_VolveTest.ExitId = 255; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, m_VolveTest); } m_IsVolveTesting = false; } SetExitlistViewEx(); m_ChannelSeleccomboBoxSelectedIndex = combobox.SelectedIndex; } } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数ChannelSeleccomboBox_SelectionChangeCommitted出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数ChannelSeleccomboBox_SelectionChangeCommitted出错" + ex); #endif } }
/// <summary> /// 通道选择改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChannelcomboBox_SelectedIndexChanged(object sender, EventArgs e) { try { //if (m_ChannelcomboBoxClick && m_ChannelcomboBoxSelectedIndex >= 0) if (m_ChannelcomboBoxSelectedIndex >= 0) //Modify by ChengSk - 20191104 { if (this.StartTestbutton.Text == m_resourceManager.GetString("StopTestlabel.Text")) { if (GlobalDataInterface.global_IsTestMode) { stVolveTest VolveTest = new stVolveTest(true);//电磁阀测试参数 VolveTest.ExitId = 255; GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); } this.StartTestbutton.Text = m_resourceManager.GetString("StartTestbutton.Text"); } m_ChannelcomboBoxSelectedIndex = this.ChannelcomboBox.SelectedIndex; //m_ChannelcomboBoxClick = false; } } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数ChannelcomboBox_SelectedIndexChanged出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数ChannelcomboBox_SelectedIndexChanged出错" + ex); #endif } }
/// <summary> /// 果杯测试按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Testbutton_Click(object sender, EventArgs e) { try { if (this.Testbutton.Text == m_resourceManager.GetString("Testbutton.Text")) { this.Testbutton.Text = m_resourceManager.GetString("StopTestlabel.Text"); this.Infolabel.Text = m_resourceManager.GetString("TestInfolabel.Text"); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_CUP_ON, null); } } else { this.Testbutton.Text = m_resourceManager.GetString("Testbutton.Text"); this.Infolabel.Text = m_resourceManager.GetString("PrepareInfolabel.Text"); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_CUP_OFF, null); } } } catch (Exception ex) { Trace.WriteLine("TestCupForm中函数Testbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("TestCupForm中函数Testbutton_Click出错" + ex); #endif } }
/// <summary> /// 颜色参数设置子界面快捷键事件 /// </summary> /// <param name="selectchannelNo"></param> private void TabControlSelectedIndex0Event(int selectchannelNo) { int SelectChannelNo = selectchannelNo; if (SelectChannelNo > 0 && SelectChannelNo <= ChannelNum) { try { m_CurrentChannelIndex = SelectChannelNo - 1; if (GlobalDataInterface.nVer == 1) { m_CurrentIPM_ID = m_ChanelIDList[m_CurrentChannelIndex]; } else if (GlobalDataInterface.nVer == 0) { m_CurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_ChanelIDList[m_CurrentChannelIndex]), Commonfunction.GetIPMIndex(m_ChanelIDList[m_CurrentChannelIndex])); } //m_CurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_ChanelIDList[m_CurrentChannelIndex]), Commonfunction.GetIPMIndex(m_ChanelIDList[m_CurrentChannelIndex])); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_CurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE, null); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm中函数TabControlSelectedIndex1Event出错" + ex + "\n" + ex.StackTrace); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm中函数TabControlSelectedIndex1Event出错" + ex + "\n" + ex.StackTrace); #endif } } }
private void button1_Click(object sender, EventArgs e) { if (GlobalDataInterface.global_IsTestMode && GlobalDataInterface.globalOut_SysConfig.nSubsysNum == 1) { GlobalDataInterface.TransmitParam(Common.Commonfunction.EncodeSubsys(0), (int)HC_FSM_COMMAND_TYPE.HC_CMD_MOTOR_ENABLE, null); } }
/// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WaveCaptureOKbutton_Click(object sender, EventArgs e) { try { m_EndInterval.CopyTo(m_waveInterval, 0); if (m_waveInterval[0] > m_waveInterval[1]) { byte temp = m_waveInterval[0]; m_waveInterval[0] = m_waveInterval[1]; m_waveInterval[1] = temp; } int WeightSubsysindex = Commonfunction.GetSubsysIndex(m_nChannelID); int WeightSubsysChannelIndex = Commonfunction.GetChannelIndex(m_nChannelID); GlobalDataInterface.globalOut_WeightBaseInfo[WeightSubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + WeightSubsysChannelIndex].waveinterval[0] = m_waveInterval[0]; GlobalDataInterface.globalOut_WeightBaseInfo[WeightSubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + WeightSubsysChannelIndex].waveinterval[1] = m_waveInterval[1]; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WEIGHT_INFO, null); GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_OFF, null);//开启波形捕捉 } } catch (Exception ex) { Trace.WriteLine("WaveCaptureForm中函数WaveCaptureOKbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("WaveCaptureForm中函数WaveCaptureOKbutton_Click出错" + ex); #endif } }
/// <summary> /// 通道出口保存配置 /// </summary> /// <returns></returns> private bool ChannelExitSaveConfig() { try { if (m_ExitSubsysindex >= 0 && m_ExitSubsysChannelIndex >= 0 && m_ChannelSeleccomboBoxSelectedIndex >= 0) { for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM * ConstPreDefine.MAX_CHANNEL_NUM; i++) { GlobalDataInterface.globalOut_ExitInfo[i].ToCopy(tempExitInfo[i]); } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_EXIT_INFO, null); } } return(true); } catch (Exception ex) { //MessageBox.Show("通道出口设置界面保存配置出错:" + ex); //MessageBox.Show("0x10001007 Lane Outlet save error: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("0x10001007 " + LanguageContainer.VolveTestFormMessagebox1Text[GlobalDataInterface.selectLanguageIndex], LanguageContainer.VolveTestFormMessageboxErrorCaption[GlobalDataInterface.selectLanguageIndex], MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
/// <summary> /// 波形捕捉窗口关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WaveCaptureForm_FormClosing(object sender, FormClosingEventArgs e) { if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_OFF, null); //关闭波形捕捉 } GlobalDataInterface.UpWaveInfoEvent -= new GlobalDataInterface.WaveInfoEventHandler(OnUpWaveInfo); //Add by ChengSk - 20180830 }
/// <summary> /// 菜单->工具->数据清零 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 数据清零toolStripMenuItem_Click(object sender, EventArgs e) { try { if (GlobalDataInterface.dataInterface.IoStStatistics.nTotalCount < 100) { this.SeparationEfficiencyChangelabel.Text = "0.0%"; this.RealWeightCountChangelabel.Text = "0.00"; this.AverWeightCountChangelabel.Text = "0.0"; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_CLEAR_DATA, null); GlobalDataInterface.WriteErrorInfo("***** 操作员点击了清零操作,当前批个数:" + GlobalDataInterface.dataInterface.IoStStatistics.nTotalCount.ToString() + " *****"); //Add by ChengSk - 20181228 } m_ClearZero = true; } else { //if (MessageBox.Show("确定进行数据清零操作?", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) //if (MessageBox.Show("0x30001108 Are you sure to clear data?", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) if (MessageBox.Show("0x30001108 " + LanguageContainer.MainMenuMessagebox6Text[GlobalDataInterface.selectLanguageIndex], LanguageContainer.MainMenuMessageboxInformationCaption[GlobalDataInterface.selectLanguageIndex], MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { this.SeparationEfficiencyChangelabel.Text = "0.0%"; this.RealWeightCountChangelabel.Text = "0.00"; this.AverWeightCountChangelabel.Text = "0.0"; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_CLEAR_DATA, null); GlobalDataInterface.WriteErrorInfo("***** 操作员点击了清零操作,当前批个数:" + GlobalDataInterface.dataInterface.IoStStatistics.nTotalCount.ToString() + " *****"); //Add by ChengSk - 20181228 } m_ClearZero = true; } } m_ExitSortingStatisticDic = new Dictionary <int, Queue <string> >(); //初始化 m_AllSortingStatisticQueue = new Queue <string>(); //初始化 for (int i = 0; i < GlobalDataInterface.ExitList.Count; i++) //Add by ChengSk - 20180122 { Queue <string> exitSortSumQueue = new Queue <string>(); m_ExitSortingStatisticDic.Add(i, exitSortSumQueue); //初始化时出口的统计量为空 } GlobalDataInterface.uCurrentSampleExitFruitTotals = 0; //Add by ChengSk - 20180202 } catch (Exception ex) { Trace.WriteLine("MainMenu中函数数据清零toolStripMenuItem_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("MainMenu中函数数据清零toolStripMenuItem_Click出错" + ex); #endif } }
/// <summary> /// 获取图像 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetImagebutton_Click(object sender, EventArgs e) { m_spotDetectTest.spotDetectTestInfo.nImgW = m_srcBitamp.Width; m_spotDetectTest.spotDetectTestInfo.nImgH = m_srcBitamp.Height; //m_spotDetectTest.spotDetectTestInfo.nCupNum = int.Parse(this.CupNumnumericUpDown.Text); //m_spotDetectTest.spotDetectTestInfo.nCupW = int.Parse(this.CupWidthnumericUpDown.Text); //m_spotDetectTest.spotDetectTestInfo.nStartX = int.Parse(this.StartXnumericUpDown.Text); //m_spotDetectTest.spotDetectTestInfo.nFruitType = int.Parse(this.FruitTypenumericUpDown.Text); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(272, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SPOT_DETECT_TEST, m_spotDetectTest);//只给17发送 } }
/// <summary> /// 通道快捷菜单单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BruiseChannelcontextMenuStrip_Click(object sender, EventArgs e) { try { ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; m_CurrentBruiseChannelIndex = this.BruiseChannelcontextMenuStrip.Items.IndexOf(menuItem); //m_BruiseCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]), Commonfunction.GetIPMIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex])); if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 { //m_BruiseCurrentIPM_ID = Commonfunction.EncodeIPMChannel(Commonfunction.GetSubsysIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]), Commonfunction.GetIPMIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex])); m_BruiseCurrentIPM_ID = m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]; } else if (GlobalDataInterface.nVer == 0) { m_BruiseCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]), Commonfunction.GetIPMIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex])); } stCameraNum cameraNum = new stCameraNum(true); switch (GlobalDataInterface.globalOut_SysConfig.nSystemInfo) //Modify by ChengSk - 20190520 { case 64: //NIR2-右 cameraNum.cCameraNum = 0; break; case 128: //NIR2-中 cameraNum.cCameraNum = 0; break; case 256: //NIR2-左 cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; case 1: //彩色-右 cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_BruiseChanelIDList[m_CurrentBruiseChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_BruiseCurrentIPM_ID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); GlobalDataInterface.TransmitParam(m_BruiseCurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE_SPOT, cameraNum); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-BruiseSetFormt中函数BruiseChannelcontextMenuStrip_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-BruiseSetFormt中函数BruiseChannelcontextMenuStrip_Click出错" + ex); #endif } }
/// <summary> /// 关闭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FruitParamForm_FormClosed(object sender, FormClosedEventArgs e) { if (GlobalDataInterface.global_IsTestMode) { //if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 //{ // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPMChannel(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); //} //else if (GlobalDataInterface.nVer == 0) //{ // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); //} GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); } GlobalDataInterface.UpFruitGradeInfoEvent -= new GlobalDataInterface.FruitGradeInfoEventHandler(OnUpFruitGradeInfo); //Add by ChengSk - 20180830 }
/// <summary> /// 菜单->设置->工程设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 工程设置toolStripMenuItem_Click(object sender, EventArgs e) { //if (GlobalDataInterface.OpenProjectSetFormNumber > 0) // return; //Add by ChengSk - 20190111 每次仅打开1个工程配置窗体 ValidateForm validateForm = new ValidateForm(); if (validateForm.ShowDialog() == DialogResult.OK) { if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_PROJ_OPENED, null); } GlobalDataInterface.projectSet = new ProjectSetForm(this); GlobalDataInterface.projectSet.ShowDialog(); } }
///// <summary> ///// 通道出口保存配置 ///// </summary> ///// <returns></returns> //private bool ChannelExitSaveConfig() //{ // try // { // if (m_ExitSubsysindex >= 0 && m_ExitSubsysChannelIndex >= 0 && m_ChannelSeleccomboBoxSelectedIndex >= 0) // { // for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM * ConstPreDefine.MAX_CHANNEL_NUM; i++) // { // GlobalDataInterface.globalOut_ExitInfo[i].ToCopy(tempExitInfo[i]); // } // if (GlobalDataInterface.global_IsTestMode) // { // GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_EXIT_INFO, null); // } // } // return true; // } // catch (Exception ex) // { // //MessageBox.Show("通道出口设置界面保存配置出错:" + ex); // //MessageBox.Show("0x10001007 Lane Outlet save error: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // MessageBox.Show("0x10001007 " + LanguageContainer.VolveTestFormMessagebox1Text[GlobalDataInterface.selectLanguageIndex], // LanguageContainer.VolveTestFormMessageboxErrorCaption[GlobalDataInterface.selectLanguageIndex], // MessageBoxButtons.OK, MessageBoxIcon.Error); // return false; // } //} //private void 单击测试ToolStripMenuItem_Click(object sender, EventArgs e) //{ // stVolveTest volveTest = new stVolveTest(true); // volveTest.ExitId = (byte)(m_CurrentMotorItemIndex + 48); // if (GlobalDataInterface.global_IsTestMode) // GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ExitChannelSelectIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, volveTest); //} private void 单机测试ToolStripMenuItem_Click(object sender, EventArgs e) { try { stVolveTest volveTest = new stVolveTest(true); volveTest.ExitId = (byte)(m_CurrentItemIndex + 48); GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, volveTest); } catch (Exception ex) { Trace.WriteLine("ProjectSetForm-ChannelExit中函数Start_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("ProjectSetForm-ChannelExit中函数Start_Click出错" + ex); #endif } }
/// <summary> /// 电机参数发送按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MotorSendbutton_Click(object sender, EventArgs e) { tempMotorInfo.bExitId = (byte)m_nCurrentExitIndex; //tempMotorInfo.bMotorSwitch = (byte)this.MotorEnableSwitchcomboBox.SelectedIndex; tempMotorInfo.bMotorSwitch = (byte)(this.MotorEnableSwitchcomboBox.SelectedIndex + 2); //Modify by ChengSk - 20190708 tempMotorInfo.nMotorEnableSwitchNum = int.Parse(this.MotorEnableSwitchNumnumericUpDown.Text); tempMotorInfo.nMotorEnableSwitchWeight = int.Parse(this.MotorEnableSwitchWeightnumericUpDown.Text); tempMotorInfo.fDelay_time = float.Parse(this.DelayTimenumericUpDown.Text); tempMotorInfo.fHold_time = float.Parse(this.HoldTimenumericUpDown.Text); GlobalDataInterface.globalOut_GlobalExitInfo[m_nCurrentExitIndex].Delay_time[m_nCurrentExitIndex] = float.Parse(this.DelayTimenumericUpDown.Text); GlobalDataInterface.globalOut_GlobalExitInfo[m_nCurrentExitIndex].Hold_time[m_nCurrentExitIndex] = float.Parse(this.HoldTimenumericUpDown.Text); GlobalDataInterface.globalOut_MotorInfo[m_nCurrentExitIndex].ToCopy(tempMotorInfo); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_MOTOR_INFO, tempMotorInfo); } }
public void Reload2(int IsSys) //仅“工程配置”加载后刷新调用 Add by ChengSk - 20190827 { try { //if (IsSys == 0) SystemStructInitial(); ChannelExitIntial(); WeightSetInitial(IsSys); ChannelRangeInitial(); if (GlobalDataInterface.global_IsTestMode) { stCameraNum cameraNum = new stCameraNum(true); cameraNum.cCameraNum = (byte)m_CameraIndex; int nDrcId = 0; if (m_ChannelRangeSubSysIdx >= 0 && m_ChannelRangeIPMInSysIndex >= 0) { if (GlobalDataInterface.nVer == 0) //版本号判断 add by xcw 20200604 { nDrcId = Commonfunction.EncodeIPM(m_ChannelRangeSubSysIdx, m_ChannelRangeIPMInSysIndex); } else if (GlobalDataInterface.nVer == 1) { nDrcId = Commonfunction.EncodeIPMChannel(m_ChannelRangeSubSysIdx, m_ChannelRangeChannelInIPMIndex + m_ChannelRangeIPMInSysIndex * ConstPreDefine.CHANNEL_NUM); } } // add by xcw 20200715 cameraNum.cCameraNum = (byte)m_CameraIndex; ContinuousSamplecheckBox.Checked = false; ShowBlobcheckBox.Checked = false; ImageCorrectioncheckBox.Checked = false; GlobalDataInterface.TransmitParam(nDrcId, (int)HC_IPM_COMMAND_TYPE.HC_CMD_CONTINUOUS_SAMPLE_OFF, cameraNum); } FruitSetInitial(); InnerQualityIntial(); //Add by ChengSk - 20190114 //FlawSetIntial(); //瑕疵功能待确定 ProjecttabControl.TabPages.Remove(this.FlawSettabPage); } catch (Exception ex) { Trace.WriteLine("ProjectSetForm中函数Reload出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("ProjectSetForm中函数Reload出错" + ex); #endif } }
/// <summary> /// 窗口关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VolveTestForm_FormClosed(object sender, FormClosedEventArgs e) { try { if (GlobalDataInterface.global_IsTestMode) //Modify by ChengSk - 20180704 { stVolveTest VolveTest = new stVolveTest(true); //电磁阀测试参数 VolveTest.ExitId = 255; GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); } } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数VolveTestForm_FormClosed出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数VolveTestForm_FormClosed出错" + ex); #endif } }
/// <summary> /// 菜单->工具->复位果杯 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 位果杯toolStripMenuItem_Click(object sender, EventArgs e) { try { ResetCupState(); this.位果杯toolStripMenuItem.Enabled = false; if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WEIGHTRESET, null); } } catch (Exception ex) { Trace.WriteLine("MainMenu中函数复位果杯toolStripMenuItem_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("MainMenu中函数复位果杯toolStripMenuItem_Click出错" + ex); #endif } }
private void WaveCaptureForm_Load(object sender, EventArgs e) { try { sign = GlobalDataInterface.globalIn_defaultInis.FirstOrDefault().nFsmModule; this.WaveCapturehScrollBar.Enabled = false;//波形捕捉时不许查看之前数据 if (sign == 1) { _parameters = 4096; m_fTransRatio = (float)this.WeightWavepictureBox.Height / (4096.0f * 2.0f); } else { _parameters = 65535; m_fTransRatio = (float)this.WeightWavepictureBox.Height / (65535.0f * 2.0f); } this.WaveCapturehScrollBar.Value = this.WaveCapturehScrollBar.Maximum; lock (this) { GlobalDataInterface.globalIn_wavelist.Clear(); } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_nChannelID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_WAVE_FORM_ON, null);//开启波形捕捉 } this.IntervalnumericUpDown1.Text = m_waveInterval[0].ToString(); this.IntervalnumericUpDown2.Text = m_waveInterval[1].ToString(); m_IntervalValueChanged1 = false; m_IntervalValueChanged2 = false; this.WeightWavepictureBox.Invalidate(); } catch (Exception ex) { Trace.WriteLine("WaveCaptureForm中函数WaveCaptureForm_Load出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("WaveCaptureForm中函数WaveCaptureForm_Load出错" + ex); #endif } }
/// <summary> /// 立即生效按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FruitEffectbutton_Click(object sender, EventArgs e) { try { string furitselect = ""; this.FruitEffectbutton.Enabled = false; this.EffectButtonDelaytimer5.Enabled = true; for (int i = 0; i < this.FruitTypedataGridView.Rows.Count; i++) { string fruitsub = ""; for (int j = 1; j < this.FruitTypedataGridView.ColumnCount; j++) { if (this.FruitTypedataGridView[j, i].Value != null) { fruitsub += this.FruitTypedataGridView[j, i].Value.ToString().TrimEnd('\0') + ";"; } if (this.FruitTypedataGridView[j, i].Style.BackColor == Color.Pink) { furitselect += (i + 1).ToString() + "." + j + '-' + this.FruitTypedataGridView[j, i].Value.ToString().TrimEnd('\0') + ";"; } } Commonfunction.SetAppSetting(sFruitMajortArray[i], fruitsub); } Commonfunction.SetAppSetting("已选水果种类", furitselect); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_DENSITY_INFO, null);//下发密度信息 } } catch (Exception ex) { Trace.WriteLine("ProjectSetForm-FruitSet中函数FruitEffectbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("ProjectSetForm-FruitSet中函数FruitEffectbutton_Click出错" + ex); #endif } }
/// <summary> /// Channel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChannelcomboBox_SelectedIndexChanged(object sender, EventArgs e) { try { int tempChannelIndex = this.ChannelcomboBox.SelectedIndex; int tempCurrentIPMIndex = Commonfunction.GetIPMIndex(m_ChannelIDList[tempChannelIndex]); int tempCurrentSysIndex = Commonfunction.GetSubsysIndex(m_ChannelIDList[tempChannelIndex]); if (GlobalDataInterface.global_IsTestMode) { //if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 //{ // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPMChannel(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); // //GlobalDataInterface.TransmitParam(m_IPMIDList[this.IPMcomboBox.SelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPMChannel(tempCurrentSysIndex, tempCurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); //} //else if (GlobalDataInterface.nVer == 0) //{ // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); // //GlobalDataInterface.TransmitParam(m_IPMIDList[this.IPMcomboBox.SelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); // GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(tempCurrentSysIndex, tempCurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); //} GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(m_CurrentSysIndex, m_CurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); //GlobalDataInterface.TransmitParam(m_IPMIDList[this.IPMcomboBox.SelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); GlobalDataInterface.TransmitParam(Commonfunction.EncodeIPM(tempCurrentSysIndex, tempCurrentIPMIndex), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null); } m_CurrentChannelIndex = this.ChannelcomboBox.SelectedIndex; m_CurrentIPMIndex = Commonfunction.GetIPMIndex(m_ChannelIDList[m_CurrentChannelIndex]); m_CurrentSysIndex = Commonfunction.GetSubsysIndex(m_ChannelIDList[m_CurrentChannelIndex]); } catch (Exception ex) { Trace.WriteLine("FruitParamForm中函数ChannelcomboBox_SelectedIndexChanged出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("FruitParamForm中函数ChannelcomboBox_SelectedIndexChanged出错" + ex); #endif } }
private void Start_Click(object sender, EventArgs e) { try { if (m_VolveTest.ExitId != 255) { if (m_VolveTest.ExitId <= 100) { this.ExitlistViewEx.Items[m_VolveTest.ExitId].BackColor = Color.White; this.ExitlistViewEx.Items[m_VolveTest.ExitId].Font = new Font("宋体", 9, FontStyle.Regular); } } m_VolveTest.ExitId = (byte)(m_CurrentItemIndex); this.ExitlistViewEx.Items[m_CurrentItemIndex].BackColor = Color.Red; this.ExitlistViewEx.Items[m_CurrentItemIndex].Font = new Font("黑体", 9, FontStyle.Italic | FontStyle.Bold); if (GlobalDataInterface.global_IsTestMode) { if (this.chkSidebySideTest.Checked) //Modify by ChengSk - 20190726 { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_ALL_LANE_VOLVE, m_VolveTest); } else { GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelSeleccomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, m_VolveTest); } } m_IsVolveTesting = true; m_CurrentItemIndex = -1; } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数Start_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数Start_Click出错" + ex); #endif } }
private void ExitInfoSendbutton_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; //等待 tempGlobalExitInfo.CopyTo(GlobalDataInterface.globalOut_GlobalExitInfo, 0); //add by xcw -20191209 if (GlobalDataInterface.global_IsTestMode) { for (int i = 0; i < GlobalDataInterface.globalOut_SysConfig.nSubsysNum; i++) { GlobalDataInterface.TransmitParam(Commonfunction.EncodeSubsys(i), (int)HC_FSM_COMMAND_TYPE.HC_CMD_GLOBAL_EXIT_INFO, null); } } this.Cursor = Cursors.Default;//正常状态 } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数ExitInfoSendbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数ExitInfoSendbutton_Click出错" + ex); #endif } }
/// <summary> /// 开始测试按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartTestbutton_Click(object sender, EventArgs e) { try { if (m_ChannelcomboBoxSelectedIndex >= 0) { if (this.StartTestbutton.Text == m_resourceManager.GetString("StartTestbutton.Text")) { if (GlobalDataInterface.global_IsTestMode) { stVolveTest VolveTest = new stVolveTest(true);//电磁阀测试参数 VolveTest.ExitId = 254; GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); } this.StartTestbutton.Text = m_resourceManager.GetString("StopTestlabel.Text"); } else { if (GlobalDataInterface.global_IsTestMode) { stVolveTest VolveTest = new stVolveTest(true);//电磁阀测试参数 VolveTest.ExitId = 255; GlobalDataInterface.TransmitParam(m_ChanelIDList[m_ChannelcomboBoxSelectedIndex], (int)HC_FSM_COMMAND_TYPE.HC_CMD_TEST_VOLVE, VolveTest); } this.StartTestbutton.Text = m_resourceManager.GetString("StartTestbutton.Text"); } } } catch (Exception ex) { Trace.WriteLine("VolveTestForm中函数StartTestbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("VolveTestForm中函数StartTestbutton_Click出错" + ex); #endif } }