示例#1
0
        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);
        }