/// <summary> /// 构造方法 /// </summary> /// <param name="dayReportJjEntity"></param> public DayReportJjEntering(DayReportJj dayReportJjEntity) { _dayReportJJEntity = dayReportJjEntity; InitializeComponent(); //修改初始化 //ChangeInfo(); //设置窗体格式 FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_MS.DAY_REPORT_JJ_CHANGE); dgrdvDayReportJJ.AllowUserToAddRows = false; dgrdvDayReportJJ.Controls.Add(dtp); //把时间控件加入DataGridView dtp.Visible = false; //先不让它显示 dtp.Format = DateTimePickerFormat.Custom; //设置日期格式为2010-08-05 dtp.TextChanged += dtp_TextChange; //为时间控件加入事件dtp_TextChange dgrdvDayReportJJ.DataError += delegate { }; selectWorkingfaceSimple1.SelectedWorkingFace = dayReportJjEntity.WorkingFace; }
private void RefreshData() { gcDayReportJj.DataSource = DayReportJj.FindAll(); }
/// <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消息发送完成"); }