Esempio n. 1
0
        void CreateExceptionRecordsCell(ReportDownloadModel Datas, XWPFTable table, out CT_Row m_NewRow, out XWPFTableRow m_Row, out XWPFTableCell cell, out CT_Tc cttc, out CT_TcPr ctPr)
        {
            DealWithMergeCell(table, out m_NewRow, out m_Row, out cell, out cttc, out ctPr);
            StartMergeRow(cttc, ctPr, "异常记录");
            cell = m_Row.CreateCell();
            SetBoldFontCell(cell, "检测类型");
            SetAlign(cell);
            cell = m_Row.CreateCell();
            SetBoldFontCell(cell, "测点编号");
            SetAlign(cell);
            cell = m_Row.CreateCell();
            SetBoldFontCell(cell, "测点位置");
            SetAlign(cell);
            cell = m_Row.CreateCell();
            SetBoldFontCell(cell, "异常次数");
            SetAlign(cell);

            for (int i = 1; i <= Datas.ExceptionRecordNumber; i++)
            {
                m_NewRow = new CT_Row();
                m_Row    = new XWPFTableRow(m_NewRow, table);
                table.AddRow(m_Row);
                cell = m_Row.CreateCell();
                cttc = cell.GetCTTc();
                ctPr = cttc.AddNewTcPr();
                ctPr.AddNewVMerge().val = ST_Merge.@continue;//合并行
                //横向创建4个单元格
                for (int k = 1; k < 5; k++)
                {
                    cell = m_Row.CreateCell();
                    SetAlign(cell);
                }
            }
        }
        /// <summary>
        /// 创建一份报告
        /// </summary>
        /// <returns></returns>
        public dynamic GetDownloadDatas(int reportId)
        {
            var resp = new FirstLevelSafetyAssessmentReportDownloadResponse();
            IList <Func <FirstAssessment_FirstLevelSafetyAssessmentReportTable, bool> >            reportPs            = new List <Func <FirstAssessment_FirstLevelSafetyAssessmentReportTable, bool> >();
            IList <Func <FirstAssessment_FirstLevelOfSafetyAssessmentExceptionRecordTable, bool> > exceptionRecordPs   = new List <Func <FirstAssessment_FirstLevelOfSafetyAssessmentExceptionRecordTable, bool> >();
            IList <Func <FirstAssessment_FirstLevelOfSafetyAssessmentResultsTable, bool> >         resultsPs           = new List <Func <FirstAssessment_FirstLevelOfSafetyAssessmentResultsTable, bool> >();
            IEnumerable <FirstAssessment_FirstLevelOfSafetyAssessmentExceptionRecordTable>         exceptionRecordData = new List <FirstAssessment_FirstLevelOfSafetyAssessmentExceptionRecordTable>();

            try
            {
                DealWithExceptionRecordReportId(reportId, exceptionRecordPs);
                DealWithReportId(reportId, reportPs);
                DealWithResultsReportId(reportId, resultsPs);
                var exceptionRecordModels = _exceptionRecordDAL.FindBy(exceptionRecordPs, ServiceConstant.ExceptionRecordAssessmentReport).ToList();
                var resultsModel          = _resultDAL.FindBy(resultsPs, ServiceConstant.ResultsAssessmentReport).SingleOrDefault();
                var reportModel           = _reportDAL.FindBy(reportPs, ServiceConstant.ReportAssessmentReasons).SingleOrDefault();
                var reportDownloadModel   = new ReportDownloadModel(exceptionRecordModels, resultsModel, reportModel);
                //创建报告模板
                resp.Report  = _reportProcessor.Create(reportDownloadModel);
                resp.Succeed = true;
            }
            catch (Exception ex)
            {
                resp.Message = "报告下载出错!";
                Log(ex);
            }
            return(resp);
        }
Esempio n. 3
0
        /// <summary>
        /// 异常记录动态赋值
        /// </summary>
        /// <param name="Datas"></param>
        /// <param name="table"></param>
        static void SetExceptionRecordsValue(ReportDownloadModel Datas, XWPFTable table)
        {
            int j = ServiceConstant.FirstExceptionRecordRowNumber;

            foreach (var item in Datas.ExceptionRecordModels)
            {
                table.GetRow(j).GetCell(1).SetText(item.TestType);
                table.GetRow(j).GetCell(2).SetText(item.MonitoringPointsNumbers);
                table.GetRow(j).GetCell(3).SetText(item.MonitoringPointsPositions);
                table.GetRow(j).GetCell(4).SetText(item.ExceptionNumber.ToString());
                j++;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 对“评估结果”动态赋值,若测试类型为异常,则“评估结果”内容为红色字体
        /// </summary>
        /// <param name="Datas"></param>
        /// <param name="table"></param>
        void SetAssessmentResultsValue(ReportDownloadModel Datas, XWPFTable table)
        {
            int disExceptionNumber = 0;
            int strExceptionNumber = 0;
            int cabExceptionNumber = 0;

            foreach (var item in Datas.ExceptionRecordModels)
            {
                switch (item.TestType)
                {
                case "索力":
                    cabExceptionNumber++;
                    break;

                case "位移":
                    disExceptionNumber++;
                    break;

                case "钢拱肋应变":
                    strExceptionNumber++;
                    break;

                case "钢格构应变":
                    strExceptionNumber++;
                    break;

                case "混凝土应变":
                    strExceptionNumber++;
                    break;

                default:
                    break;
                }
            }

            if (disExceptionNumber > 0)
            {
                SetRedFontCell(table.GetRow(3).GetCell(2), Datas.ResultsModel.DisplacementAssessmentResult);
            }
            else
            {
                table.GetRow(3).GetCell(2).SetText(Datas.ResultsModel.DisplacementAssessmentResult);
            }
            table.GetRow(3).GetCell(4).SetText(Datas.ResultsModel.DisplacementAssessmentSuggestion);

            if (strExceptionNumber > 0)
            {
                SetRedFontCell(table.GetRow(4).GetCell(2), Datas.ResultsModel.StrainAssessmentResult);
            }
            else
            {
                table.GetRow(4).GetCell(2).SetText(Datas.ResultsModel.StrainAssessmentResult);
            }
            table.GetRow(4).GetCell(4).SetText(Datas.ResultsModel.StrainAssessmentSuggestion);

            if (strExceptionNumber > 0)
            {
                SetRedFontCell(table.GetRow(5).GetCell(2), Datas.ResultsModel.CableForceAssessmentResult);
            }
            else
            {
                table.GetRow(5).GetCell(2).SetText(Datas.ResultsModel.CableForceAssessmentResult);
            }
            table.GetRow(5).GetCell(4).SetText(Datas.ResultsModel.CableForceAssessmentSuggestion);
            table.GetRow(3).MergeCells(2, 3);
            table.GetRow(4).MergeCells(2, 3);
            table.GetRow(5).MergeCells(2, 3);
        }
Esempio n. 5
0
 /// <summary>
 /// 对评估报告表格表头动态赋值
 /// </summary>
 /// <param name="Datas"></param>
 /// <param name="table"></param>
 static void SetReportHeaderValue(ReportDownloadModel Datas, XWPFTable table)
 {
     table.GetRow(0).GetCell(4).SetText(Datas.ReportModel.ReportPeriods);
     table.GetRow(1).GetCell(1).SetText(Datas.ReportModel.AssessmentReasons.AssessmentReasons);
     table.GetRow(1).GetCell(4).SetText(DateTimeHelper.FormatDateTime(Datas.ReportModel.ReportTime));
 }