/// <summary> /// 添加初始化时的回采进尺 /// </summary> private void AddHcjc(int hd1, int hd2, int qy, double zywid, double fywid, double qywid) { //已经存在回采进尺的,计算回采进尺点,保存到工作面表中,同时将绘制回采 var initialHc = 0.0; if (InitialHCLen.Text != "") { double.TryParse(InitialHCLen.Text, out initialHc); } if (initialHc > 0) { var dics = new Dictionary <string, string>(); dics[GIS_Const.FIELD_ID] = "0"; dics[GIS_Const.FIELD_BS] = "1"; dics[GIS_Const.FIELD_HDID] = hd1 + "_" + hd2; dics[GIS_Const.FIELD_XH] = "1"; dics[GIS_Const.FIELD_BID] = IDGenerator.NewBindingID(); IPoint pos = new PointClass(); var dzxlist = Global.cons.DrawHDHC(hd1.ToString(), hd2.ToString(), qy.ToString(), initialHc, zywid, fywid, qywid, 1, Global.searchlen, dics, true, null, out pos); //工作面信息提交 if (pos == null) { return; } _workingFace.SetCoordinate(pos.X, pos.Y, 0.0); _workingFace.Save(); //添加地质构造信息到数据库表中 if (dzxlist.Count > 0) { GeologySpaceBll.DeleteGeologySpaceEntityInfos(_workingFace.WorkingFaceId); //删除工作面ID对应的地质构造信息 foreach (var key in dzxlist.Keys) { var geoinfos = dzxlist[key]; var geo_type = key; for (var i = 0; i < geoinfos.Count; i++) { var tmp = geoinfos[i]; var geologyspaceEntity = new GeologySpace(); geologyspaceEntity.WorkingFace = _workingFace; geologyspaceEntity.TectonicType = Convert.ToInt32(key); geologyspaceEntity.TectonicId = tmp.geoinfos[GIS_Const.FIELD_BID]; geologyspaceEntity.Distance = tmp.dist; geologyspaceEntity.OnDateTime = DateTime.Now.ToShortDateString(); geologyspaceEntity.Save(); } } } } }
private void AddTunnelInfo() { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; //创建巷道实体 var workingFace = selectWorkingFaceControl1.SelectedWorkingFace; using (new SessionScope()) { workingFace = WorkingFace.Find(workingFace.WorkingFaceId); if (workingFace.Tunnels.FirstOrDefault(u => u.TunnelName == txtTunnelName.Text) != null) { Alert.alert("该工作面下已有同名巷道!"); return; } } var tunnel = new Tunnel { TunnelName = txtTunnelName.Text, TunnelSupportPattern = cboSupportPattern.Text, WorkingFace = selectWorkingFaceControl1.SelectedWorkingFace, Lithology = (Lithology)cboLithology.SelectedItem, TunnelType = (TunnelTypeEnum)cboTunnelType.SelectedValue, CoalOrStone = cboCoalOrStone.Text, CoalSeams = CoalSeams.FindAll().First(), BindingId = IDGenerator.NewBindingID(), TunnelWid = 5 }; //设计长度 if (txtDesignLength.Text != "") { tunnel.TunnelDesignLength = Convert.ToInt32(txtDesignLength.Text); } if (txtDesignArea.Text != "") { tunnel.TunnelDesignArea = Convert.ToInt32(txtDesignLength.Text); } //巷道信息登录 tunnel.Save(); Alert.alert("提交成功!"); }
private Tunnel AddTunnel(WorkingFace workingFace, string tunnelName) { var type = tunnelName.Contains("横川") ? TunnelTypeEnum.HENGCHUAN : TunnelTypeEnum.OTHER; var tunnel = new Tunnel { TunnelName = tunnelName, WorkingFace = workingFace, TunnelWid = 5, BindingId = IDGenerator.NewBindingID(), TunnelType = type }; tunnel.Save(); return(tunnel); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建瓦斯涌出量点实体 if (GasGushQuantity == null) { var gasGushQuantity = new GasGushQuantity { CoordinateX = Convert.ToDouble(txtCoordinateX.Text), CoordinateY = Convert.ToDouble(txtCoordinateY.Text), CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text), AbsoluteGasGushQuantity = Convert.ToDouble(txtAbsoluteGasGushQuantity.Text), RelativeGasGushQuantity = Convert.ToDouble(txtRelativeGasGushQuantity.Text), WorkingFaceDayOutput = Convert.ToDouble(txtWorkingFaceDayOutput.Text), StopeDate = dtpStopeDate.Value, Tunnel = selectTunnelSimple1.SelectedTunnel, CoalSeams = (CoalSeams)cboCoalSeams.SelectedValue, BindingId = IDGenerator.NewBindingID() }; // 坐标X gasGushQuantity.Save(); DrawGasGushQuantityPt(gasGushQuantity); } else { GasGushQuantity.CoordinateX = Convert.ToDouble(txtCoordinateX.Text); GasGushQuantity.CoordinateY = Convert.ToDouble(txtCoordinateY.Text); GasGushQuantity.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); GasGushQuantity.AbsoluteGasGushQuantity = Convert.ToDouble(txtAbsoluteGasGushQuantity.Text); GasGushQuantity.RelativeGasGushQuantity = Convert.ToDouble(txtRelativeGasGushQuantity.Text); GasGushQuantity.WorkingFaceDayOutput = Convert.ToDouble(txtWorkingFaceDayOutput.Text); GasGushQuantity.StopeDate = dtpStopeDate.Value; GasGushQuantity.Tunnel = selectTunnelSimple1.SelectedTunnel; GasGushQuantity.CoalSeams = (CoalSeams)cboCoalSeams.SelectedValue; GasGushQuantity.BindingId = IDGenerator.NewBindingID(); GasGushQuantity.Save(); DelGasGushQuantityPt(GasGushQuantity.BindingId, GasGushQuantity.CoalSeams.CoalSeamsName); DrawGasGushQuantityPt(GasGushQuantity); } }
/// <summary> /// 2014.2.26 lyf 修改函数,返回导线点List,为绘制导线点图形 /// </summary> /// <returns>导线点List</returns> private List <WirePoint> GetWirePointListFromDataGrid() { var wirePoints = new List <WirePoint>(); for (var i = 0; i < dgrdvWire.RowCount; i++) { var wirePoint = SetWirePointEntity(i); if (wirePoint == null) { break; } wirePoint.BindingId = IDGenerator.NewBindingID(); wirePoints.Add(wirePoint); } return(wirePoints); }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建一个瓦斯含量点实体 if (GasPressure == null) { var gasPressure = new GasPressure { CoordinateX = Convert.ToDouble(txtCoordinateX.Text), CoordinateY = Convert.ToDouble(txtCoordinateY.Text), CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text), Depth = Convert.ToDouble(txtDepth.Text), GasPressureValue = Convert.ToDouble(txtGasPressureValue.Text), MeasureDateTime = dtpMeasureDateTime.Value, Tunnel = selectTunnelSimple1.SelectedTunnel, CoalSeams = (CoalSeams)cboCoalSeams.SelectedItem, BindingId = IDGenerator.NewBindingID() }; // 坐标X gasPressure.Save(); DrawGasGushQuantityPt(gasPressure); } else { GasPressure.CoordinateX = Convert.ToDouble(txtCoordinateX.Text); GasPressure.CoordinateY = Convert.ToDouble(txtCoordinateY.Text); GasPressure.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); GasPressure.Depth = Convert.ToDouble(txtDepth.Text); GasPressure.GasPressureValue = Convert.ToDouble(txtGasPressureValue.Text); GasPressure.MeasureDateTime = dtpMeasureDateTime.Value; GasPressure.Tunnel = selectTunnelSimple1.SelectedTunnel; GasPressure.CoalSeams = (CoalSeams)cboCoalSeams.SelectedValue; GasPressure.Save(); DelGasGushQuantityPt(GasPressure.BindingId, GasPressure.CoalSeams.CoalSeamsName); DrawGasGushQuantityPt(GasPressure); } }
private void btnSubmint_Click(object sender, EventArgs e) { // 验证 if (!check()) { //DialogResult = DialogResult.None; return; } //DialogResult = DialogResult.OK; //停采线名称 stopLineEntity.StopLineName = txtStopLineName.Text; //起点坐标X stopLineEntity.SCoordinateX = Convert.ToDouble(txtSCoordinateX.Text); //起点坐标Y stopLineEntity.SCoordinateY = Convert.ToDouble(txtSCoordinateY.Text); //起点坐标Z stopLineEntity.SCoordinateZ = Convert.ToDouble(txtSCoordinateZ.Text); //终点坐标X stopLineEntity.FCoordinateX = Convert.ToDouble(txtFCoordinateX.Text); //终点坐标Y stopLineEntity.FCoordinateY = Convert.ToDouble(txtFCoordinateY.Text); //终点Z stopLineEntity.FCoordinateZ = Convert.ToDouble(txtFCoordinateZ.Text); //添加 if (Text == Const_MS.STOP_LINE_ADD) { //BID stopLineEntity.BindingId = IDGenerator.NewBindingID(); //添加 addStopLineInfo(); } //修改 if (Text == Const_MS.STOP_LINE_CHANGE) { //修改 UpdateStopLineInfo(); } }
private void btnMultImport_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { try { string[] file = File.ReadAllLines(fileName); var collapsePillarsName = fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1).Split('.')[0]; CollapsePillars collapsePillars = CollapsePillars.FindOneByCollapsePillarsName(collapsePillarsName); if (collapsePillars == null) { collapsePillars = new CollapsePillars { Xtype = "0", BindingId = IDGenerator.NewBindingID(), CollapsePillarsName = collapsePillarsName }; } else { collapsePillars.CollapsePillarsName = collapsePillarsName; } var collapsePillarsPoints = new List <CollapsePillarsPoint>(); //添加关键点 for (int i = 0; i < file.Length - 1; i++) { var collapsePillarsPoint = new CollapsePillarsPoint { CoordinateX = Convert.ToDouble(file[i].Split(',')[0]), CoordinateY = Convert.ToDouble(file[i].Split(',')[1]), CoordinateZ = 0.0, BindingId = IDGenerator.NewBindingID(), CollapsePillars = collapsePillars }; collapsePillarsPoints.Add(collapsePillarsPoint); } collapsePillars.CollapsePillarsPoints = collapsePillarsPoints; collapsePillars.Save(); ModifyXlz(collapsePillarsPoints, collapsePillars.Id.ToString()); lblSuccessed.Text = lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } SendMessengToServer(); Alert.alert("导入成功!"); }
/// <summary> /// 提交按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { CollapsePillars collapsePillars = CollapsePillars.FindOneByCollapsePillarsName(txtCollapsePillarsName.Text); if (collapsePillars == null) { collapsePillars = new CollapsePillars { CollapsePillarsName = txtCollapsePillarsName.Text, Discribe = txtDescribe.Text, Xtype = radioBtnX.Checked ? "0" : "1", BindingId = IDGenerator.NewBindingID() }; } else { collapsePillars.CollapsePillarsName = txtCollapsePillarsName.Text; collapsePillars.Discribe = txtDescribe.Text; collapsePillars.Xtype = radioBtnX.Checked ? "0" : "1"; } //实体赋值 //去除无用空行 for (int i = 0; i < dgrdvCoordinate.RowCount - 1; i++) { if (dgrdvCoordinate.Rows[i].Cells[0].Value == null && dgrdvCoordinate.Rows[i].Cells[1].Value == null && dgrdvCoordinate.Rows[i].Cells[2].Value == null) { dgrdvCoordinate.Rows.RemoveAt(i); } } //验证 if (!Check()) { DialogResult = DialogResult.None; return; } var collapsePillarsPoints = new List <CollapsePillarsPoint>(); //添加关键点 for (int i = 0; i < dgrdvCoordinate.RowCount - 1; i++) { var collapsePillarsPoint = new CollapsePillarsPoint { CoordinateX = Convert.ToDouble(dgrdvCoordinate[0, i].Value), CoordinateY = Convert.ToDouble(dgrdvCoordinate[1, i].Value), CoordinateZ = Convert.ToDouble(dgrdvCoordinate[2, i].Value), BindingId = IDGenerator.NewBindingID(), CollapsePillars = collapsePillars }; collapsePillarsPoints.Add(collapsePillarsPoint); } collapsePillars.CollapsePillarsPoints = collapsePillarsPoints; collapsePillars.Save(); ModifyXlz(collapsePillarsPoints, collapsePillars.Id.ToString()); SendMessengToServer(); DialogResult = DialogResult.OK; }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建井筒实体 var pitshaftEntity = new Pitshaft { PitshaftName = txtPitshaftName.Text.Trim() }; // 井筒名称 // 井筒类型 var iPitshaftTypeId = 0; if (int.TryParse(Convert.ToString(cobPitshaftType.SelectedValue), out iPitshaftTypeId)) { pitshaftEntity.PitshaftType.PitshaftTypeId = iPitshaftTypeId; } // 井口标高 double dWellheadElevation = 0; if (double.TryParse(txtWellheadElevation.Text.Trim(), out dWellheadElevation)) { pitshaftEntity.WellheadElevation = dWellheadElevation; } // 井底标高 double dWellbottomElevation = 0; if (double.TryParse(txtWellbottomElevation.Text.Trim(), out dWellbottomElevation)) { pitshaftEntity.WellbottomElevation = dWellbottomElevation; } // 井筒坐标X double dPitshaftCoordinateX = 0; if (double.TryParse(txtPitshaftCoordinateX.Text.Trim(), out dPitshaftCoordinateX)) { pitshaftEntity.PitshaftCoordinateX = Math.Round(dPitshaftCoordinateX, 3); } // 井筒坐标Y double dPitshaftCoordinateY = 0; if (double.TryParse(txtPitshaftCoordinateY.Text.Trim(), out dPitshaftCoordinateY)) { pitshaftEntity.PitshaftCoordinateY = Math.Round(dPitshaftCoordinateY, 3); } // 图形坐标X double dFigureCoordinateX = 0; if (double.TryParse(txtFigureCoordinateX.Text.Trim(), out dFigureCoordinateX)) { pitshaftEntity.FigureCoordinateX = Math.Round(dFigureCoordinateX, 3); } // 图形坐标Y double dFigureCoordinateY = 0; if (double.TryParse(txtFigureCoordinateY.Text.Trim(), out dFigureCoordinateY)) { pitshaftEntity.FigureCoordinateY = Math.Round(dFigureCoordinateY, 3); } // 图形坐标Z double dFigureCoordinateZ = 0; if (double.TryParse(txtFigureCoordinateZ.Text.Trim(), out dFigureCoordinateZ)) { pitshaftEntity.FigureCoordinateZ = dFigureCoordinateZ; } var bResult = false; if (_bllType == "add") { // BID pitshaftEntity.BindingId = IDGenerator.NewBindingID(); pitshaftEntity.Save(); DrawJingTong(pitshaftEntity); } else { // 主键 pitshaftEntity.PitshaftId = _iPk; // 井筒信息修改 pitshaftEntity.Save(); //20140428 lyf //获取井筒BID,为后面修改绘制井筒赋值所用 var sBID = ""; sBID = Pitshaft.Find(_iPk).BindingId; pitshaftEntity.BindingId = sBID; //修改图元 ModifyJingTong(pitshaftEntity); } // 添加/修改成功的场合 Close(); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建勘探线实体 var prospectingLineEntity = new ProspectingLine(); // 勘探线名称 prospectingLineEntity.ProspectingLineName = txtProspectingLineName.Text.Trim(); // 勘探线钻孔 var cnt = lstProspectingBoreholeSelected.Items.Count; var lstProspectingBoreholePts = new List <IPoint>(); //20140505 lyf 存储选择的钻孔点要素 for (var i = 0; i < cnt; i++) { var strDisplayName = lstProspectingBoreholeSelected.Items[i].ToString(); if (Validator.IsEmpty(prospectingLineEntity.ProspectingBorehole)) { prospectingLineEntity.ProspectingBorehole = strDisplayName; } else { prospectingLineEntity.ProspectingBorehole = prospectingLineEntity.ProspectingBorehole + "," + strDisplayName; } ///20140505 lyf ///根据钻孔点名查找钻孔点信息 IPoint pt = new PointClass(); pt = GetProspectingBoreholePointSelected(strDisplayName); if (pt != null && !lstProspectingBoreholePts.Contains(pt)) { lstProspectingBoreholePts.Add(pt); } } var bResult = false; if (_bllType == "add") { // BIDID prospectingLineEntity.BindingId = IDGenerator.NewBindingID(); // 勘探线信息登录 prospectingLineEntity.Save(); ///20140505 lyf ///绘制勘探线图形 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } else { // 主键 prospectingLineEntity.ProspectingLineId = _iPK; // 勘探线信息修改 prospectingLineEntity.Save(); //20140506 lyf //获取勘探线的BID var sBid = ProspectingLine.Find(_iPK).BindingId; if (sBid != "") { prospectingLineEntity.BindingId = sBid; ModifyProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); //修改图元 } } // 添加/修改成功的场合 if (bResult) { } }
private void btnReadMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { try { var strs = File.ReadAllLines(fileName, Encoding.GetEncoding("GB2312")); var type = ""; var split = strs[0].Split('|'); var bigFaultage = BigFaultage.FindOneByBigFaultageName(split[0]); var bigFaultagePoints = new List <BigFaultagePoint>(); if (bigFaultage == null) { bigFaultage = new BigFaultage { BigFaultageName = split[0], Gap = split[1], Type = split[2], Angle = split[3], BindingId = IDGenerator.NewBindingID() }; } else { bigFaultage.BigFaultageName = split[0]; bigFaultage.Gap = split[1]; bigFaultage.Type = split[2]; bigFaultage.Angle = split[3]; } for (var i = 1; i < strs.Length; i++) { if (strs[i] == "上盘") { type = "上盘"; continue; } if (strs[i] == "下盘") { type = "下盘"; continue; } if (strs[i].Equals("")) { continue; } if (type == "上盘") { bigFaultagePoints.Add(new BigFaultagePoint { Bid = IDGenerator.NewBindingID(), BigFaultage = bigFaultage, CoordinateX = Convert.ToDouble(strs[i].Split(',')[0]), CoordinateY = Convert.ToDouble(strs[i].Split(',')[1]), CoordinateZ = 0.0, UpOrDown = "上盘" }); } if (type == "下盘") { bigFaultagePoints.Add(new BigFaultagePoint { Bid = IDGenerator.NewBindingID(), BigFaultage = bigFaultage, CoordinateX = Convert.ToDouble(strs[i].Split(',')[0]), CoordinateY = Convert.ToDouble(strs[i].Split(',')[1]), CoordinateZ = 0.0, UpOrDown = "下盘" }); } } bigFaultage.BigFaultagePoints = bigFaultagePoints; var title = bigFaultage.BigFaultageName + " " + bigFaultage.Angle + " " + bigFaultage.Gap; DrawBigFaultageInfo.DrawTddc(title, bigFaultagePoints, bigFaultage.BindingId); bigFaultage.Save(); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } Alert.alert("导入成功!"); }
/// <summary> /// 添加回采日报 /// </summary> private void insertDayReportHCInfo() { var workingFace = selectWorkingfaceSimple1.SelectedWorkingFace; var dayReportHCEntityList = new List <DayReportHc>(); for (var i = 0; i < dgrdvDayReportHC.RowCount; i++) { var dayReportHCEntity = new DayReportHc(); // 最后一行为空行时,跳出循环 if (i == dgrdvDayReportHC.RowCount - 1) { break; } /**回采日报实体赋值**/ //队别名称 dayReportHCEntity.Team = (Team)cboTeamName.SelectedItem; //绑定回采面编号 dayReportHCEntity.WorkingFace = selectWorkingfaceSimple1.SelectedWorkingFace; var cells = dgrdvDayReportHC.Rows[i].Cells; //日期 if (cells[C_DATE].Value != null) { dayReportHCEntity.DateTime = Convert.ToDateTime(cells[C_DATE].Value.ToString()); } else { Alert.alert("请录入进尺时间"); DialogResult = DialogResult.None; return; } //填报人 dayReportHCEntity.Submitter = cboSubmitter.Text; //工作制式 if (rbtn38.Checked) { dayReportHCEntity.WorkTimeStyle = rbtn38.Text; } if (rbtn46.Checked) { dayReportHCEntity.WorkTimeStyle = rbtn46.Text; } //班次 if (cells[C_WORK_TIME].Value != null) { dayReportHCEntity.WorkTime = cells[C_WORK_TIME].Value.ToString(); } //工作内容 if (cells[C_WORK_CONTENT].Value != null) { dayReportHCEntity.WorkInfo = cells[C_WORK_CONTENT].Value.ToString(); } //回采进尺 if (cells[C_WORK_PROGRESS].Value != null) { dayReportHCEntity.JinChi = Convert.ToDouble(cells[C_WORK_PROGRESS].Value); } //备注 if (cells[C_COMMENTS].Value != null) { dayReportHCEntity.Remarks = cells[C_COMMENTS].Value.ToString(); } //BID dayReportHCEntity.BindingId = IDGenerator.NewBindingID(); //添加到dayReportHCEntityList中 dayReportHCEntityList.Add(dayReportHCEntity); } var bResult = false; //循环添加 foreach (var dayReportHcEntity in dayReportHCEntityList) { // 在图中绘制回采进尺 if (workingFace != null) { var hcjc = dayReportHcEntity.JinChi; var bid = dayReportHcEntity.BindingId; var workingFaceHc = WorkingFaceHc.FindByWorkingFace(workingFace); AddHcjc(workingFaceHc.TunnelZy.TunnelId, workingFaceHc.TunnelFy.TunnelId, workingFaceHc.TunnelQy.TunnelId, workingFaceHc.TunnelZy.TunnelWid, workingFaceHc.TunnelFy.TunnelWid, workingFaceHc.TunnelQy.TunnelWid, hcjc, bid); dayReportHcEntity.SaveAndFlush(); bResult = true; } else { Log.Fatal("[添加回采日报]:工作面实体为空值。"); } } //添加失败 if (!bResult) { Alert.alert(Const_MS.MSG_UPDATE_FAILURE); } else { // 工作面坐标已经改变,需要更新工作面信息 Log.Debug("发送地址构造消息------开始"); // 通知服务端回采进尺已经添加 var msg = new UpdateWarningDataMsg(selectWorkingfaceSimple1.SelectedWorkingFace.WorkingFaceId, Const.INVALID_ID, DayReportHc.TableName, OPERATION_TYPE.ADD, DateTime.Now); SocketUtil.SendMsg2Server(msg); Log.Debug("发送地址构造消息------完成" + msg); } }
/// <summary> /// 添加掘进日报 /// </summary> private void insertDayReportJJInfo() { var dayReportJJEntityList = new List <DayReportJj>(); for (var i = 0; i < dgrdvDayReportJJ.RowCount; i++) { var _dayReportJJEntity = new DayReportJj(); // 最后一行为空行时,跳出循环 if (i == dgrdvDayReportJJ.RowCount - 1) { break; } /**回采日报实体赋值**/ //队别名称 _dayReportJJEntity.Team = (Team)cboTeamName.SelectedItem; //绑定巷道编号 _dayReportJJEntity.WorkingFace = selectWorkingfaceSimple1.SelectedWorkingFace; var cells = dgrdvDayReportJJ.Rows[i].Cells; //日期 if (cells[C_DATE].Value != null) { _dayReportJJEntity.DateTime = Convert.ToDateTime(cells[C_DATE].Value.ToString()); } else { Alert.alert("请录入进尺时间"); DialogResult = DialogResult.None; return; } //填报人 _dayReportJJEntity.Submitter = cboSubmitter.Text; //工作制式 if (rbtn38.Checked) { _dayReportJJEntity.WorkTimeStyle = rbtn38.Text; } if (rbtn46.Checked) { _dayReportJJEntity.WorkTimeStyle = rbtn46.Text; } //班次 if (cells[C_WORK_TIME].Value != null) { _dayReportJJEntity.WorkTime = cells[C_WORK_TIME].Value.ToString(); } //工作内容 if (cells[C_WORK_CONTENT].Value != null) { _dayReportJJEntity.WorkInfo = cells[C_WORK_CONTENT].Value.ToString(); } //掘进进尺 if (cells[C_WORK_PROGRESS].Value != null) { _dayReportJJEntity.JinChi = Convert.ToDouble(cells[C_WORK_PROGRESS].Value); } //备注 if (cells[C_COMMENTS].Value != null) { _dayReportJJEntity.Remarks = cells[C_COMMENTS].Value.ToString(); } //BID _dayReportJJEntity.BindingId = IDGenerator.NewBindingID(); //添加到dayReportHCEntityList中 dayReportJJEntityList.Add(_dayReportJJEntity); } var tunnel = Tunnel.FindFirstByWorkingFaceId(selectWorkingfaceSimple1.SelectedWorkingFace.WorkingFaceId); //循环添加 foreach (var dayReportJjEntity in dayReportJJEntityList) { //添加回采进尺日报 dayReportJjEntity.Save(); //巷道掘进绘图 var dist = dayReportJjEntity.JinChi; // 巷道id var hdid = tunnel.TunnelId.ToString(); var bid = dayReportJjEntity.BindingId; AddHdJc(hdid, dist, bid, tunnel.TunnelWid); } Log.Debug("添加进尺数据发送Socket消息"); // 通知服务器掘进进尺已经更新 var msg = new UpdateWarningDataMsg(selectWorkingfaceSimple1.SelectedWorkingFace.WorkingFaceId, tunnel.TunnelId, DayReportJj.TableName, OPERATION_TYPE.ADD, DateTime.Now); SocketUtil.SendMsg2Server(msg); Log.Debug("添加进尺数据Socket消息发送完成"); }
///// <param name="verticesBtmRet">Vector3_DW数据</param> /// <summary> /// 根据导线点坐标绘制巷道 /// </summary> /// <summary> /// 获得导线边线点坐标集 /// </summary> /// <returns>导线边线点坐标集List</returns> //private List<IPoint> GetTunnelPts(Vector3_DW[] verticesBtmRet) //{ // var lstBtmRet = new List<IPoint>(); // try // { // Vector3_DW vector3dw; // IPoint pt; // for (int i = 0; i < verticesBtmRet.Length; i++) // { // vector3dw = new Vector3_DW(); // vector3dw = verticesBtmRet[i]; // pt = new PointClass(); // pt.X = vector3dw.X; // pt.Y = vector3dw.Y; // pt.Z = vector3dw.Z; // if (!lstBtmRet.Contains(pt)) // { // lstBtmRet.Add(pt); // } // } // return lstBtmRet; // } // catch // { // return null; // } //} #endregion 绘制导线点和巷道图形 private void btnMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Multiselect = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" }; _errorMsg = @"失败文件名:"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileCount = ofd.FileNames.Length; pbCount.Maximum = fileCount * 2; pbCount.Value = 0; foreach (var fileName in ofd.FileNames) { lblTotal.Text = fileCount.ToString(CultureInfo.InvariantCulture); string safeFileName = null; try { using (new SessionScope()) { safeFileName = fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1); var strs = safeFileName.Split('-'); var miningAreaName = strs[0]; var workingFaceName = strs[1]; var tunnelName = strs[2].Split('.')[0]; var miningArea = MiningArea.FindOneByMiningAreaName(miningAreaName); if (miningArea == null) { Alert.confirm("该采区不存在,请先添加采区"); return; } var workingFace = WorkingFace.FindByWorkingFaceNameAndMiningAreaId(workingFaceName, miningArea.MiningAreaId); if (workingFace == null) { workingFace = AddWorkingFace(miningArea, workingFaceName); } if (workingFace == null) { return; } Tunnel tunnel; if (workingFace.Tunnels != null && workingFace.Tunnels.FirstOrDefault(u => u.TunnelName == tunnelName) != null) { tunnel = workingFace.Tunnels.FirstOrDefault(u => u.TunnelName == tunnelName); } else { tunnel = AddTunnel(workingFace, tunnelName); } var sr = new StreamReader(fileName, Encoding.GetEncoding("GB2312")); string fileContent; var wirePoints = new List <WirePoint>(); while ((fileContent = sr.ReadLine()) != null) { if (String.IsNullOrEmpty(fileContent)) { continue; } var temp1 = fileContent.Split('|'); var pointName = temp1[0]; var pointX = temp1[1]; var pointY = temp1[2]; wirePoints.Add(new WirePoint { BindingId = IDGenerator.NewBindingID(), WirePointName = pointName, CoordinateX = Convert.ToDouble(pointX), CoordinateY = Convert.ToDouble(pointY), CoordinateZ = 0, LeftDis = 2.5, RightDis = 2.5, TopDis = 0, BottomDis = 0 }); } if (wirePoints.Count < 2) { Alert.alert(Const_GM.WIRE_INFO_MSG_POINT_MUST_MORE_THAN_TWO); throw new Exception(); } var wire = Wire.FindOneByTunnelId(tunnel.TunnelId); if (wire != null) { wire.WireName = tunnelName.Split('.').Length > 0 ? tunnelName.Split('.')[0] + "导线点" : tunnelName + "导线点"; wire.WirePoints = wirePoints; } else { wire = new Wire { Tunnel = tunnel, CheckDate = DateTime.Now, MeasureDate = DateTime.Now, CountDate = DateTime.Now, WireName = tunnelName.Split('.').Length > 0 ? tunnelName.Split('.')[0] + "导线点" : tunnelName + "导线点", WirePoints = wirePoints }; } wire.Save(); pbCount.Value++; DrawWirePoint(wirePoints, "CHANGE"); double hdwid; _dics = ConstructDics(tunnel, out hdwid); UpdateHdbyPnts(tunnel.TunnelId, wirePoints, _dics, hdwid); pbCount.Value++; lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); } } catch { pbCount.Value++; lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); _errorMsg += safeFileName + "\n"; btnDetails.Enabled = true; } } UpdateWarningDataMsg msg; if (selectTunnelUserControl1.SelectedTunnel != null) { msg = new UpdateWarningDataMsg(Const.INVALID_ID, selectTunnelUserControl1.SelectedTunnel.TunnelId, Wire.TableName, OPERATION_TYPE.ADD, DateTime.Now); } else { msg = new UpdateWarningDataMsg(Const.INVALID_ID, 0, Wire.TableName, OPERATION_TYPE.ADD, DateTime.Now); } SocketUtil.SendMsg2Server(msg); Alert.alert("导入完成"); }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } var borehole = Borehole.FindOneByBoreholeNum(txtBoreholeNumber.Text) ?? new Borehole { BindingId = IDGenerator.NewBindingID() }; borehole.BoreholeNumber = txtBoreholeNumber.Text.Trim(); borehole.GroundElevation = Convert.ToDouble(txtGroundElevation.Text.Trim()); borehole.CoordinateX = Convert.ToDouble(txtCoordinateX.Text.Trim()); borehole.CoordinateY = Convert.ToDouble(txtCoordinateY.Text.Trim()); borehole.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text.Trim()); borehole.CoalSeamsTexture = string.Empty; var boreholeLithologys = new List <BoreholeLithology>(); for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++) { // 最后一行为空行时,跳出循环 if (i == gvCoalSeamsTexture.RowCount - 1) { break; } // 创建钻孔岩性实体 var boreholeLithology = new BoreholeLithology { FloorElevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value), Thickness = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value), CoalSeamsName = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(), CoordinateX = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value), CoordinateY = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value), CoordinateZ = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value), Lithology = Lithology.FindOneByLithologyName(gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString()), Borehole = borehole }; boreholeLithologys.Add(boreholeLithology); } borehole.BoreholeLithologys = boreholeLithologys; borehole.Save(); // var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", // MessageBoxButtons.YesNoCancel); // if (dlgResult == DialogResult.Yes) // { // DrawZuanKong(borehole, boreholeLithologyEntityList[0]); // } // else if (dlgResult == DialogResult.No) // { // DrawZuanKong(borehole); // } // else if (dlgResult == DialogResult.Cancel) // { // } //} //else //{ //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“默认_钻孔”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。"); return; } if (borehole.BoreholeId != 0) { DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.BindingId); } var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", MessageBoxButtons.YesNoCancel); switch (dlgResult) { case DialogResult.Yes: DrawZuanKong(borehole, borehole.BoreholeLithologys.First()); break; case DialogResult.No: DrawZuanKong(borehole); break; case DialogResult.Cancel: break; } DialogResult = DialogResult.OK; }
private void btnReadMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { var encoder = TxtFileEncoding.GetEncoding(fileName, Encoding.GetEncoding("GB2312")); var sr = new StreamReader(fileName, encoder); string duqu; while ((duqu = sr.ReadLine()) != null) { try { var str = duqu.Split('|'); var borehole = Borehole.FindOneByBoreholeNum(str[0]) ?? new Borehole { BindingId = IDGenerator.NewBindingID() }; borehole.BoreholeNumber = str[0]; borehole.GroundElevation = Convert.ToDouble(str[3]); borehole.CoordinateX = Convert.ToDouble(str[1].Split(',')[0]); borehole.CoordinateY = Convert.ToDouble(str[1].Split(',')[1]); borehole.CoordinateZ = 0; borehole.CoalSeamsTexture = String.Empty; // 创建钻孔岩性实体 var boreholeLithology = new BoreholeLithology { Borehole = borehole, Lithology = Lithology.FindOneByCoal(), FloorElevation = Convert.ToDouble(str[4]), CoalSeamsName = CoalSeams.FindAll().First().CoalSeamsName, Thickness = Convert.ToDouble(str[2]), CoordinateX = Convert.ToDouble(str[1].Split(',')[0]), CoordinateY = Convert.ToDouble(str[1].Split(',')[1]), CoordinateZ = 0 }; borehole.BoreholeLithologys = new[] { boreholeLithology }; DrawZuanKong(borehole, boreholeLithology); borehole.Save(); } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } Alert.alert("导入成功!"); }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建断层实体 Faultage = Faultage.FindByFaultageName(txtFaultageName.Text.Trim()); Faultage = Faultage ?? new Faultage { BindingId = IDGenerator.NewBindingID() }; Faultage.FaultageName = txtFaultageName.Text.Trim(); Faultage.Gap = txtGap.Text.Trim(); Faultage.Type = rbtnFrontFaultage.Checked ? Const_GM.FRONT_FAULTAGE : Const_GM.OPPOSITE_FAULTAGE; Faultage.Trend = Convert.ToDouble(txtTrend.Text); Faultage.Separation = txtSeparation.Text.Trim(); double dAngle; if (double.TryParse(txtAngle.Text.Trim(), out dAngle)) { Faultage.Angle = dAngle; } // 坐标X double dCoordinateX; if (double.TryParse(txtCoordinateX.Text.Trim(), out dCoordinateX)) { Faultage.CoordinateX = dCoordinateX; } // 坐标Y double dCoordinateY; if (double.TryParse(txtCoordinateY.Text.Trim(), out dCoordinateY)) { Faultage.CoordinateY = dCoordinateY; } // 坐标Z double dCoordinateZ; if (double.TryParse(txtCoordinateZ.Text.Trim(), out dCoordinateZ)) { Faultage.CoordinateZ = dCoordinateZ; } double dLength; if (double.TryParse(txtLength.Text.Trim(), out dLength)) { Faultage.Length = dLength; } ModifyJldc(Faultage); Faultage.Save(); // 断层信息修改 SendMessengToServer(); DialogResult = DialogResult.OK; }
private void btnSubmit_Click(object sender, EventArgs e) { var bigFaultage = BigFaultage.FindOneByBigFaultageName(tbFaultageName.Text); var bigFaultagePoingList = new List <BigFaultagePoint>(); if (bigFaultage == null) { bigFaultage = new BigFaultage { BigFaultageName = tbFaultageName.Text, Gap = tbGap.Text, Angle = tbAngle.Text, Trend = tbTrend.Text, Type = rbtnFrontFaultage.Checked ? "正断层" : "逆断层", BindingId = IDGenerator.NewBindingID() }; for (var i = 0; i < dgrdvUp.Rows.Count; i++) { var point = new BigFaultagePoint { UpOrDown = "上盘" }; if (dgrdvUp.Rows[i].Cells[0].Value == null) { continue; } point.CoordinateX = Convert.ToDouble(dgrdvUp.Rows[i].Cells[0].Value); point.CoordinateY = Convert.ToDouble(dgrdvUp.Rows[i].Cells[1].Value); point.CoordinateZ = Convert.ToDouble(dgrdvUp.Rows[i].Cells[2].Value); point.Bid = IDGenerator.NewBindingID(); bigFaultagePoingList.Add(point); } for (var i = 0; i < dgrdvDown.Rows.Count; i++) { var point = new BigFaultagePoint(); if (dgrdvDown.Rows[i].Cells[0].Value == null) { continue; } point.UpOrDown = "下盘"; point.CoordinateX = Convert.ToDouble(dgrdvDown.Rows[i].Cells[0].Value); point.CoordinateY = Convert.ToDouble(dgrdvDown.Rows[i].Cells[1].Value); point.CoordinateZ = Convert.ToDouble(dgrdvDown.Rows[i].Cells[2].Value); point.Bid = IDGenerator.NewBindingID(); bigFaultagePoingList.Add(point); } bigFaultage.Save(); var title = bigFaultage.BigFaultageName + " " + bigFaultage.Angle + " " + bigFaultage.Gap; DrawBigFaultageInfo.DrawTddc(title, bigFaultagePoingList, bigFaultage.BindingId); } else { bigFaultage.BigFaultageName = tbFaultageName.Text; bigFaultage.Gap = tbGap.Text; bigFaultage.Angle = tbAngle.Text; bigFaultage.Trend = tbTrend.Text; bigFaultage.Type = rbtnFrontFaultage.Checked ? "正断层" : "逆断层"; foreach (var bigFaultagePoint in bigFaultagePoingList) { bigFaultagePoint.Save(); } bigFaultage.Save(); } }
private void btnMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; ErrorMsg = @"失败文件名:"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileCount = ofd.FileNames.Length; lblTotal.Text = fileCount.ToString(); pbCount.Maximum = fileCount; pbCount.Value = 0; foreach (var fileName in ofd.FileNames) { try { var sr = new StreamReader(fileName, Encoding.GetEncoding("GB2312")); string duqu; while ((duqu = sr.ReadLine()) != null) { var str = duqu.Split('|'); var faultage = Faultage.FindByFaultageName(str[0]); if (faultage == null) { faultage = new Faultage { FaultageName = str[0], CoordinateX = Convert.ToDouble(str[1].Split(',')[0]), CoordinateY = Convert.ToDouble(str[1].Split(',')[1]), CoordinateZ = 0.0, Separation = str[2], Gap = str[2], Trend = String.IsNullOrWhiteSpace(str[4]) ? 0.0 : Convert.ToDouble(str[4]), Angle = String.IsNullOrWhiteSpace(str[5]) ? 0.0 : Convert.ToDouble(str[5]), Length = String.IsNullOrWhiteSpace(str[6]) ? 0.0 : Convert.ToDouble(str[6]), Type = str[3], BindingId = IDGenerator.NewBindingID() }; DrawJldc(faultage); } else { faultage.FaultageName = str[0]; faultage.CoordinateX = Convert.ToDouble(str[1].Split(',')[0]); faultage.CoordinateY = Convert.ToDouble(str[1].Split(',')[1]); faultage.CoordinateZ = 0.0; faultage.Separation = str[2]; faultage.Gap = str[2]; faultage.Trend = String.IsNullOrWhiteSpace(str[4]) ? 0.0 : Convert.ToDouble(str[4]); faultage.Angle = String.IsNullOrWhiteSpace(str[5]) ? 0.0 : Convert.ToDouble(str[5]); faultage.Length = String.IsNullOrWhiteSpace(str[6]) ? 0.0 : Convert.ToDouble(str[6]); faultage.Type = str[3]; ModifyJldc(faultage); } faultage.Save(); pbCount.Value++; lblSuccessed.Text = lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); } } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); ErrorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } SendMessengToServer(); Alert.alert("导入完成"); }
private void btnSubmit_Click(object sender, EventArgs e) { try { //去除无用空行 for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { if (this.dgrdvZhzzt.Rows[i].Cells[0].Value == null && this.dgrdvZhzzt.Rows[i].Cells[1].Value == null && this.dgrdvZhzzt.Rows[i].Cells[2].Value == null) { this.dgrdvZhzzt.Rows.RemoveAt(i); } } //验证 if (!check()) { this.DialogResult = DialogResult.None; return; } this.DialogResult = DialogResult.OK; string bid = IDGenerator.NewBindingID(); //实体赋值 IPoint pt = new PointClass(); pt.X = Convert.ToDouble(txtX.Text); pt.Y = Convert.ToDouble(txtY.Text); pt.Z = 0; double bili = Convert.ToDouble(txtBlc.Text); //List<double> list = new List<double>(); var datasources = new List <KeyValuePair <int, double> >(); for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { DataGridViewTextBoxCell cell = dgrdvZhzzt.Rows[i].Cells[0] as DataGridViewTextBoxCell; DataGridViewComboBoxCell cell1 = dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewComboBoxCell; //list.Add(Convert.ToDouble(cell.Value.ToString())); int key = 0; if (cell1.Value.ToString() == "煤层") { key = 1; } datasources.Add(new KeyValuePair <int, double>(key, Convert.ToDouble(cell.Value.ToString()))); } //list.Add(Convert.ToDouble(txtDBBG.Text)); datasources.Add(new KeyValuePair <int, double>(2, Convert.ToDouble(txtDBBG.Text))); if (this.Text.Equals("修改小柱状") && this.Tag != null) { bid = this.Tag.ToString(); var AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer; //注记图层 var lineLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolylineXZZ) as IFeatureLayer; //线源图层 var topLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolygonXZZ) as IFeatureLayer; //外部图形图层 if (AnnoLayer == null || lineLayer == null || topLayer == null) { System.Windows.Forms.MessageBox.Show("小柱状图层缺失!"); return; } DataEditCommon.DeleteFeatureByBId(AnnoLayer, bid); DataEditCommon.DeleteFeatureByBId(lineLayer, bid); DataEditCommon.DeleteFeatureByBId(topLayer, bid); } if (DrawXZZ.drawXZZ(datasources, pt, Convert.ToDouble(txtAngle.Text), bid, bili)) { FrmNewXZZ frm = new FrmNewXZZ(); frm.Show(this.Owner); frm.Location = this.Location; this.Close(); DataEditCommon.g_pAxMapControl.CurrentTool = null; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSubmit_Click(object sender, EventArgs e) { //1煤2碳化灰岩3粉砂质泥岩4泥岩5泥质粉砂岩 IWorkspaceEdit workspaceEdit = null; try { labelSC.Visible = true; Application.DoEvents(); //去除无用空行 for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { if (this.dgrdvZhzzt.Rows[i].Cells[0].Value == null && this.dgrdvZhzzt.Rows[i].Cells[1].Value == null && this.dgrdvZhzzt.Rows[i].Cells[2].Value == null) { this.dgrdvZhzzt.Rows.RemoveAt(i); } } //验证 if (!check()) { this.DialogResult = DialogResult.None; return; } this.DialogResult = DialogResult.OK; if (isadd) { bid = IDGenerator.NewBindingID(); } //实体赋值 Histogram historam = new Histogram(); historam.HistogramEntName = txtname.Text.Trim(); historam.BLC = Convert.ToDouble(txtBlc.Text.Trim()); historam.ID = bid; historam.listMY = new List <Historgramlist>(); double height = 0; for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { Historgramlist hisl = new Historgramlist(); hisl.BID = bid; hisl.Index = (i + 1); //煤岩名称 DataGridViewTextBoxCell cell = dgrdvZhzzt.Rows[i].Cells[0] as DataGridViewTextBoxCell; hisl.MYName = cell.Value.ToString(); cell = dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewTextBoxCell; hisl.Height = Convert.ToDouble(cell.Value.ToString()); height += hisl.Height; hisl.SHeight = height; hisl.ZZType = ZZStrToCode(dgrdvZhzzt.Rows[i].Cells[2].Value.ToString()); cell = dgrdvZhzzt.Rows[i].Cells[3] as DataGridViewTextBoxCell; if (cell.Value != null) { hisl.Describe = cell.Value.ToString(); } historam.listMY.Add(hisl); } if (!isadd) { DataEditCommon.DeleteFeatureByWhereClause(frmZhzzt.pFeatureClass, "BID='" + bid + "'"); } progressBar1.Maximum = historam.listMY.Count * 6 + 9; progressBar1.Value = 0; IFeatureClass pFeatureClass = frmZhzzt.pFeatureClass; progressBar1.Value += 1; Application.DoEvents(); IDataset dataset = (IDataset)pFeatureClass; IWorkspace workspace = dataset.Workspace; workspaceEdit = workspace as IWorkspaceEdit; workspaceEdit.StartEditing(true); workspaceEdit.StartEditOperation(); ISegmentCollection pSegmentCollection = new PolygonClass(); double xbasic = 100; double xmin = xbasic, ymin = 99.5, xmax = 110, ymax = 100; List <IGeometry> listgeo = new List <IGeometry>(); IEnvelope pEnvelope = new EnvelopeClass(); pEnvelope.PutCoords(xmin, ymin, xmax, ymax); List <ziduan> listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", historam.HistogramEntName)); listzd.Add(new ziduan("zztype", "6")); listzd.Add(new ziduan("strtype", "1")); listzd.Add(new ziduan("bilici", historam.BLC.ToString())); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); ymax = ymin; ymin -= 0.3; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "比例 1:" + historam.BLC.ToString() + " 单位:米")); listzd.Add(new ziduan("zztype", "6")); listzd.Add(new ziduan("strtype", "2")); listzd.Add(new ziduan("bilici", historam.BLC.ToString())); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); ymax = ymin; ymin -= 0.3; xmax = xmin + 0.6; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "序号")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1.8; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "煤 岩 名 称")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 0.8; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "真厚")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "累厚")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1.2; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "柱 状")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 4.6; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "岩 性 描 述")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); List <Historgramlist> list = historam.ListMY; for (int i = 0; i < list.Count; i++) { xmin = xbasic; double m_height = list[i].Height; if (m_height < 0.3) { m_height = 0.3; } pEnvelope = new EnvelopeClass(); ymax = ymin; ymin -= m_height; xmax = xmin + 0.6; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "1")); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1.8; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", list[i].MYName)); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "2")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 0.8; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", list[i].Height.ToString())); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "3")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", Math.Round(list[i].SHeight, 1).ToString())); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "4")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 1.2; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); listzd.Add(new ziduan("textstr", "")); listzd.Add(new ziduan("zztype", list[i].ZZType)); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "5")); listzd.Add(new ziduan("strtype", "0")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); pEnvelope = new EnvelopeClass(); xmin = xmax; xmax += 4.6; pEnvelope.PutCoords(xmin, ymin, xmax, ymax); listzd = new List <ziduan>(); string strms = list[i].Describe; string miaoshu = ""; if (strms != null && strms.Length > 0) { ASCIIEncoding ascii = new ASCIIEncoding(); int temLen = 0; byte[] s = ascii.GetBytes(strms); for (int j = 0; j < s.Length; j++) { if ((int)s[j] == 63) { temLen += 2; } else { temLen += 1; } miaoshu += strms[j]; if (temLen % 38 == 0 || (temLen + 1) % 38 == 0) { if (miaoshu.LastIndexOf('|') != miaoshu.Length - 1) { miaoshu += "|"; } } } } listzd.Add(new ziduan("textstr", miaoshu)); listzd.Add(new ziduan("zztype", "0")); listzd.Add(new ziduan("xuhaoR", list[i].Index.ToString())); listzd.Add(new ziduan("xuhaoC", "6")); listzd.Add(new ziduan("strtype", "3")); listzd.Add(new ziduan("BID", historam.ID)); pSegmentCollection = new PolygonClass(); pSegmentCollection.SetRectangle(pEnvelope); DataEditCommon.CreateFeatureNoEditor(pFeatureClass, (IGeometry)pSegmentCollection, listzd); listgeo.Add(pSegmentCollection as IGeometry); progressBar1.Value += 1; Application.DoEvents(); } workspaceEdit.StopEditOperation(); workspaceEdit.StopEditing(true); frmZhzzt.pGeometry = MyMapHelp.GetGeoFromGeos(listgeo); frmZhzzt.BID = historam.ID; frmZhzzt.blc = historam.BLC; DialogResult = DialogResult.OK; this.Close(); if (!isadd) { frmZhzzt.refresh(); } } catch (Exception ex) { labelSC.Visible = false; MessageBox.Show(ex.Message); if (workspaceEdit != null) { workspaceEdit.AbortEditOperation(); workspaceEdit.StopEditing(false); } } }