/// <summary> /// 构造方法 /// </summary> public DayReportHcEntering(DayReportHc dayReportHc) { InitializeComponent(); _dayReportHc = dayReportHc; //修改初始化 //设置窗体格式 FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_MS.DAY_REPORT_HC_CHANGE); //this.selectWorkingFaceControl1.setCurSelectedID(_arr); dgrdvDayReportHC.AllowUserToAddRows = false; dgrdvDayReportHC.Controls.Add(dtp); //把时间控件加入DataGridView dtp.Visible = false; //先不让它显示 dtp.Format = DateTimePickerFormat.Custom; //设置日期格式为2010-08-05 dtp.TextChanged += dtp_TextChange; //为时间控件加入事件dtp_TextChange dgrdvDayReportHC.DataError += delegate { }; }
private void RefreshData() { gcDayReportHc.DataSource = DayReportHc.FindAll(); }
/// <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> /// 删除GIS回采进尺图形信息 /// </summary> /// <param name="hd1">主运顺槽id</param> /// <param name="hd2">辅运顺槽id</param> /// <param name="qy">切眼id</param> /// <param name="bid">回采进尺的BindingID</param> /// <param name="wfEntity">回采面实体</param> /// <param name="zywid"></param> /// <param name="fywid"></param> private void DelHcjc(int hd1, int hd2, int qy, string bid, WorkingFace wfEntity, double zywid, double fywid) { //删除对应的回采进尺图形和数据表中的记录信息 var results = Global.cons.DelHCCD(hd1.ToString(CultureInfo.InvariantCulture), hd2.ToString(CultureInfo.InvariantCulture), qy.ToString(CultureInfo.InvariantCulture), bid, zywid, fywid, Global.searchlen); if (results == null) { return; } //更新当前回采进尺后的回采进尺记录表信息 var count = results.Keys.Count; var index = 0; IPoint posnew = null; foreach (var key in results.Keys) { var x = results[key].X; var y = results[key].Y; var z = results[key].Z; wfEntity.SetCoordinate(x, y, z); wfEntity.Save(); index += 1; if (index == count - 1) { posnew = new PointClass { X = x, Y = y, Z = z }; } } //更新回采进尺表,将isdel设置0 var entity = DayReportHc.FindByBid(bid); entity.IsDel = 0; entity.SaveAndFlush(); //更新地质构造表中的信息 if (posnew == null) { return; } var hdIds = new List <int> { hd1, hd2, qy }; var dzxlist = Global.commonclss.GetStructsInfos(posnew, hdIds); if (dzxlist.Count > 0) { GeologySpaceBll.DeleteGeologySpaceEntityInfos(wfEntity.WorkingFaceId); //删除工作面ID对应的地质构造信息 foreach (var key in dzxlist.Keys) { var geoinfos = dzxlist[key]; foreach (var tmp in geoinfos) { var geologyspaceEntity = new GeologySpace { WorkingFace = wfEntity, TectonicType = Convert.ToInt32(key), TectonicId = tmp.geoinfos[GIS_Const.FIELD_BID], Distance = tmp.dist, OnDateTime = DateTime.Now.ToShortDateString() }; geologyspaceEntity.Save(); } } } }