Пример #1
0
        /// <summary>
        ///     向指定的FpSpread中添加一行
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="rowType"></param>
        private void addOneRowToFpSpread(int rowIdx, WarningResultDetail entity, FpSpread fp)
        {
            fp.ActiveSheet.Rows.Add(rowIdx, 1);
            fp.ActiveSheet.Rows[rowIdx].Height = 30;
            fp.ActiveSheet.Rows[rowIdx].Locked = true;

            sHandleStatus  = entity.HandleStatus;
            lblStatus.Text = getReadableHandleStatus(entity.HandleStatus); // 处理状态

            // 编号合并信息
            var idSpanInfo = new SpanCell(fp);

            idSpanInfo.RowIdx     = rowIdx;
            idSpanInfo.ColIdx     = COLUMN_INDEX_ID;
            idSpanInfo.SpanColCnt = 1;
            idSpanInfo.setText((rowIdx - 1).ToString());

            // 时间合并信息
            var dateSpanInfo = new SpanCell(fp);

            dateSpanInfo.RowIdx     = rowIdx;
            dateSpanInfo.ColIdx     = COLUMN_INDEX_DATE_TIME;
            dateSpanInfo.SpanColCnt = 1;

            //设置时间
            string time = null;

            if (entity.DateTime != null)
            {
                time = entity.DateTime.Split(' ')[1];
            }
            else
            {
                time = _txtDateTime.Text;
            }
            dateSpanInfo.setText(time);

            //预警类型合并信息
            var warningTypeSpanInfo = new SpanCell(fp);

            warningTypeSpanInfo.RowIdx     = rowIdx;
            warningTypeSpanInfo.ColIdx     = COLUMN_INDEX_WANRING_TYPE; //超限/突出
            warningTypeSpanInfo.SpanColCnt = 1;
            if (entity.WarningType == "0")
            {
                warningTypeSpanInfo.setText(WarningTypeCHN.超限预警.ToString());
            }
            if (entity.WarningType == "1")
            {
                warningTypeSpanInfo.setText(WarningTypeCHN.突出预警.ToString());
            }

            // 规则类型/预警依据:瓦斯,煤层赋存......
            var ruleTypeSpanInfo = new SpanCell(fp);

            ruleTypeSpanInfo.RowIdx     = rowIdx;
            ruleTypeSpanInfo.ColIdx     = COLUMN_INDEX_RULE_TYPE;
            ruleTypeSpanInfo.SpanColCnt = 1;
            ruleTypeSpanInfo.setText(entity.RuleType);

            // 预警级别/预警结果
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_WARNING_LEVEL], getWarningLevel(entity.WarningLevel));

            //预警编号单元格样式
            cells[rowIdx, COLUMN_INDEX_ID].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_ID].VerticalAlignment   = CellVerticalAlignment.Center;

            //预警类型单元格样式
            cells[rowIdx, COLUMN_INDEX_WANRING_TYPE].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_WANRING_TYPE].VerticalAlignment   = CellVerticalAlignment.Center;

            //预警依据单元格样式
            cells[rowIdx, COLUMN_INDEX_RULE_TYPE].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_RULE_TYPE].VerticalAlignment   = CellVerticalAlignment.Center;

            // 规则编码
            cells[rowIdx, COLUMN_INDEX_RULE_CODE].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_RULE_CODE].Locked              = true;
            cells[rowIdx, COLUMN_INDEX_RULE_CODE].Text                = entity.RuleCode;
            cells[rowIdx, COLUMN_INDEX_RULE_CODE].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_RULE_CODE].VerticalAlignment   = CellVerticalAlignment.Center;

            // 时间
            cells[rowIdx, COLUMN_INDEX_DATE_TIME].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_DATE_TIME].Locked              = true;
            cells[rowIdx, COLUMN_INDEX_DATE_TIME].Text                = entity.DateTime;
            cells[rowIdx, COLUMN_INDEX_DATE_TIME].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_DATE_TIME].VerticalAlignment   = CellVerticalAlignment.Center;

            //规则描述
            cells[rowIdx, COLUMN_INDEX_RULE_DESCRIPTION].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_RULE_DESCRIPTION].Locked              = true;
            cells[rowIdx, COLUMN_INDEX_RULE_DESCRIPTION].Text                = entity.RuleDescription;
            cells[rowIdx, COLUMN_INDEX_RULE_DESCRIPTION].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_RULE_DESCRIPTION].VerticalAlignment   = CellVerticalAlignment.Center;

            //标准值
            cells[rowIdx, COLUMN_INDEX_STANDARD_VALUE].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_STANDARD_VALUE].Locked              = true;
            cells[rowIdx, COLUMN_INDEX_STANDARD_VALUE].Text                = entity.Threshold;
            cells[rowIdx, COLUMN_INDEX_STANDARD_VALUE].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_STANDARD_VALUE].VerticalAlignment   = CellVerticalAlignment.Center;

            //实际值
            cells[rowIdx, COLUMN_INDEX_ACTUAL_VALUE].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_ACTUAL_VALUE].Locked              = true;
            cells[rowIdx, COLUMN_INDEX_ACTUAL_VALUE].Text                = entity.ActualValue;
            cells[rowIdx, COLUMN_INDEX_ACTUAL_VALUE].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_ACTUAL_VALUE].VerticalAlignment   = CellVerticalAlignment.Center;

            // 解除措施
            cells[rowIdx, COLUMN_INDEX_ACTIONS].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_ACTIONS].Locked              = isHistory;
            cells[rowIdx, COLUMN_INDEX_ACTIONS].Text                = entity.Actions;
            cells[rowIdx, COLUMN_INDEX_ACTIONS].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_ACTIONS].VerticalAlignment   = CellVerticalAlignment.Center;

            // 解除措施录入人
            cells[rowIdx, COLUMN_INDEX_ACTIONS_PERSON].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_ACTIONS_PERSON].Locked              = true; //this.isHistory;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_PERSON].Text                = entity.ActionsPerson;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_PERSON].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_PERSON].VerticalAlignment   = CellVerticalAlignment.Center;

            // 解除措施录入时间
            cells[rowIdx, COLUMN_INDEX_ACTIONS_DATE_TIME].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_ACTIONS_DATE_TIME].Locked              = true; //this.isHistory;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_DATE_TIME].Text                = entity.ActionsDateTime;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_DATE_TIME].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_ACTIONS_DATE_TIME].VerticalAlignment   = CellVerticalAlignment.Center;

            // 措施评价
            cells[rowIdx, COLUMN_INDEX_COMMENTS].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_COMMENTS].Locked              = isHistory;
            cells[rowIdx, COLUMN_INDEX_COMMENTS].Text                = entity.Comments;
            cells[rowIdx, COLUMN_INDEX_COMMENTS].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_COMMENTS].VerticalAlignment   = CellVerticalAlignment.Center;

            // 措施评价人
            cells[rowIdx, COLUMN_INDEX_COMMENTS_PERSON].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_COMMENTS_PERSON].Locked              = true; //this.isHistory;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_PERSON].Text                = entity.CommentsPerson;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_PERSON].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_PERSON].VerticalAlignment   = CellVerticalAlignment.Center;

            // 措施评价日期
            cells[rowIdx, COLUMN_INDEX_COMMENTS_DATE_TIME].CellType            = new TextCellType();
            cells[rowIdx, COLUMN_INDEX_COMMENTS_DATE_TIME].Locked              = true; //this.isHistory;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_DATE_TIME].Text                = entity.CommentsDateTime;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_DATE_TIME].HorizontalAlignment = CellHorizontalAlignment.Center;
            cells[rowIdx, COLUMN_INDEX_COMMENTS_DATE_TIME].VerticalAlignment   = CellVerticalAlignment.Center;

            // DataId--此列隐藏
            cells[rowIdx, COLUMN_INDEX_HIDE_DATA_ID].Text    = entity.Id;
            cells[rowIdx, COLUMN_INDEX_HIDE_WARNING_ID].Text = entity.WarningId;

            ////合并预警类型, 设置预警依据
            //warningTypeSpanInfo.applyCellsSpan();
            //warningTypeSpanInfo.setText(entity.WarningType);

            ////合并时间
            //dateSpanInfo.SpanRowCnt = warningTypeSpanInfo.SpanRowCnt;
            //dateSpanInfo.applyCellsSpan();


            ////合并编号
            //idSpanInfo.SpanRowCnt = warningTypeSpanInfo.SpanRowCnt;
            //idSpanInfo.applyCellsSpan();
            ////设置编号
            //idSpanInfo.setText(entity.WirePointName.ToString());

            //背景色设置为淡绿
            //设置背景颜色,采取白与RGB(200, 250, 160)交替设置
            if (!_bChangeBackClolor)
            {
                for (var iRow = idSpanInfo.RowIdx; iRow < idSpanInfo.RowIdx + idSpanInfo.SpanRowCnt; iRow++)
                {
                    fp.ActiveSheet.Rows[iRow].BackColor = Color.FromArgb(200, 250, 160);
                }
                fp.ActiveSheet.Rows[rowIdx].BackColor = Color.FromArgb(200, 250, 160);
                _bChangeBackClolor = true;
            }
            else
            {
                _bChangeBackClolor = false;
            }
        }
Пример #2
0
        /// <summary>
        ///     加载巷道信息
        /// </summary>
        private void LoadTunelInformation()
        {
            //设置控件是否启用
            dataPager1.Enabled = true;

            //实例化分页控件
            //维护查询结果的记录
            //List<PreWarningHistoryResultEnt> historyResultEnt = PreWarningResultQueryBLL.GetSortedPreWarningData();
            //int iRecordCount = historyResultEnt == null ? 0 : historyResultEnt.Count;
            var iRecordCount = PreWarningResultQueryBLL.GetPreWarningDataCount();

            dataPager1.PageControlInit(iRecordCount);
            var iStartIndex = dataPager1.getStartIndex();
            var iEndIndex   = dataPager1.getEndIndex();
            //根据分页控件选择数据
            var _ents = PreWarningResultQueryBLL.GetSortedPreWarningData(iStartIndex, iEndIndex);

            #region  除垃圾数据

            while (_fpTunelInfo.ActiveSheet.Rows.Count > 0)
            {
                _fpTunelInfo.ActiveSheet.Rows.Remove(0, 1);
            }

            #endregion

            if (_ents == null)
            {
                return;
            }
            var iSelCnt = _ents.Count;

            #region  除垃圾数据

            while (_fpTunelInfo.ActiveSheet.Rows.Count > 0)
            {
                _fpTunelInfo.ActiveSheet.Rows.Remove(0, 1);
            }

            #endregion

            for (var i = 0; i < iSelCnt; i++)
            {
                //添加新的行
                _fpTunelInfo.ActiveSheet.Rows.Add(i, 1);
                _fpTunelInfo.ActiveSheet.Rows[i].Height = 30;
                _fpTunelInfo.ActiveSheet.Rows[i].Locked = true;

                //巷道名称
                summaryCells[i, COLUMN_TUNNEL_NAME].Value = _ents[i].TunelName;
                summaryCells[i, COLUMN_TUNNEL_NAME].HorizontalAlignment = CellHorizontalAlignment.Center;
                summaryCells[i, COLUMN_TUNNEL_NAME].VerticalAlignment   = CellVerticalAlignment.Center;
                //日期
                summaryCells[i, COLUMN_DATE_TIME].Value = _ents[i].DateTime.ToShortDateString();
                summaryCells[i, COLUMN_DATE_TIME].HorizontalAlignment = CellHorizontalAlignment.Center;
                summaryCells[i, COLUMN_DATE_TIME].VerticalAlignment   = CellVerticalAlignment.Center;
                //班次
                summaryCells[i, COLUMN_DATE_SHIFT].Value = _ents[i].Date_Shift;
                summaryCells[i, COLUMN_DATE_SHIFT].HorizontalAlignment = CellHorizontalAlignment.Center;
                summaryCells[i, COLUMN_DATE_SHIFT].VerticalAlignment   = CellVerticalAlignment.Center;
                //超限预警
                FpUtil.setCellImg(summaryCells[i, COLUMN_WARNING_RESULT_OVERLIMIT],
                                  _ents[i].OverLimitWarningResult.WarningResult);
                //突出预警
                FpUtil.setCellImg(summaryCells[i, COLUMN_WARNING_RESULT_OUTBURST],
                                  _ents[i].OutBrustWarningResult.WarningResult);

                //瓦斯
                FpUtil.setCellImg(summaryCells[i, _iOverLimitGas], _ents[i].OverLimitWarningResult.Gas);
                //煤层
                FpUtil.setCellImg(summaryCells[i, _iOverLimitCoal], _ents[i].OverLimitWarningResult.Coal);
                //地质
                FpUtil.setCellImg(summaryCells[i, _iOverLimitGeology], _ents[i].OverLimitWarningResult.Geology);
                //通风
                FpUtil.setCellImg(summaryCells[i, _iOverLimitVentilation], _ents[i].OverLimitWarningResult.Ventilation);
                //管理
                FpUtil.setCellImg(summaryCells[i, _iOverLimitManagement], _ents[i].OverLimitWarningResult.Management);

                //瓦斯
                FpUtil.setCellImg(summaryCells[i, _iOutBurstGas], _ents[i].OutBrustWarningResult.Gas);
                //煤层
                FpUtil.setCellImg(summaryCells[i, _iOutBurstCoal], _ents[i].OutBrustWarningResult.Coal);
                //地质
                FpUtil.setCellImg(summaryCells[i, _iOutBurstGeology], _ents[i].OutBrustWarningResult.Geology);
                //通风
                FpUtil.setCellImg(summaryCells[i, _iOutBurstVentilation], _ents[i].OutBrustWarningResult.Ventilation);
                //管理
                FpUtil.setCellImg(summaryCells[i, _iOutBurstManagement], _ents[i].OutBrustWarningResult.Management);

                //记录巷道ID
                summaryCells[i, COLUMN_TUNNEL_ID].Text = _ents[i].TunnelID.ToString().Trim();
            }
            //设置焦点
            _fpTunelInfo.ActiveSheet.SetActiveCell(0, 0);
            //传入默认值,使得右侧详细信息随之改变
            _fpTunelInfo_SelectionChanged(null, null);
        }
Пример #3
0
        /// <summary>
        ///     向farpoint spread表单中添加一行数据.
        /// </summary>
        /// <param name="rowIdx"></param>
        /// <param name="entity"></param>
        private void addRow2Fp(int rowIdx, LibEntity.PreWarningResultQuery entity)
        {
            _fpPreWaringLastedValue.ActiveSheet.Rows.Add(rowIdx, 1);
            _fpPreWaringLastedValue.ActiveSheet.Rows[rowIdx].Height = 40;
            _fpPreWaringLastedValue.ActiveSheet.Rows[rowIdx].Locked = true;

            cells[rowIdx, COLUMN_INDEX_WORKFACE_NAME].Value  = entity.TunelName;
            cells[rowIdx, COLUMN_INDEX_DATETIME_SHIFT].Value = entity.DateTime + " " + entity.Date_Shift;
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_WANRING_RESULT_OVERLIMIT],
                              entity.OverLimitWarningResult.WarningResult);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_WANRING_RESULT_OUTBURST],
                              entity.OutBrustWarningResult.WarningResult);

            //瓦斯
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OVERLIMIT_GAS], entity.OverLimitWarningResult.Gas);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OUTBURST_GAS], entity.OutBrustWarningResult.Gas);

            //煤层
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OVERLIMIT_COAL], entity.OverLimitWarningResult.Coal);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OUTBURST_COAL], entity.OutBrustWarningResult.Coal);
            //地质
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OVERLIMIT_GEOLOGY], entity.OverLimitWarningResult.Geology);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OUTBURST_GEOLOGY], entity.OutBrustWarningResult.Geology);
            //通风
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OVERLIMIT_VENTILATION],
                              entity.OverLimitWarningResult.Ventilation);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OUTBURST_VENTILATION], entity.OutBrustWarningResult.Ventilation);
            //管理
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OVERLIMIT_MANAGEMENT], entity.OverLimitWarningResult.Management);
            FpUtil.setCellImg(cells[rowIdx, COLUMN_INDEX_OUTBURST_MANAGEMENT], entity.OutBrustWarningResult.Management);

            var buttonCell = new ButtonCellType();

            buttonCell.Text = "···";
            if (entity.OverLimitWarningResult.WarningResult > 1 && entity.OutBrustWarningResult.WarningResult > 1)
            {
                cells[rowIdx, COLUMN_INDEX_DETAIL_INFO_BUTTON].Locked = true;
                buttonCell.Text = "-";
            }
            cells[rowIdx, COLUMN_INDEX_DETAIL_INFO_BUTTON].CellType = buttonCell;

            if (_chkAddPreWarningVoice.Checked)
            {
                if (entity.OverLimitWarningResult.WarningResult < (int)WarningResult.GREEN ||
                    entity.OutBrustWarningResult.WarningResult < (int)WarningResult.GREEN)
                {
                    AddPreWarningTxt(entity.TunelName, entity.OverLimitWarningResult.WarningResult,
                                     entity.OutBrustWarningResult.WarningResult);
                }
            }

            //以下内容设置了隐藏,界面上无法看到
            //超限预警记录的ID  列号15
            cells[rowIdx, COLUMN_INDEX_HIDE_OVERLIMIT_WARNING_ID].Value = entity.OverLimitWarningResult.ID;
            //突出预警记录的ID  列号16
            cells[rowIdx, COLUMN_INDEX_HIDE_OUTBURST_WARNING_ID].Value = entity.OutBrustWarningResult.ID;
            //巷道ID  列号17
            cells[rowIdx, COLUMN_INDEX_HIDE_TUNNEL_ID].Value = entity.TunnelID;
            //日期  列号18
            cells[rowIdx, COLUMN_INDEX_HIDE_DATETIME].Value = entity.DateTime;
            //班次  列号19
            cells[rowIdx, COLUMN_INDEX_HIDE_SHIFT].Value = entity.Date_Shift;
            //  列号20
            cells[rowIdx, COLUMN_INDEX_HIDE_OVERLIMIT_HANDLE_STATUS].Value = entity.OverLimitWarningResult.HandleStatus;
            //班次  列号21
            cells[rowIdx, COLUMN_INDEX_HIDE_OUTBURST_HANDLE_STATUS].Value = entity.OutBrustWarningResult.HandleStatus;
        }