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; } }
private void CallDataTrxData() { DataSet _ds = null; DataTable _dtChartData = new DataTable(); CreateChartDataTable _createChartDT = new CreateChartDataTable(); try { LinkedList _llstSearchCondition = new LinkedList(); _llstSearchCondition.Add(Definition.CONDITION_KEY_START_DTTS, CommonPageUtil.StartDate(this.bDtStart.Value.ToString(Definition.DATETIME_FORMAT))); _llstSearchCondition.Add(Definition.CONDITION_KEY_END_DTTS, CommonPageUtil.EndDate(this.bDtEnd.Value.ToString(Definition.DATETIME_FORMAT))); _llstSearchCondition.Add(Definition.CONDITION_KEY_MODEL_CONFIG_RAWID, ChartVariable.MODEL_CONFIG_RAWID); if (!string.IsNullOrEmpty(ChartVariable.CONTEXT_LIST)) { _llstSearchCondition.Add(Definition.CONDITION_KEY_CONTEXT_KEY_LIST, ChartVariable.CONTEXT_LIST); } //Cancle기능 EESProgressBar.ShowProgress(this, this._lang.GetMessage(Definition.LOADING_DATA), true); AsyncCallHandler ach = new AsyncCallHandler(EESProgressBar.AsyncCallManager); object objDataSet = ach.SendWait(_wsSPC, "GetATTSPCControlChartData", new object[] { _llstSearchCondition.GetSerialData() }); EESProgressBar.CloseProgress(this); if (objDataSet != null) { _ds = (DataSet)objDataSet; } else { MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA")); return; } ChartVariable.dateTimeStart = this.bDtStart.Value; ChartVariable.dateTimeEnd = this.bDtEnd.Value; if (DataUtil.IsNullOrEmptyDataSet(_ds)) { MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA")); this.pnlChart.Controls.Clear(); } else { this.MsgShow("Drawing Chart... Can't Cancel!!!"); _dtChartData = CommonPageUtil.CLOBnBLOBParsing(_ds, _llstSearchCondition, false); if (!DataUtil.IsNullOrEmptyDataTable(_dtChartData)) { _dtChartData = DataUtil.DataTableImportRow(_dtChartData.Select(null, Definition.CHART_COLUMN.TIME)); ChartVariable.DEFAULT_CHART = _dtChartData.Rows[0][BISTel.eSPC.Common.COLUMN.DEFAULT_CHART_LIST].ToString(); ChartVariable.MAIN_YN = _dtChartData.Rows[0][BISTel.eSPC.Common.COLUMN.MAIN_YN].ToString(); ChartVariable.complex_yn = "Y"; ChartVariable.CHART_PARENT_MODE = BISTel.eSPC.Common.CHART_PARENT_MODE.SPC_CONTROL_CHART; ChartVariable.dtResource = _dtChartData; _createChartDT.COMPLEX_YN = ChartVariable.complex_yn; ChartVariable.dtParamData = _createChartDT.GetMakeDataTable(_dtChartData); ChartVariable.lstRawColumn = _createChartDT.lstRawColumn; ChartVariable.lstDefaultChart.Clear(); ChartVariable.lstDefaultChart = CommonPageUtil.DefaultChartSplit(ChartVariable.DEFAULT_CHART); List <string> rawIDs = new List <string>(); if (_dtChartData.Columns.Contains(Definition.CHART_COLUMN.OCAP_RAWID)) { bool bPOcap = _dtChartData.Columns.Contains(Definition.CHART_COLUMN.P_OCAP_LIST); bool bPNOcap = _dtChartData.Columns.Contains(Definition.CHART_COLUMN.PN_OCAP_LIST); bool bCOcap = _dtChartData.Columns.Contains(Definition.CHART_COLUMN.C_OCAP_LIST); bool bUOcap = _dtChartData.Columns.Contains(Definition.CHART_COLUMN.U_OCAP_LIST); foreach (DataRow dr in _dtChartData.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()); llstTmpOcapComment.Add(Definition.CONDITION_KEY_START_DTTS, (this.bDtStart.Value.AddHours(-12)).ToString(Definition.DATETIME_FORMAT_MS)); llstTmpOcapComment.Add(Definition.CONDITION_KEY_END_DTTS, (this.bDtEnd.Value.AddHours(12)).ToString(Definition.DATETIME_FORMAT_MS)); byte[] baData = llstTmpOcapComment.GetSerialData(); _dsOcapComment = _wsSPC.GetOCAPCommentList_New(baData); ChartVariable.dtOCAP = _dsOcapComment.Tables[0]; } } this.pnlChart.Controls.Clear(); this.InitializeSPCChart(); this.MsgClose(); } } catch (Exception ex) { EESProgressBar.CloseProgress(this); if (ex is OperationCanceledException || ex is TimeoutException) { MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true); } else { LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex); MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true); } } finally { if (_createChartDT != null) { _createChartDT = null; } if (_dtChartData != null) { _dtChartData.Dispose(); } if (_ds != null) { _ds.Dispose(); } } }