private void sbConvertVirtualMoc_Click(object sender, EventArgs e) { if (cacheMergedBomDt == null) { MessageBox.Show("請先操作Merge取得MergeBom後再執行Convert作業"); return; } SplashScreenManager.ShowDefaultWaitForm(); MvBomCompareBo bo = new MvBomCompareBo(); DataTable mocDt = null; // convert bom to moc and copy to cacheDt //mocDt = bo.convertBomToMoc(filterDt); mocDt = bo.convertBomToVirturlMoc(cacheMergedBomDt); if (cacheMergedBomToVirtualMocDt != null) { cacheMergedBomToVirtualMocDt.Clear(); } cacheMergedBomToVirtualMocDt = mocDt.Copy(); // 第3個Table的特別處理 mocDt.Columns["RealAmount"].SetOrdinal(5); mocDt.Columns["ModuleLv1"].SetOrdinal(7); treeList3.DataSource = mocDt.Copy(); //hashTreeListBackColor[2].Clear(); //showTreeListByLevel(treeList3, mocDt, ref hashTreeListBackColor[2], false, false); setColumnsCaption(ref treeList3); // 設定Sheet3的權限 // 不開放編輯功能, 或隱藏欄位等 treeList3.Columns["MD006"].Visible = false; treeList3.Columns["NameSpace"].Visible = false; treeList3.Columns["NameSpaceNoVer"].Visible = false; treeList3.Columns["Column9"].Visible = false; treeList3.Columns["RowId"].Visible = false; treeList3.Columns["MD013"].Visible = false; treeList3.OptionsView.AutoWidth = false; treeList3.OptionsBehavior.ReadOnly = true; treeList3.OptionsBehavior.Editable = false; //treeList3.BestFitColumns(); // 命名每個Pages xtraTabControl1.TabPages[2].Text = "MergedBom_VirtualMoc"; xtraTabControl1.SelectedTabPage = xtraTabControl1.TabPages[2]; SplashScreenManager.CloseForm(false); }
private void sbGetBomP07_Click(object sender, EventArgs e) { differentCellCount = 0; string bomId = cboBomType.SelectedValue == null ? "" : cboBomType.SelectedValue.ToString(); if (bomId.Length == 0) { MessageBox.Show("Please choice the bom"); return; } gridControl1.DataSource = null; gridControl1.DataBindings.Clear(); gridControl1.RefreshDataSource(); gridView1.Columns.Clear(); gridView1.RefreshData(); // show wait process SplashScreenManager.ShowDefaultWaitForm(); DataSet sourceDs = new DataSet("SourceDs"); MvBomCompareBo bo = new MvBomCompareBo(); // collect bom source by bom id and show sourceDs = bo.CollectSourceDsProcess_BomP07_Thin(new string[] { bomId }).Copy(); DataTable sourceDt1 = sourceDs.Tables[0].Copy(); //bo.filterBomP07ColumnByPdRule(ref sourceDt1); gridControl1.DataSource = sourceDt1; // calculate different between 品號 and 優先耗用 foreach (DataRow dr in sourceDt1.Rows) { //if(!string.IsNullOrEmpty(dr["Column12"].ToString()) && !dr["Column12"].Equals(dr["A8"])) if (!string.IsNullOrEmpty(dr["MB004_FIRST"].ToString()) && !dr["MB004_FIRST"].Equals(dr["MD003"])) { differentCellCount += 1; } } // update columns caption setGridViewColumnsCaption(ref gridView1); // close Wait Form SplashScreenManager.CloseForm(false); labelControl1.Text = string.Format("相異總數 : {0}", differentCellCount); }
private void sbMocCompare_Click(object sender, EventArgs e) { if (cacheMocDt == null || cacheMergedBomToVirtualMocDt == null || cacheMocDt.Rows.Count == 0 || cacheMergedBomToVirtualMocDt.Rows.Count == 0) { MessageBox.Show("請先操作取得Bom與製令"); return; } // 開始執行比對的程式 // 比對的邏輯, 先判斷第一層模組是不是合理 SplashScreenManager.ShowDefaultWaitForm(); DataSet sourceDs = null; MvBomCompareBo bo = new MvBomCompareBo(); Stopwatch loadingWatch = new Stopwatch(); loadingWatch.Start(); //resultDs = bo.compareProcessByVirtualMoc_V2(cacheMergedBomToVirtualMocDt, cacheMocDt); loadingWatch.Stop(); Console.WriteLine("V2 : " + loadingWatch.ElapsedMilliseconds); loadingWatch.Reset(); loadingWatch.Start(); sourceDs = bo.compareProcessByVirtualMoc_V3(cacheMergedBomToVirtualMocDt, cacheMocDt); loadingWatch.Stop(); Console.WriteLine("V3 : " + loadingWatch.ElapsedMilliseconds); // 取得Result DataTable sameDt = sourceDs.Tables["Same"].Copy(); DataTable diffDt = sourceDs.Tables["Different"].Copy(); // 第1個Table的特別處理 treeList5.DataSource = sameDt.Copy(); //hashTreeListBackColor[0].Clear(); //showTreeListByLevel(treeList1, sourceDt, ref hashTreeListBackColor[0], false, false); //setColumnsCaption(ref treeList1); // 第2個Table的特別處理 treeList6.DataSource = diffDt.Copy(); //hashTreeListBackColor[0].Clear(); //showTreeListByLevel(treeList2, tempDt, ref hashTreeListBackColor[1], false, true); //setColumnsCaption(ref treeList2); // 設定各Sheet的Sheet權限 // 不開放編輯功能, 或隱藏欄位等 treeList5.Columns["Add"].Visible = false; treeList5.Columns["Change"].Visible = false; treeList5.Columns["Delete"].Visible = false; treeList5.Columns["NewModule"].Visible = false; treeList5.Columns["NewItem"].Visible = false; treeList5.Columns["NewCount"].Visible = false; //treeList5.BestFitColumns(); //treeList6.BestFitColumns(); treeList5.OptionsView.AutoWidth = false; treeList6.OptionsView.AutoWidth = false; treeList5.OptionsBehavior.ReadOnly = true; treeList6.OptionsBehavior.ReadOnly = true; treeList5.OptionsBehavior.Editable = false; treeList6.OptionsBehavior.Editable = false; // 命名每個Pages xtraTabControl1.TabPages[4].Text = "CompareMoc_Result"; xtraTabControl1.SelectedTabPage = xtraTabControl1.TabPages[4]; SplashScreenManager.CloseForm(false); }
private void sbtnGetBomList_Click(object sender, EventArgs e) { if (isInitialBomList == true) { // 第一次取得BomList DataTable tmpDt = null; tmpDt = MvDbDao.collectData_BomList(); cboBomType.DataSource = tmpDt; cboBomType.ValueMember = "MC001"; cboBomType.DisplayMember = "MB0012"; cboBomType.Text = ""; cboBomType.SelectedValue = ""; isInitialBomList = false; return; } string result = cboBomType.SelectedValue == null ? "" : cboBomType.SelectedValue.ToString(); if (result.Length == 0) { MessageBox.Show("Please choice the bom"); return; } // show wait process SplashScreenManager.ShowDefaultWaitForm(); clearAllBomCacheDtAndTreeList(); // initial hash tables for (int i = 0; i < hashTreeListBackColor.Length; i++) { hashTreeListBackColor[i] = new Hashtable(); } MvBomCompareBo bo = new MvBomCompareBo(); DataSet sourceDs = null; // get source data set sourceDs = bo.GetDevDataSet_BomP09_Thin(result, true).Copy(); DataTable sourceDt = sourceDs.Tables[result + "_Filter"].Copy(); DataTable filterDt = sourceDs.Tables[result + "_Filter"].Copy(); sourceDt.TableName = sourceDt.TableName.Replace("_Filter", ""); filterDt.TableName = filterDt.TableName.Replace("_Filter", ""); DataTable tempDt = null; // 找出選配 tempDt = bo.getOptionalItem(filterDt); // 檢查選配是否合理 // LV=1, 選配, LV=2, 不可以有再製 bool checkValid = false; checkValid = bo.checkOptionalItemValid(tempDt); if (checkValid == false) { // 只顯示optional 的部份 tempDt.Columns.Remove("AmountSpace"); tempDt.Columns.Remove("NameSpaceNoVer"); tempDt.Columns.Remove("Column9"); tempDt.Columns["ModuleLv1"].SetOrdinal(6); treeList2.DataSource = tempDt.Clone(); showTreeListByLevel(treeList2, tempDt, ref hashTreeListBackColor[1], false, true); setColumnsCaption(ref treeList2); MessageBox.Show("LV=1的選配展開後含再製件, 請確認Bom表選配內容是否正確"); return; } // 確認資料正確性均合理後, 再copy至cacheBomDt // set cache datatable if (cacheBomDt != null) { cacheBomDt.Clear(); } cacheBomDt = filterDt.Copy(); // 第1個Table的特別處理 sourceDt.Columns["ModuleLv1"].SetOrdinal(6); treeList1.DataSource = sourceDt.Clone(); hashTreeListBackColor[0].Clear(); showTreeListByLevel(treeList1, sourceDt, ref hashTreeListBackColor[0], false, false); setColumnsCaption(ref treeList1); // 第2個Table的特別處理 tempDt.Columns["ModuleLv1"].SetOrdinal(6); treeList2.DataSource = tempDt.Clone(); showTreeListByLevel(treeList2, tempDt, ref hashTreeListBackColor[1], false, true); setColumnsCaption(ref treeList2); // 設定各Sheet的Sheet權限 // 不開放編輯功能, 或隱藏欄位等 treeList1.Columns["RowId"].Visible = false; treeList1.Columns["NameSpace"].Visible = false; treeList1.Columns["NameSpaceNoVer"].Visible = false; treeList2.Columns["AmountSpace"].Visible = false; treeList1.Columns["Column9"].Visible = false; treeList1.Columns["MD013"].Visible = false; treeList2.Columns["RowId"].Visible = false; treeList2.Columns["NameSpace"].Visible = false; treeList2.Columns["NameSpaceNoVer"].Visible = false; treeList2.Columns["AmountSpace"].Visible = false; treeList2.Columns["Column9"].Visible = false; treeList2.Columns["MD013"].Visible = false; treeList2.Columns["OrgLV"].Visible = false; treeList1.BestFitColumns(); treeList2.BestFitColumns(); treeList1.OptionsView.AutoWidth = false; treeList2.OptionsView.AutoWidth = false; treeList1.OptionsBehavior.ReadOnly = true; treeList2.OptionsBehavior.ReadOnly = true; treeList1.OptionsBehavior.Editable = false; treeList2.OptionsBehavior.Editable = false; treeList2.ExpandAll(); treeList2.OptionsView.ShowCheckBoxes = true; treeList2.OptionsBehavior.AllowRecursiveNodeChecking = true; // 命名每個Pages xtraTabControl1.TabPages[0].Text = "Original_Bom"; xtraTabControl1.SelectedTabPage = xtraTabControl1.TabPages[0]; //Close Wait Form SplashScreenManager.CloseForm(false); }
private void CompareProcess_Org(string[] selectedList) { DataTable illegalData = null; DataSet sourceDs = new DataSet(); DataSet tmpDs = new DataSet(); MvBomCompareBo bo = new MvBomCompareBo(); sourceDs = bo.CollectSourceDsProcess_BomP09_VB6(selectedList); if (sourceDs.Tables.Count <= 1) { MessageBox.Show(string.Format("One or all data from bom's id is empty {0}Bom1 Id : {1}{0}Bom2 Id : {2}{0}", Environment.NewLine, selectedList[0], selectedList[1])); return; } // initial tablControl pages name tabControl1.TabPages[0].Text = sourceDs.Tables[0].TableName; tabControl1.TabPages[1].Text = sourceDs.Tables[1].TableName; tabControl1.TabPages[2].Text = string.Format("{0} -> {1}", sourceDs.Tables[0].TableName, sourceDs.Tables[1].TableName); tabControl1.TabPages[3].Text = string.Format("{0} <- {1}", sourceDs.Tables[0].TableName, sourceDs.Tables[1].TableName); tabControl1.TabPages[4].Text = "Summary"; // 比對 A -> B tmpDs = bo.compareBomByRulePur(sourceDs.Tables[0], sourceDs.Tables[1]); if ((tmpDs == null) || (tmpDs.Tables.Count == 0)) { MessageBox.Show("compare error"); enableObject(true, true); return; } // rename table's column name int i = 0; foreach (MvHeader header in CompareBom09Header.Values) { tmpDs.Tables["Same"].Columns[i].ColumnName = header.AliasName(); tmpDs.Tables["Different"].Columns[i].ColumnName = header.AliasName(); i++; } // 開始填入A 比對B的結果 dgvABSame.DataSource = tmpDs.Tables["Same"]; dgvABDiff.DataSource = tmpDs.Tables["Different"]; illegalData = tmpDs.Tables["Illegal"].Copy(); // 比對 B -> A tmpDs = bo.compareBomByRulePur(sourceDs.Tables[1], sourceDs.Tables[0], true); if ((tmpDs == null) || (tmpDs.Tables.Count == 0)) { MessageBox.Show("compare error"); enableObject(true, true); return; } // Merge illegal的talbe 資料 illegalData.Merge(tmpDs.Tables["Illegal"].Copy()); // rename table's column name i = 0; foreach (MvHeader header in CompareBom09Header.Values) { tmpDs.Tables["Same"].Columns[i].ColumnName = header.AliasName(); tmpDs.Tables["Different"].Columns[i].ColumnName = header.AliasName(); i++; } // 開始填入B 比對A的結果 dgvBASame.DataSource = tmpDs.Tables["Same"]; dgvBADiff.DataSource = tmpDs.Tables["Different"]; // rename source table and illegal talbe column's name i = 0; foreach (string header in DefinedHeader.Bom09HeaderAliasNameNoPrice) { sourceDs.Tables[0].Columns[i].ColumnName = header; sourceDs.Tables[1].Columns[i].ColumnName = header; illegalData.Columns[i].ColumnName = header; i++; } // 開始填入 source dgvBomA.DataSource = sourceDs.Tables[0]; dgvBomB.DataSource = sourceDs.Tables[1]; dgvIllegal.DataSource = illegalData; return; }
private void btnCompare_Click(object sender, EventArgs e) { bool isFinishedCompressProcess = false; int cacheErrorResult = int.MaxValue; // initial dataGridView initialDataGridView(); initialTabControl(); if (BomView.Items.Count < 2) { MessageBox.Show("請選擇2個bom表"); return; } enableObject(false, true); // 取得已選取的list List <string> selectedList = new List <string>(); foreach (var item in BomView.Items) { string row = (item as ListViewItem).Text; selectedList.Add(row); } // 顯示progress bar DataSet sourceDs = new DataSet(); DataSet compareAB = new DataSet(); DataSet compareBA = new DataSet(); DataTable illegalData = new DataTable(); DataTable summaryDt = new DataTable(); progress.Message = "In progress, please wait... "; AsyncTemplate.DoWorkAsync( () => { MvBomCompareBo bo = new MvBomCompareBo(); return(bo.CompareProcess(selectedList.ToArray <string>(), ref sourceDs, ref compareAB, ref compareBA, ref illegalData, ref summaryDt)); }, (result) => { cacheErrorResult = result; switch (result) { case 0: //成功 isFinishedCompressProcess = true; break; case -1: MessageBox.Show(string.Format("One or all data from bom's id is empty {0}Bom1 Id : {1}{0}Bom2 Id : {2}{0}", Environment.NewLine, selectedList[0], selectedList[1])); break; case -2: case -3: MessageBox.Show("compare error"); break; default: MessageBox.Show("undefined error"); break; } }, (exception) => { //error handling MessageBox.Show(exception.Message); }); // 如果前段取資料有問題, 直接return if (isFinishedCompressProcess == false) { enableObject(true, true); return; } // 填入資料與後製畫面 tabControl1.TabPages[0].Text = sourceDs.Tables[0].TableName; tabControl1.TabPages[1].Text = sourceDs.Tables[1].TableName; tabControl1.TabPages[2].Text = string.Format("{0} -> {1}", sourceDs.Tables[0].TableName, sourceDs.Tables[1].TableName); tabControl1.TabPages[3].Text = string.Format("{0} <- {1}", sourceDs.Tables[0].TableName, sourceDs.Tables[1].TableName); tabControl1.TabPages[4].Text = "Summary"; // 填入 A比對B 的結果 dgvABSame.DataSource = compareAB.Tables["Same"]; dgvABDiff.DataSource = compareAB.Tables["Different"]; // 填入 B比對A 的結果 dgvBASame.DataSource = compareBA.Tables["Same"]; dgvBADiff.DataSource = compareBA.Tables["Different"]; // 填入 source 及 illegal dgvBomA.DataSource = sourceDs.Tables[0]; dgvBomB.DataSource = sourceDs.Tables[1]; dgvIllegal.DataSource = illegalData; // 填入 summary dgvSummary.DataSource = summaryDt; dgvSummary.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; dgvSummary.Columns["項目"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvSummary.Columns["項目"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvSummary.Columns["新增"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvSummary.Columns["刪除"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvSummary.Columns["變更"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; // 啟用TabControl enableObject(true, true); initialDataGridView(true); }
private void sbtnGetBomList_Click(object sender, EventArgs e) { if (isInitialBomList == true) { // 第一次取得BomList DataTable tmpDt = null; tmpDt = MvDbDao.collectData_BomList(); cboBomType.DataSource = tmpDt; cboBomType.ValueMember = "MC001"; cboBomType.DisplayMember = "MB0012"; cboBomType.Text = ""; cboBomType.SelectedValue = ""; isInitialBomList = false; return; } string result = cboBomType.SelectedValue == null ? "" : cboBomType.SelectedValue.ToString(); if (result.Length == 0) { MessageBox.Show("Please choice the bom"); return; } // show wait process SplashScreenManager.ShowDefaultWaitForm(); MvBomCompareBo bo = new MvBomCompareBo(); // initial hash tables for (int i = 0; i < hashTreeListBackColor.Length; i++) { hashTreeListBackColor[i] = new Hashtable(); } // get source data set by stored procedure DataSet sourceDs; sourceDs = bo.GetDevDataSet_BomP09_Thin(result, false).Copy(); DataTable sourceDt = sourceDs.Tables[result].Copy(); treeList1.DataSource = sourceDt.Clone(); hashTreeListBackColor[0].Clear(); showTreeListByLevel(treeList1, sourceDt, ref hashTreeListBackColor[0], false); setColumnsCaption(ref treeList1); // get source data set by optional data DataSet sourceDsOptional; sourceDsOptional = bo.GetDevDataSet_BomP09_Thin(result, false).Copy(); DataTable sourceDtOptional = sourceDsOptional.Tables[result].Copy(); treeList2.DataSource = sourceDtOptional.Clone(); hashTreeListBackColor[1].Clear(); showTreeListByLevel(treeList2, sourceDtOptional, ref hashTreeListBackColor[1], false); setColumnsCaption(ref treeList2); // Sheet1,2 不開放編輯功能, treeList 1,2,3 //treeList1.OptionsBehavior.ReadOnly = true; treeList2.OptionsBehavior.ReadOnly = true; treeList1.OptionsBehavior.Editable = false; treeList2.OptionsBehavior.Editable = false; // Sheet1 show checkbox treeList1.OptionsView.ShowCheckBoxes = true; treeList1.OptionsBehavior.AllowRecursiveNodeChecking = true; //Close Wait Form SplashScreenManager.CloseForm(false); }
private void btnCompare_Click_Thin(object sender, EventArgs e) { DataTable tmpDt = new DataTable(); if (isInitialBomList == true) { // 第一次取得BomList tmpDt = MvDbDao.collectData_BomList(); cboBomType.DataSource = tmpDt; cboBomType.ValueMember = "MC001"; cboBomType.DisplayMember = "MB0012"; cboBomType.Text = ""; cboBomType.SelectedValue = ""; isInitialBomList = false; return; } if (BomView.Items.Count < 2) { MessageBox.Show("請選擇2個bom表"); return; } // 取得已選取的list List <string> selectedList = new List <string>(); foreach (var item in BomView.Items) { string row = (item as ListViewItem).Text; selectedList.Add(row); } // 判斷是否選取相同的Bom表 if (selectedList[0].Equals(selectedList[1]) == true) { MessageBox.Show("請不要選取相同的bom表比對"); return; } // show wait process SplashScreenManager.ShowDefaultWaitForm(); DataSet sourceDs = new DataSet(); MvBomCompareBo bo = new MvBomCompareBo(); sourceDs = bo.CollectSourceDsProcess_BomP09_Thin(selectedList.ToArray <string>()).Copy(); // filter data DataTable sourceDt1 = sourceDs.Tables[0].Copy(); DataTable sourceDt2 = sourceDs.Tables[1].Copy(); DataSet summaryDs = new DataSet(); DataSet tmpDs = new DataSet(); // show tree list node // 設定column DataTable filterDt1 = bo.filterDataByRdRule(sourceDt1, true); DataTable filterDt2 = bo.filterDataByRdRule(sourceDt2, true); DataTable dtIncludeNameSpace1; DataTable dtIncludeNameSpace2; DataTable summaryDt; dtIncludeNameSpace1 = bo.extendBomNameSpace(filterDt1, true); dtIncludeNameSpace2 = bo.extendBomNameSpace(filterDt2, true); summaryDs = bo.compareBomByRuleRd_v2(dtIncludeNameSpace1, dtIncludeNameSpace2, false); tmpDs = bo.compareBomByRuleRd_v2(dtIncludeNameSpace2, dtIncludeNameSpace1, true); // 顯示Detail Summary相關資訊 // 相同的資料不用再呈現差異的比對資訊 tmpDt = summaryDs.Tables["Same"]; tmpDt.Columns.Remove("CompareLV"); tmpDt.Columns.Remove("CompareA8"); tmpDt.Columns.Remove("CompareMD006"); tmpDt.Columns.Remove("ModuleLv1"); treeList3.DataSource = tmpDt.Copy(); summaryDt = summaryDs.Tables["Different"]; summaryDt.Merge(tmpDs.Tables["Different"]); treeList4.DataSource = summaryDt.Copy(); setCompareDetailColumnsCaption(ref treeList3, ref treeList4); // 顯示SummaryBom相關資訊 for RD tmpDt = new DataTable(); tmpDt = bo.generateSummaryTableByRd(summaryDt, true); treeList5.DataSource = tmpDt.Copy(); setSummaryDetailColumnsCaption(ref treeList5); // 整理SummaryBom For Pur tmpDt = bo.generateSummaryTableByPur(summaryDt); treeList6.DataSource = tmpDt.Copy(); setSummaryColumnsCaption(ref treeList6); // initial hash tables for (int i = 0; i < hashTreeListBackColor.Length; i++) { hashTreeListBackColor[i] = new Hashtable(); } // 注意 ParentFieldName必需在 showTreeListByLevel之前 // 只要設定過, Level的功能會失效 treeList1.DataSource = dtIncludeNameSpace1.Clone(); treeList1.ParentFieldName = dtIncludeNameSpace1.TableName; hashTreeListBackColor[0].Clear(); showTreeListByLevel(treeList1, dtIncludeNameSpace1, ref hashTreeListBackColor[0], false); setColumnsCaption(ref treeList1); // 注意 ParentFieldName必需在 showTreeListByLevel之前 // 只要設定過, Level的功能會失效 treeList2.DataSource = dtIncludeNameSpace2.Clone(); treeList2.ParentFieldName = dtIncludeNameSpace2.TableName; hashTreeListBackColor[1].Clear(); showTreeListByLevel(treeList2, dtIncludeNameSpace2, ref hashTreeListBackColor[1], false); setColumnsCaption(ref treeList2); xtraTabControl1.TabPages[0].Text = string.Format("{0} vs {1}", filterDt1.TableName, filterDt2.TableName); xtraTabControl1.TabPages[1].Text = "CompareDetail"; xtraTabControl1.TabPages[2].Text = "SummaryDetail"; xtraTabControl1.TabPages[3].Text = "Summary"; // Sheet1,2 不開放編輯功能, treeList 1,2,3,4 // Sheet3,4 開放編輯功能, 這些資料都只能是read only treeList1.OptionsBehavior.ReadOnly = true; treeList2.OptionsBehavior.ReadOnly = true; treeList3.OptionsBehavior.ReadOnly = true; treeList4.OptionsBehavior.ReadOnly = true; treeList5.OptionsBehavior.ReadOnly = true; treeList6.OptionsBehavior.ReadOnly = true; treeList1.OptionsBehavior.Editable = false; treeList2.OptionsBehavior.Editable = false; treeList3.OptionsBehavior.Editable = false; treeList4.OptionsBehavior.Editable = false; treeList5.OptionsBehavior.Editable = false; treeList6.OptionsBehavior.Editable = false; treeList1.Columns["NameSpace"].Visible = false; treeList1.Columns["NameSpaceNoVer"].Visible = false; treeList1.Columns["MD013"].Visible = false; treeList1.Columns["AmountSpace"].Visible = false; treeList1.Columns["RowId"].Visible = false; treeList2.Columns["NameSpace"].Visible = false; treeList2.Columns["NameSpaceNoVer"].Visible = false; treeList2.Columns["MD013"].Visible = false; treeList2.Columns["AmountSpace"].Visible = false; treeList2.Columns["RowId"].Visible = false; //Close Wait Form SplashScreenManager.CloseForm(false); }
private void sbtnGetBomList_Click(object sender, EventArgs e) { if (isInitialBomList == true) { // 第一次取得BomList DataTable tmpDt = null; tmpDt = MvDbDao.collectData_BomList(); cboBomType.DataSource = tmpDt; cboBomType.ValueMember = "MC001"; cboBomType.DisplayMember = "MB0012"; cboBomType.Text = ""; cboBomType.SelectedValue = ""; isInitialBomList = false; return; } string result = cboBomType.SelectedValue == null ? "" : cboBomType.SelectedValue.ToString(); if (result.Length == 0) { MessageBox.Show("Please choice the bom"); return; } // show wait process SplashScreenManager.ShowDefaultWaitForm(); MvBomCompareBo bo = new MvBomCompareBo(); DataSet sourceDs; // get source data set //sourceDs = bo.GetBomP07InfoByDev(result, false).Copy(); sourceDs = bo.GetDevDataSet_BomP09_Thin(result, false).Copy(); DataTable sourceDt = sourceDs.Tables[result].Copy(); DataTable filterDt = sourceDs.Tables[result + "_Filter"].Copy(); DataTable mocDt; // convert bom to moc mocDt = bo.convertBomToMoc(filterDt); tmpMocDt = mocDt.Clone(); // initial hash tables for (int i = 0; i < hashTreeListBackColor.Length; i++) { hashTreeListBackColor[i] = new Hashtable(); } // 第1個Table的特別處理 treeList1.DataSource = sourceDt.Clone(); hashTreeListBackColor[0].Clear(); showTreeListByLevel(treeList1, sourceDt, ref hashTreeListBackColor[0], false); setColumnsCaption(ref treeList1); // 第2個Table的特別處理 filterDt.Columns.Remove("AmountSpace"); treeList2.DataSource = filterDt.Clone(); hashTreeListBackColor[1].Clear(); showTreeListByLevel(treeList2, filterDt, ref hashTreeListBackColor[1], false); setColumnsCaption(ref treeList2); // 第3個Table的特別處理 mocDt.Columns.Remove("MD006"); mocDt.Columns["RealAmount"].SetOrdinal(5); mocDt.Columns["ModuleLv1"].SetOrdinal(7); treeList3.DataSource = mocDt.Clone(); hashTreeListBackColor[2].Clear(); showTreeListByLevel(treeList3, mocDt, ref hashTreeListBackColor[2], false); setColumnsCaption(ref treeList3); xtraTabControl1.TabPages[0].Text = sourceDt.TableName; xtraTabControl1.TabPages[1].Text = sourceDt.TableName + "_虛擬製令"; // Sheet1,2 不開放編輯功能, treeList 1,2,3 treeList1.Columns["MD013"].Visible = false; treeList2.Columns["MD013"].Visible = false; treeList1.OptionsView.AutoWidth = false; treeList2.OptionsView.AutoWidth = false; treeList3.OptionsView.AutoWidth = false; treeList1.OptionsBehavior.ReadOnly = true; treeList2.OptionsBehavior.ReadOnly = true; treeList3.OptionsBehavior.ReadOnly = true; treeList1.OptionsBehavior.Editable = false; treeList2.OptionsBehavior.Editable = false; treeList3.OptionsBehavior.Editable = false; //Close Wait Form SplashScreenManager.CloseForm(false); }