tx
2025-04-22 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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.UI.WebControls.WebParts;
using System.Windows.Forms;
 
namespace TProduct.WinFrmUI.TPump
{
    public class TestList4FactoryBasePage : DocumentPage
    {
        protected List<CurrentViewModel> _bindList = null;
        protected List<Model.LoginUser> _allUsers = null;
        protected List<Model.ProductSeries> _allSeries = null;
        protected List<Model.ManufacturerBase> _allManufacturers = null;
        protected List<Model.Senderbase> _allSenderbases = null;
        protected List<Model.WorkBenchBase> _allWorkBenchs = null;
        protected List<Model.ProductMainExPump> _allPumpList = null;
        protected class CurrentViewModel
        {
            public CurrentViewModel(Model.TestProjectItemView project_item)
            {
                this.ProjectID = project_item.ProjectID;
                this.ProjectCode = project_item.ProjectCode;
                this.ProjectTime = project_item.ProjectCreateTime.ToString("MM月dd日 HH:mm");
                this.JudgeResult = project_item.ItemJudgeResult.ToString();
                this.Entity = project_item;
                this.ItemID = project_item.ItemID;
            }
            public long ProjectID { get; set; }
            public long ItemID { get; set; }
 
            public string SeriesName { get; set; }
            public string ProductName { get; set; }
            public string PartNO { get; set; }//产品编号
            public string PartName { get; set; }//产品名称
            public string SenderName { get; set; }//设备送检方
            public string ManufacturerName { get; set; }//设备生产商
            public string ProjectCode { get; set; }//项目编号
 
            public string ProjectTime { get; set; }//测试时间
            public string TestUserName { get; set; }//测试人 
 
            public string WorkBenchName { get; set; }//测试台名
 
            public string JudgeResult { get; set; }//判别结果
 
            public TProduct.Model.ProductSeries Series { get; set; }
            public TProduct.Model.ProductMainExPump Pump { get; set; }
            public TProduct.Model.PartBase Part { get; set; }
            public TProduct.Model.WorkBenchBase WorkBench { get; set; }
 
            public TProduct.Model.TestProjectItemView Entity { get; set; }
 
            public string ProjectNameDisp
            {
                get
                {
                    if (this.Entity.TestType == Model.eTestType.FeatTest)
                    {
                        if (string.IsNullOrEmpty(this.Entity.ProjectName))
                        {
                            return "性能测试";
                        }
                        else
                        {
                            return this.Entity.ProjectName;
                        }
                    }
                    if (this.Entity.TestType == Model.eTestType.NpshTest)
                    {
                        if (string.IsNullOrEmpty(this.Entity.ProjectName))
                        {
                            return string.Format("{0}({1})", "汽蚀测试", this.Entity.ItemName);
                        }
                        else
                        {
                            return string.Format("{0} {1}({2})", this.Entity.ProjectName, "汽蚀测试", this.Entity.ItemName);
                        }
                    }
 
                    return this.Entity.ProjectName;
                }
            }
            //
            internal void RestProject(TProduct.Model.TestProjectBase project)
            {
                this.Entity.Reset(project);
 
                this.ProjectCode = project.Code;
            }
            internal void RestItem(TProduct.Model.TestProjectItemView project_item)
            {
                this.Entity = project_item;
 
                this.ProjectCode = project_item.ProjectCode;
                this.ItemID = project_item.ItemID;
                this.JudgeResult = project_item.ItemJudgeResult.ToString();
            }
        }
 
        private System.Windows.Forms.BindingSource _bindingSource;
        protected void SetGridBindingSource(System.Windows.Forms.BindingSource soruce)
        {
            _bindingSource = soruce;
        }
 
        public override void InitialDataSource()
        {
            base.InitialDataSource();
 
            _allSenderbases = new BLL.Senderbase().GetAll();
            _allUsers = new BLL.LoginUser().GetAll();
            _allPumpList = new BLL.ProductPump().GetExAll();
            _allManufacturers = new BLL.ManufacturerBase().GetAll();
            _allWorkBenchs = new BLL.WorkBenchBase().GetAll();
        }
 
 
        protected void CreateDemoDataByOnePoint(
            TProduct.Model.ProductMainExPump pump,
            TProduct.Model.PartBase part,
            TProduct.Model.TestProjectItemView testItem,
            TProduct.Model.WorkBenchBase workBench)
        {
            DrawLxpCurveOnePtPanel frm2 = new DrawLxpCurveOnePtPanel();
            if (!frm2.SetBindingData(pump))
                return;
            if (frm2.ShowDialog() != DialogResult.OK)
                return;
 
 
 
            var allMonitorPointList = new BLL.WorkBenchMonitorPoint().GetByBenchID(workBench.ID);
 
            var moinitor_press_inlet = allMonitorPointList.Find(x => x.MonitorType == TProduct.Model.eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
 
            var moinitor_press_outlet = allMonitorPointList.Find(x => x.MonitorType == TProduct.Model.eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
 
 
 
            List<Eventech.Model.FeatPoint> pointInfoQH = null;
            List<Eventech.Model.FeatPoint> pointInfoQE = null;
            List<Eventech.Model.FeatPoint> pointInfoQP = null;
            List<Eventech.Model.FeatPoint> pointInfoNPSH = null;
 
            var ratedN = pump.Ratedn.Value;
 
            var bll = new BLL.PumpFeatTestRecord();
 
            frm2.GetFeatPoint(out pointInfoQH, out pointInfoQE, out pointInfoQP, out pointInfoNPSH);
            Random rd = new Random();
            for (int i = 0; i < pointInfoQH.Count; i++)
            {
                var testQ = pointInfoQH[i].X;
                var testH = pointInfoQH[i].Y;
                double testP = 0;
                if (pointInfoQP[i].Y > 50)
                    testP = Math.Round(pointInfoQP[i].Y, 1);
                else if (pointInfoQP[i].Y > 10)
                    testP = Math.Round(pointInfoQP[i].Y, 2);
                else if (pointInfoQP[i].Y > 2)
                    testP = Math.Round(pointInfoQP[i].Y, 3);
                else
                    testP = Math.Round(pointInfoQP[i].Y, 4);
                var testE = pointInfoQE[i].Y;
 
                var rTestSpeed = pump.Ratedn.Value - rd.Next(1, 30) / 10.0;
 
                TProduct.Model.PumpFeatTestRecordViewModel radomRecord
                    = new TProduct.Model.PumpFeatTestRecordViewModel();
 
                radomRecord.TestItemID = testItem.ItemID;
                radomRecord.Time = DateTime.Now.AddSeconds(i * 120 + rd.Next(1, 15));
                radomRecord.RecordType = TProduct.Model.eRecordType.Statistics;
 
                //得到相似换算值
                double xshsFlow = testQ * ratedN / rTestSpeed;
                double xshsHead = testH * ratedN * ratedN / rTestSpeed / rTestSpeed;
 
                //效率进行修正
                double xshsEffice = CalcFeatTestData1Dlg.GetSpeedE(testE, rTestSpeed, ratedN);
 
                //功率
                double xshsPower = 0;
                if (i == 0 || xshsFlow < 1)
                {//零流量点的功率
                    xshsPower = testP * ratedN * ratedN * ratedN / rTestSpeed / rTestSpeed / rTestSpeed;
                }
                else
                {//一般点的功率用效率计算
                    xshsPower = CalcFeatTestData1Dlg.CalculateP(xshsFlow, xshsHead, xshsEffice);
                }
 
                radomRecord.Speed = rTestSpeed;
                radomRecord.TestPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(testQ);
                radomRecord.TestPtH = TProduct.Common.RoundHelper.GetDispValueHead(testH);
                radomRecord.TestPtE = TProduct.Common.RoundHelper.GetDispValueEta(testE);
                radomRecord.TestPtP = TProduct.Common.RoundHelper.GetDispValuePower(testP);
                radomRecord.CorrectPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(xshsFlow);
                radomRecord.CorrectPtH = TProduct.Common.RoundHelper.GetDispValueHead(xshsHead);
                radomRecord.CorrectPtE = TProduct.Common.RoundHelper.GetDispValueEta(xshsEffice);
                radomRecord.CorrectPtP = TProduct.Common.RoundHelper.GetDispValuePower(xshsPower);
 
 
                var p1m = -0.015 + rd.Next(100, 140) / 1000.0;
 
                //高差
                double gc = 0;
 
                double OtherPressCoeff = 4 * 1000 / Math.PI / 3.6;
                double rPipeInV = 0;
                //if (moinitor_press_inlet != null &&
                //    moinitor_press_inlet.PipeDia != null &&
                //    moinitor_press_inlet.PipeDia > 10)
                //{
                //    double mm_inlet_dia = moinitor_press_inlet.PipeDia.Value;
                //    rPipeInV = OtherPressCoeff * testQ / mm_inlet_dia / mm_inlet_dia;
                //}
 
                double rPipeOutV = 0;
                //if (moinitor_press_outlet != null &&
                //    moinitor_press_outlet.PipeDia != null &&
                //    moinitor_press_outlet.PipeDia > 10)
                //{
                //    double mm_outlet_dia = moinitor_press_outlet.PipeDia.Value;
                //    rPipeOutV = OtherPressCoeff * testQ / mm_outlet_dia / mm_outlet_dia;
                //}
 
 
                //if (moinitor_press_outlet != null && moinitor_press_outlet.Elevation != null)
                //{
                //    gc += moinitor_press_outlet.Elevation.Value;
                //}
                //if (moinitor_press_inlet != null && moinitor_press_inlet.Elevation != null)
                //{
                //    gc -= moinitor_press_inlet.Elevation.Value;
                //}
                double rVDif = (rPipeOutV * rPipeOutV - rPipeInV * rPipeInV) / (TProduct.ConstantParas.g * 2.0);
                double p2m = Math.Round((testH - rVDif - gc) * TProduct.ConstantParas.g / 1000 + p1m, 4);
 
 
                TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList();
                foreach (var db in allMonitorPointList)
                {
                    if (db.MonitorType == TProduct.Model.eMonitorType.功率)
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, testP));
                    if (db.MonitorType == TProduct.Model.eMonitorType.压力 && db.Property == TProduct.Model.MonitorTypeProperty.进口)
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, p1m));
                    if (db.MonitorType == TProduct.Model.eMonitorType.压力 && db.Property == TProduct.Model.MonitorTypeProperty.出口)
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, p2m));
                    if (db.MonitorType == TProduct.Model.eMonitorType.流量)
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, testQ));
                    if (db.MonitorType == TProduct.Model.eMonitorType.转速)
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, rTestSpeed));
                    if (db.MonitorType == TProduct.Model.eMonitorType.电机效率)
                    {
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(db.ID, 100));
                    }
                }
                radomRecord.MonitorRecordList = monitorRecord4Ds;
                radomRecord.MonitorRecords = monitorRecord4Ds.ToDsString();
 
                radomRecord.ID = bll.Add(testItem, radomRecord);
            }
            testItem.PointNumber = pointInfoQH.Count();
            new BLL.TestProjectItem().UpdatePointNumberAndTime(testItem.ItemID, testItem.PointNumber);
        }
 
        /// <summary>
        /// 通过对话框添加测试
        /// </summary>
        /// <param name="Series"></param>
        /// <param name="ProductID"></param>
        protected void AddTestByDialog(long SeriesID, long ProductID)
        {
            var dlg = new AddTest泵厂Dlg();
            dlg.SetBindingData(SeriesID, ProductID);
            dlg.OnAddTest += (prj_items, dataSouceType) =>
            {
                if (prj_items == null)
                    return;
                var workBench = dlg.SelWorkBenchBase;
                var part = dlg.SelPart;
                var pump = dlg.SelProductPump;
                var series = dlg.SelProductSeries;
 
                CurrentViewModel feat_test_viewModel = null;
 
                List<CurrentViewModel> vCurrents = new List<CurrentViewModel>();
                foreach (var test_item in prj_items)
                {
                    var vCurrent = new CurrentViewModel(test_item);
                    vCurrent.TestUserName = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.RealName;
 
 
                    vCurrent.WorkBenchName = workBench.Name;
                    vCurrent.WorkBench = workBench;
                    vCurrent.PartNO = part.Code;
                    vCurrent.PartName = part.Name;
                    vCurrent.Part = part;
                    vCurrent.SenderName = _allSenderbases.Find(x => x.ID == part.SenderID)?.ShortName;
                    vCurrent.ManufacturerName = _allManufacturers.Find(x => x.ID == part.ManufacturerID)?.ShortName;
 
                    vCurrent.ProductName = pump.Name;
                    vCurrent.Pump = pump;
 
                    vCurrent.SeriesName = series.Name;
                    vCurrent.Series = series;
 
                    vCurrents.Add(vCurrent);
                    if (vCurrent.Entity.TestType == Model.eTestType.FeatTest)
                        feat_test_viewModel = vCurrent;
                }
 
 
                if (this._bindList == null)
                    this._bindList = new List<CurrentViewModel>();
                this._bindList.AddRange(vCurrents);
                this._bindingSource.ResetBindings(false);
 
 
                if (dataSouceType == 1)
                {
                    ViewTest(feat_test_viewModel, true);
                }
                else if (dataSouceType == 2 && feat_test_viewModel != null)
                {//单点生成 
                    CreateDemoDataByOnePoint(
                        dlg.SelProductPump,
                        dlg.SelPart,
                        feat_test_viewModel.Entity,
                        dlg.SelWorkBenchBase);
 
                    ViewTest(feat_test_viewModel, false);
                }
                else
                {
                    TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
                    var frmIngTest = new TPump.FeatTestIngMainDialog();
                    frmIngTest.WindowState = FormWindowState.Maximized;
                    frmIngTest.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
                    frmIngTest.SetBindingData(
                        pump, part,
                        feat_test_viewModel.Entity,
                        workBench);
                    if (frmIngTest.ShowDialog() == DialogResult.Yes)
                    {
                        ViewTest(feat_test_viewModel, true);
                    }
                }
            };
            ShowCmdOperateInfo("添加测试");
            dlg.ShowDialog();
            ShowCmdOperateInfo(_pageOperateInfo);
            if (dlg.IsChangePumpList())
            {//放在ShowDialog 之后
                _allPumpList = new BLL.ProductPump().GetExAll();
            }
        }
 
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="view_items"></param>
        protected void SetItemNpsh(List<CurrentViewModel> view_items)
        {
            var ref_view_model = view_items.First();
 
            var items = (from x in view_items select x.Entity).ToList();
            SetNpshTestItemsDialog frm = new SetNpshTestItemsDialog();
            frm.SetBindingData(items);
            frm.OnAddItem += (item) =>
            {
                var vCurrent = new CurrentViewModel(item);
                vCurrent.TestUserName = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.RealName;
 
                vCurrent.WorkBenchName = ref_view_model.WorkBenchName;
                vCurrent.WorkBench = ref_view_model.WorkBench;
 
                vCurrent.PartNO = ref_view_model.PartNO;
                vCurrent.PartName = ref_view_model.PartName;
                vCurrent.Part = ref_view_model.Part;
                vCurrent.SenderName = ref_view_model.SenderName;
                vCurrent.ManufacturerName = ref_view_model.ManufacturerName;
 
 
                vCurrent.ProductName = ref_view_model.ProductName;
                vCurrent.Pump = ref_view_model.Pump;
 
 
                vCurrent.SeriesName = ref_view_model.SeriesName;
                vCurrent.Series = ref_view_model.Series;
 
                this._bindList.Add(vCurrent);
                _bindingSource.ResetBindings(false);
            };
            frm.OnDeleteItem += (item) =>
            {
                var f = this._bindList.Find(x => x.Entity.ItemID == item.ItemID);
                if (f != null)
                {
                    this._bindList.Remove(f);
                }
                _bindingSource.ResetBindings(false);
            };
            frm.OnChangeItemName += (id, itemName) =>
            {
                var f = this._bindList.Find(x => x.Entity.ItemID == id);
                if (f != null)
                {
                    f.Entity.ItemName = itemName;
                }
                _bindingSource.ResetBindings(false);
            };
 
 
            if (frm.ShowDialog() == DialogResult.OK)
            {
 
            }
        }
 
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="selRow"></param>
        protected void EditTest(CurrentViewModel selRow)
        {
            if (selRow.Entity.TestType == Model.eTestType.FeatTest)
            {
                EditFeatTest(selRow);
            }
            else if (selRow.Entity.TestType == Model.eTestType.NpshTest)
            {
                EditNpshTest(selRow);
            }
        }
 
        protected void EditFeatTest(CurrentViewModel selRow)
        {
            var items = selRow.Entity;
            if (items == null)
                return;
            var dlg = new EditFeatItem泵厂Dlg();
            dlg.SetBindingData(items);
            dlg.OnEditTest += (testItem) =>
            {
                if (testItem == null)
                    return;
                selRow.RestItem(testItem);
                //进去测试时,可能产品信息改了,所有重新获取一下
                if(selRow.Pump != null)
                selRow.Pump = new BLL.ProductPump().GetExByProductID(selRow.Pump.ID);
 
                TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
                var frmIngTest = new TPump.FeatTestIngMainDialog();
                frmIngTest.WindowState = FormWindowState.Maximized;
                frmIngTest.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
                frmIngTest.SetBindingData(
                    dlg.SelectPump, dlg.SelectPart,
                    testItem,
                    dlg.SelWorkBench);
                frmIngTest.OnChangeProductInfo += (pump, motor) =>
                {
                    if (selRow.Pump != null)
                        selRow.Pump = pump;
                };
                frmIngTest.OnChangeTestInfo += (item) =>
                {
                    selRow.RestItem(item);
                };
                //frm.Show();
                if (frmIngTest.ShowDialog() == DialogResult.Yes)
                {
                    ViewTest(selRow, true);
                }
            };
            dlg.ShowDialog();
            if (dlg.IsChangePumpList())
            {//放在ShowDialog 之后
                _allPumpList = new BLL.ProductPump().GetExAll();
            }
        }
        protected void EditNpshTest(CurrentViewModel selRow)
        {
            var items = selRow.Entity;
            if (items == null)
                return;
            var dlg = new EditNpshItem泵厂Dlg();
            dlg.SetBindingData(items);
            dlg.OnEditTest += (testItem) =>
            {
                if (testItem == null)
                    return;
                selRow.RestItem(testItem);
 
                TProduct.WinFrmUI.WaitFrmHelper.ShowWaitForm();
                var frm = new TPump.NpshTestIngMainDialog();
                frm.WindowState = FormWindowState.Maximized;
                frm.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
                frm.SetBindingData(
                    dlg.SelProductPump, dlg.SelPart,
                      testItem,
                    dlg.SelWorkBench);
                frm.OnChangeProductInfo += (pump, motor) =>
                {
                    selRow.Pump = pump;
                };
                frm.OnChangeTestInfo += (item) =>
                {
                    selRow.RestItem(item);
                };
                frm.ShowDialog();
 
 
            };
            dlg.ShowDialog();
            if (dlg.IsChangePumpList())
            {//放在ShowDialog 之后
                _allPumpList = new BLL.ProductPump().GetExAll();
            }
        }
 
        protected virtual void ViewTest(CurrentViewModel selRow, bool isDelay)
        {
            var all_views = (from x in this._bindList where x.ProjectID == selRow.ProjectID select x).ToList();
            var feat_view = all_views.Find(x => x.Entity.TestType == Model.eTestType.FeatTest);
            //进去测试时,可能产品信息改了,所有重新获取一下
            if(selRow.Pump != null)
            selRow.Pump = new BLL.ProductPump().GetExByProductID(selRow.Pump.ID);
 
            var viewPage = new FeatTestViewMainPage();
            viewPage.Name = "FeatTestViewMainPumpPage";
 
            //修改了测试信息
            viewPage.OnChangeFeatTestInfo += (item) =>
            {//只针对性能测试
                if (feat_view != null)
                    feat_view.RestItem(item);
                this._bindingSource.ResetBindings(false);
            };
            viewPage.OnChangeTestItemInfo += (item) =>
            {//只针对所有测试
                var view = all_views.Find(x => x.ItemID == item.ItemID);
                view.RestItem(item);
                this._bindingSource.ResetBindings(false);
            };
            viewPage.OnChangeTestProjectInfo += (prj) =>
            {//只针对所有测试
                foreach (var view in all_views)
                    view.RestProject(prj);
                this._bindingSource.ResetBindings(false);
            };
            viewPage.OnChangeJudgeResult += (prj, item) =>
            {
                feat_view.JudgeResult = item.ToString();
                this._bindingSource.ResetBindings(false);
            };
 
            viewPage.OnChangeProductInfo += (pump, motor) =>
            {
                feat_view.Pump = pump;
            };
            var items = all_views.Select(x => x.Entity).ToList();
            viewPage.SetBindingData(
                selRow.Pump, selRow.Part,
                items);
 
            var detail_guid = new SurfaceGuid()
            {
                DockType = eDockType.Tab,
                Modular = eModular.PumpTest,
                Function = "PumpTestView",
                TagName = String.Format("PumpTestView{0}", selRow.ProjectID)
            };
 
            if (isDelay)
            {
                Task.Factory.StartNew(() =>
                {
                    Task.Delay(500).ContinueWith(t =>
                    {
                        this.Invoke(new MethodInvoker(delegate
                        {
                            OpenNewPageInMain(viewPage, detail_guid);
                        }));
                    });
                });
            }
            else
            {
                OpenNewPageInMain(viewPage, detail_guid);
            }
 
        }
 
 
        protected int BuilViewModelList(
            List<Model.TestProjectItemView> all_project_item, long senderID)
        {
            if (all_project_item == null || all_project_item.Count() == 0)
            {
                _bindList = new List<CurrentViewModel>();
 
                this._bindingSource.DataSource = _bindList;
                this._bindingSource.ResetBindings(false);
 
                return 0;
            }
            var part_ids = (from x in all_project_item where x.PartID > 0 select x.PartID).Distinct();
 
            List<Model.PartBase> allParts = null;
            if (part_ids.Count() > 0)
            {
                var partBaseBll = new BLL.PartBase();
                allParts = partBaseBll.GetByIds(part_ids.ToList());
            }
 
            if (_allSeries == null)
                _allSeries = new BLL.ProductSeries().GetByProductType(Model.eProductType.Pump);
 
 
 
 
            _bindList = new List<CurrentViewModel>();
 
            foreach (var project_item in all_project_item)
            {
                CurrentViewModel v = new CurrentViewModel(project_item);
 
                v.TestUserName = _allUsers?.Find(x => x.ID == project_item.LastTestUserID)?.RealName;
 
                v.JudgeResult = project_item.ItemJudgeResult.ToString();
 
                var workBench = _allWorkBenchs.Find(x => x.ID == project_item.BenchID);
                if (workBench == null)
                    continue;
 
                v.WorkBenchName = workBench.Name;
                v.WorkBench = workBench;
 
                if(project_item.ProductID == 0 || project_item.PartID == 0)
                {
                    v.PartNO = "未指定";
                    v.PartName = "未指定";  
                }
                else if (allParts != null)
                {
                    var part = allParts.Find(x => x.ID == project_item.PartID);
                    if (part == null)
                        continue;
                    if (senderID > 0)
                    {
                        if (part.SenderID != senderID)
                            continue;
                    }
 
                    v.PartNO = part.Code;
                    v.PartName = part.Name;
                    v.Part = part;
                    v.SenderName = _allSenderbases.Find(x => x.ID == part.SenderID)?.ShortName;
                    v.ManufacturerName = _allManufacturers.Find(x => x.ID == part.ManufacturerID)?.ShortName;
                }
 
                if(project_item.ProductID >0)
                {
                    var pump = _allPumpList.Find(x => x.ID == project_item.ProductID);
                    if (pump != null)
                    {
                        v.ProductName = pump.Name;
                        v.Pump = pump;
                    }
                }
               else  {
                    v.ProductName = "未指定"; 
                }
 
                if(project_item.SeriesID > 0)
                {
                    if (_allSeries != null)
                    {
                        var series = _allSeries.Find(x => x.ID == project_item.SeriesID);
                        if (series != null)
                        {
                            v.SeriesName = series.Name;
                            v.Series = series;
                        }
                        else
                        {
                            v.SeriesName = "Error:596";
                        }
                    }
                }
                else
                {
                    v.SeriesName = "未指定";
                }
 
 
                _bindList.Add(v);
            }
 
 
            return _bindList.Count();
        }
 
 
    }
}