/// <summary> /// 筛选统计数据 /// </summary> /// <param name="_layerNumber">分层编号</param> /// <returns></returns> public static List <StatisticGAT> SelectStatisticData(string _layerNumber) { // 定义统计数据列表 List <StatisticGAT> _statisticList = new List <StatisticGAT>(); // 定义分层分层编号列表、分层岩土名称列表 List <string> layerNumberList = ProjectDataBase.ReadLayerNumberList(Program.currentProject); List <string> layerNameList = ProjectDataBase.ReadLayerNameList(Program.currentProject); // 提取分层岩土名称 string _layerName = ""; for (int i = 0; i < layerNumberList.Count; i++) { if (layerNumberList[i] == _layerNumber) { _layerName = layerNameList[i]; } } // 赋值统计数据列表 List <GrainAnalysisTest> gatList = GrainAnalysisTestDataBase.SelectByZkAndLayer(Program.currentProject, "", _layerNumber); if (gatList.Count > 0) { StatisticGAT statistic = new StatisticGAT(_layerNumber, _layerName, gatList); _statisticList.Add(statistic); } // 返回 return(_statisticList); }
/// <summary> /// 保存试验数据函数 /// </summary> private void Save() { // 提取参数 List <GrainAnalysisTest> gats = new List <GrainAnalysisTest>(); for (int i = 0; i < dtGAT.Rows.Count; i++) { double num; string zkNumber = dtGAT.Rows[i]["zkNumber"].ToString(); double sampleDepth = Convert.ToDouble(dtGAT.Rows[i]["sampleDepth"]); string sampleLayer = dtGAT.Rows[i]["sampleLayer"].ToString(); double group0to0075 = double.TryParse(dtGAT.Rows[i]["Group0To0_075"].ToString(), out num) ? num : -0.19880205; double group0075to025 = double.TryParse(dtGAT.Rows[i]["Group0_075To0_25"].ToString(), out num) ? num : -0.19880205; double group025to05 = double.TryParse(dtGAT.Rows[i]["Group0_25To0_5"].ToString(), out num) ? num : -0.19880205; double group05to2 = double.TryParse(dtGAT.Rows[i]["Group0_5To2"].ToString(), out num) ? num : -0.19880205; double group2to20 = double.TryParse(dtGAT.Rows[i]["Group2To20"].ToString(), out num) ? num : -0.19880205; double group20tomax = double.TryParse(dtGAT.Rows[i]["Group20ToMax"].ToString(), out num) ? num : -0.19880205; GrainAnalysisTest gat = new GrainAnalysisTest(zkNumber, sampleDepth, sampleLayer, group0to0075, group0075to025, group025to05, group05to2, group2to20, group20tomax); gats.Add(gat); } // 保存试验数据到数据库 GC.Collect(); GC.WaitForPendingFinalizers(); GrainAnalysisTestDataBase.Refresh(Program.currentProject, gats); }
// 查看/添加颗粒分析试验数据函数 private void ShowAddGrainAnalysisTestData() { this.ContectGrid.Children.Clear(); // 实例化一个GrainAnalysisTest类列表,并读取数据库信息赋值给此实例 List <GrainAnalysisTest> gats = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject); // 实例化GrainAnalysisTestControl用户控件,并赋值 GrainAnalysisTestControl gatc = new GrainAnalysisTestControl(gats); this.ContectGrid.Children.Add(gatc); }
// 单击菜单"项目"-"打开项目" private void OpenProjectMenu_Click(object sender, RoutedEventArgs e) { // 隐藏项目基本信息窗口 foreach (TreeViewItem item in this.ProjectTreeView.Items) { item.IsSelected = false; } // 重置窗口 SetProgramText(); // 打开 ProjectList projectList = new ProjectList(); projectList.ShowDialog(); if (projectList.DialogResult == true) { MenuIsEnable(true); SetProgramText(Program.currentProject); // 赋值钻孔列表 bind.ReSetZkItem(Program.currentProject); // 赋值原位测试-静力触探列表 if (CPTDataBase.ReadJkList(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(2, "静力触探"); } bind.ReSetJkItem(Program.currentProject); // 赋值室内试验-土工常规 if (RoutineSoilTestDataBase.ReadAllData(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(3, "土工常规"); bind.TreeItem[3].IsExpanded = true; } // 赋值室内试验-颗粒分析 if (GrainAnalysisTestDataBase.ReadAllData(Program.currentProject).Count > 0) { bind.AddItemToSecondTree(3, "颗粒分析"); bind.TreeItem[3].IsExpanded = true; } } }
/// <summary> /// 筛选数据函数 /// </summary> /// <param name="_zk">钻孔编号</param> /// <param name="_layer">分层编号</param> private void SelectData(string _zk, string _layer) { if (_zk == "全部钻孔") { _zk = ""; } if (_layer == "全部分层") { _layer = ""; } if (_layer != "") { _layer = _layer.Substring(0, _layer.IndexOf(" ")); } List <GrainAnalysisTest> gats = GrainAnalysisTestDataBase.SelectByZkAndLayer(Program.currentProject, _zk, _layer); RefreshTestDataListDataGrid(gats); }
/// <summary> /// 读取统计数据 /// </summary> /// <returns></returns> public static List <StatisticGAT> SelectStatisticData() { // 定义统计数据列表 List <StatisticGAT> _statisticList = new List <StatisticGAT>(); // 定义分层分层编号列表、分层岩土名称列表 List <string> layerNumberList = ProjectDataBase.ReadLayerNumberList(Program.currentProject); List <string> layerNameList = ProjectDataBase.ReadLayerNameList(Program.currentProject); // 在分层编号列表中循环,赋值统计数据列表 for (int i = 0; i < layerNumberList.Count; i++) { // 检查当前的分层编号下在数据库中是否有内容,并添加数据到统计列表 List <GrainAnalysisTest> gatList = GrainAnalysisTestDataBase.SelectByZkAndLayer(Program.currentProject, "", layerNumberList[i]); if (gatList.Count > 0) { StatisticGAT statistic = new StatisticGAT(layerNumberList[i], layerNameList[i], gatList); _statisticList.Add(statistic); } } // 返回 return(_statisticList); }
/// <summary> /// 初始化项目数据库,创建基本表结构 /// </summary> /// <param name="_projectName">项目名称</param> private static void Initial(string _projectName) { // 创建连接到项目信息数据库 string sql = "Data Source=" + Program.ReadProgramPath() + "\\" + _projectName + ".gsygeo"; using (SQLiteConnection conn = new SQLiteConnection(sql)) { // 打开连接 conn.Open(); // 新建项目基本信息表projectBasicInfo 设置 项目名称 所在省份 所在县市 为空字符串 // 表头 项目名称name 所在省份province 所在县市city sql = "create table projectBasicInfo(name varchar(255),province varchar(255),city varchar(255))"; new SQLiteCommand(sql, conn).ExecuteNonQuery(); sql = "insert into projectBasicInfo(name,province,city) values('','','')"; new SQLiteCommand(sql, conn).ExecuteNonQuery(); // 新建项目岩土分层信息表projectLayer // 表头 分层编号number 分层名称name 地质年代geo 分层描述description sql = "create table projectLayer(number varchar(255),name varchar(255),geo varchar(255),description text)"; new SQLiteCommand(sql, conn).ExecuteNonQuery(); // 新建项目公司信息表projectCompany 设置初始空字符串 // 表头 公司名称companyName 资质代码companyCode 绘图人drawer 报告编写人writer 校核人checker 审查人inspector 核定人approver 批准人finalApprover sql = "create table projectCompany(companyName varchar(255),companyCode varchat(255),drawer varchat(255),writer varchat(255),checker varchar(255),inspector varchar(255),approver varchar(255),finalApprover varchar(255))"; new SQLiteCommand(sql, conn).ExecuteNonQuery(); sql = "insert into projectCompany(companyName,companyCode,drawer,writer,checker,inspector,approver,finalApprover) values('','','','','','','','')"; new SQLiteCommand(sql, conn).ExecuteNonQuery(); } // 创建必要数据表 BoreholeDataBase.Initial(_projectName); CPTDataBase.Initial(_projectName); RoutineSoilTestDataBase.Initial(_projectName); GrainAnalysisTestDataBase.Initial(_projectName); }
// TreeView选择节点变化时激活不同的内容控件 private void ProjectTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { // 读取选中节点 TreeViewItem selectedItem = (TreeViewItem)e.NewValue; // 根据选中状况清空窗口中的控件 if (selectedItem == null) { this.ContectGrid.Children.Clear(); return; } if (selectedItem.Header.ToString() != "基本信息" && selectedItem.Parent != null) { this.ContectGrid.Children.Clear(); } // 选中一级节点时 // 选中"基本信息" if (selectedItem.Header.ToString() == "基本信息") { ProjectBasicInfo prjb = new ProjectBasicInfo(); this.ContectGrid.Children.Add(prjb); } // 选中二级、三级节点时 if (selectedItem.Parent != null) { // 读取父节点 TreeViewItem parentItem = (TreeViewItem)selectedItem.Parent; // 选中"钻孔"子节点 if (parentItem.Header.ToString() == "钻孔") { // 读取当前所选钻孔名称 string prj = Program.currentProject; string zkName = selectedItem.Header.ToString(); // 实例化一个Borehole类,并将当前所选钻孔的数据库信息赋值给此实例 Borehole bh = new Borehole(zkName, BoreholeDataBase.ReadAltitude(prj, zkName)); bh.X = BoreholeDataBase.ReadXAxis(prj, zkName); bh.Y = BoreholeDataBase.ReadYAxis(prj, zkName); bh.InitialWaterLevel = BoreholeDataBase.ReadInitialWaterLevel(prj, zkName); bh.StableWaterLevel = BoreholeDataBase.ReadStableWaterLevel(prj, zkName); bh.Layers = BoreholeDataBase.ReadZkLayer(prj, zkName); bh.Samples = BoreholeDataBase.ReadZkSample(prj, zkName); bh.NTests = BoreholeDataBase.ReadZkNTest(prj, zkName); // 实例化BoreholeControl用户控件,并赋值 BoreholeControl bhc = new BoreholeControl(bh); this.ContectGrid.Children.Add(bhc); } // 选取"原位测试"-"静力触探"子节点 if (parentItem.Header.ToString() == "静力触探") { // 读取当前所选触探孔名称 string prj = Program.currentProject; string jkName = selectedItem.Header.ToString(); // 实例化一个CPT类,并将当前所选触探孔的数据库信息赋值给此实例 CPT cpt = new CPT(jkName, CPTDataBase.ReadAltitude(prj, jkName)); cpt.X = CPTDataBase.ReadXAxis(prj, jkName); cpt.Y = CPTDataBase.ReadYAxis(prj, jkName); cpt.Layers = CPTDataBase.ReadJkLayer(prj, jkName); cpt.PsList = CPTDataBase.ReadJkPs(prj, jkName); // 实例化CPTControl用户控件,并赋值 CPTControl cptc = new CPTControl(cpt); this.ContectGrid.Children.Add(cptc); } // 选取"室内试验"-"土工常规"子节点 if (selectedItem.Header.ToString() == "土工常规") { // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例 List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.ReadAllData(Program.currentProject); // 实例化RoutineSoilTestControl用户控件,并赋值 RoutineSoilTestControl rstc = new RoutineSoilTestControl(rsts); this.ContectGrid.Children.Add(rstc); } // 选取"室内试验"-"颗粒分析"子节点 if (selectedItem.Header.ToString() == "颗粒分析") { // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例 List <GrainAnalysisTest> gats = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject); // 实例化RoutineSoilTestControl用户控件,并赋值 GrainAnalysisTestControl gatc = new GrainAnalysisTestControl(gats); this.ContectGrid.Children.Add(gatc); } } }
/// <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); }