private void comboBoxNCgroup_SelectedIndexChanged(object sender, EventArgs e) { //清空superGrid資料 OperPanel.Rows.Clear(); //取得comboBox資料 CurrentNCGroup = comboBoxNCgroup.Text; //取得選擇的NC foreach (NXOpen.CAM.NCGroup ncGroup in NCGroupAry) { if (CurrentNCGroup != ncGroup.Name) { continue; } SelectNCGroup = ncGroup; } //取得Group下的所有OP OperationObj = SelectNCGroup.GetMembers(); #region 填值到SuperGridOperPanel GridRow row = new GridRow(); foreach (KeyValuePair <string, string> kvp in DicNCData) { if (CurrentNCGroup != kvp.Key) { continue; } string[] splitOperName = kvp.Value.Split(','); for (int i = 0; i < splitOperName.Length; i++) { //CheckBox1 aaa = new CheckBox1(); row = new GridRow(false, splitOperName[i], ""); //OperPanel.Columns["挑選"].EditorType = typeof(CheckBox1); OperPanel.Rows.Add(row); } } #endregion }
private void comboBoxNCgroup_SelectedIndexChanged(object sender, EventArgs e) { PostPanel.Rows.Clear(); //清空superGrid資料&機台資訊 OperPanel.Rows.Clear(); MachineNo.Text = ""; //取得comboBox資料 CurrentNCGroup = comboBoxNCgroup.Text; #region 建立NC資料夾 string Is_Local = ""; Is_Local = Environment.GetEnvironmentVariable("UGII_ENV_FILE"); if (Is_Local != null) { //CaxPublic.GetAllPath("TE", displayPart.FullPath, out sPartInfo, ref cMETE_Download_Upload_Path); //if (!cMETE_Download_Upload_Path.Local_Folder_CAM.Contains("Oper1")) //{ // NCFolderPath = string.Format(@"{0}\{1}_{2}", cMETE_Download_Upload_Path.Local_Folder_CAM, CurrentNCGroup, "NC"); //} //else //{ // NCFolderPath = string.Format(@"{0}\{1}_{2}", Path.GetDirectoryName(displayPart.FullPath), CurrentNCGroup, "NC"); //} if (displayPart.FullPath.Contains("D:\\Globaltek\\Task")) { CaxPublic.GetAllPath("TE", displayPart.FullPath, out sPartInfo, ref cMETE_Download_Upload_Path); NCFolderPath = string.Format(@"{0}\{1}_{2}", cMETE_Download_Upload_Path.Local_Folder_CAM, CurrentNCGroup, "NC"); } else { NCFolderPath = string.Format(@"{0}\{1}_{2}", System.IO.Path.GetDirectoryName(displayPart.FullPath), CurrentNCGroup, "NC"); } } else { NCFolderPath = string.Format(@"{0}\{1}_{2}", Path.GetDirectoryName(displayPart.FullPath), CurrentNCGroup, "NC"); } if (!Directory.Exists(NCFolderPath)) { System.IO.Directory.CreateDirectory(NCFolderPath); } #endregion //取得選擇的NC foreach (NXOpen.CAM.NCGroup ncGroup in NCGroupAry) { if (CurrentNCGroup == ncGroup.Name) { SelectNCGroup = ncGroup; } } //取得Group下的所有OP OperationObj = SelectNCGroup.GetMembers(); #region 填值到SuperGridOperPanel GridRow gridRow = new GridRow(); foreach (KeyValuePair <string, string> kvp in DicNCData) { if (CurrentNCGroup != kvp.Key) { continue; } string[] splitOperName = kvp.Value.Split(','); for (int i = 0; i < splitOperName.Length; i++) { gridRow = new GridRow(false, splitOperName[i], ""); OperPanel.Rows.Add(gridRow); } } #endregion //填機台到MachineNo欄位並取得對應後處理器 try { this.MachineNo.Text = PostProcessorDlg.SelectNCGroup.GetStringAttribute("MachineNo"); } catch (Exception exception) { this.MachineNo.Text = ""; } if (this.MachineNo.Text == "") { gridRow = new GridRow(""); PostProcessorDlg.PostPanel.Rows.Add(gridRow); for (int k = 0; k < (int)PostProcessorDlg.TemplatePostData.Length; k++) { if (k > 6) { string templatePostData = PostProcessorDlg.TemplatePostData[k]; char[] chrArray = new char[] { ',' }; gridRow = new GridRow(templatePostData.Split(chrArray)[0]); PostProcessorDlg.PostPanel.Rows.Add(gridRow); } } } else { gridRow = new GridRow(""); PostProcessorDlg.PostPanel.Rows.Add(gridRow); ISession session = MyHibernateHelper.SessionFactory.OpenSession(); List <string> strs = new List <string>(); string[] strArrays1 = this.MachineNo.Text.Split(new char[] { ',' }); int num = 0; while (num < (int)strArrays1.Length) { string str = strArrays1[num]; Sys_MachineNo sysMachineNo = session.QueryOver <Sys_MachineNo>().Where((Sys_MachineNo x) => x.machineNo == str).SingleOrDefault <Sys_MachineNo>(); if (sysMachineNo.postprocessor != null) { string[] strArrays2 = sysMachineNo.postprocessor.Split(new char[] { ',' }); for (int l = 0; l < (int)strArrays2.Length; l++) { string str1 = strArrays2[l]; if (!strs.Contains(str1)) { strs.Add(str1); } } num++; } else { for (int m = 0; m < (int)PostProcessorDlg.TemplatePostData.Length; m++) { if (m > 6) { string templatePostData1 = PostProcessorDlg.TemplatePostData[m]; char[] chrArray1 = new char[] { ',' }; gridRow = new GridRow(templatePostData1.Split(chrArray1)[0]); PostProcessorDlg.PostPanel.Rows.Add(gridRow); } } break; } } foreach (string str2 in strs) { gridRow = new GridRow(str2); PostProcessorDlg.PostPanel.Rows.Add(gridRow); } } /* * try * { * MachineNo.Text = SelectNCGroup.GetStringAttribute("MachineNo"); * //postprocessor = SelectNCGroup.GetStringAttribute("postprocessor"); * } * catch (System.Exception ex) * { * MachineNo.Text = ""; * postprocessor = ""; * } * * if (postprocessor != "") * { * string[] splitPostProcessor = postprocessor.Split(','); * string empty = ""; * row = new GridRow(empty); * PostPanel.Rows.Add(row); * for (int i = 0; i < splitPostProcessor.Length; i++) * { * row = new GridRow(splitPostProcessor[i]); * PostPanel.Rows.Add(row); * } #region 在ShopDoc中有指定機台並且有後處理 * if (splitPostProcessor.Length == 1) * { * //如果只有一個後處理,則自動對應 * for (int i = 0; i < OperPanel.Rows.Count;i++ ) * { * OperPanel.GetCell(i, 2).Value = splitPostProcessor[0]; * } * } #endregion * } * else * { #region 在ShopDoc中沒指定機台or有指定機台但沒有後處理,則顯示全部後處理 * string empty = ""; * row = new GridRow(empty); * PostPanel.Rows.Add(row); * for (int i = 0; i < TemplatePostData.Length; i++) * { * if (i > 6) * { * string PostName = TemplatePostData[i].Split(',')[0]; * row = new GridRow(PostName); * PostPanel.Rows.Add(row); * } * } #endregion * } */ }
private void comboBoxNCgroup_SelectedIndexChanged(object sender, EventArgs e) { //清空listView資料 listView1.Items.Clear(); listView3.Items.Clear(); listView4.Items.Clear(); listView5.Items.Clear(); //取得comboBox資料 CurrentNCGroup = comboBoxNCgroup.Text; //取得選擇的NC foreach (NXOpen.CAM.NCGroup ncGroup in NCGroupAry) { if (CurrentNCGroup != ncGroup.Name) { continue; } NCGroupMessage = CaxOper.AskNCGroupMessage(ncGroup); SelectNCGroup = ncGroup; } //當選擇海德漢控制器時,修改檔頭檔尾 NewGroupName = "O" + Regex.Replace(CurrentNCGroup, "[^0-9]", "") + "0"; if (chb_Heidenhain.Checked == true) { for (int i = 0; i < cControlerConfig.Controler.Count; i++) { if (cControlerConfig.Controler[i].CompanyName == chb_Heidenhain.Text) { if (cControlerConfig.Controler[i].MasterValue1 != "") { listView3.Items.Add(cControlerConfig.Controler[i].MasterValue1); } if (cControlerConfig.Controler[i].MasterValue2 != "") { listView4.Items.Add(cControlerConfig.Controler[i].MasterValue2); } if (cControlerConfig.Controler[i].MasterValue3 != "") { listView4.Items.Add(cControlerConfig.Controler[i].MasterValue3); } break; } } listView3.Items[0].Text = listView3.Items[0].Text.Replace("[NCGroupName]", NewGroupName); listView3.Items.Add(";(" + NCGroupMessage + ")"); listView4.Items[1].Text = listView4.Items[1].Text.Replace("[NCGroupName]", NewGroupName); } else if (chb_Fanuc.Checked == true) { for (int i = 0; i < cControlerConfig.Controler.Count; i++) { if (cControlerConfig.Controler[i].CompanyName == chb_Fanuc.Text) { if (cControlerConfig.Controler[i].MasterValue1 != "") { ListViewItem tempViewItem = new ListViewItem(cControlerConfig.Controler[i].MasterValue1); listView3.Items.Add(tempViewItem); } if (cControlerConfig.Controler[i].MasterValue2 != "") { ListViewItem tempViewItem = new ListViewItem(cControlerConfig.Controler[i].MasterValue2); listView4.Items.Add(tempViewItem); } if (cControlerConfig.Controler[i].MasterValue3 != "") { ListViewItem tempViewItem = new ListViewItem(cControlerConfig.Controler[i].MasterValue3); listView4.Items.Add(tempViewItem); } break; } } listView3.Items.Add(NewGroupName + "(" + NCGroupMessage + ")"); } //取得Group下的所有OP OperObjAry = SelectNCGroup.GetMembers(); #region 填值到ListView5 foreach (KeyValuePair <string, string> kvp in DicNCData) { if (CurrentNCGroup != kvp.Key) { continue; } string[] splitOperName = kvp.Value.Split(','); for (int i = 0; i < splitOperName.Length; i++) { ListViewItem tempViewItem = new ListViewItem(splitOperName[i]); ListViewItem.ListViewSubItem tempViewSubItem = new ListViewItem.ListViewSubItem(); foreach (CAMObject tempOper in OperObjAry) { if (splitOperName[i] == tempOper.Name) { tempViewSubItem = new ListViewItem.ListViewSubItem(tempViewItem, CaxOper.AskOperToolNumber((NXOpen.CAM.Operation)tempOper)); } } tempViewItem.SubItems.Add(tempViewSubItem); listView5.Items.Add(tempViewItem); } } #endregion }