예제 #1
0
        private void comboBoxCusVer_SelectedIndexChanged(object sender, EventArgs e)
        {
            //取得當前選取的客戶
            //CurrentCusVer = comboBoxCusVer.Text;
            //開啟&清空下拉選單-製程版次
            comboBoxOpVer.Enabled = true;
            comboBoxOpVer.Items.Clear();
            comboBoxOpVer.Text = "";
            //清空superGridPanel
            panel.Rows.Clear();

            //取得本機客戶版次資料夾目錄
            string Local_CusVerDir = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetLocalTaskDir(), comboBoxCus.Text, comboBoxPartNo.Text, comboBoxCusVer.Text);

            Local_OpVerPathAry = Directory.GetDirectories(Local_CusVerDir);/*目錄(含路徑)的陣列*/

            foreach (string item in Local_OpVerPathAry)
            {
                comboBoxOpVer.Items.Add(Path.GetFileNameWithoutExtension(item));
            }
            if (comboBoxOpVer.Items.Count == 1)
            {
                comboBoxOpVer.Text = comboBoxOpVer.Items[0].ToString();
            }

            /*
             * //取得本機客戶版次目錄
             * string Local_CusVerDir = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetLocalTaskDir(), CurrentCusName, CurrentPartNo, CurrentCusVer);
             *
             * string[] Local_PartAry = System.IO.Directory.GetFiles(Local_CusVerDir);
             *
             * List<string> ListPartName = new List<string>();
             *
             * foreach (string item in Local_PartAry)
             * {
             *  if (!item.Contains("OIS"))
             *  {
             *      continue;
             *  }
             *  ListPartName.Add(item);
             * }
             *
             * GridRow row = new GridRow();
             * foreach (string item in ListPartName)
             * {
             *  row = new GridRow(false, Path.GetFileName(item));
             *  panel.Rows.Add(row);
             * }
             */
        }
예제 #2
0
        public MEDownloadDlg()
        {
            InitializeComponent();

            #region 客戶資料填入
            string[] S_Task_CusName = Directory.GetDirectories(CaxEnv.GetGlobaltekTaskDir());
            foreach (string item in S_Task_CusName)
            {
                comboBoxCusName.Items.Add(Path.GetFileNameWithoutExtension(item));//走訪每個元素只取得目錄名稱(不含路徑)並加入dirlist集合中
            }
            PartNocomboBox.Enabled = false;
            CusRevcomboBox.Enabled = false;
            OpRevcomboBox.Enabled  = false;
            Oper1comboBox.Enabled  = false;
            #endregion

            /*
             * //取得METEDownloadData資料
             * status = CaxGetDatData.GetMETEDownloadData(out cMETEDownloadData);
             * if (!status)
             * {
             *  MessageBox.Show("取得METEDownloadData失敗");
             *  return;
             * }
             *
             * //存入下拉選單-客戶
             * for (int i = 0; i < cMETEDownloadData.EntirePartAry.Count; i++)
             * {
             *  comboBoxCusName.Items.Add(cMETEDownloadData.EntirePartAry[i].CusName);
             * }
             * PartNocomboBox.Enabled = false;
             * CusRevcomboBox.Enabled = false;
             * Oper1comboBox.Enabled = false;
             */


            //取得METEDownload_Upload資料
            sDownUpLoadDat = new CaxDownUpLoad.DownUpLoadDat();
            status         = CaxDownUpLoad.GetDownUpLoadDat(out sDownUpLoadDat);
            if (!status)
            {
                return;
            }
            //status = CaxGetDatData.GetMETEDownload_Upload(out cMETE_Download_Upload_Path);
            //if (!status)
            //{
            //    MessageBox.Show("取得METEDownload_Upload_New失敗");
            //    return;
            //}
        }
예제 #3
0
        private void comboBoxOldCusRev_SelectedIndexChanged(object sender, EventArgs e)
        {
            //清空superGrid資料
            panel.Rows.Clear();
            //取得當前選取的客戶版次
            CurrentOldCusRev = comboBoxOldCusRev.Text;

            //取得PECreateData.dat
            string PECreateData_Path = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekTaskDir(), CurrentOldCusName, CurrentOldPartNo, CurrentOldCusRev, "MODEL", "PECreateData.dat");

            if (!File.Exists(PECreateData_Path))
            {
                CaxLog.ShowListingWindow("此料號沒有舊資料檔案,請檢查PECreateData.dat");
                return;
            }
            CaxPE.ReadPECreateData(PECreateData_Path, out cPECreateData);

            //將舊資料填入SuperGridControl
            GridRow row = new GridRow();

            for (int i = 0; i < cPECreateData.Oper1Ary.Count; i++)
            {
                row = new GridRow(cPECreateData.Oper1Ary[i], cPECreateData.Oper2Ary[i], "刪除");
                panel.Rows.Add(row);
            }

            /*
             * //比對選擇的客戶版次取得對應的Oper並塞入SuperGridControl
             * List<string> ListOper1 = new List<string>();
             * List<string> ListOper2 = new List<string>();
             * for (int i = 0; i < cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev.Count; i++)
             * {
             *  if (CurrentOldCusRev == cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev[i].RevNo)
             *  {
             *      ListOper1 = cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev[i].OperAry1;
             *      ListOper2 = cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev[i].OperAry2;
             *  }
             * }
             *
             * GridRow row = new GridRow();
             * for (int i = 0; i < ListOper1.Count;i++ )
             * {
             *  row = new GridRow(ListOper1[i], ListOper2[i], "刪除");
             *  panel.Rows.Add(row);
             * }
             */
            Is_OldPart = true;
        }
예제 #4
0
        private void buttonWSelPart_Click(object sender, EventArgs e)
        {
            string ServerPartPath = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetGlobaltekTaskDir(),
                                                  CurrentCusName,
                                                  CurrentPartNo,
                                                  CurrentCusVer);
            string tempFileName = "";

            status = CaxPublic.OpenFileDialog(out tempFileName, out labelWBilletPath, ServerPartPath);
            if (!status)
            {
                MessageBox.Show("選擇檔案失敗,請聯繫開發工程師");
                return;
            }
            labelW.Text = tempFileName;
        }
예제 #5
0
        private void comboBoxCusName_SelectedIndexChanged(object sender, EventArgs e)
        {
            //清空ListView資訊
            listView.Items.Clear();
            //取得當前選取的客戶
            CurrentCusName = comboBoxCusName.Text;
            //打開&清空下拉選單-料號
            PartNocomboBox.Enabled = true;
            PartNocomboBox.Items.Clear();
            PartNocomboBox.Text = "";
            //關閉&清空下拉選單-客戶版次
            CusRevcomboBox.Enabled = false;
            CusRevcomboBox.Items.Clear();
            CusRevcomboBox.Text = "";
            //關閉&清空下拉選單-製程序
            Oper1comboBox.Enabled = false;
            Oper1comboBox.Items.Clear();
            Oper1comboBox.Text = "";

            string S_Task_CusName_Path = string.Format(@"{0}\{1}", CaxEnv.GetGlobaltekTaskDir(), CurrentCusName);

            string[] S_Task_PartNo = Directory.GetDirectories(S_Task_CusName_Path);
            foreach (string item in S_Task_PartNo)
            {
                PartNocomboBox.Items.Add(Path.GetFileNameWithoutExtension(item));//走訪每個元素只取得目錄名稱(不含路徑)並加入dirlist集合中
            }

            /*
             * //比對選擇的客戶取得對應的料號並塞入料號下拉選單中
             * for (int i = 0; i < cMETEDownloadData.EntirePartAry.Count; i++)
             * {
             *  if (CurrentCusName == cMETEDownloadData.EntirePartAry[i].CusName)
             *  {
             *      IndexofCusName = i;
             *      for (int j = 0; j < cMETEDownloadData.EntirePartAry[i].CusPart.Count; j++)
             *      {
             *          PartNocomboBox.Items.Add(cMETEDownloadData.EntirePartAry[i].CusPart[j].PartNo);
             *      }
             *  }
             * }
             */
        }
예제 #6
0
        private void comboBoxCus_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                MOT_File = "";
                //取得當前選取的客戶
                CurrentCusName = comboBoxCus.Text;
                //開啟&清空下拉選單-料號
                comboBoxPartNo.Enabled = true;
                comboBoxPartNo.Items.Clear();
                comboBoxPartNo.Text = "";
                //關閉&清空下拉選單-客戶版次
                comboBoxCusVer.Enabled = false;
                comboBoxCusVer.Items.Clear();
                comboBoxCusVer.Text = "";
                //關閉&清空下拉選單-製程版次
                comboBoxOpVer.Enabled = false;
                comboBoxOpVer.Items.Clear();
                comboBoxOpVer.Text = "";

                //取得Server客戶資料夾目錄
                string Server_CusDir = string.Format(@"{0}\{1}", CaxEnv.GetGlobaltekTaskDir(), CurrentCusName);
                Server_PartNoPathAry = Directory.GetDirectories(Server_CusDir);/*目錄(含路徑)的陣列*/

                foreach (string item in Server_PartNoPathAry)
                {
                    comboBoxPartNo.Items.Add(Path.GetFileNameWithoutExtension(item));
                }
                if (comboBoxPartNo.Items.Count == 1)
                {
                    comboBoxPartNo.Text = comboBoxPartNo.Items[0].ToString();
                }
            }
            catch (System.Exception ex)
            {
            }
        }
예제 #7
0
        private void CusRevcomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //清空ListView資訊
            listView.Items.Clear();
            //取得當前選取的客戶版次
            CurrentCusRev = CusRevcomboBox.Text;
            //打開&清空下拉選單-製程序
            Oper1comboBox.Enabled = true;
            Oper1comboBox.Items.Clear();
            Oper1comboBox.Text = "";

            //取得PECreateData.dat
            string PECreateData_Path = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekTaskDir(), CurrentCusName, CurrentPartNo, CurrentCusRev, "MODEL", "PECreateData.dat");

            if (!File.Exists(PECreateData_Path))
            {
                CaxLog.ShowListingWindow("此料號沒有舊資料檔案,請檢查PECreateData.dat");
                return;
            }
            CaxPE.ReadPECreateData(PECreateData_Path, out cPECreateData);

            Oper1comboBox.Items.AddRange(cPECreateData.Oper1Ary.ToArray());
            Oper1comboBox.Items.Add("全部下載");

            /*
             * //比對選擇的客戶、料號、版次取得對應的製程序並塞入下拉選單中
             * for (int i = 0; i < cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev.Count; i++ )
             * {
             *  if (CurrentCusRev == cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev[i].RevNo)
             *  {
             *      Oper1comboBox.Items.AddRange(cMETEDownloadData.EntirePartAry[IndexofCusName].CusPart[IndexofPartNo].CusRev[i].OperAry1.ToArray());
             *  }
             * }
             * Oper1comboBox.Items.Add("全部下載");
             */
        }
예제 #8
0
        private void comboBoxCus_SelectedIndexChanged(object sender, EventArgs e)
        {
            //取得當前選取的客戶
            //CurrentCusName = comboBoxCus.Text;
            //開啟&清空下拉選單-料號
            comboBoxPartNo.Enabled = true;
            comboBoxPartNo.Items.Clear();
            comboBoxPartNo.Text = "";
            //關閉&清空下拉選單-客戶版次
            comboBoxCusVer.Enabled = false;
            comboBoxCusVer.Items.Clear();
            comboBoxCusVer.Text = "";
            //關閉&清空下拉選單-製程版次
            comboBoxOpVer.Enabled = false;
            comboBoxOpVer.Items.Clear();
            comboBoxOpVer.Text = "";
            //清空superGridPanel
            panel.Rows.Clear();

            //取得本機客戶資料夾目錄
            string Local_CusDir = string.Format(@"{0}\{1}", CaxEnv.GetLocalTaskDir(), comboBoxCus.Text);

            Local_PartNoPathAry = Directory.GetDirectories(Local_CusDir);/*目錄(含路徑)的陣列*/

            foreach (string item in Local_PartNoPathAry)
            {
                comboBoxPartNo.Items.Add(Path.GetFileNameWithoutExtension(item));
            }
            if (comboBoxPartNo.Items.Count == 1)
            {
                comboBoxPartNo.Text = comboBoxPartNo.Items[0].ToString();
            }

            /*
             * //取得當前選取的客戶
             * CurrentCusName = comboBoxCus.Text;
             * //開啟&清空下拉選單-料號
             * comboBoxPartNo.Enabled = true;
             * comboBoxPartNo.Items.Clear();
             * comboBoxPartNo.Text = "";
             * //關閉&清空下拉選單-客戶版次
             * comboBoxCusVer.Enabled = false;
             * comboBoxCusVer.Items.Clear();
             * comboBoxCusVer.Text = "";
             * //清空superGridPanel
             * panel.Rows.Clear();
             *
             * //取得本機客戶資料夾目錄
             * Local_PartNoPathAry = new string[] { };
             * Local_PartNoAry = new ArrayList();
             * string Local_CusDir = string.Format(@"{0}\{1}", CaxEnv.GetLocalTaskDir(), CurrentCusName);
             * Local_PartNoPathAry = Directory.GetDirectories(Local_CusDir);
             *
             * foreach (string item in Local_PartNoPathAry)
             * {
             *  Local_PartNoAry.Add(Path.GetFileNameWithoutExtension(item));
             * }
             *
             * comboBoxPartNo.Items.AddRange(Local_PartNoAry.ToArray());
             */
        }
예제 #9
0
        private void buttonOpenTask_Click(object sender, EventArgs e)
        {
            #region (註解)檢查是否有選擇組裝方式

            /*
             * if (SeleOperValue == "001")
             * {
             *  if (check001HasBillet.Checked == false && check001NoBillet.Checked == false)
             *  {
             *      MessageBox.Show("請選擇一種組裝方式");
             *      return;
             *  }
             *  if (check001HasBillet.Checked == true && check001NoBillet.Checked == false)
             *  {
             *      if (label001.Text == "")
             *      {
             *          MessageBox.Show("請選擇一個零件當作胚料檔,或勾選無胚料檔");
             *          return;
             *      }
             *  }
             * }
             * else if (SeleOperValue == "900")
             * {
             *
             * }
             * else
             * {
             *  if (checkWHasBillet.Checked == false && checkWNoBillet.Checked == false)
             *  {
             *      MessageBox.Show("請選擇一種組裝方式");
             *      return;
             *  }
             *  if (checkWHasBillet.Checked == true && checkWHasBillet.Checked == false)
             *  {
             *      if (labelW.Text == "")
             *      {
             *          MessageBox.Show("請選擇一個前段工序檔當作此工序零件檔,或勾選無前段工序檔");
             *          return;
             *      }
             *  }
             * }
             */
            #endregion

            if (SelePartName == "")
            {
                MessageBox.Show("請選擇欲開啟的零件!");
                return;
            }

            string Local_CAMPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetLocalTaskDir(),
                                                         comboBoxCus.Text,
                                                         comboBoxPartNo.Text,
                                                         comboBoxCusVer.Text,
                                                         comboBoxOpVer.Text,
                                                         SelePartName);

            //組件存在,直接開啟任務組立
            BasePart newAsmPart;
            status = CaxPart.OpenBaseDisplay(Local_CAMPartFullPath, out newAsmPart);
            if (!status)
            {
                CaxLog.ShowListingWindow("組立開啟失敗!");
                return;
            }



            /*
             * //判斷組件是否曾經被開啟。如已被開啟過,則開啟檔案後離開;反之則塞上屬性(Title=IsOpend,Value=Y)並組裝客戶零件與胚料零件
             * string checkIsOpened = "";
             * try
             * {
             *  checkIsOpened = newAsmPart.GetStringAttribute("ISOPENED");
             *  if (checkIsOpened == "Y")
             *  {
             *      CaxPart.Save();
             *      this.Close();
             *      return;
             *  }
             * }
             * catch (System.Exception ex)
             * {
             *  newAsmPart.SetAttribute("ISOPENED", "Y");
             * }
             *
             * NXOpen.Assemblies.Component newComponent = null;
             *
             #region 組裝客戶檔案
             *
             * string Local_NewModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(),
             *                                                                         CurrentCusName,
             *                                                                         CurrentPartNo,
             *                                                                         CurrentCusVer,
             *                                                                         CurrentPartNo + ".prt");
             * //判斷是否已經有客戶檔案,如果沒有則複製過來
             * if (!System.IO.File.Exists(Local_NewModelPartFullPath))
             * {
             *  File.Copy(Local_ModelPartFullPath, Local_NewModelPartFullPath, true);
             * }
             *
             * status = CaxAsm.AddComponentToAsmByDefault(Local_NewModelPartFullPath, out newComponent);
             * if (!status)
             * {
             *  CaxLog.ShowListingWindow("ERROR,組裝失敗!");
             *  return;
             * }
             *
             #endregion
             *
             * CaxAsm.SetWorkComponent(null);
             *
             #region 建立三階製程檔
             *
             * string Local_CurrentOperPartFullPath = "";
             * if (groupBox001.Enabled == true)
             * {
             *  if (check001NoBillet.Checked == true)
             *  {
             *      //選擇無胚料檔--新建檔案(檔名:料號_TE_製程序)
             *      Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_TE_" + SeleOperValue + ".prt");
             *      if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
             *      {
             *          status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("建立二階製程檔失敗");
             *              return;
             *          }
             *      }
             *  }
             *  else
             *  {
             *      //選擇有胚料檔--組裝胚料檔(檔名:胚料檔原始名稱)
             *      Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, label001.Text);
             *      if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
             *      {
             *          status = CaxAsm.AddComponentToAsmByDefault(Local_CurrentOperPartFullPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("001胚料檔組裝失敗");
             *              return;
             *          }
             *      }
             *  }
             * }
             * else if (groupBox900.Enabled == true)
             * {
             * }
             * else
             * {
             #region W階
             *  //組立"前段製程檔"
             *  if (checkWHasBillet.Checked == true & System.IO.File.Exists(labelWBilletPath))
             *  {
             *      //複製檔案到任務資料夾
             *      string tempBilletPath = labelWBilletPath;
             *      tempBilletPath = tempBilletPath.Replace(Path.GetDirectoryName(tempBilletPath), Path.GetDirectoryName(Local_NewModelPartFullPath));
             *      File.Copy(labelWBilletPath, tempBilletPath, true);
             *
             *      status = CaxAsm.AddComponentToAsmByDefault(tempBilletPath, out newComponent);
             *      if (!status)
             *      {
             *          CaxLog.ShowListingWindow("W階胚料檔組裝失敗");
             *          return;
             *      }
             *  }
             *
             *  //選擇無前段製程檔案--新建檔案(檔名:料號_TE_製程序)
             *  Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_TE_" + SeleOperValue + ".prt");
             *  if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
             *  {
             *      status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
             *      if (!status)
             *      {
             *          CaxLog.ShowListingWindow("建立三階製程檔失敗");
             *          return;
             *      }
             *  }
             #endregion
             * }
             *
             #endregion
             */

            CaxPart.Save();
            this.Close();
        }
예제 #10
0
        private void buttonOpenTask_Click(object sender, EventArgs e)
        {
            #region 檢查是否有選擇組裝方式

            if (SeleOperValue == "001")
            {
                if (check001HasBillet.Checked == false && check001NoBillet.Checked == false)
                {
                    MessageBox.Show("請選擇一種組裝方式");
                    return;
                }
                if (check001HasBillet.Checked == true && check001NoBillet.Checked == false)
                {
                    if (label001.Text == "")
                    {
                        MessageBox.Show("請選擇一個零件當作胚料檔,或勾選無胚料檔");
                        return;
                    }
                }
            }
            else if (SeleOperValue == "900")
            {
            }
            else
            {
                if (checkWHasBillet.Checked == false && checkWNoBillet.Checked == false)
                {
                    MessageBox.Show("請選擇一種組裝方式");
                    return;
                }
                if (checkWHasBillet.Checked == true && checkWHasBillet.Checked == false)
                {
                    if (labelW.Text == "")
                    {
                        MessageBox.Show("請選擇一個前段工序檔當作此工序零件檔,或勾選無前段工序檔");
                        return;
                    }
                }
            }

            #endregion

            string Local_CAMPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(),
                                                         CurrentCusName,
                                                         CurrentPartNo,
                                                         CurrentCusVer,
                                                         SelePartName);
            string Local_ModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetLocalTaskDir(),
                                                           CurrentCusName,
                                                           CurrentPartNo,
                                                           CurrentCusVer,
                                                           "MODEL",
                                                           CurrentPartNo + ".prt");
            string Local_ShareStrPartFullPath = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetLocalTaskDir(),
                                                              CurrentCusName,
                                                              CurrentPartNo,
                                                              CurrentCusVer);
            //組件存在,直接開啟任務組立
            BasePart newAsmPart;
            status = CaxPart.OpenBaseDisplay(Local_CAMPartFullPath, out newAsmPart);
            if (!status)
            {
                CaxLog.ShowListingWindow("組立開啟失敗!");
                return;
            }

            //判斷組件是否曾經被開啟。如已被開啟過,則開啟檔案後離開;反之則塞上屬性(Title=IsOpend,Value=Y)並組裝客戶零件與胚料零件
            string checkIsOpened = "";
            try
            {
                checkIsOpened = newAsmPart.GetStringAttribute("IsOpened");
                if (checkIsOpened == "Y")
                {
                    CaxPart.Save();
                    this.Close();
                    return;
                }
            }
            catch (System.Exception ex)
            {
                newAsmPart.SetAttribute("IsOpened", "Y");
            }

            NXOpen.Assemblies.Component newComponent = null;

            #region 組裝客戶檔案

            string Local_NewModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(),
                                                              CurrentCusName,
                                                              CurrentPartNo,
                                                              CurrentCusVer,
                                                              CurrentPartNo + ".prt");
            //判斷是否已經有客戶檔案,如果沒有則複製過來
            if (!System.IO.File.Exists(Local_NewModelPartFullPath))
            {
                File.Copy(Local_ModelPartFullPath, Local_NewModelPartFullPath, true);
            }

            status = CaxAsm.AddComponentToAsmByDefault(Local_NewModelPartFullPath, out newComponent);
            if (!status)
            {
                CaxLog.ShowListingWindow("ERROR,組裝失敗!");
                return;
            }

            #endregion

            CaxAsm.SetWorkComponent(null);

            #region 建立二階製程檔

            string Local_CurrentOperPartFullPath = "";
            if (groupBox001.Enabled == true)
            {
                if (check001NoBillet.Checked == true)
                {
                    //選擇無胚料檔--新建檔案(檔名:料號+製程序)
                    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_TE_" + SeleOperValue + ".prt");
                    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
                    {
                        status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立二階製程檔失敗");
                            return;
                        }
                    }
                }
                else
                {
                    //選擇有胚料檔--組裝胚料檔(檔名:胚料檔原始名稱)
                    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, label001.Text);
                    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
                    {
                        status = CaxAsm.AddComponentToAsmByDefault(Local_CurrentOperPartFullPath, out newComponent);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("001胚料檔組裝失敗");
                            return;
                        }
                    }
                }
            }
            else if (groupBox900.Enabled == true)
            {
            }
            else
            {
                if (checkWNoBillet.Checked == true)
                {
                    //選擇無胚料檔--新建檔案(檔名:料號+製程序)
                    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_TE_" + SeleOperValue + ".prt");
                    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
                    {
                        status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立二階製程檔失敗");
                            return;
                        }
                    }
                }
                else
                {
                    //選擇有胚料檔--組裝胚料檔(檔名:胚料檔原始名稱)
                    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, labelW.Text);
                    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
                    {
                        status = CaxAsm.AddComponentToAsmByDefault(Local_CurrentOperPartFullPath, out newComponent);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("W階胚料檔組裝失敗");
                            return;
                        }
                    }
                }
            }

            #endregion

            CaxPart.Save();
            this.Close();
        }
예제 #11
0
        private void buttonOpenTask_Click(object sender, EventArgs e)
        {
            #region (註解)檢查是否有選擇組裝方式

            //if (SeleOperValue == "001.prt")
            //{
            //    if (check001HasBillet.Checked == false && check001NoBillet.Checked == false)
            //    {
            //        MessageBox.Show("請選擇一種組裝方式");
            //        return;
            //    }
            //    if (check001HasBillet.Checked == true && check001NoBillet.Checked == false)
            //    {
            //        if (label001.Text == "")
            //        {
            //            MessageBox.Show("請選擇一個零件當作胚料檔,或勾選無胚料檔");
            //            return;
            //        }
            //    }
            //}
            //else if (SeleOperValue == "900.prt")
            //{

            //}
            //else
            //{
            //    if (checkWHasBillet.Checked == false && checkWNoBillet.Checked == false)
            //    {
            //        MessageBox.Show("請選擇一種組裝方式");
            //        return;
            //    }
            //    if (checkWHasBillet.Checked == true && checkWNoBillet.Checked == false)
            //    {
            //        if (labelW.Text == "")
            //        {
            //            MessageBox.Show("請選擇一個前段工序檔當作此工序零件檔,或勾選無前段工序檔");
            //            return;
            //        }
            //    }
            //}

            #endregion

            if (SelePartName == "")
            {
                MessageBox.Show("請選擇欲開啟的零件!");
                return;
            }
            string Local_OISPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetLocalTaskDir(),
                                                         comboBoxCus.Text,
                                                         comboBoxPartNo.Text,
                                                         comboBoxCusVer.Text,
                                                         comboBoxOpVer.Text,
                                                         SelePartName);

            //string Local_ModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}\{6}", CaxEnv.GetLocalTaskDir(),
            //                                                                               CurrentCusName,
            //                                                                               CurrentPartNo,
            //                                                                               CurrentCusVer,
            //                                                                               CurrentOpVer,
            //                                                                               "MODEL",
            //                                                                               CurrentPartNo + ".prt");

            //string Local_ShareStrPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(),
            //                                                                          CurrentCusName,
            //                                                                          CurrentPartNo,
            //                                                                          CurrentCusVer,
            //                                                                          CurrentOpVer);
            BasePart newAsmPart;
            status = CaxPart.OpenBaseDisplay(Local_OISPartFullPath, out newAsmPart);
            if (!status)
            {
                CaxLog.ShowListingWindow("組立開啟失敗!");
                return;
            }

            /*
             * if (check001HasBillet.Checked == true || check001NoBillet.Checked == true ||
             *  checkWHasBillet.Checked == true || checkWNoBillet.Checked == true)
             * {
             #region 組裝客戶檔案
             *  NXOpen.Assemblies.Component newComponent = null;
             *  string Local_NewModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetLocalTaskDir(),
             *                                                                                CurrentCusName,
             *                                                                                CurrentPartNo,
             *                                                                                CurrentCusVer,
             *                                                                                CurrentOpVer,
             *                                                                                CurrentPartNo + ".prt");
             *  //判斷是否已經有客戶檔案,如果沒有則複製過來
             *  if (!System.IO.File.Exists(Local_NewModelPartFullPath))
             *  {
             *      File.Copy(Local_ModelPartFullPath, Local_NewModelPartFullPath, true);
             *  }
             *
             *  status = CaxAsm.AddComponentToAsmByDefault(Local_NewModelPartFullPath, out newComponent);
             *  if (!status)
             *  {
             *      MessageBox.Show("客戶檔案組裝失敗!");
             *      this.Close();
             *      return;
             *  }
             #endregion
             *
             *  CaxAsm.SetWorkComponent(null);
             *
             #region 建立三階製程檔
             *
             *  string Local_CurrentOperPartFullPath = "";
             *  if (groupBox001.Enabled == true)
             *  {
             #region 001
             *      //組立"胚料檔"
             *      if (check001HasBillet.Checked == true & System.IO.File.Exists(label001BilletPath))
             *      {
             *          //複製檔案到任務資料夾
             *          string tempBilletPath = label001BilletPath;
             *          tempBilletPath = tempBilletPath.Replace(Path.GetDirectoryName(tempBilletPath), Path.GetDirectoryName(Local_NewModelPartFullPath));
             *          File.Copy(label001BilletPath, tempBilletPath, true);
             *
             *          status = CaxAsm.AddComponentToAsmByDefault(tempBilletPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("001胚料檔組裝失敗");
             *              return;
             *          }
             *      }
             *
             *      //組立"料號_ME_OISxxx"
             *      Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_ME_" + SeleOperValue);
             *
             *      if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
             *      {
             *          status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("建立三階製程檔失敗");
             *              return;
             *          }
             *      }
             #endregion
             *  }
             *  else if (groupBox900.Enabled == true)
             *  {
             *  }
             *  else
             *  {
             #region W階
             *      //組立"前段製程檔"
             *      if (checkWHasBillet.Checked == true & System.IO.File.Exists(labelWBilletPath))
             *      {
             *          //複製檔案到任務資料夾
             *          string tempBilletPath = labelWBilletPath;
             *          tempBilletPath = tempBilletPath.Replace(Path.GetDirectoryName(tempBilletPath), Path.GetDirectoryName(Local_NewModelPartFullPath));
             *          File.Copy(labelWBilletPath, tempBilletPath, true);
             *
             *          status = CaxAsm.AddComponentToAsmByDefault(tempBilletPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("W階胚料檔組裝失敗");
             *              return;
             *          }
             *      }
             *
             *      //組立"料號_ME_OISxxx"
             *      Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_ME_" + SeleOperValue);
             *      if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
             *      {
             *          status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
             *          if (!status)
             *          {
             *              CaxLog.ShowListingWindow("建立三階製程檔失敗");
             *              return;
             *          }
             *      }
             #endregion
             *  }
             *
             #endregion
             * }
             */
            //組件存在,直接開啟任務組立
            //BasePart newAsmPart;
            //status = CaxPart.OpenBaseDisplay(Local_OISPartFullPath, out newAsmPart);
            //if (!status)
            //{
            //    CaxLog.ShowListingWindow("組立開啟失敗!");
            //    return;
            //}

            //判斷組件是否曾經被開啟。如已被開啟過,則開啟檔案後離開;反之則塞上屬性(Title=IsOpend,Value=Y)並組裝客戶零件與胚料零件
            //string checkIsOpened = "";
            //try
            //{
            //    checkIsOpened = newAsmPart.GetStringAttribute("IsOpened");
            //    if (checkIsOpened == "Y")
            //    {
            //        CaxPart.Save();
            //        this.Close();
            //        return;
            //    }
            //}
            //catch (System.Exception ex)
            //{
            //    newAsmPart.SetAttribute("IsOpened", "Y");
            //}

            //NXOpen.Assemblies.Component newComponent = null;

            #region (註解中)組裝客戶檔案

            //string Local_NewModelPartFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(),
            //                                                                           CurrentCusName,
            //                                                                           CurrentPartNo,
            //                                                                           CurrentCusVer,
            //                                                                           CurrentPartNo + ".prt");
            //判斷是否已經有客戶檔案,如果沒有則複製過來
            //if (!System.IO.File.Exists(Local_NewModelPartFullPath))
            //{
            //    File.Copy(Local_ModelPartFullPath, Local_NewModelPartFullPath, true);
            //}

            //status = CaxAsm.AddComponentToAsmByDefault(Local_NewModelPartFullPath, out newComponent);
            //if (!status)
            //{
            //    CaxLog.ShowListingWindow("ERROR,組裝失敗!");
            //    this.Close();
            //    return;
            //}

            #endregion

            //CaxAsm.SetWorkComponent(null);

            #region (註解中)建立三階製程檔

            //string Local_CurrentOperPartFullPath = "";
            //if (groupBox001.Enabled == true)
            //{
            //    #region 001
            //    //組立"胚料檔"
            //    if (check001HasBillet.Checked == true & System.IO.File.Exists(label001BilletPath))
            //    {
            //        //複製檔案到任務資料夾
            //        string tempBilletPath = label001BilletPath;
            //        tempBilletPath = tempBilletPath.Replace(Path.GetDirectoryName(tempBilletPath), Path.GetDirectoryName(Local_NewModelPartFullPath));
            //        File.Copy(label001BilletPath, tempBilletPath, true);

            //        status = CaxAsm.AddComponentToAsmByDefault(tempBilletPath, out newComponent);
            //        if (!status)
            //        {
            //            CaxLog.ShowListingWindow("001胚料檔組裝失敗");
            //            return;
            //        }
            //    }

            //    //組立"料號_ME_OISxxx"
            //    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_ME_" + SeleOperValue);
            //    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
            //    {
            //        status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
            //        if (!status)
            //        {
            //            CaxLog.ShowListingWindow("建立三階製程檔失敗");
            //            return;
            //        }
            //    }
            //    #endregion
            //}
            //else if (groupBox900.Enabled == true)
            //{
            //}
            //else
            //{
            //    #region W階
            //    //組立"前段製程檔"
            //    if (checkWHasBillet.Checked == true & System.IO.File.Exists(labelWBilletPath))
            //    {
            //        //複製檔案到任務資料夾
            //        string tempBilletPath = labelWBilletPath;
            //        tempBilletPath = tempBilletPath.Replace(Path.GetDirectoryName(tempBilletPath), Path.GetDirectoryName(Local_NewModelPartFullPath));
            //        File.Copy(labelWBilletPath, tempBilletPath, true);

            //        status = CaxAsm.AddComponentToAsmByDefault(tempBilletPath, out newComponent);
            //        if (!status)
            //        {
            //            CaxLog.ShowListingWindow("W階胚料檔組裝失敗");
            //            return;
            //        }
            //    }

            //    //組立"料號_ME_OISxxx"
            //    Local_CurrentOperPartFullPath = string.Format(@"{0}\{1}", Local_ShareStrPartFullPath, CurrentPartNo + "_ME_" + SeleOperValue);
            //    if (!System.IO.File.Exists(Local_CurrentOperPartFullPath))
            //    {
            //        status = CaxAsm.CreateNewEmptyComp(Local_CurrentOperPartFullPath, out newComponent);
            //        if (!status)
            //        {
            //            CaxLog.ShowListingWindow("建立三階製程檔失敗");
            //            return;
            //        }
            //    }
            //    #endregion
            //}

            #endregion



            CaxPart.Save();
            this.Close();
        }
예제 #12
0
        private void comboBoxOpVer_SelectedIndexChanged(object sender, EventArgs e)
        {
            /*
             * //取得當前選取的客戶
             * //CurrentOpVer = comboBoxOpVer.Text;
             * //清空superGridPanel
             * panel.Rows.Clear();
             *
             * //取得本機製程版次目錄
             * string Local_OpVerDir = string.Format(@"{0}\{1}\{2}\{3}\{4}", CaxEnv.GetLocalTaskDir(), CurrentCusName, CurrentPartNo, CurrentCusVer, CurrentOpVer);
             *
             * string[] Local_PartAry = System.IO.Directory.GetFiles(Local_OpVerDir);
             *
             * List<string> ListPartName = new List<string>();
             *
             * foreach (string item in Local_PartAry)
             * {
             *  if (!item.Contains("OIS") || item.ToUpper().Contains("INSPECTION") || item.Contains(".pdf"))
             *  {
             *      continue;
             *  }
             *  ListPartName.Add(item);
             * }
             *
             * GridRow row = new GridRow();
             * foreach (string item in ListPartName)
             * {
             *  row = new GridRow(false, Path.GetFileName(item));
             *  panel.Rows.Add(row);
             * }
             */

            //MEOpenTaskDlg.CurrentOpVer = this.comboBoxOpVer.Text;
            MEOpenTaskDlg.panel.Rows.Clear();
            object[]      localTaskDir = new object[] { CaxEnv.GetLocalTaskDir(), comboBoxCus.Text, comboBoxPartNo.Text, comboBoxCusVer.Text, comboBoxOpVer.Text };
            string[]      files        = Directory.GetFiles(string.Format(@"{0}\{1}\{2}\{3}\{4}", localTaskDir));
            List <string> strs         = new List <string>();
            List <string> strs1        = new List <string>();

            string[] strArrays = files;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                if (str.Contains(string.Format("{0}_{1}", comboBoxPartNo.Text, "OIS")))
                {
                    string[] strArrays1 = new string[] { "OIS" };
                    string[] strArrays2 = str.Split(strArrays1, StringSplitOptions.RemoveEmptyEntries);
                    string   str1       = strArrays2[1].Substring(0, 3);
                    if (!strs1.Contains(str1))
                    {
                        strs1.Add(str1);
                    }
                }
            }
            foreach (string str2 in strs1)
            {
                strs.Add(string.Format("{0}_OIS{1}.prt", comboBoxPartNo.Text, str2));
            }
            GridRow gridRow = new GridRow();

            foreach (string str3 in strs)
            {
                object[] fileName = new object[] { false, Path.GetFileName(str3) };
                gridRow = new GridRow(fileName);
                MEOpenTaskDlg.panel.Rows.Add(gridRow);
            }
        }
예제 #13
0
        public static bool CreatePFMEA(string partNo, string cusRev, string opRev, Dictionary <Node, List <Node> > DicSelNodes)
        {
            try
            {
                //設定輸出路徑
                OutputPath = string.Format(@"{0}\{1}_{2}_{3}\{4}_{5}_{6}"
                                           , Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
                                           , partNo
                                           , cusRev
                                           , opRev
                                           , partNo
                                           , cusRev
                                           , opRev + "_" + "PFMEA" + ".xls");
                //設定Template路徑
                string excelTemplatePath = string.Format(@"{0}\{1}\{2}\{3}\{4}.xls"
                                                         , CaxEnv.GetGlobaltekEnvDir()
                                                         , "PE_Config"
                                                         , "Config"
                                                         , "PFMEA"
                                                         , "PFMEA");
                //1.開啟Excel
                //2.將Excel設為不顯示
                //3.取得第一頁Sheet
                workBook         = excelApp.Workbooks.Open(excelTemplatePath);
                excelApp.Visible = false;
                workSheet        = (Worksheet)workBook.Sheets[1];

                //Insert所需欄位
                int dimenCount = 0;
                foreach (KeyValuePair <Node, List <Node> > kvp in DicSelNodes)
                {
                    foreach (Node i in kvp.Value)
                    {
                        dimenCount++;
                    }
                }
                while (dimenCount - 1 != 0 && dimenCount > 1)
                {
                    workRange = (Range)workSheet.Range["A16"].EntireRow;
                    workRange.Insert(XlInsertShiftDirection.xlShiftDown, workRange.Copy(Type.Missing));
                    dimenCount--;
                }
                //設定欄位的Row,Column
                int
                    currentRow = 16, op1Column = 1, PFMColumn = 2, PEoFColumn = 3, SevColumn = 4, ClassChara = 5,
                    PC_MoFColumn = 6, OccColumn = 7, CPCPColumn = 8, CPCDColumn = 9, DetColumn = 10, RPNColumn = 11;
                foreach (KeyValuePair <Node, List <Node> > kvp in DicSelNodes)
                {
                    workRange = (Range)workSheet.Cells;
                    workRange[currentRow, op1Column] = kvp.Key.Cells[0].Text;
                    string OP1MergeRow = currentRow.ToString();
                    foreach (Node j in kvp.Value)
                    {
                        workRange[currentRow, PFMColumn]    = j.Cells[3].Text;
                        workRange[currentRow, PEoFColumn]   = j.Cells[4].Text;
                        workRange[currentRow, SevColumn]    = j.Cells[5].Text;
                        workRange[currentRow, ClassChara]   = j.Cells[6].Text;
                        workRange[currentRow, PC_MoFColumn] = j.Cells[7].Text;
                        workRange[currentRow, OccColumn]    = j.Cells[8].Text;
                        workRange[currentRow, CPCPColumn]   = j.Cells[9].Text;
                        workRange[currentRow, CPCDColumn]   = j.Cells[10].Text;
                        workRange[currentRow, DetColumn]    = j.Cells[11].Text;
                        workRange[currentRow, RPNColumn]    = j.Cells[12].Text;
                        currentRow++;
                    }
                    //合併儲存格-OP1
                    workSheet.get_Range("A" + OP1MergeRow, "A" + (currentRow - 1).ToString()).Merge(false);
                }

                if (File.Exists(OutputPath))
                {
                    File.Delete(OutputPath);
                }
                workBook.SaveAs(OutputPath, XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing,
                                Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
                workBook.Close(Type.Missing, Type.Missing, Type.Missing);
                excelApp.Quit();
            }
            catch (System.Exception ex)
            {
                if (File.Exists(OutputPath))
                {
                    File.Delete(OutputPath);
                }
                workBook.SaveAs(OutputPath, XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing,
                                Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
                workBook.Close(Type.Missing, Type.Missing, Type.Missing);
                excelApp.Quit();
                File.Delete(OutputPath);
                return(false);
            }
            finally
            {
                Dispose();
            }
            return(true);
        }
예제 #14
0
        public PEGenerateDlg()
        {
            InitializeComponent();

            #region  客戶資料填入
            string[] S_Task_CusName = Directory.GetDirectories(CaxEnv.GetGlobaltekTaskDir());
            if (S_Task_CusName.Length == 0)
            {
                comboBoxOldCusName.Items.Add("沒有舊資料");
            }
            else
            {
                foreach (string item in S_Task_CusName)
                {
                    comboBoxOldCusName.Items.Add(Path.GetFileNameWithoutExtension(item));//走訪每個元素只取得目錄名稱(不含路徑)並加入dirlist集合中
                }
            }
            comboBoxOldPartNo.Enabled = false;
            comboBoxOldCusRev.Enabled = false;
            #endregion


            /*
             #region 舊客戶資料填入
             * //取得METEDownloadData資料
             * CaxGetDatData.GetMETEDownloadData(out cMETEDownloadData);
             * //存入下拉選單-客戶
             * for (int i = 0; i < cMETEDownloadData.EntirePartAry.Count; i++)
             * {
             *  comboBoxOldCusName.Items.Add(cMETEDownloadData.EntirePartAry[i].CusName);
             * }
             * comboBoxOldPartNo.Enabled = false;
             * comboBoxOldCusRev.Enabled = false;
             *
             #endregion
             */

            //取得CustomerName配置檔
            string CustomerName_dat    = "CustomerName.dat";
            string CustomerNameDatPath = string.Format(@"{0}\{1}", CaxPE.GetPEConfigDir(), CustomerName_dat);

            //讀取OperationArray配置檔內容,並存入結構中
            CusName cCusName = new CusName();
            CaxPE.ReadCustomerNameData(CustomerNameDatPath, out cCusName);

            //將客戶名稱填入下拉選單-客戶
            comboBoxCusName.Items.AddRange(cCusName.CustomerName.ToArray());

            //取得OperationArray配置檔
            string OperationArray_dat    = "OperationArray.dat";
            string OperationArrayDatPath = string.Format(@"{0}\{1}", CaxPE.GetPEConfigDir(), OperationArray_dat);

            //讀取OperationArray配置檔內容,並存入結構中
            CaxPE.ReadOperationArrayData(OperationArrayDatPath, out cOperationArray);

            //將Operation2Array塞入陣列Oper2StringAry中
            Oper2StringAry = cOperationArray.Operation2Array.ToArray();

            //建立GridPanel
            panel = OperSuperGridControl.PrimaryGrid;

            //設定製程別的基礎型態與數據
            panel.Columns["Oper2Ary"].EditorType   = typeof(PEComboBox);
            panel.Columns["Oper2Ary"].EditorParams = new object[] { Oper2StringAry };

            //設定刪除的基礎型態
            panel.Columns["Delete"].EditorType = typeof(OperDeleteBtn);
        }
예제 #15
0
        private void OK_Click(object sender, EventArgs e)
        {
            //先關閉所有檔案
            CaxPart.CloseAllParts();

            try
            {
                if (Is_OldPart == true)
                {
                    //定義總組立檔案、二階檔案、三階檔案名稱
                    string AsmCompFileFullPath       = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", comboBoxOldCusName.Text, comboBoxOldPartNo.Text, comboBoxOldCusRev.Text.ToUpper(), comboBoxOldPartNo.Text + "_MOT.prt");
                    string SecondFileFullPath        = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", comboBoxOldCusName.Text, comboBoxOldPartNo.Text, comboBoxOldCusRev.Text.ToUpper(), comboBoxOldPartNo.Text + "_OP" + "[Oper1]" + ".prt");
                    string ThirdFileFullPath_OIS     = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", comboBoxOldCusName.Text, comboBoxOldPartNo.Text, comboBoxOldCusRev.Text.ToUpper(), comboBoxOldPartNo.Text + "_OIS" + "[Oper1]" + ".prt");
                    string ThirdFileFullPath_CAM     = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", comboBoxOldCusName.Text, comboBoxOldPartNo.Text, comboBoxOldCusRev.Text.ToUpper(), comboBoxOldPartNo.Text + "_OP" + "[Oper1]" + "_CAM.prt");
                    string OPFolderPath              = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", comboBoxOldCusName.Text, comboBoxOldPartNo.Text, comboBoxOldCusRev.Text.ToUpper(), "OP" + "[Oper1]");
                    string tempSecondFileFullPath    = SecondFileFullPath;
                    string tempThirdFileFullPath_OIS = ThirdFileFullPath_OIS;
                    string tempThirdFileFullPath_CAM = ThirdFileFullPath_CAM;
                    string tempOPFolderPath          = OPFolderPath;


                    #region 開啟總組立
                    if (File.Exists(AsmCompFileFullPath))
                    {
                        //組件存在,直接開啟任務組立
                        BasePart newAsmPart;
                        status = CaxPart.OpenBaseDisplay(AsmCompFileFullPath, out newAsmPart);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("組立開啟失敗,料號不可有中文字!");
                            return;
                        }
                    }
                    else
                    {
                        CaxLog.ShowListingWindow("開啟失敗:找不到總組立" + Path.GetFileNameWithoutExtension(AsmCompFileFullPath));
                        return;
                    }
                    #endregion

                    #region 建立新插入的製程
                    NXOpen.Assemblies.Component tempComp;

                    foreach (string i in ListAddOper)
                    {
                        //設定一階為WorkComp
                        CaxAsm.SetWorkComponent(null);

                        //建立二階檔案
                        SecondFileFullPath = tempSecondFileFullPath;
                        SecondFileFullPath = SecondFileFullPath.Replace("[Oper1]", i);
                        status             = CaxAsm.CreateNewEmptyComp(SecondFileFullPath, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立二階製程檔失敗");
                            return;
                        }

                        //取得二階所有comp
                        List <NXOpen.Assemblies.Component> ChildenComp = new List <NXOpen.Assemblies.Component>();
                        CaxAsm.GetCompChildren(out ChildenComp);

                        foreach (NXOpen.Assemblies.Component ii in ChildenComp)
                        {
                            if (ii.Name == Path.GetFileNameWithoutExtension(SecondFileFullPath).ToUpper())
                            {
                                CaxAsm.SetWorkComponent(ii);
                            }
                        }

                        //建立三階檔案
                        ThirdFileFullPath_OIS = tempThirdFileFullPath_OIS;
                        ThirdFileFullPath_CAM = tempThirdFileFullPath_CAM;

                        ThirdFileFullPath_OIS = ThirdFileFullPath_OIS.Replace("[Oper1]", i);
                        ThirdFileFullPath_CAM = ThirdFileFullPath_CAM.Replace("[Oper1]", i);
                        status = CaxAsm.CreateNewEmptyComp(ThirdFileFullPath_OIS, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立三階OIS檔失敗");
                            return;
                        }
                        status = CaxAsm.CreateNewEmptyComp(ThirdFileFullPath_CAM, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立三階CAM檔失敗");
                            return;
                        }
                    }
                    #endregion

                    #region 建立新插入的製程資料夾
                    foreach (string i in ListAddOper)
                    {
                        OPFolderPath = tempOPFolderPath;
                        OPFolderPath = OPFolderPath.Replace("[Oper1]", i);
                        string OISFolderPath = string.Format(@"{0}\{1}", OPFolderPath, "OIS");
                        string CAMFolderPath = string.Format(@"{0}\{1}", OPFolderPath, "CAM");

                        if (!File.Exists(OISFolderPath))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(OISFolderPath);
                            }
                            catch (System.Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                                return;
                            }
                        }
                        if (!File.Exists(CAMFolderPath))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(CAMFolderPath);
                            }
                            catch (System.Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                                return;
                            }
                        }
                    }
                    #endregion

                    #region 將值儲存起來
                    cPECreateData.CusName       = comboBoxOldCusName.Text;
                    cPECreateData.PartNo        = comboBoxOldPartNo.Text;
                    cPECreateData.CusRev        = comboBoxOldCusRev.Text.ToUpper();
                    cPECreateData.ListOperation = new List <Operation>();
                    Operation cOperation = new Operation();
                    cPECreateData.Oper1Ary = new List <string>();
                    cPECreateData.Oper2Ary = new List <string>();
                    for (int i = 0; i < panel.Rows.Count; i++)
                    {
                        if (panel.Rows.Count == 0)
                        {
                            MessageBox.Show("尚未選擇製程序與製程別!");
                            return;
                        }

                        if (panel.GetCell(i, 1).Value.ToString() == "")
                        {
                            MessageBox.Show("製程序" + panel.GetCell(i, 0).Value + "尚未選取製程別!");
                            return;
                        }

                        cOperation       = new Operation();
                        cOperation.Oper1 = panel.GetCell(i, 0).Value.ToString();
                        cOperation.Oper2 = panel.GetCell(i, 1).Value.ToString();

                        cPECreateData.ListOperation.Add(cOperation);

                        cPECreateData.Oper1Ary.Add(panel.GetCell(i, 0).Value.ToString());
                        cPECreateData.Oper2Ary.Add(panel.GetCell(i, 1).Value.ToString());
                    }
                    #endregion

                    #region 寫出PECreateData.dat
                    string PECreateDataJsonDat = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekTaskDir(), CurrentOldCusName, CurrentOldPartNo, CurrentOldCusRev, "MODEL", "PECreateData.dat");
                    status = CaxFile.WriteJsonFileData(PECreateDataJsonDat, cPECreateData);
                    if (!status)
                    {
                        MessageBox.Show("PECreateData.dat 輸出失敗...");
                        return;
                    }
                    #endregion
                }
                else
                {
                    #region 取得客戶名稱

                    CusName = comboBoxCusName.Text;
                    if (CusName == "")
                    {
                        MessageBox.Show("尚未填寫客戶!");
                        return;
                    }

                    #endregion

                    #region 取得料號

                    PartNo = textPartNo.Text;
                    if (PartNo == "")
                    {
                        MessageBox.Show("尚未填寫料號!");
                        return;
                    }

                    #endregion

                    #region 取得客戶版次

                    CusRev = textCusRev.Text;
                    if (CusRev == "")
                    {
                        MessageBox.Show("尚未填寫客戶版次!");
                        return;
                    }

                    #endregion

                    #region 取得檔案路徑

                    if (PartPath == "-1")
                    {
                        MessageBox.Show("尚未選擇客戶檔案!");
                        return;
                    }

                    #endregion

                    #region 定義根目錄

                    //定義MODEL資料夾路徑
                    string ModelFolderFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", CusName, PartNo, CusRev.ToUpper(), "MODEL");

                    //定義總組立檔案名稱
                    string AsmCompFileFullPath = string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", CaxEnv.GetGlobaltekEnvDir(), "Task", CusName, PartNo, CusRev.ToUpper(), PartNo + "_MOT.prt");

                    //定義CAM資料夾路徑、OIS資料夾路徑、三階檔案路徑
                    string CAMFolderPath = "", OISFolderPath = "", ThridOperPartPath = "";

                    #endregion

                    #region 建立MODEL資料夾

                    if (!File.Exists(ModelFolderFullPath))
                    {
                        try
                        {
                            System.IO.Directory.CreateDirectory(ModelFolderFullPath);
                        }
                        catch (System.Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                            return;
                        }
                    }

                    #endregion

                    #region 複製客戶檔案到MODEL資料夾內

                    //判斷客戶的檔案是否存在
                    status = System.IO.File.Exists(PartPath);
                    if (!status)
                    {
                        MessageBox.Show("指定的檔案不存在,請再次確認");
                        return;
                    }

                    //建立MODEL資料夾內客戶檔案路徑
                    string CustomerPartFullPath = string.Format(@"{0}\{1}", ModelFolderFullPath, PartNo + ".prt");

                    //開始複製
                    if (!System.IO.File.Exists(CustomerPartFullPath))
                    {
                        File.Copy(PartPath, CustomerPartFullPath, true);
                    }


                    #endregion

                    #region 將值儲存起來

                    cPECreateData.CusName = CusName;
                    cPECreateData.PartNo  = PartNo;
                    cPECreateData.CusRev  = CusRev.ToUpper();
                    //cPE_OutPutDat.PartPath = PartPath;
                    cPECreateData.ListOperation = new List <Operation>();
                    Operation cOperation = new Operation();
                    cPECreateData.Oper1Ary = new List <string>();
                    cPECreateData.Oper2Ary = new List <string>();
                    for (int i = 0; i < panel.Rows.Count; i++)
                    {
                        if (panel.Rows.Count == 0)
                        {
                            MessageBox.Show("尚未選擇製程序與製程別!");
                            return;
                        }

                        if (panel.GetCell(i, 1).Value.ToString() == "")
                        {
                            MessageBox.Show("製程序" + panel.GetCell(i, 0).Value + "尚未選取製程別!");
                            return;
                        }

                        cOperation       = new Operation();
                        cOperation.Oper1 = panel.GetCell(i, 0).Value.ToString();
                        cOperation.Oper2 = panel.GetCell(i, 1).Value.ToString();

                        //建立CAM資料夾路徑
                        CAMFolderPath = string.Format(@"{0}\{1}\{2}", Path.GetDirectoryName(AsmCompFileFullPath), "OP" + panel.GetCell(i, 0).Value.ToString(), "CAM");

                        //儲存CAM資料夾路徑
                        //cOperation.CAMFolderPath = CAMFolderPath;

                        //建立CAM資料夾
                        if (!File.Exists(CAMFolderPath))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(CAMFolderPath);
                            }
                            catch (System.Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                                return;
                            }
                        }

                        //建立OIS資料夾路徑
                        OISFolderPath = string.Format(@"{0}\{1}\{2}", Path.GetDirectoryName(AsmCompFileFullPath), "OP" + panel.GetCell(i, 0).Value.ToString(), "OIS");

                        //儲存OIS資料夾路徑
                        //cOperation.OISFolderPath = OISFolderPath;

                        //建立OIS資料夾
                        if (!File.Exists(OISFolderPath))
                        {
                            try
                            {
                                System.IO.Directory.CreateDirectory(OISFolderPath);
                            }
                            catch (System.Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                                return;
                            }
                        }

                        //建立三階檔案路徑
                        ThridOperPartPath = Path.GetDirectoryName(AsmCompFileFullPath);

                        cPECreateData.ListOperation.Add(cOperation);

                        cPECreateData.Oper1Ary.Add(panel.GetCell(i, 0).Value.ToString());
                        cPECreateData.Oper2Ary.Add(panel.GetCell(i, 1).Value.ToString());
                    }

                    #endregion

                    #region (註解中)複製MODEL內的客戶檔案到料號資料夾內,並更名XXX_MOT.prt

                    /*
                     * //判斷要複製的檔案是否存在
                     * status = System.IO.File.Exists(destFileName_Model);
                     * if (!status)
                     * {
                     *  MessageBox.Show("指定的檔案不存在,請再次確認");
                     *  return;
                     * }
                     *
                     * //建立目的地(客戶版次)檔案全路徑
                     * string destFileName_CusRev = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetGlobalTekEnvDir(), PartNo, CusRev.ToUpper(), PartNo + "_MOT.prt");
                     *
                     * //開始複製
                     * File.Copy(destFileName_Model, destFileName_CusRev, true);
                     */
                    #endregion

                    #region 自動建立總組立檔案架構,並組立相關製程

                    status = CaxAsm.CreateNewAsm(AsmCompFileFullPath);
                    if (!status)
                    {
                        CaxLog.ShowListingWindow("建立一階總組立檔失敗");
                        return;
                    }

                    CaxPart.Save();


                    string OPCompName = "";
                    NXOpen.Assemblies.Component tempComp;
                    //List<double> ListOperDouble = new List<double>();
                    //for (int i = 0; i < cPE_OutPutDat.ListOperation.Count; i++)
                    //{
                    //    ListOperDouble.Add(Convert.ToDouble(cPE_OutPutDat.ListOperation[i].Oper1));
                    //}
                    //ListOperDouble.Sort();

                    for (int i = 0; i < cPECreateData.ListOperation.Count; i++)
                    {
                        //設定一階為WorkComp
                        CaxAsm.SetWorkComponent(null);

                        //建立二階製程檔
                        OPCompName = string.Format(@"{0}\{1}", Path.GetDirectoryName(AsmCompFileFullPath), PartNo + "_OP" + cPECreateData.ListOperation[i].Oper1 + ".prt");
                        status     = CaxAsm.CreateNewEmptyComp(OPCompName, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立二階製程檔失敗");
                            return;
                        }
                    }

                    string OISCompFullPath = "", CAMCompFullPath = "";

                    //取得二階所有comp
                    List <NXOpen.Assemblies.Component> ChildenComp = new List <NXOpen.Assemblies.Component>();
                    CaxAsm.GetCompChildren(out ChildenComp);

                    for (int i = 0; i < ChildenComp.Count; i++)
                    {
                        CaxAsm.SetWorkComponent(ChildenComp[i]);
                        string OperStr = ChildenComp[i].Name.Split(new string[] { "OP" }, StringSplitOptions.RemoveEmptyEntries)[1];

                        #region 建立三階CAM檔
                        //建立三階CAM檔
                        CAMCompFullPath = string.Format(@"{0}\{1}", Path.GetDirectoryName(AsmCompFileFullPath), PartNo + "_OP" + OperStr + "_CAM.prt");
                        status          = CaxAsm.CreateNewEmptyComp(CAMCompFullPath, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("建立三階CAM檔失敗");
                            return;
                        }
                        #endregion


                        #region 建立三階OIS檔
                        //先複製drafting_template.prt到OIS檔
                        string drafting_template_Path = string.Format(@"{0}\{1}", CaxEnv.GetGlobaltekEnvDir(), "drafting_template.prt");
                        OISCompFullPath = string.Format(@"{0}\{1}", Path.GetDirectoryName(AsmCompFileFullPath), PartNo + "_OIS" + OperStr + ".prt");
                        if (!File.Exists(drafting_template_Path))
                        {
                            CaxLog.ShowListingWindow("drafting_template.prt遺失,請聯繫開發工程師");
                            return;
                        }
                        System.IO.File.Copy(drafting_template_Path, OISCompFullPath, true);

                        //組立三階OIS檔
                        //status = CaxAsm.CreateNewEmptyComp(OISCompFullPath, out tempComp);
                        status = CaxAsm.AddComponentToAsmByDefault(OISCompFullPath, out tempComp);
                        if (!status)
                        {
                            CaxLog.ShowListingWindow("組立三階OIS檔失敗");
                            return;
                        }
                        #endregion
                    }

                    #endregion

                    #region 寫出PECreateData.dat

                    string PECreateDataJsonDat = string.Format(@"{0}\{1}", ModelFolderFullPath, "PECreateData.dat");
                    status = CaxFile.WriteJsonFileData(PECreateDataJsonDat, cPECreateData);
                    if (!status)
                    {
                        MessageBox.Show("PECreateData.dat 輸出失敗...");
                        return;
                    }

                    #endregion

                    #region (註解中)寫出METEDownloadData.dat

                    //string METEDownloadData = string.Format(@"{0}\{1}", CaxEnv.GetGlobaltekTaskDir(), "METEDownloadData.dat");
                    //METEDownloadData cMETEDownloadData = new METEDownloadData();

                    //if (File.Exists(METEDownloadData))
                    //{
                    //    #region METEDownloadData.dat檔案存在

                    //    status = CaxPublic.ReadMETEDownloadData(METEDownloadData, out cMETEDownloadData);
                    //    if (!status)
                    //    {
                    //        MessageBox.Show("METEDownloadData.dat讀取失敗...");
                    //        return;
                    //    }

                    //    int CusCount = 0, IndexOfCusName = -1;
                    //    for (int i = 0; i < cMETEDownloadData.EntirePartAry.Count; i++)
                    //    {
                    //        if (CusName != cMETEDownloadData.EntirePartAry[i].CusName)
                    //        {
                    //            CusCount++;
                    //        }
                    //        else
                    //        {
                    //            IndexOfCusName = i;
                    //            break;
                    //        }
                    //    }

                    //    //新的客戶且已經有METEDownloadDat.dat
                    //    if (CusCount == cMETEDownloadData.EntirePartAry.Count)
                    //    {
                    //        EntirePartAry cEntirePartAry = new EntirePartAry();
                    //        cEntirePartAry.CusName = CusName;
                    //        cEntirePartAry.CusPart = new List<CusPart>();

                    //        CusPart cCusPart = new CusPart();
                    //        cCusPart.PartNo = PartNo;
                    //        cCusPart.CusRev = new List<CusRev>();

                    //        CusRev cCusRev = new CusRev();
                    //        cCusRev.RevNo = CusRev.ToUpper();
                    //        cCusRev.OperAry1 = new List<string>();
                    //        cCusRev.OperAry2 = new List<string>();
                    //        cCusRev.OperAry1 = cPECreateData.Oper1Ary;
                    //        cCusRev.OperAry2 = cPECreateData.Oper2Ary;

                    //        cCusPart.CusRev.Add(cCusRev);
                    //        cEntirePartAry.CusPart.Add(cCusPart);
                    //        cMETEDownloadData.EntirePartAry.Add(cEntirePartAry);
                    //    }
                    //    //舊的客戶新增料號
                    //    else
                    //    {
                    //        //判斷料號是否已存在
                    //        int PartCount = 0; int IndexOfPartNo = -1;
                    //        for (int i = 0; i < cMETEDownloadData.EntirePartAry[IndexOfCusName].CusPart.Count; i++)
                    //        {
                    //            if (PartNo != cMETEDownloadData.EntirePartAry[IndexOfCusName].CusPart[i].PartNo)
                    //            {
                    //                PartCount++;
                    //            }
                    //            else
                    //            {
                    //                IndexOfPartNo = i;
                    //                break;
                    //            }
                    //        }

                    //        //舊的客戶且新的料號 PartCount == CusPart.Count 表示新的料號
                    //        if (PartCount == cMETEDownloadData.EntirePartAry[IndexOfCusName].CusPart.Count)
                    //        {
                    //            CusPart cCusPart = new CusPart();
                    //            cCusPart.PartNo = PartNo;
                    //            cCusPart.CusRev = new List<CusRev>();

                    //            CusRev cCusRev = new CusRev();
                    //            cCusRev.RevNo = CusRev.ToUpper();
                    //            cCusRev.OperAry1 = new List<string>();
                    //            cCusRev.OperAry2 = new List<string>();
                    //            cCusRev.OperAry1 = cPECreateData.Oper1Ary;
                    //            cCusRev.OperAry2 = cPECreateData.Oper2Ary;

                    //            cCusPart.CusRev.Add(cCusRev);
                    //            cMETEDownloadData.EntirePartAry[IndexOfCusName].CusPart.Add(cCusPart);
                    //        }
                    //        //舊的客戶且舊的料號新增客戶版次
                    //        else
                    //        {
                    //            CusRev cCusRev = new CusRev();
                    //            cCusRev.RevNo = CusRev.ToUpper();
                    //            cCusRev.OperAry1 = new List<string>();
                    //            cCusRev.OperAry1 = cPECreateData.Oper1Ary;

                    //            cMETEDownloadData.EntirePartAry[IndexOfCusName].CusPart[IndexOfPartNo].CusRev.Add(cCusRev);
                    //        }
                    //    }
                    //    /*
                    //    int PartCount = 0; int IndexOfPartNo = -1;
                    //    for (int i = 0; i < cMETEDownloadData.EntirePartAry.Count; i++)
                    //    {
                    //    if (PartNo != cMETEDownloadData.EntirePartAry[i].PartNo)
                    //    {
                    //    PartCount++;
                    //    }
                    //    else
                    //    {
                    //    IndexOfPartNo = i;
                    //    break;
                    //    }
                    //    }

                    //    //新的料號且已經有METEDownloadDat.dat
                    //    if (PartCount == cMETEDownloadData.EntirePartAry.Count)
                    //    {
                    //    EntirePartAry cEntirePartAry = new EntirePartAry();
                    //    cEntirePartAry.CusRev = new List<CusRev>();

                    //    CusRev cCusRev = new CusRev();
                    //    cCusRev.OperAry1 = new List<string>();
                    //    cCusRev.RevNo = CusRev.ToUpper();
                    //    cCusRev.OperAry1 = cPE_OutPutDat.Oper1Ary;

                    //    cEntirePartAry.CusName = CusName;
                    //    cEntirePartAry.PartNo = PartNo;
                    //    cEntirePartAry.CusRev.Add(cCusRev);

                    //    cMETEDownloadData.EntirePartAry.Add(cEntirePartAry);
                    //    }
                    //    //舊的料號新增客戶版次
                    //    else
                    //    {
                    //    CusRev cCusRev = new CusRev();
                    //    cCusRev.OperAry1 = new List<string>();
                    //    cCusRev.RevNo = CusRev.ToUpper();
                    //    cCusRev.OperAry1 = cPE_OutPutDat.Oper1Ary;

                    //    cMETEDownloadData.EntirePartAry[IndexOfPartNo].CusRev.Add(cCusRev);
                    //    }
                    //    */
                    //    #endregion
                    //}
                    //else
                    //{
                    //    #region METEDownloadData.dat檔案不存在

                    //    cMETEDownloadData.EntirePartAry = new List<EntirePartAry>();
                    //    EntirePartAry cEntirePartAry = new EntirePartAry();
                    //    cEntirePartAry.CusName = CusName;
                    //    cEntirePartAry.CusPart = new List<CusPart>();

                    //    CusPart cCusPart = new CusPart();
                    //    cCusPart.PartNo = PartNo;
                    //    cCusPart.CusRev = new List<CusRev>();

                    //    CusRev cCusRev = new CusRev();
                    //    cCusRev.RevNo = CusRev.ToUpper();
                    //    cCusRev.OperAry1 = new List<string>();
                    //    cCusRev.OperAry2 = new List<string>();
                    //    cCusRev.OperAry1 = cPECreateData.Oper1Ary;
                    //    cCusRev.OperAry2 = cPECreateData.Oper2Ary;

                    //    cCusPart.CusRev.Add(cCusRev);
                    //    cEntirePartAry.CusPart.Add(cCusPart);
                    //    cMETEDownloadData.EntirePartAry.Add(cEntirePartAry);

                    //    #endregion
                    //}

                    //status = CaxFile.WriteJsonFileData(METEDownloadData, cMETEDownloadData);
                    //if (!status)
                    //{
                    //    MessageBox.Show("METEDownloadData.dat輸出失敗...");
                    //    return;
                    //}

                    #endregion
                }

                CaxAsm.SetWorkComponent(null);
                CaxPart.Save();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                CaxLog.ShowListingWindow(ex.ToString());
            }
        }