Esempio n. 1
0
 /// <summary>
 /// 批量添加统计表格
 /// </summary>
 /// <param name="_wordLoadStatistic">勘察工作量数据</param>
 /// <param name="_nTestStatistic">标贯/动探统计数据</param>
 /// <param name="_cptStatistic">静力触探摩阻力统计数据</param>
 /// <param name="_rstStatistic">土工常规试验统计数据</param>
 /// <param name="_gatStatistic">颗粒分析试验数据</param>
 /// <param name="_bamStatistic">承载力和压缩模量综合取值数据</param>
 /// <param name="_ssStatistic">抗剪强度综合取值数据</param>
 public void AddAllStatisticTable(List <string> outputList, StatisticWordLoad _wordLoadStatistic, List <StatisticNTest> _nTestStatistic, List <StatisticCPT> _cptStatistic, List <StatisticRST> _rstStatistic, List <StatisticGAT> _gatStatistic, List <BearingAndModulusCalculation.BearingAndModulus> _bamStatistic, List <ShearingStrengthCalculation.ShearingStrength> _ssStatistic)
 {
     if (outputList.Contains("勘察工作量统计"))
     {
         AddWorkLoadStatisticTable(_wordLoadStatistic);
     }
     if (outputList.Contains("标贯/动探统计"))
     {
         AddNTestStatisticTable(_nTestStatistic);
     }
     if (outputList.Contains("静力触探摩阻力统计"))
     {
         AddPsStatisticTable(_cptStatistic);
     }
     if (outputList.Contains("土工常规试验统计"))
     {
         AddRSTStatisticTable(_rstStatistic);
     }
     if (outputList.Contains("颗粒分析试验统计"))
     {
         AddGATStatisticTable(_gatStatistic);
     }
     if (outputList.Contains("承载力和压缩模量综合取值"))
     {
         AddBearingAndModulusTable(_bamStatistic);
     }
     if (outputList.Contains("抗剪强度综合取值"))
     {
         AddShearingStrengthTable(_ssStatistic);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 输出Word文档函数
        /// </summary>
        /// <param name="_path"></param>
        public static void OutputToWord(string _path)
        {
            // 定义统计数据列表
            StatisticWordLoad statisticData = SelectStatisticData();

            // 输出Word
            Word workLoadStatisticWord = new Word();

            workLoadStatisticWord.AddWorkLoadStatisticTable(statisticData);
            workLoadStatisticWord.SaveAndQuit(_path);
        }
        /// <summary>
        /// 预加载全部数据
        /// </summary>
        public static void PreviewLoadAll()
        {
            WlStatisticList = WorkLoadStatistic.SelectStatisticData();

            NTestStatisticList = NTestStatistic.SelectStatisticData();

            RstStatisticList = RSTStatistic.SelectStatisticData();

            CptStatisticList = CPTStatistic.SelectStatisticData();

            GatStatisticList = GATStatistic.SelectStatisticData();
        }
Esempio n. 4
0
        /// <summary>
        /// 初始化NTestStatisticDataGrid
        /// </summary>
        private void InitialWordLoadStatisticDataGrid()
        {
            // 定义统计数据列表
            StatisticWordLoad statisticData = SelectStatisticData();

            // 定义NTestStatisticDataGrid数据列
            foreach (string sta in staName)
            {
                dtWL.Columns.Add(new DataColumn(sta, typeof(string)));
            }

            // 赋值工作量数组
            amountList[0]  = "";
            amountList[1]  = "";
            amountList[2]  = statisticData.Borehole + "/" + statisticData.CountBorehole;
            amountList[3]  = statisticData.Borehole + "/" + statisticData.CountBorehole;
            amountList[4]  = statisticData.UndisturbedSample.ToString();
            amountList[5]  = statisticData.DisturbedSample.ToString();
            amountList[6]  = statisticData.NTestStandard.ToString();
            amountList[7]  = statisticData.NTestN10.ToString();
            amountList[8]  = statisticData.NTestN635.ToString();
            amountList[9]  = statisticData.NTestN120.ToString();
            amountList[10] = statisticData.CPT + "/" + statisticData.CountCPT;
            amountList[11] = statisticData.RST.ToString();
            amountList[12] = statisticData.Permeability.ToString();
            amountList[13] = statisticData.GAT.ToString();
            amountList[14] = "";

            // 将统计数据列表赋值给DataTable
            DataRow dr;

            for (int i = 0; i < amountList.Length; i++)
            {
                if (amountList[i] == "" || amountList[i] == "0")
                {
                    continue;
                }

                dr           = dtWL.NewRow();
                dr["type"]   = typeList[i];
                dr["unite"]  = uniteList[i];
                dr["amount"] = amountList[i];
                dr["remark"] = remarkList[i];
                dtWL.Rows.Add(dr);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 筛选统计数据
        /// </summary>
        /// <returns></returns>
        public static StatisticWordLoad SelectStatisticData()
        {
            // 定义统计数据列表
            StatisticWordLoad statisticData = new StatisticWordLoad();

            // 读取钻孔列表
            List <Borehole> zkList = BoreholeDataBase.ReadZkListAsClass(Program.currentProject);

            // 统计钻孔数量
            int countZk = zkList.Count;

            double countZkDepth = 0;
            int    countUndisturbedSample = 0, countDisturbedSample = 0;
            int    countNTestStandard = 0, countNTestN10 = 0, countNTestN635 = 0, countNTestN120 = 0;

            foreach (Borehole zk in zkList)
            {
                // 统计钻孔进尺
                countZkDepth += zk.Layers[zk.Layers.Count - 1].Depth;

                // 统计原状样、扰动样数量
                foreach (ZkSample sample in zk.Samples)
                {
                    if (sample.IsDisturbed)
                    {
                        countDisturbedSample++;
                    }
                    else
                    {
                        countUndisturbedSample++;
                    }
                }

                // 统计标贯/动探数量
                foreach (ZkNTest ntest in zk.NTests)
                {
                    if (ntest.Type == ZkNTest.ntype.N)
                    {
                        countNTestStandard++;
                    }
                    else if (ntest.Type == ZkNTest.ntype.N10)
                    {
                        countNTestN10++;
                    }
                    else if (ntest.Type == ZkNTest.ntype.N635)
                    {
                        countNTestN635++;
                    }
                    else
                    {
                        countNTestN120++;
                    }
                }
            }

            // 读取土工常规试验列表
            List <RoutineSoilTest> rstList = RoutineSoilTestDataBase.ReadAllData(Program.currentProject);

            // 统计常规试验数量、室内渗透试验数量
            int    countRST = 0, countPermeability = 0;
            double n = -0.19880205;

            foreach (RoutineSoilTest rst in rstList)
            {
                // 统计室内渗透试验
                if (rst.permeability != n)
                {
                    countPermeability++;
                }

                //统计土工常规试验
                if (rst.waterLevel != n ||
                    rst.voidRatio != n ||
                    rst.specificGravity != n ||
                    rst.saturation != n ||
                    rst.plasticLimit != n ||
                    rst.plasticIndex != n ||
                    rst.modulus != n ||
                    rst.liquidLimit != n ||
                    rst.liquidityIndex != n ||
                    rst.frictionAngle != n ||
                    rst.density != n ||
                    rst.compressibility != n ||
                    rst.cohesion != n)
                {
                    countRST++;
                }
            }

            // 读取颗粒分析试验列表
            List <GrainAnalysisTest> gatList = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject);

            // 统计颗分试验数量
            int countGAT = gatList.Count;

            // 读取静力触探列表
            List <CPT> jkList = CPTDataBase.ReadJkListAsClass(Program.currentProject);

            // 统计钻孔数量
            int countJk = jkList.Count;

            // 统计静力触探进尺
            double countJkDepth = 0;

            foreach (CPT jk in jkList)
            {
                countJkDepth += jk.Layers[jk.Layers.Count - 1].Depth;
            }

            // 赋值给统计列表
            statisticData.CountBorehole        = countZk;
            statisticData.CountBoreholePacking = countZk;
            statisticData.Borehole             = countZkDepth;
            statisticData.BoreholePacking      = countZkDepth;
            statisticData.UndisturbedSample    = countUndisturbedSample;
            statisticData.DisturbedSample      = countDisturbedSample;
            statisticData.NTestStandard        = countNTestStandard;
            statisticData.NTestN10             = countNTestN10;
            statisticData.NTestN635            = countNTestN635;
            statisticData.NTestN120            = countNTestN120;
            statisticData.CountCPT             = countJk;
            statisticData.CPT          = countJkDepth;
            statisticData.RST          = countRST;
            statisticData.Permeability = countPermeability;
            statisticData.GAT          = countGAT;

            // 返回
            return(statisticData);
        }
Esempio n. 6
0
        /// <summary>
        /// 添加勘察工作量统计表格
        /// </summary>
        /// <param name="_wordLoadStatistic">勘察工作量数据</param>
        /// <returns></returns>
        public MSWord.Table AddWorkLoadStatisticTable(StatisticWordLoad _wordLoadStatistic)
        {
            // 赋值工作量数组
            WorkLoadStatistic.amountList[0]  = "";
            WorkLoadStatistic.amountList[1]  = "";
            WorkLoadStatistic.amountList[2]  = _wordLoadStatistic.Borehole + "/" + _wordLoadStatistic.CountBorehole;
            WorkLoadStatistic.amountList[3]  = _wordLoadStatistic.Borehole + "/" + _wordLoadStatistic.CountBorehole;
            WorkLoadStatistic.amountList[4]  = _wordLoadStatistic.UndisturbedSample.ToString();
            WorkLoadStatistic.amountList[5]  = _wordLoadStatistic.DisturbedSample.ToString();
            WorkLoadStatistic.amountList[6]  = _wordLoadStatistic.NTestStandard.ToString();
            WorkLoadStatistic.amountList[7]  = _wordLoadStatistic.NTestN10.ToString();
            WorkLoadStatistic.amountList[8]  = _wordLoadStatistic.NTestN635.ToString();
            WorkLoadStatistic.amountList[9]  = _wordLoadStatistic.NTestN120.ToString();
            WorkLoadStatistic.amountList[10] = _wordLoadStatistic.CPT + "/" + _wordLoadStatistic.CountCPT;
            WorkLoadStatistic.amountList[11] = _wordLoadStatistic.RST.ToString();
            WorkLoadStatistic.amountList[12] = _wordLoadStatistic.Permeability.ToString();
            WorkLoadStatistic.amountList[13] = _wordLoadStatistic.GAT.ToString();
            WorkLoadStatistic.amountList[14] = "";

            // 填写表格标题
            Doc.Paragraphs.Last.Range.Text                = "表1 勘察工作量统计表";
            Doc.Paragraphs.Last.Range.Font.Bold           = 1;
            Doc.Paragraphs.Last.Range.Font.Size           = 12;
            App.Selection.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
            object unite = MSWord.WdUnits.wdStory;

            App.Selection.EndKey(ref unite, ref Nothing);

            // 定义表格对象
            MSWord.Table table = Tables.Add(App.Selection.Range, 16, 5, ref Nothing, ref Nothing);

            // 填充行标题
            string[] rowheader = new string[] { "工 作 项 目", "单 位", "工作量", "备注" };
            for (int i = 2; i <= table.Columns.Count; i++)
            {
                table.Cell(1, i).Range.Text = rowheader[i - 2];
            }

            // 设置文档格式
            Doc.PageSetup.LeftMargin  = 50F;
            Doc.PageSetup.RightMargin = 50F;

            // 设置表格格式
            table.Select();
            App.Selection.Tables[1].Rows.Alignment = WdRowAlignment.wdAlignRowCenter;
            for (int i = 1; i <= table.Rows.Count; i++)
            {
                table.Rows[i].Range.Bold = 0;
            }
            table.Rows[1].Range.Bold = 1;
            table.Range.Font.Size    = 10.5F;
            table.Range.ParagraphFormat.Alignment = MSWord.WdParagraphAlignment.wdAlignParagraphCenter;
            table.Range.Cells.VerticalAlignment   = MSWord.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
            table.Borders.OutsideLineStyle        = MSWord.WdLineStyle.wdLineStyleDouble;
            table.Borders.InsideLineStyle         = MSWord.WdLineStyle.wdLineStyleSingle;
            float[] columnWidth = new float[] { 80, 120, 60, 60, 60 };
            for (int i = 1; i <= table.Columns.Count; i++)
            {
                table.Columns[i].Width = columnWidth[i - 1];
            }

            // 填充工作量数据
            for (int i = 0; i < WorkLoadStatistic.amountList.Length; i++)
            {
                table.Cell(i + 2, 2).Range.Text = WorkLoadStatistic.typeList[i];
                table.Cell(i + 2, 3).Range.Text = WorkLoadStatistic.uniteList[i];
                table.Cell(i + 2, 4).Range.Text = WorkLoadStatistic.amountList[i];
                table.Cell(i + 2, 5).Range.Text = WorkLoadStatistic.remarkList[i];
            }

            // 填充第一列
            table.Cell(2, 1).Range.Text  = "测绘";
            table.Cell(4, 1).Range.Text  = "勘探";
            table.Cell(6, 1).Range.Text  = "取样";
            table.Cell(8, 1).Range.Text  = "原位测试";
            table.Cell(13, 1).Range.Text = "室内试验";

            // 删除空行
            int d = 0;

            for (int i = 0; i < 15; i++)
            {
                if (WorkLoadStatistic.amountList[i].ToString() == "0")
                {
                    table.Rows[i + 2 - d].Delete();
                    d++;
                }
            }


            // 合并单元格
            table.Cell(1, 1).Merge(table.Cell(1, 2));
            table.Cell(2, 1).Merge(table.Cell(3, 1));
            table.Cell(4, 1).Merge(table.Cell(5, 1));
            table.Cell(table.Rows.Count, 1).Merge(table.Cell(table.Rows.Count, 2));
            int[] mergeIndex = new int[3] {
                0, 0, 0
            };
            for (int i = 6; i <= table.Rows.Count - 1; i++)
            {
                if ((mergeIndex[0] == 0) && (table.Cell(i, 2).Range.Text.Contains("原状样") || table.Cell(i, 2).Range.Text.Contains("扰动样")))
                {
                    mergeIndex[0] = i;
                }
                if ((mergeIndex[1] == 0) && (table.Cell(i, 2).Range.Text.Contains("标准贯入试验") || table.Cell(i, 2).Range.Text.Contains("触探试验")))
                {
                    mergeIndex[1] = i;
                }
                if ((mergeIndex[2] == 0) && (table.Cell(i, 2).Range.Text.Contains("土工常规") || table.Cell(i, 2).Range.Text.Contains("室内渗透") || table.Cell(i, 2).Range.Text.Contains("颗粒分析") || table.Cell(i, 2).Range.Text.Contains("水质") || table.Cell(i, 2).Range.Text.Contains("击实")))
                {
                    mergeIndex[2] = i;
                }
            }
            for (int i = 0; i < 3; i++)
            {
                int startIndex = mergeIndex[i];
                int endIndex;
                if (i < 2)
                {
                    endIndex = mergeIndex[i + 1] - 1;
                }
                else
                {
                    endIndex = table.Rows.Count - 1;
                }
                if (startIndex == 0)
                {
                    continue;
                }
                if (startIndex != endIndex)
                {
                    table.Cell(startIndex, 1).Merge(table.Cell(endIndex, 1));
                }
            }

            // 返回
            return(table);
        }