/// <summary> /// 初始化 /// </summary> private void RotSetInitial() { try { int num = 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) //Modify by xcw - 20200619 { m_RotChanelIDList.Add(Commonfunction.EncodeChannel(i, j, j)); } else if (GlobalDataInterface.nVer == 1) { m_RotChanelIDList.Add(Commonfunction.EncodeChannel(i, j / 2, j % 2)); } num++; this.RotChannelcontextMenuStrip.Items.Add(m_resourceManager.GetString("Lanelabel.Text") + string.Format(" {0}", num)); this.RotChannelcontextMenuStrip.Items[num - 1].Click += new EventHandler(RotChannelcontextMenuStrip_Click); } } } if (GlobalDataInterface.RotGradeNum == 0) { GlobalDataInterface.RotGradeNum = ConstPreDefine.MAX_ROT_GRADE_NUM; } this.RotcomboBox.SelectedIndex = GlobalDataInterface.RotGradeNum - 1; GlobalDataInterface.globalOut_GradeInfo.stRotGradeName.CopyTo(m_RotGradeName, 0); GlobalDataInterface.globalOut_GradeInfo.unRotFactor.CopyTo(m_RotFactor, 0); SetRotListView(); RotSetEditors = new Control[] { this.RotNametextBox, this.RotAreanumericUpDown, this.RotNumnumericUpDown }; } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-RotSetFormt中函数RotSetInitial出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-RotSetFormt中函数RotSetInitial出错" + ex); #endif } }
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 } }
/// <summary> /// 初始化 /// </summary> private void FlawSetInitial() { try { int num = 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) //Modify by xcw - 20200619 { m_FlawChanelIDList.Add(Commonfunction.EncodeChannel(i, j, j)); } else if (GlobalDataInterface.nVer == 1) { m_FlawChanelIDList.Add(Commonfunction.EncodeChannel(i, j / 2, j % 2)); } num++; this.FlawChannelcontextMenuStrip.Items.Add(m_resourceManager.GetString("Lanelabel.Text") + string.Format(" {0}", num)); //this.FlawChannelcontextMenuStrip.Items[num - 1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); //modify by xcw 20200901 switch (GlobalDataInterface.globalOut_SysConfig.nSystemInfo) { //case ConstPreDefine.RM_M: case ConstPreDefine.RM2_FM: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LMR: case ConstPreDefine.RM2_FLMR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_F_M: case ConstPreDefine.RM2_MM_FM: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LFR_LMR: case ConstPreDefine.RM2_MLMR_FLMR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_F_M_B: case ConstPreDefine.RM2_BM_MM_FM: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-B Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[2].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LFR_LMR_LBR: case ConstPreDefine.RM2_BLMR_MLMR_FLMR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-B Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[2].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LR: case ConstPreDefine.RM2_FLR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("Color Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_F: case ConstPreDefine.RM2_MM: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LFR: case ConstPreDefine.RM2_MLMR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_F_B: case ConstPreDefine.RM2_BM_MM: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-B Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; //case ConstPreDefine.RM_LFR_LBR: case ConstPreDefine.RM2_BLMR_MLMR: ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-F Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[0].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems.Add("NIR-B Camera"); ((ToolStripDropDownItem)this.FlawChannelcontextMenuStrip.Items[num - 1]).DropDownItems[1].Click += new EventHandler(FlawChannelcontextMenuStrip_Click); break; default: break; } } } } if (GlobalDataInterface.FlawGradeNum == 0) { GlobalDataInterface.FlawGradeNum = ConstPreDefine.MAX_FlAWAREA_GRADE_NUM; } this.FlawcomboBox.SelectedIndex = GlobalDataInterface.FlawGradeNum - 1; GlobalDataInterface.globalOut_GradeInfo.stFlawareaGradeName.CopyTo(m_FlawGradeName, 0); GlobalDataInterface.globalOut_GradeInfo.unFlawAreaFactor.CopyTo(m_FlawFactor, 0); SetFlawListView(); FlawSetEditors = new Control[] { this.FlawNametextBox, this.FlawAreanumericUpDown, this.FlawNumnumericUpDown }; } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-FlawSeFormt中函数FlawSetInitial出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-FlawSeFormt中函数FlawSetInitial出错" + ex); #endif } }