Ejemplo n.º 1
0
        private bool SetupParameterCheckProcess2()
        {
            SetBlackDisplay();

            #region 验证光谱信息是否合法
            int    SelId = m_ChanelIDList[m_InnerQualitySelectIndex];
            int    m_InnerQualitySubsysindex  = Commonfunction.GetSubsysIndex(SelId);  //子系统索引
            int    m_InnerQualityChannelIndex = Commonfunction.GetChannelIndex(SelId); //子系统通道
            string strData             = this.EditInfoProductID.Text.Trim();
            int    len                 = strData.Length;
            string qProductID          = "";
            string qProductSerial      = "";
            string qSpectrometerSerial = "";
            float  FL = 0;
            if ((len < 5) || (len > 23) || string.IsNullOrWhiteSpace(strData))
            {
                this.EditInfoProductID.ForeColor = Color.Red;
                return(false);
            }
            else
            {
                this.EditInfoProductID.ForeColor = Color.Black;
                qProductID = strData;
            }
            strData = this.EditInfoProductSerial.Text.Trim();
            len     = strData.Length;
            if ((len < 5) || (len > 23) || string.IsNullOrWhiteSpace(strData))
            {
                this.EditInfoProductSerial.ForeColor = Color.Red;
                return(false);
            }
            else
            {
                this.EditInfoProductSerial.ForeColor = Color.Black;
                qProductSerial = strData;
            }
            strData = this.EditInfoSpectoroSerial.Text.Trim();
            len     = strData.Length;
            if ((len < 5) || (len > 23) || string.IsNullOrWhiteSpace(strData))
            {
                this.EditInfoSpectoroSerial.ForeColor = Color.Red;
                return(false);
            }
            else
            {
                this.EditInfoSpectoroSerial.ForeColor = Color.Black;
                qSpectrometerSerial = strData;
            }
            TMsgByte24Format buffProductID          = Commonfunction.StringToByteArrayConversion(qProductID);
            TMsgByte24Format buffProductSerial      = Commonfunction.StringToByteArrayConversion(qProductSerial);
            TMsgByte24Format buffSpectrometerSerial = Commonfunction.StringToByteArrayConversion(qSpectrometerSerial);
            for (int i = 0; i < 23; i++)
            {
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].ProductID.buf[i]     = buffProductID.buf[i];
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].ProductSerial.buf[i] = buffProductSerial.buf[i];
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].SpectraSerial.buf[i] = buffSpectrometerSerial.buf[i];
            }
            temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].ProductID.buf[23]     = 0;
            temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].ProductSerial.buf[23] = 0;
            temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].SpectraSerial.buf[23] = 0;
            if (float.TryParse(this.EditCcdInfoCoeffA0.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA0.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[0] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA0.ForeColor = Color.Red;
                return(false);
            }
            if (float.TryParse(this.EditCcdInfoCoeffA1.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA1.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[1] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA1.ForeColor = Color.Red;
                return(false);
            }
            if (float.TryParse(this.EditCcdInfoCoeffA2.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA2.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[2] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA2.ForeColor = Color.Red;
                return(false);
            }
            if (float.TryParse(this.EditCcdInfoCoeffA3.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA3.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[3] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA3.ForeColor = Color.Red;
                return(false);
            }
            if (float.TryParse(this.EditCcdInfoCoeffA4.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA4.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[4] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA4.ForeColor = Color.Red;
                return(false);
            }
            if (float.TryParse(this.EditCcdInfoCoeffA5.Text.Trim(), out FL))
            {
                this.EditCcdInfoCoeffA5.ForeColor = Color.Black;
                temp_SysDevInfoData[m_InnerQualitySubsysindex * ConstPreDefine.MAX_CHANNEL_NUM + m_InnerQualityChannelIndex].unitDblAr.DblArray[5] = FL;
            }
            else
            {
                this.EditCcdInfoCoeffA5.ForeColor = Color.Red;
                return(false);
            }
            #endregion
            return(true);
        }