Example #1
0
        /// <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
                }
            }
        }
Example #2
0
        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
            }
        }
Example #3
0
        /// <summary>
        /// 更新IPM列表状态
        /// </summary>
        private void RefreshIPMList()
        {
            try
            {
                Ping m_ping = new Ping();
                this.IPMcustomCheckedListBox.Items.Clear();
                this.IPMMACAddrlistViewEx.Items.Clear();
                lstIPMIP.Clear();
                //统计每个子系统的通道数
                int          k = 0;
                ListViewItem lvi;
                for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM; i++)
                {
                    for (int j = 0; j < ConstPreDefine.MAX_CHANNEL_NUM; j++)
                    {
                        //if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i * ConstPreDefine.MAX_CHANNEL_NUM + j] == 1)
                        if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i] > j)  //Modify by ChengSk - 20190521
                        {
                            //nDstId = Commonfunction.EncodeIPM(i, j);
                            //GlobalDataInterface.TransmitParam(nDstId, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SHUTDOWN, null);
                            int    nDstId    = Commonfunction.EncodeIPM(i, j);
                            int    nSubsysId = Commonfunction.GetIPMID(nDstId);
                            string strTemp   = ConstPreDefine.LC_IP_ADDR_TEMPLATE;
                            string strIP     = strTemp + nSubsysId;//得到IPM的IP地址
                            string strIPName = (nSubsysId - 16).ToString();
                            this.IPMcustomCheckedListBox.Items.Add("IPM-" + strIPName);
                            //this.IPMcustomCheckedListBox.Items.Add("IPM-" + strIP);

                            lstIPMIP.Add(strIP);
                            lvi = new ListViewItem((k + 1).ToString());
                            string strMACAddr = Commonfunction.GetAppSetting("IPM-" + strIP);
                            lvi.SubItems.Add(strMACAddr);
                            this.IPMMACAddrlistViewEx.Items.Add(lvi);//Add by ChengSk - 20190829

                            PingReply pingReply = m_ping.Send(strIP, 500);
                            if (pingReply.Status == IPStatus.Success)
                            {
                                //lvi.SubItems[k].ForeColor= Color.Green;
                                IPMMACAddrlistViewEx.Items[k].BackColor = System.Drawing.Color.Green;
                                //itemColor[k] = Color.Green;
                            }
                            else
                            {
                                //itemColor[k] = Color.White;
                                IPMMACAddrlistViewEx.Items[k].BackColor = System.Drawing.Color.White;//add by xcw 20200226
                                //lvi.SubItems[k].ForeColor = Color.White;
                            }
                            k++;
                        }
                    }
                }

                this.IPMcustomCheckedListBox.Refresh();
            }
            catch (Exception ex)
            { }
        }
Example #4
0
        /// <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
            }
        }
Example #5
0
 /// <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
 }
Example #6
0
        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
            }
        }
Example #7
0
        /// <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
            }
        }
Example #8
0
        /// <summary>
        /// 远程关机
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Closebutton_Click(object sender, EventArgs e)
        {
            //Note by ChengSk - 20191112
            //foreach (string item in this.IPMcustomCheckedListBox.CheckedItems)
            //{
            //    string[] sArray = item.Split('-');
            //    string IP = sArray[sArray.Length - 1];
            //    if (GlobalDataInterface.global_IsTestMode)
            //    {
            //        // int nDstId = Commonfunction.EncodeIPM(i, j);
            //        //GlobalDataInterface.TransmitParam(nDstId, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SHUTDOWN, null);

            //        //网络关闭IPM机器

            //        ConnectionOptions op = new ConnectionOptions();
            //        op.Username = "******";//账号
            //        op.Password = "";//登录密码
            //        op.Authority = "ntlmdomain:DOMAIN";
            //        ManagementScope scope = new ManagementScope("\\\\"+IP+"\\root\\cimv2", op);
            //        try
            //        {
            //            scope.Connect();
            //            ObjectQuery oq = new ObjectQuery("select * from win32_OperatingSystem");
            //            ManagementObjectSearcher query1 = new ManagementObjectSearcher(scope, oq);//得到WMI控制
            //            ManagementObjectCollection queryCollection1 = query1.Get();
            //            foreach (ManagementObject mobj in queryCollection1)
            //            {
            //                string[] str = { "" };
            //                mobj.InvokeMethod("ShutDown", str);
            //            }
            //        }
            //        catch (Exception ex)
            //        {

            //        }
            //    }
            //}

            if (GlobalDataInterface.global_IsTestMode)  //Modify by ChengSk - 20191112
            {
                for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM; i++)
                {
                    for (int j = 0; j < ConstPreDefine.MAX_CHANNEL_NUM; j++)
                    {
                        //if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i * ConstPreDefine.MAX_CHANNEL_NUM + j] == 1)
                        if (j < GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i])    //Modify by ChengSk - 20191112
                        {
                            int nDstId = 0;
                            if (GlobalDataInterface.nVer == 1)            //版本号判断 add by xcw 20200604
                            {
                                nDstId = Commonfunction.EncodeIPMChannel(i, j);
                            }
                            else if (GlobalDataInterface.nVer == 0)
                            {
                                nDstId = Commonfunction.EncodeIPM(i, j);
                            }
                            int    nSubsysId = Commonfunction.GetIPMID(nDstId);
                            string strTemp   = ConstPreDefine.LC_IP_ADDR_TEMPLATE;
                            string strIP     = strTemp + nSubsysId;         //得到IPM的IP地址
                            string strIPName = (nSubsysId - 16).ToString(); //add by xcw 20201225
                            foreach (string item in this.IPMcustomCheckedListBox.CheckedItems)
                            {
                                string[] sArray = item.Split('-');
                                string   IP     = sArray[sArray.Length - 1];
                                //if (IP == strIP)
                                if (IP == strIPName)
                                {
                                    nDstId = Commonfunction.EncodeIPM(i, j);
                                    GlobalDataInterface.TransmitParam(nDstId, (int)HC_IPM_COMMAND_TYPE.HC_CMD_SHUTDOWN, null);
#if REALEASE
                                    GlobalDataInterface.WriteErrorInfo("=> ShutDown to IPM, IP: " + IP + " !");
#endif
                                    break;
                                }
                            }
                        } //End if
                    }     //End for
                }         //End for
            }             //End if
        }
Example #9
0
        private void FruitParamForm_Load(object sender, EventArgs e)
        {
            try
            {
                ////统计每个子系统的IPM数
                //int IPMid = 0, IDnum = 1;
                //this.IPMcomboBox.Items.Clear();
                //for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM; i++)
                //{
                //    for (int j = 0; j < ConstPreDefine.MAX_CHANNEL_NUM; j++)
                //    {
                //        if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i * ConstPreDefine.MAX_CHANNEL_NUM + j] == 1)
                //        {
                //            if (j % 2 == 0)
                //            {
                //                IPMid = Commonfunction.EncodeIPM(i, j / 2);
                //                this.IPMcomboBox.Items.Add(string.Format("IPM {0}", IDnum));
                //                IDnum++;

                //                if (m_IPMIDList.Count > 0)
                //                {
                //                    if (m_IPMIDList.Contains(IPMid))
                //                        continue;
                //                }
                //                m_IPMIDList.Add(IPMid);
                //            }

                //        }
                //    }
                //}
                //if (m_IPMIDList.Count > 0)
                //{
                //    this.IPMcomboBox.SelectedIndex = 0;
                //    if (GlobalDataInterface.global_IsTestMode)
                //        GlobalDataInterface.TransmitParam(m_IPMIDList[0], (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null);
                //}

                m_IPMIDList.Clear();
                m_ChannelIDList.Clear();
                this.ChannelcomboBox.Items.Clear();
                //统计每个子系统的通道数和IPM数
                int IPMid = 0;
                for (int i = 0; i < ConstPreDefine.MAX_SUBSYS_NUM; i++)
                {
                    for (int j = 0; j < ConstPreDefine.MAX_CHANNEL_NUM; j++)
                    {
                        //if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i * ConstPreDefine.MAX_CHANNEL_NUM + j] == 1)
                        if (GlobalDataInterface.globalOut_SysConfig.nChannelInfo[i] > j) //Modify by ChengSk - 20190521
                        {
                            if (GlobalDataInterface.nVer == 0)                           //版本号判断 add by xcw 20200619
                            {
                                m_ChannelIDList.Add(Commonfunction.EncodeChannel(i, j, j));
                            }
                            else if (GlobalDataInterface.nVer == 1)
                            {
                                m_ChannelIDList.Add(Commonfunction.EncodeChannel(i, j / 2, j % 2));
                            }

                            if (j % 2 == 0)
                            {
                                IPMid = Commonfunction.EncodeIPM(i, j / 2);
                                if (m_IPMIDList.Count > 0)
                                {
                                    if (m_IPMIDList.Contains(IPMid))
                                    {
                                        continue;
                                    }
                                }
                                m_IPMIDList.Add(IPMid);
                            }
                        }
                    }
                }
                if (m_ChannelIDList.Count > 0)
                {
                    for (int i = 0; i < m_ChannelIDList.Count; i++)
                    {
                        this.ChannelcomboBox.Items.Add(string.Format("lane-{0}", i + 1));
                    }
                    this.ChannelcomboBox.SelectedIndex = 0;
                    if (GlobalDataInterface.global_IsTestMode)
                    {
                        GlobalDataInterface.TransmitParam(m_IPMIDList[0], (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADEINFO_ON, null);
                    }
                }

                //控件属性
                //CIR视觉系统
                if ((GlobalDataInterface.globalOut_SysConfig.nClassificationInfo & 0x01) == 1)
                {
                    this.Diameterlabel1.Enabled   = true;     //直径
                    this.DiametertextBox1.Enabled = true;
                    if (GlobalDataInterface.SystemStructProjectedArea)
                    {
                        this.Arealabel1.Enabled   = true;     //投影面积
                        this.AreatextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Arealabel1.Enabled   = false;     //投影面积
                        this.AreatextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructVolume)
                    {
                        this.Volumelabel1.Enabled   = true;   //体积
                        this.VolumetextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Volumelabel1.Enabled   = false;   //体积
                        this.VolumetextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructColor)
                    {
                        this.ColorRate0label1.Enabled   = true; //颜色1比例
                        this.ColorRate0textBox1.Enabled = true;
                        this.ColorRate1label1.Enabled   = true; //颜色2比例
                        this.ColorRate1textBox1.Enabled = true;
                        this.ColorRate2label1.Enabled   = true; //颜色3比例
                        this.ColorRate2textBox1.Enabled = true;
                    }
                    else
                    {
                        this.ColorRate0label1.Enabled   = false; //颜色1比例
                        this.ColorRate0textBox1.Enabled = false;
                        this.ColorRate1label1.Enabled   = false; //颜色2比例
                        this.ColorRate1textBox1.Enabled = false;
                        this.ColorRate2label1.Enabled   = false; //颜色3比例
                        this.ColorRate2textBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructFlaw)
                    {
                        this.FlawArealabel1.Enabled   = true; //瑕疵面积
                        this.FlawAreatextBox1.Enabled = true;
                        this.FlawNumlabel1.Enabled    = true; //瑕疵个数
                        this.FlawNumtextBox1.Enabled  = true;
                    }
                    else
                    {
                        this.FlawArealabel1.Enabled   = false; //瑕疵面积
                        this.FlawAreatextBox1.Enabled = false;
                        this.FlawNumlabel1.Enabled    = false; //瑕疵个数
                        this.FlawNumtextBox1.Enabled  = false;
                    }
                    if (GlobalDataInterface.SystemStructShape)
                    {
                        this.VerticalAxislabel1.Enabled    = true; //垂轴径
                        this.VerticalAxistextBox1.Enabled  = true;
                        this.DiameterRatiolabel1.Enabled   = true; //横径比
                        this.DiameterRatiotextBox1.Enabled = true;
                        this.MinDRatiotextBox.Enabled      = true; //扁椭型横径比
                        this.MinDRatiolabel.Enabled        = true;
                    }
                    else
                    {
                        this.VerticalAxislabel1.Enabled    = false; //垂轴径
                        this.VerticalAxistextBox1.Enabled  = false;
                        this.DiameterRatiolabel1.Enabled   = false; //横径比
                        this.DiameterRatiotextBox1.Enabled = false;
                        this.MinDRatiotextBox.Enabled      = false;
                        this.MinDRatiolabel.Enabled        = false;
                    }
                }
                else
                {
                    this.Diameterlabel1.Enabled        = false; //直径
                    this.DiametertextBox1.Enabled      = false;
                    this.Arealabel1.Enabled            = false; //投影面积
                    this.AreatextBox1.Enabled          = false;
                    this.Volumelabel1.Enabled          = false; //体积
                    this.VolumetextBox1.Enabled        = false;
                    this.ColorRate0label1.Enabled      = false; //颜色1比例
                    this.ColorRate0textBox1.Enabled    = false;
                    this.ColorRate1label1.Enabled      = false; //颜色2比例
                    this.ColorRate1textBox1.Enabled    = false;
                    this.ColorRate2label1.Enabled      = false; //颜色3比例
                    this.ColorRate2textBox1.Enabled    = false;
                    this.FlawArealabel1.Enabled        = false; //瑕疵面积
                    this.FlawAreatextBox1.Enabled      = false;
                    this.FlawNumlabel1.Enabled         = false; //瑕疵个数
                    this.FlawNumtextBox1.Enabled       = false;
                    this.VerticalAxislabel1.Enabled    = false; //垂轴径
                    this.VerticalAxistextBox1.Enabled  = false;
                    this.DiameterRatiolabel1.Enabled   = false; //横径比
                    this.DiameterRatiotextBox1.Enabled = false;
                    this.MinDRatiotextBox.Enabled      = false; //扁椭型横径比
                    this.MinDRatiolabel.Enabled        = false;
                }
                //UV视觉系统
                if ((GlobalDataInterface.globalOut_SysConfig.nClassificationInfo & 0x02) == 2)
                {
                    if (GlobalDataInterface.SystemStructBruise)
                    {
                        this.BruiseArealabel1.Enabled   = true; //擦伤面积
                        this.BruiseAreatextBox1.Enabled = true;
                        this.BruiseNumlabel1.Enabled    = true; //擦伤个数
                        this.BruiseNumtextBox1.Enabled  = true;
                    }
                    else
                    {
                        this.BruiseArealabel1.Enabled   = false; //擦伤面积
                        this.BruiseAreatextBox1.Enabled = false;
                        this.BruiseNumlabel1.Enabled    = false; //擦伤个数
                        this.BruiseNumtextBox1.Enabled  = false;
                    }
                    if (GlobalDataInterface.SystemStructRot)
                    {
                        this.RotArealabel1.Enabled   = true;   //腐蚀面积
                        this.RotAreatextBox1.Enabled = true;
                        this.RotNumlabel1.Enabled    = true;   //腐蚀个数
                        this.RotNumtextBox1.Enabled  = true;
                    }
                    else
                    {
                        this.RotArealabel1.Enabled   = false;   //腐蚀面积
                        this.RotAreatextBox1.Enabled = false;
                        this.RotNumlabel1.Enabled    = false;   //腐蚀个数
                        this.RotNumtextBox1.Enabled  = false;
                    }
                }
                else
                {
                    this.BruiseArealabel1.Enabled   = false; //擦伤面积
                    this.BruiseAreatextBox1.Enabled = false;
                    this.BruiseNumlabel1.Enabled    = false; //擦伤个数
                    this.BruiseNumtextBox1.Enabled  = false;
                    this.RotArealabel1.Enabled      = false; //腐蚀面积
                    this.RotAreatextBox1.Enabled    = false;
                    this.RotNumlabel1.Enabled       = false; //腐蚀个数
                    this.RotNumtextBox1.Enabled     = false;
                }
                //重量系统
                if ((GlobalDataInterface.globalOut_SysConfig.nClassificationInfo & 0x04) == 4)
                {
                    this.Weightlabel1.Enabled   = true;        //重量
                    this.WeighttextBox1.Enabled = true;
                    if (GlobalDataInterface.SystemStructDensity)
                    {
                        this.Densitylabel1.Enabled   = true;   //密度
                        this.DensitytextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Densitylabel1.Enabled   = false;   //密度
                        this.DensitytextBox1.Enabled = false;
                    }
                }
                else
                {
                    this.Weightlabel1.Enabled    = false;   //重量
                    this.WeighttextBox1.Enabled  = false;
                    this.Densitylabel1.Enabled   = false;   //密度
                    this.DensitytextBox1.Enabled = false;
                }
                //内部品质
                if ((GlobalDataInterface.globalOut_SysConfig.nClassificationInfo & 0x08) == 8)
                {
                    if (GlobalDataInterface.SystemStructSugar)
                    {
                        this.Sugarlabel1.Enabled   = true;     //糖度
                        this.SugartextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Sugarlabel1.Enabled   = false;     //糖度
                        this.SugartextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructAcidity)
                    {
                        this.Aciditylabel1.Enabled   = true;   //酸度
                        this.AciditytextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Aciditylabel1.Enabled   = false;   //酸度
                        this.AciditytextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructHollow)
                    {
                        this.Hollowlabel1.Enabled   = true;    //空心
                        this.HollowtextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Hollowlabel1.Enabled   = false;    //空心
                        this.HollowtextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructSkin)
                    {
                        this.Skinlabel1.Enabled   = true;      //浮皮
                        this.SkintextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Skinlabel1.Enabled   = false;      //浮皮
                        this.SkintextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructBrown)
                    {
                        this.Brownlabel1.Enabled   = true;     //褐变
                        this.BrowntextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Brownlabel1.Enabled   = false;     //褐变
                        this.BrowntextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructTangxin)
                    {
                        this.Tangxinlabel1.Enabled   = true;   //糖心
                        this.TangxintextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Tangxinlabel1.Enabled   = false;   //糖心
                        this.TangxintextBox1.Enabled = false;
                    }
                }
                else
                {
                    this.Sugarlabel1.Enabled     = false;   //糖度
                    this.SugartextBox1.Enabled   = false;
                    this.Aciditylabel1.Enabled   = false;   //酸度
                    this.AciditytextBox1.Enabled = false;
                    this.Hollowlabel1.Enabled    = false;   //空心
                    this.HollowtextBox1.Enabled  = false;
                    this.Skinlabel1.Enabled      = false;   //浮皮
                    this.SkintextBox1.Enabled    = false;
                    this.Brownlabel1.Enabled     = false;   //褐变
                    this.BrowntextBox1.Enabled   = false;
                    this.Tangxinlabel1.Enabled   = false;   //糖心
                    this.TangxintextBox1.Enabled = false;
                }
                //超声波系统
                if ((GlobalDataInterface.globalOut_SysConfig.nClassificationInfo & 0x10) == 16)
                {
                    if (GlobalDataInterface.SystemStructRigidity)
                    {
                        this.Rigiditylabel1.Enabled   = true;   //硬度
                        this.RigiditytextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Rigiditylabel1.Enabled   = false;   //硬度
                        this.RigiditytextBox1.Enabled = false;
                    }
                    if (GlobalDataInterface.SystemStructWater)
                    {
                        this.Waterlabel1.Enabled   = true;      //含水率
                        this.WatertextBox1.Enabled = true;
                    }
                    else
                    {
                        this.Waterlabel1.Enabled   = false;      //含水率
                        this.WatertextBox1.Enabled = false;
                    }
                }
                else
                {
                    this.Rigiditylabel1.Enabled   = false;   //硬度
                    this.RigiditytextBox1.Enabled = false;
                    this.Waterlabel1.Enabled      = false;   //含水率
                    this.WatertextBox1.Enabled    = false;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("FruitParamForm中函数FruitParamForm_Load出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("FruitParamForm中函数FruitParamForm_Load出错" + ex);
#endif
            }
        }
Example #10
0
        /// <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
                }
            }
        }
Example #11
0
        /// <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
            }
        }