| | |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraEditors; |
| | | using NPOI.HSSF.UserModel; |
| | | using NPOI.SS.Formula.Functions; |
| | | using NPOI.SS.UserModel; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using DevExpress.Utils; |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraGrid.Columns; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using Yw.WinFrmUI; |
| | | |
| | | namespace PBS.WinFrmUI.DataAnalysis |
| | | { |
| | | public partial class EnergyAnalysis : DocumentPage |
| | | { |
| | | private string startCode = "[&start&]"; |
| | | private string endCode = "[&end&]"; |
| | | private string paramCode = "[¶m&]"; |
| | | private string getenergyanalyCode = "getenergyanaly";//获取能耗分析数据 |
| | | private string analydayCode = "analyday";//校验能耗分析 |
| | | |
| | | public EnergyAnalysis() |
| | | { |
| | | this.PageTitle.Caption = "能耗分析"; |
| | | InitializeComponent(); |
| | | |
| | | _series_ysl.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | _series_ydl.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | _series_qds.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | ((SideBySideBarSeriesLabel)_series_ysl.Label).Position = BarSeriesLabelPosition.Top; |
| | | ((SideBySideBarSeriesLabel)_series_ydl.Label).Position = BarSeriesLabelPosition.Top; |
| | | |
| | | _series_ysl.CrosshairLabelPattern = "用水量:{V:N2} m³"; |
| | | _series_ydl.CrosshairLabelPattern = "用电量:{V:N2} kW·h"; |
| | | _series_qds.CrosshairLabelPattern = "千吨水能耗:{V:N2} kW·h/km³"; |
| | | InitialChart(); |
| | | } |
| | | |
| | | private void InitDate() |
| | | private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | this.dateEditStartDate.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); |
| | | this.dateEditEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | } |
| | | |
| | | List<PumpEnergyViewModel> _models; |
| | | public void BindData(List<PumpEnergyViewModel> models) |
| | | { |
| | | _models = models; |
| | | this.pumpEnergyViewModelBindingSource.DataSource = models; |
| | | this.gridView4.RefreshData(); |
| | | SetChart(models); |
| | | } |
| | | |
| | | // private XYDiagram _diagram_xy { get { return this.chartControl1.Diagram as XYDiagram; } } |
| | | private Series _series_ysl { get { return this.chartControl1.Series[1]; } } |
| | | private Series _series_ydl { get { return this.chartControl1.Series[0]; } } |
| | | private Series _series_qds { get { return this.chartControl1.Series[2]; } } |
| | | |
| | | private void SetChart(List<PumpEnergyViewModel> models) |
| | | { |
| | | this.chartControl1.BeginInit(); |
| | | |
| | | _series_ysl.Points.Clear(); |
| | | _series_ydl.Points.Clear(); |
| | | _series_qds.Points.Clear(); |
| | | foreach (var item in models) |
| | | //导入文件 |
| | | var dlg = new System.Windows.Forms.OpenFileDialog(); |
| | | dlg.Filter = "EXCEL 文件(*.xls)|*.xls"; |
| | | dlg.CheckFileExists = true; |
| | | if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) |
| | | return; |
| | | var datalist = new List<FlowPressChartViewModel>(); |
| | | var datatable = new DataTable(); |
| | | ParseExcel(dlg.FileName, out datalist, out datatable); |
| | | if (datalist.Any()) |
| | | { |
| | | _series_ysl.Points.Add(new SeriesPoint(item.Day, item.Supply)); |
| | | _series_ydl.Points.Add(new SeriesPoint(item.Day, item.Electricity)); |
| | | _series_qds.Points.Add(new SeriesPoint(item.Day, item.EnergyOfWater)); |
| | | SetBindingData(datalist, datatable); |
| | | } |
| | | } |
| | | #region Private Variable |
| | | |
| | | private XYDiagram _diagram; |
| | | private XYDiagramDefaultPane _default_pane; |
| | | |
| | | private AxisX _axis_x_flow; |
| | | private AxisY _axis_y_head; |
| | | //private SecondaryAxisY _axis_y_eff; |
| | | |
| | | |
| | | #endregion |
| | | /// <summary> |
| | | /// 初始化图表 |
| | | /// </summary> |
| | | private void InitialChart() |
| | | { |
| | | |
| | | this.chartControl1.RuntimeHitTesting = true; |
| | | |
| | | this.chartControl1.Legend.Visibility = DefaultBoolean.True; |
| | | _diagram = (XYDiagram)this.chartControl1.Diagram; |
| | | _diagram.EnableAxisXScrolling = true; |
| | | _diagram.EnableAxisYScrolling = true; |
| | | _diagram.EnableAxisXZooming = true; |
| | | _diagram.EnableAxisYZooming = true; |
| | | _default_pane = _diagram.DefaultPane; |
| | | |
| | | _diagram.AxisX.TimeSpanScaleOptions.MeasureUnit = TimeSpanMeasureUnit.Minute; |
| | | _diagram.AxisX.TimeSpanScaleOptions.ScaleMode = ScaleMode.Continuous; |
| | | |
| | | _axis_x_flow = _diagram.AxisX; |
| | | _axis_y_head = _diagram.AxisY; |
| | | //_axis_y_eff = _diagram.SecondaryAxesY.GetAxisByName("AxisYEff"); |
| | | //_axis_y_eff.Alignment = AxisAlignment.Far; |
| | | |
| | | |
| | | _axis_x_flow.GridLines.Visible = false; |
| | | _axis_y_head.GridLines.Visible = false; |
| | | //_axis_y_eff.GridLines.Visible = false; |
| | | |
| | | this.chartControl1.CrosshairEnabled = DefaultBoolean.True; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置图表 |
| | | /// </summary> |
| | | public void SetBindingData(List<FlowPressChartViewModel> vm_list, DataTable dataTable) |
| | | { |
| | | |
| | | var view = gridControl1.MainView as GridView; |
| | | view.Columns.Clear(); |
| | | |
| | | this.chartControl1.BeginInit(); |
| | | this.chartControl1.Series.Clear(); |
| | | for (int i = this.chartControl1.AnnotationRepository.Count - 1; i > 0; i--) |
| | | { |
| | | if (i == 0) |
| | | break; |
| | | this.chartControl1.AnnotationRepository.RemoveAt(i); |
| | | } |
| | | this.chartControl1.Legend.CustomItems.Clear(); |
| | | if (IsInvalidData()) |
| | | { |
| | | |
| | | this.chartControl1.EndInit(); |
| | | return; |
| | | } |
| | | |
| | | AxisXBase axis_x = null; |
| | | AxisYBase axis_y = null; |
| | | XYDiagramPaneBase pane = null; |
| | | |
| | | //chartControl1.Series.Clear(); |
| | | //var seriesSupply = new Series("用水量", ViewType.Bar); |
| | | //seriesSupply.DataSource = models; |
| | | //seriesSupply.ArgumentScaleType = ScaleType.Qualitative; |
| | | //seriesSupply.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | //var labelSupply = (SideBySideBarSeriesLabel)seriesSupply.Label; |
| | | //labelSupply.Position = BarSeriesLabelPosition.Top; |
| | | //seriesSupply.ArgumentDataMember = "Day"; |
| | | //seriesSupply.ValueScaleType = ScaleType.Numerical; |
| | | //seriesSupply.ValueDataMembers.AddRange(new string[] { "Supply" }); |
| | | var colTime = new GridColumn(); |
| | | colTime.FieldName = "时间"; |
| | | colTime.Caption = "时间"; |
| | | colTime.Visible = true; |
| | | view.Columns.Add(colTime); |
| | | |
| | | //var seriesElectricity = new Series("用电量", ViewType.Bar); |
| | | //seriesElectricity.DataSource = models; |
| | | //seriesElectricity.ArgumentScaleType = ScaleType.Qualitative; |
| | | //seriesElectricity.ArgumentDataMember = "Day"; |
| | | //seriesElectricity.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | //var labelElectricity = (SideBySideBarSeriesLabel)seriesElectricity.Label; |
| | | //labelElectricity.Position = BarSeriesLabelPosition.Top; |
| | | //seriesElectricity.ValueScaleType = ScaleType.Numerical; |
| | | //seriesElectricity.ValueDataMembers.AddRange(new string[] { "Electricity" }); |
| | | foreach (var vm in vm_list) |
| | | { |
| | | //if (!vm.Name.Contains("压力")) |
| | | //{ |
| | | axis_x = _axis_x_flow; |
| | | axis_y = _axis_y_head; |
| | | pane = _default_pane; |
| | | //} |
| | | //else |
| | | //{ |
| | | // axis_x = _axis_x_flow; |
| | | // axis_y = _axis_y_eff; |
| | | // pane = _default_pane; |
| | | |
| | | //} |
| | | |
| | | var col = new GridColumn(); |
| | | col.FieldName = vm.Name; |
| | | col.Caption = vm.Name; |
| | | col.Visible = true; |
| | | view.Columns.Add(col); |
| | | |
| | | AddLineSeries(vm.Name, axis_x, axis_y, pane, vm.Datas); |
| | | } |
| | | |
| | | var min_x = vm_list.SelectMany(x => x.Datas).Min(x => TimeSpan.Parse(x.Time)); |
| | | var max_x = vm_list.SelectMany(x => x.Datas).Max(x => TimeSpan.Parse(x.Time)); |
| | | |
| | | |
| | | //var xy_diagram = this.chartControl1.Diagram as XYDiagram; |
| | | //var axis_y = new SecondaryAxisY(); |
| | | //axis_y.Title.Text = "%"; |
| | | //axis_y.Alignment = AxisAlignment.Far; |
| | | //axis_y.Visibility = DevExpress.Utils.DefaultBoolean.True; |
| | | //xy_diagram.SecondaryAxesY.Add(axis_y); |
| | | _axis_x_flow.NumericScaleOptions.AutoGrid = false; |
| | | _axis_x_flow.WholeRange.SideMarginsValue = 0; |
| | | _axis_x_flow.VisualRange.SideMarginsValue = 0; |
| | | _axis_x_flow.WholeRange.SetMinMaxValues(min_x, max_x); |
| | | _axis_x_flow.VisualRange.SetMinMaxValues(min_x, max_x); |
| | | |
| | | |
| | | //var lineEnergyOfWater = new Series("吨水能耗", ViewType.Line); |
| | | //lineEnergyOfWater.DataSource = models; |
| | | //lineEnergyOfWater.ArgumentScaleType = ScaleType.Qualitative; |
| | | //lineEnergyOfWater.ArgumentDataMember = "Day"; |
| | | //lineEnergyOfWater.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; |
| | | //lineEnergyOfWater.ValueScaleType = ScaleType.Numerical; |
| | | ////var labelEnergyOfWater = (SideBySideBarSeriesLabel)lineEnergyOfWater.Label; |
| | | ////labelEnergyOfWater.Position = BarSeriesLabelPosition.Top; |
| | | //lineEnergyOfWater.ValueDataMembers.AddRange(new string[] { "EnergyOfWater" }); |
| | | //((LineSeriesView)lineEnergyOfWater.View).AxisY = axis_y; |
| | | |
| | | //chartControl1.Series.Add(seriesSupply); |
| | | //chartControl1.Series.Add(seriesElectricity); |
| | | //chartControl1.Series.Add(lineEnergyOfWater); |
| | | |
| | | gridControl1.DataSource = dataTable; |
| | | |
| | | this.chartControl1.EndInit(); |
| | | |
| | | } |
| | | |
| | | private void EboxFormEnergyAnalysis_Load(object sender, EventArgs e) |
| | | //是否是无效数据 |
| | | private bool IsInvalidData() |
| | | { |
| | | InitDate(); |
| | | Search(); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | private void Search() |
| | | |
| | | |
| | | private void AddLineSeries(string id, AxisXBase axis_x, AxisYBase axis_y, XYDiagramPaneBase pane, List<TimeChartViewModel> pt_list, DevExpress.XtraCharts.DashStyle dash = DevExpress.XtraCharts.DashStyle.Solid) |
| | | { |
| | | var m = new GetCalcValueModel() |
| | | if (pt_list == null || !pt_list.Any()) |
| | | return; |
| | | |
| | | var view = new DevExpress.XtraCharts.LineSeriesView(); |
| | | view.LineStyle.DashStyle = dash; |
| | | view.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; |
| | | view.LineStyle.Thickness = 2; |
| | | if (dash != DashStyle.Solid) |
| | | { |
| | | StartDate = DateTime.Parse(this.dateEditStartDate.EditValue.ToString()), |
| | | EndDate = DateTime.Parse(this.dateEditEndDate.EditValue.ToString()), |
| | | }; |
| | | |
| | | SendText(startCode + getenergyanalyCode + paramCode + JsonHelper.Object2Json(m) + endCode); |
| | | } |
| | | |
| | | public event EventHandler<string> SendData; |
| | | private void SendText(string content) |
| | | { |
| | | //BluetoothHelper.GetInstance().SendData(content); |
| | | SendData?.Invoke(null, content); |
| | | } |
| | | /// <summary> |
| | | /// 查询 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void simpleButton1_Click(object sender, EventArgs e) |
| | | { |
| | | Search(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void simpleButton2_Click(object sender, EventArgs e) |
| | | { |
| | | ExportXLS(); |
| | | } |
| | | |
| | | public void ExportXLS() |
| | | { |
| | | try |
| | | { |
| | | if (_models == null || _models.Count == 0) |
| | | { |
| | | XtraMessageBox.Show("没有可导出的数据!"); |
| | | return; |
| | | } |
| | | |
| | | var dlg = new SaveFileDialog(); |
| | | dlg.Filter = "EXCEL 文件(*.xls)|*.xls"; |
| | | if (dlg.ShowDialog() != DialogResult.OK) |
| | | return; |
| | | |
| | | HSSFWorkbook theBook = new HSSFWorkbook(); |
| | | var theSheet1 = theBook.CreateSheet("Sheet1"); |
| | | |
| | | IRow rowTile = theSheet1.CreateRow(0); |
| | | rowTile.CreateCell(0).SetCellValue("日期"); |
| | | rowTile.CreateCell(1).SetCellValue("用水量(m³)"); |
| | | rowTile.CreateCell(2).SetCellValue("用电量(kW·h)"); |
| | | rowTile.CreateCell(3).SetCellValue("千吨水能耗(kW·h/km³)"); |
| | | |
| | | |
| | | for (int rowIndex = 1; rowIndex <= _models.Count; rowIndex++) |
| | | { |
| | | int col = 0; |
| | | IRow row = theSheet1.CreateRow(rowIndex); |
| | | var celValue = _models[rowIndex - 1].Day; |
| | | var dt = DateTime.Parse(celValue); |
| | | row.CreateCell(col).SetCellValue(celValue + " " + dt.ToString("dddd")); |
| | | col++; |
| | | row.CreateCell(col).SetCellValue((double)_models[rowIndex - 1].Supply); |
| | | col++; |
| | | row.CreateCell(col).SetCellValue((double)_models[rowIndex - 1].Electricity); |
| | | col++; |
| | | row.CreateCell(col).SetCellValue((double)_models[rowIndex - 1].EnergyOfWater); |
| | | col++; |
| | | } |
| | | |
| | | //强制Excel在打开时重新计算所有公式 |
| | | theSheet1.ForceFormulaRecalculation = true; |
| | | using (FileStream fs = File.OpenWrite(dlg.FileName)) |
| | | { |
| | | theBook.Write(fs); |
| | | } |
| | | XtraMessageBox.Show("导出成功"); |
| | | |
| | | view.LineStyle.Thickness = 3; |
| | | } |
| | | catch (Exception ex) |
| | | |
| | | view.EnableAntialiasing = DefaultBoolean.True; |
| | | view.MarkerVisibility = DefaultBoolean.False; |
| | | view.AxisX = axis_x; |
| | | view.AxisY = axis_y; |
| | | view.EmptyPointOptions.Color = Color.Transparent; |
| | | view.Pane = pane; |
| | | |
| | | |
| | | var series_pt_list = pt_list.Select(x => new SeriesPoint(TimeSpan.Parse(x.Time), x.Y)).ToArray(); |
| | | var series = new DevExpress.XtraCharts.Series(); |
| | | series.Tag = id; |
| | | //series.ShowInLegend = false; |
| | | series.Name = id; |
| | | series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.TimeSpan; |
| | | series.TimeSpanSummaryOptions.MeasureUnit = TimeSpanMeasureUnit.Minute; |
| | | series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; |
| | | series.CrosshairEnabled = DefaultBoolean.True; |
| | | series.CrosshairLabelPattern = id + ":{V:N2}"; |
| | | series.ToolTipEnabled = DefaultBoolean.False; |
| | | series.SeriesPointsSorting = SortingMode.None; |
| | | series.Visible = true; |
| | | series.View = view; |
| | | series.Points.AddRange(series_pt_list); |
| | | |
| | | this.chartControl1.Series.Add(series); |
| | | } |
| | | public static string ParseExcel(string fileName, out List<FlowPressChartViewModel> datalist, out DataTable dataTable) |
| | | { |
| | | datalist = new List<FlowPressChartViewModel>(); |
| | | dataTable = new DataTable(); |
| | | |
| | | if (!File.Exists(fileName)) |
| | | return "文件不存在"; |
| | | int line = 0; |
| | | |
| | | //初始化文件 |
| | | NPOI.HSSF.UserModel.HSSFWorkbook theBook = null; |
| | | using (FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite)) |
| | | { |
| | | XtraMessageBox.Show(ex.ToString()); |
| | | theBook = new NPOI.HSSF.UserModel.HSSFWorkbook(file); |
| | | } |
| | | |
| | | //检查表格是否符合 |
| | | NPOI.SS.UserModel.ISheet sheet1 = theBook.GetSheet("Sheet1"); |
| | | if (sheet1 == null) |
| | | { |
| | | sheet1 = theBook.GetSheetAt(0); |
| | | if (sheet1 == null) |
| | | return ("无Sheet数据"); |
| | | } |
| | | |
| | | //标题行 |
| | | int title_line_index = 0; |
| | | |
| | | var row_title = sheet1.GetRow(title_line_index); |
| | | if (row_title == null) |
| | | { |
| | | return ("第一行第一列不能空"); |
| | | } |
| | | |
| | | //开始读取的行 |
| | | int start_line = title_line_index + 1; |
| | | var cell_0 = row_title.GetCell(0); |
| | | if (cell_0 == null) |
| | | { |
| | | return ("无法读取表头文件"); |
| | | } |
| | | |
| | | var totalcell = row_title.Cells.Count; |
| | | for (int i = 0; i < totalcell; i++) |
| | | { |
| | | var row_cell = row_title.GetCell(i); |
| | | |
| | | if (i > 0) |
| | | { |
| | | if (row_cell != null) |
| | | { |
| | | datalist.Add(new FlowPressChartViewModel() |
| | | { |
| | | Name = row_cell.StringCellValue, |
| | | Datas = new List<TimeChartViewModel>() |
| | | }); |
| | | } |
| | | dataTable.Columns.Add(row_cell.StringCellValue, typeof(double)); |
| | | } |
| | | else |
| | | { |
| | | dataTable.Columns.Add(row_cell.StringCellValue, typeof(string)); |
| | | |
| | | } |
| | | } |
| | | |
| | | NPOI.SS.UserModel.IRow row_temp = null; |
| | | NPOI.SS.UserModel.ICell cell; |
| | | |
| | | for (line = start_line; line < 10000; line++) |
| | | { |
| | | |
| | | row_temp = sheet1.GetRow(line); |
| | | if (row_temp == null || row_temp.Cells.Count < 3) |
| | | break; |
| | | var rowData = new object[totalcell]; |
| | | for (int i = 0; i < totalcell; i++) |
| | | { |
| | | try |
| | | { |
| | | var cell_temp = row_temp.GetCell(i); |
| | | |
| | | if (i > 0) |
| | | { |
| | | if (cell_temp != null && cell_temp.CellType != NPOI.SS.UserModel.CellType.Blank) |
| | | { |
| | | double yvalue = cell_temp.NumericCellValue; |
| | | var timevalue = row_temp.GetCell(0).NumericCellValue; |
| | | //double.TryParse(cell_temp.StringCellValue,out yvalue); |
| | | datalist[i - 1].Datas.Add(new TimeChartViewModel() |
| | | { |
| | | Time = DateTime.FromOADate(timevalue).ToString("HH:mm:ss"), |
| | | Y = yvalue, |
| | | }); |
| | | rowData[i] = yvalue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var timevalue = row_temp.GetCell(0).NumericCellValue; |
| | | rowData[i] = DateTime.FromOADate(timevalue).ToString("HH:mm:ss"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var a = ex.Message; |
| | | } |
| | | } |
| | | |
| | | dataTable.Rows.Add(rowData); |
| | | } |
| | | |
| | | return ""; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 前三个月 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void simpleButton3_Click(object sender, EventArgs e) |
| | | private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | this.dateEditStartDate.Text = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd"); |
| | | this.dateEditEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | Search(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 前一个月 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void simpleButton4_Click(object sender, EventArgs e) |
| | | { |
| | | this.dateEditStartDate.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); |
| | | this.dateEditEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | Search(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 前半个月 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void simpleButton6_Click(object sender, EventArgs e) |
| | | { |
| | | this.dateEditStartDate.Text = DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd"); |
| | | this.dateEditEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | Search(); |
| | | } |
| | | |
| | | private void simpleButton5_Click(object sender, EventArgs e) |
| | | { |
| | | var dlg = new AnalyDayForm(); |
| | | var dlg = new SetPressForm(); |
| | | if (dlg.ShowDialog() == DialogResult.OK) |
| | | { |
| | | var dt = dlg.CurrDateTime; |
| | | SendText(startCode + analydayCode + paramCode + dt + endCode); |
| | | MessageBoxHelper.ShowInfo("操作成功"); |
| | | } |
| | | } |
| | | |
| | | private void gridView4_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) |
| | | { |
| | | if (e.Column.FieldName == "Day") |
| | | { |
| | | var celValue = e.Value.ToString(); |
| | | var dt = DateTime.Parse(celValue); |
| | | e.DisplayText = celValue + " " + dt.ToString("dddd"); |
| | | var press= dlg.Press; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |