コード例 #1
0
        private DataTable GetProbeDataTableGroup(DataTable dtBasis)
        {
            string           sCol        = string.Empty;
            string           sColumnList = string.Empty;
            DataTable        dtGroup     = null;
            DataTableGroupBy dtGroupBy   = new DataTableGroupBy();

            for (int i = 0; i < this._arrSortingKey.Count; i++)
            {
                if (_arrSortingKey[i].ToString().Equals("SAMPLE"))
                {
                    continue;
                }
                sColumnList += _arrSortingKey[i].ToString() + ",";
            }

            if (!string.IsNullOrEmpty(sColumnList))
            {
                sColumnList = sColumnList.Substring(0, sColumnList.Length - 1);
            }

            string sField     = string.Format("{0},{1},sum(QTY) SAMPLE", sColumnList, Definition.CHART_COLUMN.OPERATION_ID);
            string sGroup     = string.Format("{0},{1}", sColumnList, Definition.CHART_COLUMN.OPERATION_ID);
            string sRowFilter = string.Empty;

            return(dtGroupBy.SelectGroupByInto("GROUP", dtBasis, sField, sRowFilter, sGroup));
        }
コード例 #2
0
        private void PROC_BindContext()
        {
            DataTableGroupBy dtGroupBy = new DataTableGroupBy();

            this.PROC_ContextCall();
            if (DataUtil.IsNullOrEmptyDataTable(this.mDTModelContext))
            {
                return;
            }

            this.AddHead();
            DataTable dtModelConfigRawID = dtGroupBy.SelectGroupByInto(COLUMN.MODEL_CONFIG_RAWID, this.mDTModelContext, COLUMN.MODEL_CONFIG_RAWID, null, COLUMN.MODEL_CONFIG_RAWID);
            DataTable dtContextKey       = dtGroupBy.SelectGroupByInto(COLUMN.CONTEXT_KEY, this.mDTModelContext, COLUMN.CONTEXT_KEY + "," + COLUMN.KEY_ORDER, null, COLUMN.CONTEXT_KEY + "," + COLUMN.KEY_ORDER);

            DataRow[] drSelect = dtContextKey.Select(null, COLUMN.KEY_ORDER);
            //this.Height = 100 + ((drSelect.Length + 1) * 28)+this.bTitlePnlPeriod.Height;
            //this.bTitlePnlContext.Dock = DockStyle.Fill;
            //this.bTitlePnlPeriod.Dock = DockStyle.Bottom;
            //this.bTitlePnlContext.Height = 97 + ((drSelect.Length+1) * 28);
            //this.AutoScroll=true;
            //this.AutoSize=true;
            if (!string.IsNullOrEmpty(this.mModelConfigRawID))
            {
                this.PROC_SpreadContextBind(this.mllstContext, this.mllstCustomContext);
            }
            else
            {
                this.pnlSelectModel.Visible = true;
                if (dtModelConfigRawID.Rows.Count == 1)
                {
                    this.mModelConfigRawID = this.mDTModelContext.Rows[0][COLUMN.MODEL_CONFIG_RAWID].ToString();
                    this.mMainYN           = this.mDTModelContext.Rows[0][COLUMN.MAIN_YN].ToString();
                    this.mParamAlias       = this.mDTModelContext.Rows[0][COLUMN.PARAM_ALIAS].ToString();
                    this.mDefaultChartList = this.mDTModelContext.Rows[0][COLUMN.DEFAULT_CHART_LIST].ToString();
                    this.mAreaRawidUnit    = this.mDTModelContext.Rows[0][COLUMN.AREA_RAWID].ToString();
                    this.mAreaUnit         = this.mDTModelContext.Rows[0][COLUMN.AREA].ToString();
                    this.mEQPModelUnit     = this.mDTModelContext.Rows[0][COLUMN.EQP_MODEL].ToString();

                    this.iRestrictSampleDays = int.Parse(string.IsNullOrEmpty(this.mDTModelContext.Rows[0][COLUMN.RESTRICT_SAMPLE_DAYS].ToString()) ? "15" : this.mDTModelContext.Rows[0][COLUMN.RESTRICT_SAMPLE_DAYS].ToString());

                    this.dateCondition1.DateType      = Definition.PERIOD_TYPE.CUSTOM;
                    this.dateCondition1.DateTimeStart = DateTime.Now.AddDays(-this.iRestrictSampleDays);
                    this.dateCondition1.DateTimeEnd   = DateTime.Now;

                    this.mllstContext       = new LinkedList();
                    this.mllstCustomContext = new LinkedList();
                    foreach (DataRow dr in dtContextKey.Rows)
                    {
                        DataRow[] drSelect2 = this.mDTModelContext.Select(string.Format("{0}='{1}'", COLUMN.CONTEXT_KEY, dr[COLUMN.CONTEXT_KEY].ToString()));
                        this.mllstContext.Add(dr[COLUMN.CONTEXT_KEY].ToString(), drSelect2[0][COLUMN.CONTEXT_VALUE].ToString());
                    }
                    PROC_SpreadContextBind(mllstContext, mllstCustomContext);
                }
                else
                {
                    this.bbtnSelectModel.Visible = true;
                }
            }
        }
コード例 #3
0
        private DataTable GetMeasDataTableGroup(DataTable dtBasis)
        {
            DataRow          nRow      = null;
            string           sCol      = string.Empty;
            DataTable        dtGroup   = null;
            DataTableGroupBy dtGroupBy = new DataTableGroupBy();

            string sField      = string.Empty;
            string sGroup      = string.Empty;
            string sColumnList = string.Empty;
            string sRowFilter  = string.Empty;

            for (int i = 0; i < this._arrSortingKey.Count; i++)
            {
                sCol = _arrSortingKey[i].ToString();
                if (dtBasis.Columns.Contains(sCol))
                {
                    sColumnList += sCol + ",";
                }
            }

            sColumnList += Definition.CHART_COLUMN.OPERATION_ID + ",";
            for (int i = 0; i < this._arrInfo.Count; i++)
            {
                sCol = this._arrInfo[i].ToString();
                if (dtBasis.Columns.Contains(sCol) && !this._arrSortingKey.Contains(sCol))
                {
                    sColumnList += sCol + ",";
                }
            }

            for (int i = 0; i < this._arrTargetInfo.Count; i++)
            {
                sCol = this._arrTargetInfo[i].ToString();
                if (dtBasis.Columns.Contains(sCol) && !this._arrInfo.Contains(sCol))
                {
                    sColumnList += sCol + ",";
                }
            }

            if (!string.IsNullOrEmpty(sColumnList))
            {
                sColumnList = sColumnList.Substring(0, sColumnList.Length - 1);
            }

            sField     = sColumnList;
            sGroup     = sField;
            sRowFilter = string.Empty;

            return(dtGroupBy.SelectGroupByInto("GROUP", dtBasis, sField, sRowFilter, sGroup));
        }
コード例 #4
0
        private void PROC_DataBinding()
        {
            ////초기화
            StringBuilder sb     = null;
            StringBuilder sbSort = null;

            CreateChartDataTable _chartData = null;
            DataTableGroupBy     dtGroupBy  = null;
            DataTable            dtGB       = null;
            DataTable            dtSearch   = null;
            DataSet       _ds         = null;
            CommonSPCStat comSPCStat  = null;
            List <double> listRawData = null;
            DataRow       nRow        = null;
            string        sField      = string.Empty;
            string        sGroupBy    = string.Empty;
            string        sRowFilter  = string.Empty;
            string        sWhere      = string.Empty;
            StringBuilder sbField     = new StringBuilder();
            StringBuilder sbGroup     = new StringBuilder();

            try
            {
                dtGB       = new DataTable();
                dtSearch   = new DataTable();
                dtGroupBy  = new DataTableGroupBy();
                _chartData = new CreateChartDataTable();
                sb         = new StringBuilder();
                sbSort     = new StringBuilder();
                comSPCStat = new CommonSPCStat();

                this.bsprData.ActiveSheet.ColumnCount = 0;
                this.bsprData.ActiveSheet.RowCount    = 0;
                SpreadHeader();
                this.bsprData.ActiveSheet.RowCount = 0;
                this.bsprData.DataSource           = null;
                this.MsgShow(COMMON_MSG.Query_Data);
                _llstSearchCondition.Add(Definition.CONDITION_KEY_CONTEXT_KEY_LIST, GetSelectString());
                _ds = _wsSPC.GetPpkReport(_llstSearchCondition.GetSerialData());
                if (!DataUtil.IsNullOrEmptyDataSet(_ds))
                {
                    dtSearch = CommonPageUtil.CLOBnBLOBParsing(_ds, _llstSearchCondition, false);
                    if (_ds != null)
                    {
                        _ds.Dispose();
                    }

                    if (DataUtil.IsNullOrEmptyDataTable(dtSearch))
                    {
                        this.MsgClose();
                        MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                        return;
                    }

                    _chartData.COMPLEX_YN = "N";
                    if (dtSearch.Rows.Count > 0)
                    {
                        _chartData.COMPLEX_YN = dtSearch.Rows[0]["COMPLEX_YN"].ToString();
                    }

                    _dtResult     = _chartData.GetPpkMakeDataTable(dtSearch);
                    _lstRawColumn = _chartData.lstRawColumn;
                    if (_chartData != null)
                    {
                        _chartData = null;
                    }

                    sbField.AppendFormat("MODEL_CONFIG_RAWID,COMPLEX_YN,MAIN_YN,DEFAULT_CHART_LIST,AREA,{0} ,PARAM_ALIAS", _OperationColumnName);
                    sbGroup.AppendFormat("MODEL_CONFIG_RAWID,COMPLEX_YN,MAIN_YN,DEFAULT_CHART_LIST,AREA,{0},PARAM_ALIAS", _OperationColumnName);
                    sbSort.AppendFormat("{0},PARAM_ALIAS", _OperationColumnName);

                    for (int i = 0; i < this.arrSortingKey.Count; i++)
                    {
                        string sCol = this.arrSortingKey[i].ToString();
                        if (_dtResult.Columns.Contains(sCol))
                        {
                            sbField.AppendFormat(",{0}", sCol);
                            sbGroup.AppendFormat(",{0}", sCol);
                            sbSort.AppendFormat(",{0}", sCol);
                        }
                    }
                    sbSort.Append(",PERIOD,USL,LSL ASC");
                    sbField.Append(",PERIOD,MEAN_LSL LSL,MEAN_USL USL ");
                    sbGroup.Append(",PERIOD,MEAN_LSL,MEAN_USL ");
                    sRowFilter = string.Empty;
                    dtGB       = dtGroupBy.SelectGroupByInto("PPK", _dtResult, sbField.ToString(), sRowFilter, sbGroup.ToString());
                    dtGB       = DataUtil.DataTableImportRow(dtGB.Select(null, sbSort.ToString()));
                }
                else
                {
                    this.MsgClose();
                    MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                    return;
                }

                _llstSearchCondition.Clear();
                _llstSearchCondition.Add(Definition.DynamicCondition_Condition_key.OPERATION_TYPE, this._sParamTypeCD == "MET" ? "METROLOGY" : "PROCESSING");
                DataSet dsOperation = _wsSPC.GetOperationID(_llstSearchCondition.GetSerialData());

                _dtMain = dtGB.Copy();
                _dtMain.Columns.Add(Definition.CHART_COLUMN.OPERATION_DESC, typeof(string));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.SPEC, typeof(string));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.MIN, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.MAX, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.SUM, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.SUM_SQUARED, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.STDDEV, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.AVG, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.PPK, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.PP, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.PPU, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.PPL, typeof(double));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.LOT_QTY, typeof(int));
                _dtMain.Columns.Add(Definition.CHART_COLUMN.SAMPLE_QTY, typeof(int));

                sField     = "count(LOT_ID) count ";
                sGroupBy   = "LOT_ID";
                sRowFilter = string.Empty;
                StringBuilder sbSelect = null;
                for (int i = 0; i < dtGB.Rows.Count; i++)
                {
                    string param_alias = dtGB.Rows[i][Definition.CHART_COLUMN.PARAM_ALIAS].ToString();
                    string operation   = dtGB.Rows[i][_OperationColumnName].ToString();
                    string sUsl        = dtGB.Rows[i][Definition.CHART_COLUMN.USL].ToString();
                    string sLsl        = dtGB.Rows[i][Definition.CHART_COLUMN.LSL].ToString();
                    double usl         = double.NaN;
                    double lsl         = double.NaN;

                    if (!string.IsNullOrEmpty(sUsl))
                    {
                        usl = double.Parse(sUsl);
                    }
                    if (!string.IsNullOrEmpty(sLsl))
                    {
                        lsl = double.Parse(sLsl);
                    }

                    sbSelect = new StringBuilder();
                    if (double.IsNaN(usl) && double.IsNaN(lsl))
                    {
                        sbSelect.AppendFormat("PARAM_ALIAS = '{0}' AND {1} = '{2}' AND MEAN_USL IS NULL AND MEAN_LSL IS NULL AND PERIOD = '{3}' "
                                              , param_alias
                                              , this._OperationColumnName
                                              , operation
                                              , dtGB.Rows[i]["PERIOD"].ToString()
                                              );
                    }
                    else if (double.IsNaN(usl) && !double.IsNaN(lsl))
                    {
                        sbSelect.AppendFormat("PARAM_ALIAS = '{0}' AND {1} = '{2}' AND MEAN_USL IS NULL AND MEAN_LSL = '{3}' AND PERIOD = '{4}' "
                                              , param_alias
                                              , this._OperationColumnName
                                              , operation
                                              , sLsl
                                              , dtGB.Rows[i]["PERIOD"].ToString()
                                              );
                    }
                    else if (!double.IsNaN(usl) && double.IsNaN(lsl))
                    {
                        sbSelect.AppendFormat("PARAM_ALIAS = '{0}' AND {1} = '{2}' AND MEAN_USL = '{3}' AND MEAN_LSL IS NULL AND PERIOD = '{4}' "
                                              , param_alias
                                              , this._OperationColumnName
                                              , operation
                                              , sUsl
                                              , dtGB.Rows[i]["PERIOD"].ToString()
                                              );
                    }
                    else
                    {
                        sbSelect.AppendFormat("PARAM_ALIAS = '{0}' AND {1} = '{2}' AND MEAN_USL = '{3}' AND MEAN_LSL = '{4}' AND PERIOD = '{5}' "
                                              , param_alias
                                              , this._OperationColumnName
                                              , operation
                                              , sUsl
                                              , sLsl
                                              , dtGB.Rows[i]["PERIOD"].ToString()
                                              );
                    }
                    for (int k = 0; k < this.arrSortingKey.Count; k++)
                    {
                        string sCol = this.arrSortingKey[k].ToString();
                        if (_dtResult.Columns.Contains(sCol))
                        {
                            sbSelect.AppendFormat(" AND {0} = '{1}'", sCol, dtGB.Rows[i][sCol].ToString());
                        }
                    }

                    DataTable dt = DataUtil.DataTableImportRow(_dtResult.Select(sbSelect.ToString()));
                    listRawData = comSPCStat.AddDataList(dt);
                    if (listRawData.Count == 0)
                    {
                        continue;
                    }

                    DataRow[] drSelectOperation = dsOperation.Tables[0].Select(string.Format("OPERATION_ID='{0}'", operation));
                    comSPCStat.CalcPpk(listRawData.ToArray(), usl, lsl);
                    nRow = _dtMain.Rows[i];
                    nRow[Definition.CHART_COLUMN.OPERATION_DESC] = drSelectOperation.Length > 0 ? drSelectOperation[0]["DESCRIPTION"].ToString() : null;
                    nRow[Definition.CHART_COLUMN.SPEC]           = sLsl + "~" + sUsl;
                    nRow[Definition.CHART_COLUMN.SAMPLE_QTY]     = listRawData.Count;
                    nRow[Definition.CHART_COLUMN.MIN]            = comSPCStat.min;
                    nRow[Definition.CHART_COLUMN.MAX]            = comSPCStat.max;
                    nRow[Definition.CHART_COLUMN.AVG]            = comSPCStat.mean;
                    nRow[Definition.CHART_COLUMN.SUM]            = comSPCStat.sum;
                    nRow[Definition.CHART_COLUMN.STDDEV]         = comSPCStat.stddev;
                    nRow[Definition.CHART_COLUMN.SUM_SQUARED]    = comSPCStat.sum2;
                    if (double.IsNaN(comSPCStat.ppk))
                    {
                        nRow[Definition.CHART_COLUMN.PPK] = DBNull.Value;
                    }
                    else
                    {
                        nRow[Definition.CHART_COLUMN.PPK] = comSPCStat.ppk;
                    }

                    if (double.IsNaN(comSPCStat.pp))
                    {
                        nRow[Definition.CHART_COLUMN.PP] = DBNull.Value;
                    }
                    else
                    {
                        nRow[Definition.CHART_COLUMN.PP] = comSPCStat.pp;
                    }

                    if (double.IsNaN(comSPCStat.ppu))
                    {
                        nRow[Definition.CHART_COLUMN.PPU] = DBNull.Value;
                    }
                    else
                    {
                        nRow[Definition.CHART_COLUMN.PPU] = comSPCStat.ppu;
                    }

                    if (double.IsNaN(comSPCStat.ppl))
                    {
                        nRow[Definition.CHART_COLUMN.PPL] = DBNull.Value;
                    }
                    else
                    {
                        nRow[Definition.CHART_COLUMN.PPL] = comSPCStat.ppl;
                    }
                    nRow[Definition.CHART_COLUMN.LOT_QTY] = dtGroupBy.SelectGroupByInto("LOT", dt, sField, sRowFilter, sGroupBy).Rows.Count;
                }
                _dtMain.AcceptChanges();

                this.bsprData.UseSpreadEdit       = false;
                this.bsprData.AutoGenerateColumns = false;
                this.bsprData.ActiveSheet.DefaultStyle.ResetLocked();
                this.bsprData.ClearHead();
                this.bsprData.UseEdit = true;
                this.bsprData.Locked  = true;

                //this.bsprData.ActiveSheet.FrozenColumnCount = 1;
                this.bsprData.ColFronzen = 1;

                this._Initialization.InitializePpkColumnHeader(ref this.bsprData, _sortHeader, this._sortHeaderLabel);
                this.bsprData.DataSource = _dtMain;
                if (dsOperation != null)
                {
                    dsOperation.Dispose();
                }
            }
            catch (Exception ex)
            {
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                this.MsgClose();
                if (dtGB != null)
                {
                    dtGB.Dispose();
                }
                if (_dtMain != null)
                {
                    _dtMain.Dispose();
                }
            }
        }
コード例 #5
0
        private void PROC_DataBinding()
        {
            DataSet          ds         = null;
            DataTableGroupBy dtGroupBy  = null;
            string           sFieldList = string.Empty;
            string           sGroupBy   = string.Empty;
            string           sFilter    = string.Empty;
            LinkedList       _llstCol   = new LinkedList();
            DataRow          nRow       = null;
            DataTable        dtResult   = null;
            DataTable        dtBasis    = null;
            DataTable        dtTarget   = null;

            try
            {
                this.MsgShow(_lang.GetVariable("RMS_PROGRESS_SEARCH"));
                dtGroupBy = new DataTableGroupBy();
                CreateChartDataTable _chartData = new CreateChartDataTable();
                LinkedList           _llstWhere = new LinkedList();

                //Table 생성
                dtResult = new DataTable();
                CreateTable(dtResult);

                //기준Step
                string  sParam  = "'" + CommonPageUtil.GetConditionKeyArrayList(this._arrItem).Replace(",", "','") + "'";
                DataSet dsBasis = GetResultDataSet(this._bProb, sParam, this._sOperation, this._arrInfo, this._arrSubData);
                if (!DataUtil.IsNullOrEmptyDataSet(dsBasis))
                {
                    if (!this._bProb)
                    {
                        _llstCol = GetQueryColumn(_bProb);
                        if (this._arrSortingKey.Contains(Definition.CHART_COLUMN.MOCVDNAME))
                        {
                            dtBasis = CommonPageUtil.CLOBnBLOBParsing(dsBasis, _llstWhere, false, true);
                        }
                        else
                        {
                            dtBasis = CommonPageUtil.CLOBnBLOBParsing(dsBasis, _llstWhere, false, false);
                        }

                        _llstCol.Clear();
                        for (int i = 0; i < this._arrSubData.Count; i++)
                        {
                            _llstCol.Add(this._arrSubData[i].ToString(), "1");
                        }

                        dtBasis = _chartData.GetMakeDataTable(dtBasis, _llstCol);
                    }
                    else
                    {
                        dtBasis = dsBasis.Tables[0];
                    }
                }

                //Target
                if (!string.IsNullOrEmpty(_sTargetOperation))
                {
                    string  sParamTarget = "'" + CommonPageUtil.GetConditionKeyArrayList(this._arrTargetItem).Replace(",", "','") + "'";
                    DataSet dsTarget     = GetResultDataSet(this._bTartProb, sParamTarget, this._sTargetOperation, this._arrTargetInfo, this._arrTargetSubData);
                    if (!DataUtil.IsNullOrEmptyDataSet(dsTarget))
                    {
                        if (!this._bTartProb)
                        {
                            if (this._arrSortingKey.Contains(Definition.CHART_COLUMN.MOCVDNAME))
                            {
                                dtTarget = CommonPageUtil.CLOBnBLOBParsing(dsTarget, _llstWhere, false, true);
                            }
                            else
                            {
                                dtTarget = CommonPageUtil.CLOBnBLOBParsing(dsTarget, _llstWhere, false, false);
                            }

                            _llstCol.Clear();
                            for (int i = 0; i < this._arrTargetSubData.Count; i++)
                            {
                                _llstCol.Add(this._arrTargetSubData[i].ToString(), "1");
                            }

                            dtTarget = _chartData.GetMakeDataTable(dtTarget, _llstCol);
                        }
                        else
                        {
                            dtTarget = dsTarget.Tables[0];
                        }
                    }
                }


                this.bSpread1.DataSource = null;
                if (!DataUtil.IsNullOrEmptyDataTable(dtBasis))
                {
                    this.MakeCrateTable(dtBasis, dtTarget, this._bProb, this._bTartProb, dtResult);
                }
                else
                {
                    this.MsgClose();
                    MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                }

                this.bSpread1.DataSource = dtResult;
                this.bSpread1.ActiveSheet.ColumnHeader.Cells[0, this._arrSortingKey.Count].Text = this._sOperationDesc;
                if (!string.IsNullOrEmpty(this._sTargetOperation))
                {
                    this.bSpread1.ActiveSheet.ColumnHeader.Cells[0, this.bSpread1.ActiveSheet.ColumnCount - (this._arrTargetItem.Count * this._arrTargetSubData.Count) - this._arrTargetInfo.Count].Text = this._sTargetOperationDesc;
                }
            }
            catch (Exception ex)
            {
                this.MsgClose();
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                if (ds != null)
                {
                    ds.Dispose();
                }
                this.MsgClose();
            }
        }
コード例 #6
0
        private void PROC_MainModelContext(int iSelect)
        {
            DataTableGroupBy dtGroupBy = new DataTableGroupBy();
            int       iContext         = (int)SPCChartConditionContext.COUNT;
            DataRow   dr = null;
            string    _model_config_rawid = this.mModelConfigRawID;
            string    _main_yn            = this.strucContextinfo.MAIN_YN;
            DataTable _mDTContextKey      = this.mDTContextKey;

            if (iSelect > -1)
            {
                if (this.bSpreadModelList != null && this.bSpreadModelList.ActiveSheet.RowCount > 0)
                {
                    _model_config_rawid = this.bSpreadModelList.ActiveSheet.Cells[iSelect, (int)SPCChartConditionContext.MODEL_CONFIG_RAWID].Text;
                }
                _main_yn = this.bSpreadModelList.ActiveSheet.Cells[iSelect, (int)SPCChartConditionContext.MAIN_YN].Text;

                if (_main_yn != "Y")
                {
                    return;
                }

                string _sFilter = string.Format("{0}='{1}'", COLUMN.MODEL_CONFIG_RAWID, _model_config_rawid);
                string _sColumn = COLUMN.CONTEXT_KEY + "," + COLUMN.KEY_ORDER;
                _mDTContextKey = dtGroupBy.SelectGroupByInto(COLUMN.CONTEXT_KEY, this.strucContextinfo.DTModelContext, _sColumn, _sFilter, _sColumn);
                _mDTContextKey = DataUtil.DataTableImportRow(_mDTContextKey.Select(null, COLUMN.KEY_ORDER));
            }

            if (this.bTabControl1.TabPages.Count > 1)
            {
                this.bTabControl1.TabPages.RemoveAt(this.bTabControl1.TabPages.Count - 1);
            }

            this.bTabControl1.TabPages.Add("Main Model Context");
            this.bTabControl1.TabPages[this.bTabControl1.TabPages.Count - 1].BackColor = Color.White;

            //SPC-744 By Louis - tabpage AutoScroll 추가
            this.bTabControl1.TabPages[this.bTabControl1.TabPages.Count - 1].AutoScroll = true;
            ///////
            if (this.strucContextinfo.SPCModelType == SPCMODEL_TYPE.SPC_CHART)
            {
                this.bTabControl1.SelectedIndex = this.bTabControl1.TabPages.Count - 1;
            }

            for (int xi = _mDTContextKey.Rows.Count - 1; xi >= 0; xi--)
            {
                string sColumn = _mDTContextKey.Rows[xi][COLUMN.CONTEXT_KEY].ToString();
                string sValue  = string.Empty;

                for (int j = iContext; j < this.bSpreadModelList.ActiveSheet.ColumnCount; j++)
                {
                    if (sColumn == this.bSpreadModelList.ActiveSheet.Columns[j].DataField)
                    {
                        sValue = this.bSpreadModelList.ActiveSheet.Cells[iSelect, j].Text;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(sValue))
                {
                    continue;
                }

                mDTMCRawIDContext = new DataTable();
                mDTMCRawIDContext.Columns.Add(COLUMN.SELECT, typeof(bool));
                mDTMCRawIDContext.Columns.Add(COLUMN.CONTEXT_VALUE, typeof(string));
                mDTMCRawIDContext.Columns.Add(COLUMN.DESCRIPTION, typeof(string));


                if (sValue == Definition.VARIABLE.STAR)
                {
                    DataTable _dt = dtGroupBy.SelectGroupByInto(sColumn, this.strucContextinfo.DTModelContext, COLUMN.CONTEXT_VALUE, string.Format("{0}='{1}'", COLUMN.CONTEXT_KEY, sColumn), COLUMN.CONTEXT_VALUE);
                    foreach (DataRow drData in _dt.Rows)
                    {
                        dr = mDTMCRawIDContext.NewRow();
                        if (this.strucContextinfo.llstCustomContext != null && this.strucContextinfo.llstCustomContext.Count > 0)
                        {
                            dr[COLUMN.SELECT] = isContains(sColumn, drData[COLUMN.CONTEXT_VALUE].ToString());
                        }
                        else if (drData[COLUMN.CONTEXT_VALUE].ToString() == sValue)
                        {
                            dr[COLUMN.SELECT] = true;
                        }
                        else
                        {
                            dr[COLUMN.SELECT] = false;
                        }


                        dr[COLUMN.CONTEXT_VALUE] = drData[COLUMN.CONTEXT_VALUE];
                        if (sColumn.IndexOf("OPERATION_ID") > -1)
                        {
                            dr[COLUMN.DESCRIPTION] = this.GetOperationDesc(drData[COLUMN.CONTEXT_VALUE].ToString());
                        }
                        mDTMCRawIDContext.Rows.Add(dr);
                    }
                }
                else
                {
                    string[] arr = sValue.Split(';');
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (string.IsNullOrEmpty(arr[i]))
                        {
                            continue;
                        }
                        dr = mDTMCRawIDContext.NewRow();

                        if (this.strucContextinfo.llstCustomContext != null && this.strucContextinfo.llstCustomContext.Count > 0)
                        {
                            dr[COLUMN.SELECT] = isContains(sColumn, arr[i]);
                        }
                        else
                        {
                            dr[COLUMN.SELECT] = true;
                        }

                        dr[COLUMN.CONTEXT_VALUE] = arr[i];

                        if (sColumn.IndexOf("OPERATION_ID") > -1)
                        {
                            dr[COLUMN.DESCRIPTION] = this.GetOperationDesc(arr[i]);
                        }

                        mDTMCRawIDContext.Rows.Add(dr);
                    }
                }
                this.InitializeBSpreadContxt(sColumn, mDTMCRawIDContext);
                this.bSpreadContext.Dock = DockStyle.Left;
                this.bTabControl1.TabPages[this.bTabControl1.TabPages.Count - 1].Controls.Add(this.bSpreadContext);
            }
        }
コード例 #7
0
        public void InitializeBSpread()
        {
            this.bSpreadModelList.UseSpreadEdit       = false;
            this.bSpreadModelList.AutoGenerateColumns = false;
            this.bSpreadModelList.ActiveSheet.DefaultStyle.ResetLocked();
            this.bSpreadModelList.UseEdit = true;
            this.bSpreadModelList.ClearHead();
            this.bSpreadModelList.Locked                  = true;
            this.bSpreadModelList.UseHeadColor            = true;
            this.bSpreadModelList.EditMode                = false;
            this.bSpreadModelList.ActiveSheet.RowCount    = 0;
            this.bSpreadModelList.ActiveSheet.ColumnCount = 0;



            DataTableGroupBy dtGroupBy = new DataTableGroupBy();

            string _sField  = string.Format("{0}, max({1}) {1}", COLUMN.CONTEXT_KEY, COLUMN.KEY_ORDER);
            string _sFilter = string.Empty;

            this.mDTContextKey = dtGroupBy.SelectGroupByInto(COLUMN.CONTEXT_KEY, this.strucContextinfo.DTModelContext, _sField, null, COLUMN.CONTEXT_KEY);

            StringBuilder sbField = new StringBuilder();

            sbField.AppendFormat("{0},", COLUMN.AREA_RAWID);
            sbField.AppendFormat("{0},", COLUMN.AREA);
            sbField.AppendFormat("{0},", COLUMN.EQP_MODEL);
            sbField.AppendFormat("{0},", COLUMN.MODEL_CONFIG_RAWID);
            sbField.AppendFormat("{0},", COLUMN.MAIN_YN);
            sbField.AppendFormat("{0},", COLUMN.PARAM_ALIAS);
            sbField.AppendFormat("{0},{1}", COLUMN.RESTRICT_SAMPLE_DAYS, COLUMN.DEFAULT_CHART_LIST);

            //Parent가 SPC_CONTROL_CHART 화면인경우 해당 Model만조회한다.
            if (this.strucContextinfo.SPCModelType == SPCMODEL_TYPE.SPC_CHART)
            {
                _sFilter = string.Format("{0}='{1}'", COLUMN.MODEL_CONFIG_RAWID, this.mModelConfigRawID);
            }

            this.mDTModelConfigRawID = dtGroupBy.SelectGroupByInto(COLUMN.MODEL_CONFIG_RAWID, this.strucContextinfo.DTModelContext, sbField.ToString(), _sFilter, sbField.ToString());


            this.mDTContextKey = DataUtil.DataTableImportRow(mDTContextKey.Select(null, COLUMN.KEY_ORDER));
            int iRow = (int)SPCChartConditionContext.COUNT;

            this.bSpreadModelList.DataSource = null;
            this.bSpreadModelList.ClearHead();
            this.bSpreadModelList.ActiveSheet.RowCount    = this.mDTModelConfigRawID.Rows.Count;
            this.bSpreadModelList.ActiveSheet.ColumnCount = this.mDTContextKey.Rows.Count + iRow;


            if (this.strucContextinfo.SPCModelType == SPCMODEL_TYPE.SPC_CHART)
            {
                this.bSpreadModelList.AddHead((int)SPCChartConditionContext.SELECT, this._mlthandler.GetVariable(Definition.SpreadHeaderColKey.V_SELECT), COLUMN.SELECT, 40, 20, null, null, null, ColumnAttribute.ReadOnly, ColumnType.CheckBox, null, null, null, false, true);
            }
            else
            {
                this.bSpreadModelList.AddHead((int)SPCChartConditionContext.SELECT, this._mlthandler.GetVariable(Definition.SpreadHeaderColKey.V_SELECT), COLUMN.SELECT, 40, 20, null, null, null, ColumnAttribute.Null, ColumnType.CheckBox, null, null, null, false, true);
            }


            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.MODEL_CONFIG_RAWID, COLUMN.MODEL_CONFIG_RAWID, COLUMN.MODEL_CONFIG_RAWID, 40, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.DEFAULT_CHART_LIST, COLUMN.DEFAULT_CHART_LIST, COLUMN.DEFAULT_CHART_LIST, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.RESTRICT_SAMPLE_DAYS, COLUMN.RESTRICT_SAMPLE_DAYS, COLUMN.RESTRICT_SAMPLE_DAYS, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.AREA_RAWID, COLUMN.AREA_RAWID, COLUMN.AREA_RAWID, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.AREA, COLUMN.AREA, COLUMN.AREA, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.EQP_MODEL, COLUMN.EQP_MODEL, COLUMN.EQP_MODEL, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, false);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.PARAM_ALIAS, COLUMN.PARAM_ALIAS, COLUMN.PARAM_ALIAS, 80, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);
            this.bSpreadModelList.AddHead((int)SPCChartConditionContext.MAIN_YN, COLUMN.MAIN_YN, COLUMN.MAIN_YN, 50, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);

            for (int i = 0; i < this.mDTContextKey.Rows.Count; i++)
            {
                string sContextKey = mDTContextKey.Rows[i][COLUMN.CONTEXT_KEY].ToString();
                this.bSpreadModelList.AddHead(iRow++, sContextKey, sContextKey, 120, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);
            }


            for (int i = 1; i < this.bSpreadModelList.ActiveSheet.ColumnCount; i++)
            {
                this.bSpreadModelList.ActiveSheet.Columns[i].Locked = true;
            }

            //SPC-777 By Louis ContextMenu Delete
            this.bSpreadModelList.UseGeneralContextMenu = false;
        }