tx
8 天以前 e0b138b3e057de6f57021e6c8963868f5c5acc5a
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
using DevExpress.XtraEditors;
using System.Windows.Forms;
using TProduct.Model;
 
 
namespace TProduct.WinFrmUI.TPump
{
    /// <summary>
    /// 性能测试
    /// </summary>
    public partial class FeatTestViewMainPage
    {
        private void IntialPartInfoCtrl()
        {
            if (_partInfoCtrl == null)
            {
                this._partInfoCtrl = new TProduct.WinFrmUI.TPump.PartInfoCtrl();
 
                this._partInfoCtrl.Appearance.BackColor = System.Drawing.SystemColors.Control;
                this._partInfoCtrl.Appearance.Options.UseBackColor = true;
                this._partInfoCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
                this._partInfoCtrl.Location = new System.Drawing.Point(0, 0);
                this._partInfoCtrl.Name = "featTestIngPartInfoDlg1";
                this._partInfoCtrl.Size = new System.Drawing.Size(967, 555);
                this._partInfoCtrl.TabIndex = 0;
 
                this._partInfoCtrl.OnEditMore += () =>
                {
                    EditPumpMoreInfo();
                };
                this._partInfoCtrl.OnChangePump += () =>
                {
                    ChangePumpEntity();
                };
                this._partInfoCtrl.OnGetMaxEtaPt += () =>
                {
                    if (this._allRecords == null || this._allRecords.Count < 4)
                        return null;
                    if (_chartMainCtrl == null)
                        return null;
 
                    return _chartMainCtrl.GetMaxEtaPt();
                };
                this._partInfoCtrl.OnChangeMotorInfo += (motor ) =>
                {
                    if (_currentMotor == null)
                        return;
                    this._currentMotor = motor;
                    var rated_motor = TProduct.Model.RatedParas4Motor.ToModel(_currentMotor.RatedParas);
 
                    if (theCalcDataDlg != null)
                        theCalcDataDlg.SetMotorInfo(motor);
 
                    var bllMtor = new BLL.ProductMain();
                    new BLL.ProductMotor().UpdateEx(_currentMotor);
 
                    if (OnChangeProductInfo != null)
                    {
                        OnChangeProductInfo(this._currentPump, _currentMotor);
                    }
                };
 
                this._partInfoCtrl.OnChangeElectricInfo += (eleInfo) =>
                {
                    if (eleInfo == null)
                        return; 
                };
                this._partInfoCtrl.OnChangeRatedParas += (rateParas) =>
                {
                    if (rateParas != this._ratedParas.ToJson())
                    {
                        this._ratedParas = Model.RatedParas4Pump.ToModel(rateParas);
                        this._currentPump.RatedParas = _ratedParas.ToJson();
                        this._chartMainCtrl.RefreshRatedParas(this._ratedParas, this._testJudgeItems);
                        new BLL.ProductMain().UpdateRatedParas(_currentPump.ID, rateParas);
 
                        if (OnChangeProductInfo != null)
                        {
                            OnChangeProductInfo(this._currentPump, _currentMotor);
                        }
 
                        JudgeTestResult();//合格重新判断
                    }
                };
 
                this.tabPagePartInfo.Controls.Add(this._partInfoCtrl);
            }
 
  
          this._partInfoCtrl.SetBindingData(
                this._currentPump,
                this._currentMotor,
                this._currentPart,
                this._featTestItem.ElectricInfo);
            
        }
 
        //PumpTestBimfaceViewCtrl _model3dCtrl = null;
        private void InitialModel3d()
        {
            this.tabPage3D.PageVisible = false;//暂时不需要
 
            //if (_model3dCtrl == null)
            //{
            //    //_model3dCtrl = new PumpTestBimfaceViewCtrl();
            //    //_model3dCtrl.Dock = DockStyle.Fill;
            //    //_model3dCtrl.Name = "PumpTestBimfaceViewCtrl";
 
            //    //string error_info;
            //    //if (_model3dCtrl.SetBindingData(out error_info) == false)
            //    //{
            //    //    MessageBox.Show(error_info);
            //    //    return;
            //    //}
 
            //    //this.tabPage3D.Controls.Add(_model3dCtrl);
            //}
        }
 
        //测试信息 
        void InitialTestInfoCtrl()
        {
            if (this._featTestItem == null)
                return;
 
 
            TestInfoCtrl ctrl = new TestInfoCtrl();
            ctrl.Name = "TestInfoCtrl";
            ctrl.Dock = DockStyle.Fill;
            ctrl.SetBindingData(this._testProject, this._testItems);
            this.tabPageTestInfo.Controls.Add(ctrl);
            ctrl.OnSaveItem += (item) =>
            {
                if (this.OnChangeTestItemInfo != null)
                {
                    this.OnChangeTestItemInfo(item);
                }
                new BLL.TestProjectItem().Update(new TestProjectItem(item));
                TProduct.WinFrmUI.TipFrmHelper.ShowSuccess(" 已保存");
            };
            ctrl.OnSaveProject += (prj) =>
            {
                foreach (var item in this._testItems)
                {
                    item.Reset(prj);
                }
                if (this.OnChangeTestProjectInfo != null)
                {
                    this.OnChangeTestProjectInfo(prj);
                }
                new BLL.TestProject().Update(prj);
            };
        }
 
 
 
        //耐久试验
        private void InitialDurabilityTest()
        {
            if (this._featTestItem == null)
                return;
            TProduct.Model.DurabilityTestBundle bundle = this._featTestItem.DurabilityTestInfo;
            if (bundle == null || !bundle.IsHave || bundle.TotalDuration < 5)
            {
                tabPageDurabilityTest.PageVisible = false;
                return;
            }
            var durabilityTestCtrl = new TProduct.WinFrmUI.TBase.ViewDurabilityTestDetail();
            durabilityTestCtrl.Name = "ViewDurabilityTestDetail";
            durabilityTestCtrl.Dock = DockStyle.Fill;
            durabilityTestCtrl.SetBindingData(bundle);
            tabPageDurabilityTest.Controls.Add(durabilityTestCtrl);
        }
 
        private void barBtn测试台仪表参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ShowWorkBenchInfo();
        }
        public void ShowWorkBenchInfo()
        {
            var frm = new TProduct.WinFrmUI.TPump.ViewWorkBenchInfoDlg();
            frm.SetBindingData(this._workBenchInfo, this._featTestItem);
            frm.Show();
        }
 
        private void barBtn测点参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ShowMonitorPointList();
        }
        public void ShowMonitorPointList()
        {
            TProduct.WinFrmUI.TestBench.ListWorkBenchMonitorPointDlg frm = new TProduct.WinFrmUI.TestBench.ListWorkBenchMonitorPointDlg();
            frm.SetBindingData(this._workBenchInfo);
            frm.Show();
        }
 
        private void bbi产品参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            EditPumpMoreInfo();
        }
        /// <summary>
        /// 
        /// </summary>
        private void EditPumpMoreInfo()
        {
            if (_currentPump == null)
                return;
 
            WaitFrmHelper.ShowWaitForm();
            TProduct.WinFrmUI.Data4Factory.EditProductPumpDlg
                dlg = new Data4Factory.EditProductPumpDlg();
            dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
            dlg.SetBindingData(this._currentPump,this._currentPart==null?0:this._currentPart.ID);
            dlg.IsEditChangedAble( false);
            dlg.ReloadDataEvent += (isChangePart, pump, motor,part) =>
            {
                if (part != null)
                {
                    this._currentPart = part;
                }
                this._currentPump.Reset(pump); 
                this._ratedParas = TProduct.Model.RatedParas4Pump.ToModel(pump.RatedParas);
                JudgeTestResult();
                this._chartMainCtrl.RefreshRatedParas(this._ratedParas, this._testJudgeItems);
                ShowCmdOperateInfo("更新成功!");
                XtraMessageBox.Show("更新成功!");
              
                if (this._partInfoCtrl != null)
                {
                    this._partInfoCtrl.SetBindingData(
   this._currentPump,
   this._currentMotor,
   this._currentPart,
   this._featTestItem.ElectricInfo);
                }
                if (this.theCalcDataDlg != null)
                {
                    this.theCalcDataDlg.SetPumpInfo(this._currentPumpSeries, this._currentPump);
                    this.theCalcDataDlg.SetMotorInfo(this._currentMotor);
                } 
            };
            dlg.Show();
        }
        /// <summary>
        /// 
        /// </summary>
        private void ChangePumpEntity()
        {
 
        }
    }
}