/// <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 } }
/// <summary> /// 通道快捷菜单单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RotChannelcontextMenuStrip_Click(object sender, EventArgs e) { try { ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; m_CurrentRotChannelIndex = this.RotChannelcontextMenuStrip.Items.IndexOf(menuItem); //m_RotCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 { //m_RotCurrentIPM_ID = Commonfunction.EncodeIPMChannel(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); m_RotCurrentIPM_ID = (m_RotChanelIDList[m_CurrentRotChannelIndex]); } else if (GlobalDataInterface.nVer == 0) { m_RotCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); } stCameraNum cameraNum = new stCameraNum(true); // cameraNum.bChannelIndex = (byte)Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]); //switch (GlobalDataInterface.globalOut_SysConfig.nSystemInfo) //{ // case 1: // cameraNum.cCameraNum = 0; // break; // case 2: // cameraNum.cCameraNum = 0; // break; // case 4: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; // case 8: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; //} 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_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; case 1: //彩色-右 cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_RotCurrentIPM_ID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); GlobalDataInterface.TransmitParam(m_RotCurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE_SPOT, cameraNum); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-RotSetFormt中函数RotChannelcontextMenuStrip_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-RotSetFormt中函数RotChannelcontextMenuStrip_Click出错" + ex); #endif } }
/// <summary> /// 腐烂参数设置子界面快捷键事件 /// </summary> /// <param name="selectchannelNo"></param> private void TabControlSelectedIndex4Event(int selectchannelNo) { int SelectChannelNo = selectchannelNo; if (SelectChannelNo > 0 && SelectChannelNo <= ChannelNum) { try { m_CurrentRotChannelIndex = SelectChannelNo - 1; //m_RotCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 { m_RotCurrentIPM_ID = m_RotChanelIDList[m_CurrentRotChannelIndex]; //m_RotCurrentIPM_ID = Commonfunction.EncodeIPMChannel(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); } else if (GlobalDataInterface.nVer == 0) { m_RotCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]), Commonfunction.GetIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex])); } stCameraNum cameraNum = new stCameraNum(true); // cameraNum.bChannelIndex = (byte)Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]); //switch (GlobalDataInterface.globalOut_SysConfig.nSystemInfo) //{ // case 1: // cameraNum.cCameraNum = 0; // break; // case 2: // cameraNum.cCameraNum = 0; // break; // case 4: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; // case 8: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; //} 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_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; case 1: //彩色-右 cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_RotChanelIDList[m_CurrentRotChannelIndex]) * ConstPreDefine.CHANNEL_NUM); break; } if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(m_RotCurrentIPM_ID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); GlobalDataInterface.TransmitParam(m_RotCurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE_SPOT, cameraNum); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm中函数TabControlSelectedIndex4Event出错" + ex + "\n" + ex.StackTrace); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm中函数TabControlSelectedIndex4Event出错" + ex + "\n" + ex.StackTrace); #endif } } }
/// <summary> /// 瑕疵参数设置子界面快捷键事件 /// </summary> /// <param name="selectchannelNo"></param> private void TabControlSelectedIndex2Event(int selectchannelNo) { int SelectChannelNo = selectchannelNo; if (SelectChannelNo > 0 && SelectChannelNo <= ChannelNum) { try { m_CurrentChannelIndex = SelectChannelNo - 1; if (GlobalDataInterface.nVer == 1) { //m_CurrentIPM_ID = Commonfunction.EncodeIPMChannel(Commonfunction.GetSubsysIndex(m_ChanelIDList[m_CurrentChannelIndex]), Commonfunction.GetIPMIndex(m_ChanelIDList[m_CurrentChannelIndex])); m_FlawCurrentIPM_ID = m_ChanelIDList[m_CurrentChannelIndex]; } else if (GlobalDataInterface.nVer == 0) { m_FlawCurrentIPM_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_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); //GlobalDataInterface.TransmitParam(m_CurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE, null); //新增 Add by ChengSk - 20190508 GlobalDataInterface.TransmitParam(m_FlawCurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE_SPOT, null); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm中函数TabControlSelectedIndex2Event出错" + ex + "\n" + ex.StackTrace); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm中函数TabControlSelectedIndex2Event出错" + ex + "\n" + ex.StackTrace); #endif } } }
private void FlawChannelcontextMenuStrip_MouseEnter(object sender, EventArgs e) //新增采集IPM原图时使用 Add by ChengSk - 20190508 { try { ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; m_CurrentChannelIndex = this.FlawChannelcontextMenuStrip.Items.IndexOf(menuItem); if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 { m_CurrentIPM_ID = (m_FlawChanelIDList[m_CurrentFlawChannelIndex]); //m_CurrentIPM_ID = Commonfunction.EncodeIPMChannel(Commonfunction.GetSubsysIndex(m_ChanelIDList[m_CurrentChannelIndex]), Commonfunction.GetIPMIndex(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_FlawChanelIDList[m_CurrentChannelIndex]), Commonfunction.GetIPMIndex(m_FlawChanelIDList[m_CurrentChannelIndex])); } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-FlawSeFormt中函数FlawChannelcontextMenuStrip_MouseEnter出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-FlawSeFormt中函数FlawChannelcontextMenuStrip_MouseEnter出错" + ex); #endif } }
/// <summary> /// 通道快捷菜单单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FlawChannelcontextMenuStrip_Click(object sender, EventArgs e) { try { stCameraNum cameraNum = new stCameraNum(true); ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; switch (menuItem.Text) { case "Color Camera": cameraNum.cCameraNum = 0; m_cameraIndex = 0; break; case "NIR-F Camera": cameraNum.cCameraNum = 1; m_cameraIndex = 1; break; case "NIR-B Camera": cameraNum.cCameraNum = 2; m_cameraIndex = 2; break; default: break; } //string chanel = menuItem.OwnerItem.Text; m_CurrentFlawChannelIndex = this.FlawChannelcontextMenuStrip.Items.IndexOf(menuItem.OwnerItem); //m_CurrentFlawChannelIndex = this.FlawChannelcontextMenuStrip.Items.IndexOf(menuItem); if (GlobalDataInterface.nVer == 1) //版本号判断 add by xcw 20200604 { m_FlawCurrentIPM_ID = (m_FlawChanelIDList[m_CurrentFlawChannelIndex]); } else if (GlobalDataInterface.nVer == 0) { m_FlawCurrentIPM_ID = Commonfunction.EncodeIPM(Commonfunction.GetSubsysIndex(m_FlawChanelIDList[m_CurrentFlawChannelIndex]), Commonfunction.GetIPMIndex(m_FlawChanelIDList[m_CurrentFlawChannelIndex])); } // stCameraNum cameraNum = new stCameraNum(true); //// cameraNum.bChannelIndex = (byte)Commonfunction.ChanelInIPMIndex(m_FlawChanelIDList[m_CurrentFlawChannelIndex]); // switch (GlobalDataInterface.globalOut_SysConfig.nSystemInfo) // { // case 1: // cameraNum.cCameraNum = 0; // break; // case 2: // cameraNum.cCameraNum = 0; // break; // case 4: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_FlawChanelIDList[m_CurrentFlawChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; // case 8: // cameraNum.cCameraNum = (byte)(Commonfunction.ChanelInIPMIndex(m_FlawChanelIDList[m_CurrentFlawChannelIndex]) * ConstPreDefine.CHANNEL_NUM); // break; // } if (GlobalDataInterface.global_IsTestMode) { m_CurrentIPM_ID = m_FlawCurrentIPM_ID; //GlobalDataInterface.TransmitParam(m_FlawCurrentIPM_ID, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_OFF, null); GlobalDataInterface.TransmitParam(m_CurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE, null); //新增 Add by ChengSk - 20190508 Thread.Sleep(500); //add by xcw 20200909 GlobalDataInterface.TransmitParam(m_FlawCurrentIPM_ID, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SINGLE_SAMPLE_SPOT, null); } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-FlawSeFormt中函数FlawChannelcontextMenuStrip_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-FlawSeFormt中函数FlawChannelcontextMenuStrip_Click出错" + ex); #endif } }