/// <summary> /// 删除按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsBtnDel_Click(object sender, EventArgs e) { //确认删除 if (!Alert.confirm(Const.DEL_CONFIRM_MSG)) { return; } var entity = (DayReportJj)gridView1.GetFocusedRow(); // 掘进工作面,只有一条巷道 var tunnel = Tunnel.FindFirstByWorkingFaceId(entity.WorkingFace.WorkingFaceId); DelJJCD(tunnel.TunnelId.ToString(CultureInfo.InvariantCulture), entity.BindingId, entity.WorkingFace.WorkingFaceId); entity.Delete(); RefreshData(); // 向server端发送更新预警数据 var msg = new UpdateWarningDataMsg(entity.WorkingFace.WorkingFaceId, Const.INVALID_ID, DayReportJj.TableName, OPERATION_TYPE.DELETE, DateTime.Now); SocketUtil.SendMsg2Server(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消息发送完成"); }