| | |
| | | using System; |
| | | using DevExpress.XtraEditors; |
| | | using System.Collections.Generic; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace TProduct.WinFrmUI.TestBench |
| | | { |
| | | public partial class MgrWorkBenchMonitorPointPanel : DevExpress.XtraEditors.XtraUserControl |
| | | public partial class MgrWorkBenchMonitorPointPanel : DocumentPage |
| | | { |
| | | public MgrWorkBenchMonitorPointPanel() |
| | | { |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "æµç¹ä¿¡æ¯"; |
| | | this._pageOperateInfo = "æµç¹ä¿¡æ¯å表"; |
| | | |
| | | this.gridView1.SetNormalView(); |
| | | this.gridView1.SetGridMianViewColor(); |
| | | this.gridView1.CustomUnboundColumnData += GridView1_CustomUnboundColumnData; |
| | | } |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | |
| | | /// <summary> |
| | | /// åå§å |
| | | /// </summary> |
| | | /// <param name="paras"></param> |
| | | _bindList = new BLL.WorkBenchMonitorPoint().GetAll(); |
| | | if (_bindList == null) |
| | | _bindList = new List<Model.WorkBenchMonitorPoint>(); |
| | | this.bindingSource1.DataSource = _bindList; |
| | | this.bindingSource1.ResetBindings(false); |
| | | } |
| | | |
| | | private void GridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) |
| | |
| | | } |
| | | if (pt.SourceType == Model.eMonitorPointSourceType.模æé) |
| | | { |
| | | e.Value = "模æé"; |
| | | e.Value = "模æé,éè¦ç¡®è®¤éç¨"; |
| | | } |
| | | if (pt.SourceType == Model.eMonitorPointSourceType.æ°åé) |
| | | { |
| | | e.Value = "æ°åé"; |
| | | e.Value = "æ°åé,éè¦ç¡®è®¤å¯åå¨å°å"; |
| | | } |
| | | if (pt.SourceType == Model.eMonitorPointSourceType.é¢å®åæ°) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | if (e.Column == this.colDataParasInfo) |
| | | { |
| | | var pt = e.Row as Model.WorkBenchMonitorPoint; |
| | | if (pt != null) |
| | | { |
| | | //if (pt.SourceType == Model.eMonitorPointSourceType.模æé) |
| | | //{ |
| | | // e.Value = "模æé"; |
| | | //} |
| | | //else |
| | | { |
| | | e.Value = pt.DataParasInfo4Disp; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private Model.WorkBenchBase _paras; |
| | | private List<Model.WorkBenchMonitorPoint> _bindList = null; |
| | | public List<Model.WorkBenchMonitorPoint> GetMonitorList() |
| | | { |
| | | return _bindList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå§å |
| | | /// </summary> |
| | | /// <param name="paras"></param> |
| | | public void SetBindingData(Model.WorkBenchBase paras) |
| | | { |
| | | _paras = paras; |
| | | if (_paras == null) |
| | | return; |
| | | _bindList = new BLL.WorkBenchMonitorPoint().GetByBenchID(_paras.ID); |
| | | if (_bindList == null) |
| | | _bindList = new List<Model.WorkBenchMonitorPoint>(); |
| | | this.bindingSource1.DataSource = _bindList; |
| | | this.bindingSource1.ResetBindings(false); |
| | | } |
| | | |
| | | |
| | | private List<Model.WorkBenchMonitorPoint> _bindList = null; |
| | | |
| | | |
| | | |
| | | private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) |
| | | //æ·»å |
| | | private void barBtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (e.Column == colEdit) |
| | | { |
| | | if (_bindList == null) |
| | | return; |
| | | var row = this.gridView1.GetRow(e.RowHandle) as Model.WorkBenchMonitorPoint; |
| | | if (row == null) |
| | | { |
| | | return; |
| | | } |
| | | double? dia = null; |
| | | int pressMonitor = 0;//0 å
¶ä» 1è¿å£åå 2 åºå£åå |
| | | if (row.MonitorType == Model.eMonitorType.åå) |
| | | { |
| | | if(row.Property == TProduct.Model.MonitorTypeProperty.è¿å£) |
| | | { |
| | | dia = row.PipeDia; |
| | | pressMonitor = 1; |
| | | } |
| | | if (row.Property == TProduct.Model.MonitorTypeProperty.åºå£) |
| | | { |
| | | dia = row.PipeDia; |
| | | pressMonitor = 2; |
| | | } |
| | | } |
| | | |
| | | var dlg = new SetSingleBenchMonitorPointInfoDlg(); |
| | | dlg.SetBindingData(row); |
| | | dlg.ReloadDataEvent += rhs => |
| | | { |
| | | if(pressMonitor == 1) |
| | | { |
| | | //1:æ¥æºæ³µå£å¾ |
| | | if (TProduct.UserSetting.Setting.PumpTest.InletPressMonitorDiaStatus == 1) |
| | | { |
| | | if(dia != row.PipeDia) |
| | | { |
| | | MessageBox.Show("已设置为ååæµç¹å£å¾æ¥æºæ³µå£å¾, æä»¥æ¤å¤è®¾ç½®æµç¹å£å¾,å¹¶ä¸ä¼çæï¼"); |
| | | } |
| | | } |
| | | } |
| | | if (pressMonitor == 2) |
| | | { |
| | | //1:æ¥æºæ³µå£å¾ |
| | | if (TProduct.UserSetting.Setting.PumpTest.OutletPressMonitorDiaStatus == 1) |
| | | { |
| | | if (dia != row.PipeDia) |
| | | { |
| | | MessageBox.Show("已设置为ååæµç¹å£å¾æ¥æºæ³µå£å¾, æä»¥æ¤å¤è®¾ç½®æµç¹å£å¾,å¹¶ä¸ä¼çæï¼"); |
| | | } |
| | | } |
| | | } |
| | | row.Reset(rhs); |
| | | this.gridView1.RefreshData(); |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | private void MenuItemæ·»å æµç¹_Click(object sender, EventArgs e) |
| | | { |
| | | if ( _bindList == null) |
| | | return; |
| | | WaitFrmHelper.ShowWaitForm(); |
| | | var dlg = new SetSingleBenchMonitorPointInfoDlg(); |
| | | dlg.SetBindingData(_paras.ID); |
| | | dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); }; |
| | | dlg.SetBindingData( ); |
| | | dlg.ReloadDataEvent += rhs => |
| | | { |
| | | _bindList.Add(rhs); |
| | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | // |
| | | private void barBtnCopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_bindList == null) |
| | | return; |
| | | var source = this.gridView1.GetCurrentViewModel(_bindList); |
| | | if (source == null) |
| | | { |
| | | XtraMessageBox.Show("æªéæ©æ°æ®ï¼"); |
| | | return; |
| | | } |
| | | var bll = new BLL.WorkBenchMonitorPoint(); |
| | | var copy_pt = new TProduct.Model.WorkBenchMonitorPoint(source); |
| | | copy_pt.ID = 0; |
| | | copy_pt.Name = copy_pt.Name + "(å¤å¶)"; |
| | | copy_pt.Code = bll.CreateNO(); |
| | | copy_pt.ID = bll.Insert(copy_pt); |
| | | |
| | | WaitFrmHelper.ShowWaitForm(); |
| | | var dlg = new SetSingleBenchMonitorPointInfoDlg(); |
| | | dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); }; |
| | | dlg.SetBindingData(copy_pt); |
| | | dlg.ReloadDataEvent += rhs => |
| | | { |
| | | _bindList.Add(rhs); |
| | | this.gridView1.RefreshData(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //ç¼è¾ |
| | | private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_bindList == null) |
| | | return; |
| | | var row = this.gridView1.GetCurrentViewModel(_bindList); |
| | | if (row == null) |
| | | { |
| | | XtraMessageBox.Show("æªéæ©æ°æ®ï¼"); |
| | | return; |
| | | } |
| | | WaitFrmHelper.ShowWaitForm(); |
| | | var dlg = new SetSingleBenchMonitorPointInfoDlg(); |
| | | dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); }; |
| | | dlg.SetBindingData(row); |
| | | dlg.ReloadDataEvent += rhs => |
| | | { |
| | | row.Reset(rhs); |
| | | this.gridView1.RefreshData(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | |
| | | private void barBtnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var row = this.gridView1.GetCurrentViewModel(_bindList); |
| | | if (row == null) |
| | | return; |
| | | |
| | | DialogResult dr = XtraMessageBox.Show("æ¯å¦å 餿¤æµç¹ï¼", "æç¤ºä¿¡æ¯", MessageBoxButtons.YesNo, MessageBoxIcon.Information); |
| | | if (dr != DialogResult.Yes) |
| | | return; |
| | | |
| | | var result = new BLL.WorkBenchMonitorPoint().DeleteByID(row.ID); |
| | | |
| | | if (result) |
| | | { |
| | | _bindList.Remove(row); |
| | | this.bindingSource1.ResetBindings(false); |
| | | XtraMessageBox.Show("å 餿åï¼"); |
| | | } |
| | | else |
| | | { |
| | | XtraMessageBox.Show("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | |
| | | private void bbi导åºEXCEL_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var path = ExcelSaveFilePathHelper.SaveFilePathName(); |
| | | if (string.IsNullOrEmpty(path)) return; |
| | | DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions(); |
| | | options.RawDataMode = true;//æè§å³æå¾ |
| | | options.TextExportMode = DevExpress.XtraPrinting.TextExportMode.Text; |
| | | this.colID.DisplayFormat.FormatString = "\t{0}"; |
| | | this.colID.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; |
| | | this.gridView1.OptionsPrint.AutoWidth = false; |
| | | this.gridView1.ExportToXls(path, options); |
| | | DialogResult dr = XtraMessageBox.Show("å¯¼åºæåï¼æ¯å¦æå¼ååä¿åçExcelæä»¶ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); |
| | | if (dr != DialogResult.OK) |
| | | return; |
| | | System.Diagnostics.Process.Start(path); |
| | | } |
| | | |
| | | private void barBtnView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |