Пример #1
0
        private void frmTestParser_Load(object sender, EventArgs e)
        {
            // 第一次取得BomList
            DataTable tmpDt = null;

            tmpDt = MvDbDao.collectData_BomList();
            cboBomType.DataSource    = tmpDt.Copy();
            cboBomType.ValueMember   = "MC001";
            cboBomType.DisplayMember = "MB0012";
            cboBomType.Text          = "";
            cboBomType.SelectedValue = "";

            // 調整GridControl 為不可編輯
            gridView1.OptionsBehavior.Editable = false;
            gridView1.OptionsBehavior.ReadOnly = true;
            gridView1.RefreshData();

            // 第一次取得單別
            tmpDt = MvDbDao.collectData_Cmsmq();
            cboOrderType.DataSource    = tmpDt.Copy();
            cboOrderType.ValueMember   = "MQ001";
            cboOrderType.DisplayMember = "MQ001";
            cboOrderType.Text          = "";
            cboOrderType.SelectedValue = "";

            deStart.Properties.DisplayFormat.FormatString = "yyyy/MM/dd";
            deEnd.Properties.DisplayFormat.FormatString   = "yyyy/MM/dd";
            deStart.DateTime = DateTime.Today;
            deEnd.DateTime   = DateTime.Today;
        }
Пример #2
0
        private void btnGetBomList_Click(object sender, EventArgs e)
        {
            DataTable tmpDt = null;

            tmpDt = MvDbDao.collectData_BomList();
            cboBomType.DataSource    = tmpDt;
            cboBomType.ValueMember   = "MC001";
            cboBomType.DisplayMember = "MB0012";
            cboBomType.Text          = "";
            cboBomType.SelectedValue = "";

            BomView.Columns.Add("BomId");
            BomView.Columns.Add("BomName");
            BomView.View = View.Details;

            enableObject(true, false);
            btnGetBomList.Visible = false;
        }
Пример #3
0
        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);
        }
Пример #4
0
        private void cboReportType_SelectedIndexChanged(object sender, EventArgs e)
        {
            // 如果沒被選取, 則直接離開
            if (cboReportType.SelectedIndex < 0)
            {
                return;
            }
            string result = cboReportType.SelectedValue.ToString();

            // 如果有值再判斷是否要intial value
            if (result.Length == 0)
            {
                return;
            }

            // Find the report type
            DataTable tmpDt = null;

            DefinedReport.ErpReportType reportList = DefinedReport.ErpReportType.NONE;
            try
            {
                reportList = (DefinedReport.ErpReportType)Enum.Parse(typeof(DefinedReport.ErpReportType), result);
            }
            catch (ArgumentException)
            { }

            switch (reportList)
            {
            case DefinedReport.ErpReportType.MocP10Auto:
                groupBom.Enabled      = false;
                chkBomListBox.Enabled = false;
                groupDate.Enabled     = true;
                enableObject(true, false, false);

                break;

            case DefinedReport.ErpReportType.BomP09:
                // initial button value
                tmpDt = MvDbDao.collectData_BomList();
                cboBomType.DataSource    = tmpDt;
                cboBomType.ValueMember   = "MC001";
                cboBomType.DisplayMember = "MB0012";
                cboBomType.Text          = "";
                cboBomType.SelectedValue = "";
                enableObject(false, true, false);

                break;

            case DefinedReport.ErpReportType.BomP09_Multi:
                // initial button value
                tmpDt = MvDbDao.collectData_BomList();
                chkBomListBox.DataSource    = tmpDt;
                chkBomListBox.ValueMember   = "MC001";
                chkBomListBox.DisplayMember = "MB0012";
                enableObject(false, false, true);

                break;

            default:

                enableObject(false, false, false);
                // do nothing
                return;
            }
        }
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }