Ejemplo n.º 1
0
        private void bbtnList_ButtonClick(string name)
        {
            switch (name.ToUpper())
            {
            case "COPY":
                Copy();
                break;

            case "PASTE":
                Paste();
                break;

            case "SPC_MODIFY_MODEL":
                Modify();
                break;

            case "SPC_CONFIGURATION":
                ViewModel();
                break;

            case "SPC_VIEW_CHART":
                ViewChart();
                break;

            case "EXPORT":
                // this.bsprData.Export(true);
                BSpreadUtility bsprUtil = new BSpreadUtility();
                bsprUtil.Export(this.bsprData, true);
                break;
            }
        }
Ejemplo n.º 2
0
        private void bbtnList_ButtonClick(string name)
        {
            LinkedList _llstPopup = null;
            DataTable  dtResource = null;

            try
            {
                if (!(this.bsprData.ActiveSheet.RowCount > 0))
                {
                    MSGHandler.DisplayMessage(MSGType.Information, MSGHandler.GetMessage(Definition.MSG_KEY_NO_SEARCH_DATA));
                    return;
                }


                if (name.ToUpper() == Definition.ButtonKey.EXPORT)
                {
                    BSpreadUtility bsprUtil = new BSpreadUtility();
                    bsprUtil.Export(this.bsprData, true);
                }
                else if (name.ToUpper().Equals("SELECT"))
                {
                    if (this.bsprData.ActiveSheet.SelectionCount > 0)
                    {
                        FarPoint.Win.Spread.Model.CellRange[] selections = this.bsprData.ActiveSheet.GetSelections();

                        for (int i = 0; i < selections[0].RowCount; i++)
                        {
                            this.bsprData.ActiveSheet.SetText(selections[0].Row + i, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT, "True");
                        }
                    }
                }
                else if (name.ToUpper().Equals("UNSELECT"))
                {
                    if (this.bsprData.ActiveSheet.SelectionCount > 0)
                    {
                        FarPoint.Win.Spread.Model.CellRange[] selections = this.bsprData.ActiveSheet.GetSelections();

                        for (int i = 0; i < selections[0].RowCount; i++)
                        {
                            this.bsprData.ActiveSheet.SetText(selections[0].Row + i, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT, "False");
                        }
                    }
                }
                else if (name.ToUpper() == Definition.ButtonKey.VIEW || name.ToUpper() == Definition.ButtonKey.OCAP_MODIFY)
                {
                    ArrayList alCheckRowIndex = _bSpreadUtil.GetCheckedRowIndex(this.bsprData, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT);
                    if (alCheckRowIndex.Count == 0)
                    {
                        MSGHandler.DisplayMessage(MSGType.Information, "SPC_INFO_SELECT_ROW", null, null);
                        return;
                    }

                    if (name.ToUpper() == Definition.ButtonKey.VIEW)
                    {
                        this.ClickButtonOCAP(BISTel.eSPC.Common.enum_PopupType.View, alCheckRowIndex);
                    }
                    else if (name.ToUpper() == Definition.ButtonKey.OCAP_MODIFY)
                    {
                        this.ClickButtonOCAP(BISTel.eSPC.Common.enum_PopupType.Modify, alCheckRowIndex);
                    }
                }
                else if (name.ToUpper() == "SPC_REMOVE_DUPLICATE")
                {
                    if (this._bRemovedDuplicatedRow)
                    {
                        this.bsprData.ActiveSheet.Rows[0, this.bsprData.ActiveSheet.RowCount - 1].Visible = true;
                        this._bRemovedDuplicatedRow = false;
                    }
                    else
                    {
                        ArrayList arrDuplicatedRow = new ArrayList();
                        for (int i = 0; i < this.bsprData.ActiveSheet.RowCount; i++)
                        {
                            string strModelConfigRawID = this.bsprData.ActiveSheet.Cells[i, (int)BISTel.eSPC.Common.enum_OCAPLIST.MODEL_CONFIG_RAWID].Text;
                            if (arrDuplicatedRow.Contains(strModelConfigRawID))
                            {
                                this.bsprData.ActiveSheet.Rows[i].Visible = false;
                                if (this.bsprData.ActiveSheet.Cells[i, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT].Text == "True")
                                {
                                    this.bsprData.ActiveSheet.Cells[i, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT].Text = "False";
                                }
                            }
                            else
                            {
                                arrDuplicatedRow.Add(strModelConfigRawID);
                            }
                        }
                        this._bRemovedDuplicatedRow = true;
                    }
                }
                else
                {
                    ArrayList alCheckRowIndex = _bSpreadUtil.GetCheckedRowIndex(this.bsprData, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_V_SELECT);
                    if (alCheckRowIndex.Count < 1 || alCheckRowIndex.Count > 1)
                    {
                        MSGHandler.DisplayMessage(MSGType.Information, MSGHandler.GetMessage("FDC_ALLOW_SINGLE_SELECTED_ROW"));
                        return;
                    }

                    _ChartVariable = new ChartInterface();
                    int iRowIndex = (int)alCheckRowIndex[0];
                    if (iRowIndex < 0)
                    {
                        return;
                    }


                    string strModelConfigRawID = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.MODEL_CONFIG_RAWID].Text;
                    string strTime             = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.TIME].Text;
                    string strocaprawid        = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.OCAP_RAWID].Text;

                    //SPC-1292, KBLEE, START
                    if (this._llstSearchCondition.Contains(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD))
                    {
                        this._llstSearchCondition.Remove(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD);
                        this._llstSearchCondition.Add(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD, this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.PARAM_TYPE_CD].Text);
                    }
                    else
                    {
                        this._llstSearchCondition.Add(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD, this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.PARAM_TYPE_CD].Text);
                    }
                    //SPC-1292, KBLEE, END

                    DataRow drCurrent = this._dsOCAPList.Tables[0].Rows[iRowIndex];

                    _llstPopup = CommonPageUtil.GetOCAPParameter(this._dsOCAPList.Tables[0], iRowIndex);
                    dtResource = GetChartData(_llstPopup, strModelConfigRawID, iRowIndex);

                    List <string> rawIDs = new List <string>();
                    if (dtResource.Columns.Contains(Definition.CHART_COLUMN.OCAP_RAWID))
                    {
                        bool bPOcap  = dtResource.Columns.Contains(Definition.CHART_COLUMN.P_OCAP_LIST);
                        bool bPNOcap = dtResource.Columns.Contains(Definition.CHART_COLUMN.PN_OCAP_LIST);
                        bool bCOcap  = dtResource.Columns.Contains(Definition.CHART_COLUMN.C_OCAP_LIST);
                        bool bUOcap  = dtResource.Columns.Contains(Definition.CHART_COLUMN.U_OCAP_LIST);

                        foreach (DataRow dr in dtResource.Rows)
                        {
                            string rawid = dr[Definition.CHART_COLUMN.OCAP_RAWID].ToString();

                            string sTemp = rawid.Replace(";", "");
                            if (sTemp.Length > 0)
                            {
                                string[] ids = rawid.Split(';');
                                foreach (string id in ids)
                                {
                                    if (string.IsNullOrEmpty(id))
                                    {
                                        continue;
                                    }
                                    if (!rawIDs.Contains(id))
                                    {
                                        rawIDs.Add(id);
                                    }
                                }
                            }

                            if (bPOcap)
                            {
                                rawid = dr[Definition.CHART_COLUMN.P_OCAP_LIST].ToString();

                                sTemp = rawid.Replace("^", "").Replace(";", "");
                                if (sTemp.Length > 0)
                                {
                                    string[] ids = rawid.Replace(";", "^").Split('^');
                                    foreach (string id in ids)
                                    {
                                        if (string.IsNullOrEmpty(id))
                                        {
                                            continue;
                                        }
                                        if (!rawIDs.Contains(id))
                                        {
                                            rawIDs.Add(id);
                                        }
                                    }
                                }
                            }

                            if (bPNOcap)
                            {
                                rawid = dr[Definition.CHART_COLUMN.PN_OCAP_LIST].ToString();

                                sTemp = rawid.Replace("^", "");
                                if (sTemp.Length > 0)
                                {
                                    string[] ids = rawid.Split('^');
                                    foreach (string id in ids)
                                    {
                                        if (string.IsNullOrEmpty(id))
                                        {
                                            continue;
                                        }
                                        if (!rawIDs.Contains(id))
                                        {
                                            rawIDs.Add(id);
                                        }
                                    }
                                }
                            }

                            if (bCOcap)
                            {
                                rawid = dr[Definition.CHART_COLUMN.C_OCAP_LIST].ToString();

                                sTemp = rawid.Replace("^", "");
                                if (sTemp.Length > 0)
                                {
                                    string[] ids = rawid.Split('^');
                                    foreach (string id in ids)
                                    {
                                        if (string.IsNullOrEmpty(id))
                                        {
                                            continue;
                                        }
                                        if (!rawIDs.Contains(id))
                                        {
                                            rawIDs.Add(id);
                                        }
                                    }
                                }
                            }

                            if (bUOcap)
                            {
                                rawid = dr[Definition.CHART_COLUMN.U_OCAP_LIST].ToString();

                                sTemp = rawid.Replace("^", "");
                                if (sTemp.Length > 0)
                                {
                                    string[] ids = rawid.Split('^');
                                    foreach (string id in ids)
                                    {
                                        if (string.IsNullOrEmpty(id))
                                        {
                                            continue;
                                        }
                                        if (!rawIDs.Contains(id))
                                        {
                                            rawIDs.Add(id);
                                        }
                                    }
                                }
                            }
                        }

                        if (rawIDs.Count == 0)
                        {
                            rawIDs.Add("");
                        }

                        LinkedList llstTmpOcapComment = new LinkedList();
                        llstTmpOcapComment.Add(Definition.CONDITION_KEY_OOC_TRX_SPC_RAWID, rawIDs.ToArray());

                        if (this._llstSearchCondition[Definition.DynamicCondition_Condition_key.START_DTTS] != null)
                        {
                            llstTmpOcapComment.Add(Definition.CONDITION_KEY_START_DTTS, (DateTime.Parse(this._llstSearchCondition[Definition.DynamicCondition_Condition_key.START_DTTS].ToString())).ToString(Definition.DATETIME_FORMAT_MS));
                        }
                        if (this._llstSearchCondition[Definition.DynamicCondition_Condition_key.END_DTTS] != null)
                        {
                            llstTmpOcapComment.Add(Definition.CONDITION_KEY_END_DTTS, (DateTime.Parse(this._llstSearchCondition[Definition.DynamicCondition_Condition_key.END_DTTS].ToString())).ToString(Definition.DATETIME_FORMAT_MS));
                        }

                        byte[] baData = llstTmpOcapComment.GetSerialData();

                        _dsOcapComment = _wsSPC.GetOCAPCommentList_New(baData);
                    }

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

                    if (lineName.ContainsKey(this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.LINE].Text))
                    {
                        _ChartVariable.LINE = lineName[this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.LINE].Text];
                    }
                    _ChartVariable.AREA                  = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.AREA].Text;
                    _ChartVariable.SPC_MODEL             = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.SPC_MODEL_NAME].Text;
                    _ChartVariable.PARAM_ALIAS           = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.PARAM_ALIAS].Text;
                    _ChartVariable.OPERATION_ID          = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.OPERATION_ID].Text;
                    _ChartVariable.PRODUCT_ID            = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.PRODUCT_ID].Text;
                    _ChartVariable.llstInfoCondition     = _llstPopup;
                    _ChartVariable.DEFAULT_CHART         = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.DEFAULT_CHART_LIST].Text;
                    _ChartVariable.complex_yn            = Definition.VARIABLE_Y;
                    _ChartVariable.MODEL_CONFIG_RAWID    = strModelConfigRawID;
                    _ChartVariable.MAIN_YN               = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.MAIN_YN].Text;
                    _ChartVariable.dtResource            = dtResource;
                    _ChartVariable.CHART_PARENT_MODE     = BISTel.eSPC.Common.CHART_PARENT_MODE.OCAP;
                    _ChartVariable.dateTimeStart         = DateTime.Parse(this._llstSearchCondition[Definition.DynamicCondition_Condition_key.START_DTTS].ToString());
                    _ChartVariable.dateTimeEnd           = DateTime.Parse(this._llstSearchCondition[Definition.DynamicCondition_Condition_key.END_DTTS].ToString());
                    _ChartVariable.llstDTSelectCondition = this._llstDTSelectCondition;
                    _ChartVariable.OCAPRawID             = strocaprawid;

                    this._lineRawid = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.LINE].Text;
                    this._areaRawid = this.bsprData.ActiveSheet.Cells[iRowIndex, (int)BISTel.eSPC.Common.enum_OCAPLIST.AREA_RAWID].Text;

                    if (name.ToUpper() == Definition.ButtonKey.VIEW_CHART)
                    {
                        this.ClickButtonChartView();
                    }
                }
            }
            catch (Exception ex)
            {
                MSGHandler.DisplayMessage(MSGType.Error, ex.Message);
            }
            finally
            {
                if (dtResource != null)
                {
                    dtResource.Dispose();
                }

                _llstPopup     = null;
                _ChartVariable = null;
            }
        }