tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
using System;
using System.Collections.Generic;
using System.Windows.Forms;
 
namespace TProduct.WinFrmUI.TestBench
{
    public partial class MgrWorkBenchMonitorPointPanel : DevExpress.XtraEditors.XtraUserControl
    {
        public MgrWorkBenchMonitorPointPanel()
        {
            InitializeComponent();
            this.gridView1.SetNormalView();
            this.gridView1.SetGridMianViewColor();
            this.gridView1.CustomUnboundColumnData += GridView1_CustomUnboundColumnData;
        }
 
        private void GridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            if (e.Column == this.colSourceType)
            {
                var pt = e.Row as Model.WorkBenchMonitorPoint;
                if (pt != null)
                {
                    if (pt.SourceType == Model.eMonitorPointSourceType.未知)
                    {
                        e.Value = "还未设置,请尽快确认";
                    }
                    if (pt.SourceType == Model.eMonitorPointSourceType.模拟量)
                    {
                        e.Value = "模拟量";
                    }
                    if (pt.SourceType == Model.eMonitorPointSourceType.数字量)
                    {
                        e.Value = "数字量";
                    }
                    if (pt.SourceType == Model.eMonitorPointSourceType.额定参数)
                    {
                        e.Value = "额定参数";
                    }
                }
            }
            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 void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs 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)
        {
            var dlg = new SetSingleBenchMonitorPointInfoDlg();
            dlg.SetBindingData(_paras.ID);
            dlg.ReloadDataEvent += rhs =>
            {
                _bindList.Add(rhs);
                this.bindingSource1.ResetBindings(false);
            };
            dlg.ShowDialog();
        }
    }
}