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
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
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TProduct.Model;
using static DevExpress.Data.Helpers.ExpressiveSortInfo;
 
namespace TProduct.DataTran.FromBPump
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// X86运行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!System.IO.File.Exists(access_file_path))
            {
                return;
            }
            var user_id = 1;
            var now = DateTime.Now;
 
            var allWorkBenchBase = new BLL.WorkBenchBase().GetByProductType(TProduct.Model.eProductType.Pump);
            if (allWorkBenchBase == null || allWorkBenchBase.Count() == 0)
            {
                XtraMessageBox.Show("请手动添加默认测试台!");
                return;
            }
            Model.WorkBenchBase selWorkBench进口压力 = null;
            Model.WorkBenchBase selWorkBench清水池 = null;
 
            foreach (var benchBase in allWorkBenchBase)
            {
                if (string.IsNullOrEmpty(benchBase.TestMethod))
                {
                    continue;
                }
 
                var method = new Model.WorkBenchMethod4Pump(benchBase.TestMethod);
                if (method.InletIsUseWaterLevel == 1)
                {
                    selWorkBench清水池 = benchBase;
                }
                else
                {
                    selWorkBench进口压力 = benchBase;
                }
                //this.imgComPowerTestMethod.EditValue = method.Power;
                //this.imgComPressTestMethod.EditValue = method.Press;
                //this.imgComTorqueTestMethod.EditValue = method.Torque;
                //this.imgComeNpshTestMethod.EditValue = method.Npsh;
                //this.check用清水池水位代替进口压力.Checked = method.InletIsUseWaterLevel == 1 ? true : false;
 
            }
            if (selWorkBench清水池 == null)
            {
                XtraMessageBox.Show("请手动添加默认测试台(用清水池测试进口压力)!");
                return;
            }
            if (selWorkBench进口压力 == null)
            {
                XtraMessageBox.Show("请手动添加默认测试台(用进口压力仪)!");
                return;
            }
 
            var _allMeters = new BLL.PressureMeter().GetAll();
            if (_allMeters == null || _allMeters.Count() == 0)
            {
                XtraMessageBox.Show("请添加压力计!");
                return;
            }
            var inlet_press_压力计 = _allMeters.Find(x => x.RangeMin == -0.1 && x.RangeMax == 0.1);
            if (inlet_press_压力计 == null)
            {
                XtraMessageBox.Show("请手动添加量程正负0.1的压力计!");
                return;
            }
            var outlet_press_压力计 = _allMeters.Find(x => x.RangeMin == 0 && x.RangeMax == 1);
            if (outlet_press_压力计 == null)
            {
                XtraMessageBox.Show("请手动添加量程0-1的压力计!");
                return;
            }
 
            var bllStation = new BLL.StationBase();
            List<TProduct.Model.StationBase> allStation_tproduct = bllStation.GetAll();
            if (allStation_tproduct == null)
                allStation_tproduct = new List<Model.StationBase>();
 
            #region ProductStyle
            var bllProductStyle = new BLL.ProductStyle();
            List<TProduct.Model.ProductStyle> allProductStyle_tproduct = bllProductStyle.GetAll();
            if (allProductStyle_tproduct == null)
                allProductStyle_tproduct = new List<Model.ProductStyle>();
 
            var productStyle双吸泵 = allProductStyle_tproduct.Find(x => x.Name == "双吸泵");
            if (productStyle双吸泵 == null)
            {
                productStyle双吸泵 = new Model.ProductStyle();
                productStyle双吸泵.Name = "双吸泵";
                productStyle双吸泵.Type = Model.eProductType.Pump;
                productStyle双吸泵.CreateUserID = user_id;
                productStyle双吸泵.CreateTime = now;
                productStyle双吸泵.UpdateUserID = user_id;
                productStyle双吸泵.UpdateTime = now;
                productStyle双吸泵.SortCode = 1;
                productStyle双吸泵.ID = bllProductStyle.Insert(productStyle双吸泵);
            }
 
            var productStyle常规电机 = allProductStyle_tproduct.Find(x => x.Name == "常规电机");
            if (productStyle常规电机 == null)
            {
                productStyle常规电机 = new Model.ProductStyle();
                productStyle常规电机.Name = "常规电机";
                productStyle常规电机.Type = Model.eProductType.Pump;
                productStyle常规电机.CreateUserID = user_id;
                productStyle常规电机.CreateTime = now;
                productStyle常规电机.UpdateUserID = user_id;
                productStyle常规电机.UpdateTime = now;
                productStyle常规电机.SortCode = 2;
                productStyle常规电机.ID = bllProductStyle.Insert(productStyle常规电机);
            }
            #endregion
 
 
            #region ProductSeries
 
            var bllProductSeries = new BLL.ProductSeries();
            List<TProduct.Model.ProductSeries> allProductSeries_tproduct = bllProductSeries.GetAll();
            if (allProductSeries_tproduct == null)
                allProductSeries_tproduct = new List<Model.ProductSeries>();
 
            var productSeries双吸泵 = allProductSeries_tproduct.Find(x => x.Name == "双吸泵");
            if (productSeries双吸泵 == null)
            {
                productSeries双吸泵 = new Model.ProductSeries();
                productSeries双吸泵.Name = "双吸泵";
                productSeries双吸泵.ProductStyleID = productStyle双吸泵.ID;
                productSeries双吸泵.CreateUserID = user_id;
                productSeries双吸泵.CreateTime = now;
                productSeries双吸泵.UpdateUserID = user_id;
                productSeries双吸泵.UpdateTime = now;
                productSeries双吸泵.SortCode = 1;
                productSeries双吸泵.IsInnerMotor = 0;
                productSeries双吸泵.ID = bllProductSeries.Insert(productSeries双吸泵);
            }
            var productSeries常规电机 = allProductSeries_tproduct.Find(x => x.Name == "常规电机");
            if (productSeries常规电机 == null)
            {
                productSeries常规电机 = new Model.ProductSeries();
                productSeries常规电机.Name = "双吸泵";
                productSeries常规电机.ProductStyleID = productStyle常规电机.ID;
                productSeries常规电机.CreateUserID = user_id;
                productSeries常规电机.CreateTime = now;
                productSeries常规电机.UpdateUserID = user_id;
                productSeries常规电机.UpdateTime = now;
                productSeries常规电机.SortCode = 2;
                productSeries常规电机.ID = bllProductSeries.Insert(productSeries常规电机);
            }
            #endregion
 
 
            #region 产品
            var bllProductMotor = new BLL.ProductMotor();
            List<TProduct.Model.ProductMainExMotor> allMotor_tproduct = bllProductMotor.GetExBySeriesID(productSeries常规电机.ID);
            if (allMotor_tproduct == null)
                allMotor_tproduct = new List<Model.ProductMainExMotor>();
 
            var bllProductPump = new BLL.ProductPump();
            List<TProduct.Model.ProductMainExPump> allPump_tproduct = bllProductPump.GetExBySeriesID(productSeries双吸泵.ID);
            if (allPump_tproduct == null)
                allPump_tproduct = new List<Model.ProductMainExPump>();
 
 
            var bllPartBase = new BLL.PartBase();
            List<TProduct.Model.PartBase> allPartBase_tproduct = bllPartBase.GetAll();
            if (allPartBase_tproduct == null)
                allPartBase_tproduct = new List<Model.PartBase>();
 
 
 
            var bllManufacturerBase = new BLL.ManufacturerBase();
            List<TProduct.Model.ManufacturerBase> allManufacturertproduct = bllManufacturerBase.GetAll();
            if (allManufacturertproduct == null)
                allManufacturertproduct = new List<Model.ManufacturerBase>();
            #endregion
 
            var bllTestProject = new BLL.TestProject();
            List<TProduct.Model.TestProjectBase> allProject_tproduct = bllTestProject.GetAll();
            if (allProject_tproduct == null)
                allProject_tproduct = new List<Model.TestProjectBase>();
 
 
            var bllTestProjectItem = new BLL.TestProjectItem();
            List<Model.TestProjectItem> allItem_tproduct = bllTestProjectItem.GetAll();
            if (allItem_tproduct == null)
                allItem_tproduct = new List<Model.TestProjectItem>();
 
 
            #region 泵站转化
            //Factorys
            var factorysDataSet = Read("Factorys");
            List<BPump.Model.Factorys> allFactorys_bpump = BPump.Model.Factorys.DataTableToList(factorysDataSet.Tables[0]);
 
            int SortCode = 1;
            foreach (var bp in allFactorys_bpump)
            {
                TProduct.Model.StationBase station_tproduct = allStation_tproduct.Find(x => x.Tag == bp.FactoryID.ToString());
                if (station_tproduct != null)
                {
                    continue;
                }
                station_tproduct = new Model.StationBase();
                station_tproduct.CreateUserID = user_id;
                station_tproduct.CreateTime = now;
                station_tproduct.UpdateUserID = user_id;
                station_tproduct.UpdateTime = now;
                station_tproduct.Code = "";
                station_tproduct.Name = bp.FactoryName;
                station_tproduct.Note = "";
                station_tproduct.Tag = bp.FactoryID.ToString();
                station_tproduct.SortCode = SortCode;
                station_tproduct.ParasStr = "";
 
                station_tproduct.ID = bllStation.Insert(station_tproduct);
                allStation_tproduct.Add(station_tproduct);
 
                SortCode++;
            }
 
 
            #endregion
 
            #region 产品转化
            var motorsDataSet = Read("Motors");
            List<BPump.Model.Motors> allMotors_bpump = BPump.Model.Motors.DataTableToList(motorsDataSet.Tables[0]);
            if (allMotors_bpump != null)
            {
                SortCode = 1;
                foreach (var bp in allMotors_bpump)
                {
                    var productmain_tproduct = allMotor_tproduct.Find(x => x.Tag == bp.MotorID.ToString());
                    if (productmain_tproduct != null)
                    {
                        continue;
                    }
                    productmain_tproduct = new ProductMainExMotor();
                    productmain_tproduct.Tag = bp.MotorID.ToString();
                    productmain_tproduct.CreateUserID = user_id;
                    productmain_tproduct.CreateTime = now;
                    productmain_tproduct.UpdateUserID = user_id;
                    productmain_tproduct.UpdateTime = now;
                    productmain_tproduct.Name = bp.MotorCode;
                    productmain_tproduct.SeriesID = productSeries常规电机.ID;
                    var ratedparas = new TProduct.Model.RatedParas4Motor();
                    ratedparas.CurrentType = Model.eSupplyCurrentType.交流;
 
                    productmain_tproduct.RatedParas = ratedparas.ToJson();
 
                    productmain_tproduct.SortCode = SortCode;
 
 
                    productmain_tproduct.RatedPower = bp.MotorPower;
                    productmain_tproduct.PowerFactor = bp.MotorFactor;
                    productmain_tproduct.RatedI = bp.RatedI;
                    productmain_tproduct.RatedU = bp.RatedU;
                    productmain_tproduct.Ratedn = bp.RatedN;
                    productmain_tproduct.PhaseNum = Model.eSupplyCurrentPhase.三相;
 
 
 
                    productmain_tproduct.ID = bllProductMotor.InsertEx(productmain_tproduct);
                    SortCode++;
 
                    allMotor_tproduct.Add(productmain_tproduct);
                }
            }
 
 
            var pumpsDataSet = Read("Pumps");
            List<BPump.Model.Pumps> allPumps_bpump = BPump.Model.Pumps.DataTableToList(pumpsDataSet.Tables[0]);
            if (allPumps_bpump == null || allPumps_bpump.Count() == 0)
                return;
            SortCode = 1;
            foreach (var bp in allPumps_bpump)
            {
                var productmain_tproduct = allPump_tproduct.Find(x => x.Tag == bp.PumpID.ToString());
                if (productmain_tproduct != null)
                {
                    continue;
                }
                productmain_tproduct = new ProductMainExPump();
                productmain_tproduct.Tag = bp.PumpID.ToString();
                productmain_tproduct.CreateUserID = user_id;
                productmain_tproduct.CreateTime = now;
                productmain_tproduct.UpdateUserID = user_id;
                productmain_tproduct.UpdateTime = now;
                //productmain_tproduct.Code = bp.PumpCode;
                productmain_tproduct.Name = bp.PumpCode;
                productmain_tproduct.SeriesID = productSeries双吸泵.ID;
 
 
                var ratedparas = new TProduct.Model.RatedParas4Pump();
                ratedparas.CurrentType = Model.eSupplyCurrentType.交流;
                ratedparas.Q = bp.RatedParas.Q;
                ratedparas.H = bp.RatedParas.H;
                ratedparas.P = bp.RatedParas.P;
                ratedparas.E = bp.RatedParas.E;
                ratedparas.NPSHr = bp.RatedParas.NPSHr;
                ratedparas.IsFrequency = bp.IsFrequency;
                ratedparas.IsSxp = true;
                ratedparas.StageNumber = 1;
 
                productmain_tproduct.RatedParas = ratedparas.ToJson();
 
 
                productmain_tproduct.MotorMainID = 0;
                if (bp.MotorID > 0)
                {
                    var motor = allMotor_tproduct.Find(x => x.Tag == bp.MotorID.ToString());
                    if (motor != null)
                    {
                        productmain_tproduct.MotorMainID = motor.ID;
                    }
                }
                productmain_tproduct.Ratedn = bp.RatedN;
                productmain_tproduct.D2 = bp.OriginD2;
                productmain_tproduct.PosiAngle = 0;
                productmain_tproduct.SortCode = SortCode;
                SortCode++;
 
                productmain_tproduct.CurveFitTypeQH = Eventech.Model.eCurveFitType.CubicCurve;
                productmain_tproduct.CurveFitTypeQE = Eventech.Model.eCurveFitType.CubicCurve;
                productmain_tproduct.CurveFitTypeQP = Eventech.Model.eCurveFitType.CubicCurve;
 
 
 
                productmain_tproduct.ID = bllProductPump.InsertEx(productmain_tproduct);
 
                allPump_tproduct.Add(productmain_tproduct);
 
 
 
 
 
                TProduct.Model.PartBase part = new TProduct.Model.PartBase();
                part.Name = bp.PumpName;
                part.ManufacturerID = 0;
                part.ProductMainID = productmain_tproduct.ID;
                var station = allStation_tproduct.Find(x => x.Tag == bp.FactoryID.ToString());
                if (station != null)
                    part.StationID = station.ID;
 
                if (!string.IsNullOrEmpty(bp.PumpManufacturer))
                {
                    var manu = allManufacturertproduct.Find(x => x.FullName == bp.PumpManufacturer);
                    if (manu != null)
                    {
                        part.ManufacturerID = manu.ID;
                    }
                    else
                    {
                        manu = new ManufacturerBase();
                        manu.CreateUserID = user_id;
                        manu.CreateTime = now;
                        manu.UpdateUserID = user_id;
                        manu.UpdateTime = now;
                        manu.ShortName = bp.PumpManufacturer;
                        manu.FullName = bp.PumpManufacturer;
                        manu.ID = bllManufacturerBase.Insert(manu);
                        part.ManufacturerID = manu.ID;
                    }
                }
 
                part.ID = bllPartBase.Insert(part);
                allPartBase_tproduct.Add(part);
            }
 
            #endregion
 
 
 
            var tproduct_monitor_points_all = new BLL.WorkBenchMonitorPoint().GetAll();
 
 
            var testsDataSet = Read("Tests");
            List<BPump.Model.Tests> allTests_bpump = BPump.Model.Tests.DataTableToList(testsDataSet.Tables[0]);
 
            var testDatassDataSet = Read("TestDatas");
            List<BPump.Model.TestDatas> allTestDatas_bpump = BPump.Model.TestDatas.DataTableToList(testDatassDataSet.Tables[0]);
 
            var bllTestRecord = new BLL.PumpFeatTestRecord();
 
            foreach (var test_bp in allTests_bpump)
            {
                var test_dataS_bp = allTestDatas_bpump.Where(x => x.TestID == test_bp.TestID);
                if (test_dataS_bp == null || test_dataS_bp.Count() < 3)
                    continue;
                var project = allProject_tproduct.Find(x => x.Tag == test_bp.TestID.ToString());
                if (project != null)
                {
                    continue;
                }
                var pump = allPump_tproduct.Find(x => x.Tag == test_bp.PumpID.ToString());
                if (pump == null)
                {
                    continue;
                }
                var part = allPartBase_tproduct.Find(x => x.ProductMainID == pump.ID);
                if (part == null)
                {
                    continue;
                }
                //if (part.Name != "低压1#泵")
                //{
                //    continue;
                //}
                Dictionary<string, string> dict = BPump.Common.TypeConvert.StringToDict(test_bp.MethodParas);
                BPump.Model.eInletPressMethod inletMethod = BPump.Model.eInletPressMethod.泵进口压力;
                if (dict.ContainsKey("进口压力"))
                {
                    string strValue = dict["进口压力"];
                    inletMethod=(BPump.Model.eInletPressMethod)Convert.ToInt32(strValue);
                }
 
 
 
 
                Model.WorkBenchBase selWorkBench = null;
           
                switch (inletMethod)
                {
                    case BPump.Model.eInletPressMethod.泵进口压力:
                        selWorkBench = selWorkBench进口压力;
                        break;
                    case BPump.Model.eInletPressMethod.清水池高度:
                        selWorkBench = selWorkBench清水池;
                        break;
                }
                if (selWorkBench == null)
                {
                    MessageBox.Show("对应测试台无法找到");
                    return;
                }
 
                List<MonitorPointBundle> points = new List<MonitorPointBundle>();
                MonitorPointBundle point转速 = null;
                var mp_电机效率 = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID && x.MonitorType == eMonitorType.电机效率);
                var mp_电机频率 = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID && x.MonitorType == eMonitorType.频率);
                string[] strMeasureList = test_bp.MeasureList.Split(',');
                for (int i = 0; i < strMeasureList.Count(); i++)
                {
                    var strMeasure = strMeasureList[i];
                    string[] details = strMeasure.Split('|');
                    int measureType = Convert.ToInt32(details[0]);//第一个是类型
                    string MeasureName = details[1];// 第二个是名称  第三个是系数
 
                    MonitorPointBundle point = new MonitorPointBundle() { IndexBP = i };
                    points.Add(point);
                    if (measureType == (int)BPump.Model.eMeasureType.泵进口压力)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
                        && x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.泵出口压力)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.流量)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.流量);
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.功率)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.功率);
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.总管出口压力)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
  && x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.总管进口压力)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
  && x.MonitorType == eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.进口);
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.泵出口阀后压力)
                    {
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.泵进口阀前压力)
                    {
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.并联泵出口压力)
                    {
 
                    }
 
                    else if (measureType == (int)BPump.Model.eMeasureType.转速)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
  && x.MonitorType == eMonitorType.转速);
                        point转速 = point;
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.介质温度)
                    {
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.轴温)
                    {
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.清水池高度)
                    {
                        point.point = tproduct_monitor_points_all.Find(x => x.BenchID == selWorkBench.ID
&& x.MonitorType == eMonitorType.水位);
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.相电流A || measureType == (int)BPump.Model.eMeasureType.相电流B ||
                        measureType == (int)BPump.Model.eMeasureType.相电流C)
                    {
 
                    }
                    else if (measureType == (int)BPump.Model.eMeasureType.相电压A || measureType == (int)BPump.Model.eMeasureType.相电压B ||
                       measureType == (int)BPump.Model.eMeasureType.相电压C)
                    {
 
                    }
 
                    else if (measureType == (int)BPump.Model.eMeasureType.总管出口压力)
                    {
 
                    }
                }
 
 
 
                Dictionary<string, string> dictEquip = BPump.Common.TypeConvert.StringToDict(test_bp.EquipParas);
                Dictionary<string, string> dictUnit = BPump.Common.TypeConvert.StringToDict(test_bp.DispUnitParas);
                Dictionary<string, string> dictMethod = BPump.Common.TypeConvert.StringToDict(test_bp.MethodParas);
                Dictionary<string, string> dictEnvi = BPump.Common.TypeConvert.StringToDict(test_bp.EnviParas);
 
 
 
                //BPump.Model.ePowerTestMethod powerMethod = BPump.Model.ePowerTestMethod.功率;
                //switch (powerMethod)
                //{
                //    case BPump.Model.ePowerTestMethod.功率: 
                //        break;
                //    case BPump.Model.ePowerTestMethod.扭矩: 
                //        break;
                //    case BPump.Model.ePowerTestMethod.单相电流电压: 
                //        break;
                //    case BPump.Model.ePowerTestMethod.三相电流电压: 
                //        break;
                //}
 
                //BPump.Model.eOutletPressMethod outletMethod = BPump.Model.eOutletPressMethod.泵出口压力;
                //switch (outletMethod)
                //{
                //    case BPump.Model.eOutletPressMethod.泵出口压力: 
                //        break;
                //    case BPump.Model.eOutletPressMethod.总管压力: 
                //        break;
                //}
 
                double inlet_meter_dia = 0, inlet_meter_ele = 0;
                double outlet_meter_dia = 0, outlet_meter_ele = 0;
                double ele_dis = 0;
                foreach (var record in dictEquip)
                {
                    string strValue = record.Value;
                    switch (record.Key)
                    {
                        case "进口直径":
                            inlet_meter_dia = Convert.ToDouble(strValue);
                            break;
                        case "出口直径":
                            outlet_meter_dia = Convert.ToDouble(strValue);
                            break;
                        case "表位差":
                            ele_dis = Convert.ToDouble(strValue) ;//存储的是m 显示为mm
                            break;
                        case "进口压力表高":
                            inlet_meter_ele = Convert.ToDouble(strValue);
                            break;
                        case "出口压力表高":
                            outlet_meter_ele = Convert.ToDouble(strValue);
                            break;
 
                        //case "水位基准高":
                        //    this.spinShuiWeiJizhun.Value = Convert.ToDecimal(strValue);
                        //    break;
 
 
                        case "高差": 
                            break;
                    }
                }
 
 
 
 
                var first_time = (from x in test_dataS_bp select x.TestTime).Min();
                project = new TestProjectBase();
                project.ProductType = eProductType.Pump;
                project.SeriesID = pump.SeriesID;
                project.ProductID = pump.ID;
                project.PartID = part.ID;
                project.CreateUserID = user_id;
                project.CreateTime = first_time;
 
                project.Name = test_bp.TestName;
                project.IsFixed = true;
                project.UseStatus = eUseStatus.Enable;
                project.JudgeResult = eTestJudgeResult.未判断;
 
                project.ProjectParas = new TestProjectParas();
 
                project.Tag = test_bp.TestID.ToString();
 
 
 
 
                Model.TestProjectItemBundleTree bundleTree = new Model.TestProjectItemBundleTree();
                bundleTree.Bundle = new TProduct.Model.TestProjectItemBundle()
                {
                    TestType = TProduct.Model.eTestType.FeatTest,
                    BenchID = selWorkBench.ID,//暂时统一测试台, 统一标准, 以后改成可以通过界面设置
                    TestStandardID = "GB3216-2016",
                    TestGradeID = "GB3216-2016-2B",
                    ItemCount = 1
                };
 
                var instrument = new Model.PrjItemInstrumentSetting()
                {
                    InletPressureMeterID = inlet_press_压力计.ID,
                    InletPressureMeterElevation = inlet_meter_ele - ele_dis,//清水池水位标高也放在这里
                    InletPressureMeterPipeDia = inlet_meter_dia,
 
                    OutletPressureMeterID = outlet_press_压力计.ID,
                    OutletPressureMeterElevation = outlet_meter_ele,
                    OutletPressureMeterPipeDia = outlet_meter_dia,
 
                    
                    //FlowMeterRangeMax = flow_range_max,
                    //FlowMeterRangeMin = flow_range_min,
                };
 
                var featTestItem = new TProduct.Model.TestProjectItem()
                {
                    CreateTime = first_time,
                    CreateUserID = user_id,
                    LastTestUserID = user_id,
                    Name = "性能测试",
                    TestType = TProduct.Model.eTestType.FeatTest,
                    JudgeResult = TProduct.Model.eTestJudgeResult.未判断,
                    UseStatus = TProduct.Model.eUseStatus.Enable,
                    InstrumentInfo = instrument,
                    AutoTestInfo = null,
                    DurabilityTestInfo = null,
                    ItemParas = null
                };
                bundleTree.Items = new List<TestProjectItem>() { featTestItem };
 
 
                var test_views = bllTestProject.Insert(project, new List<TestProjectItemBundleTree>() { bundleTree });
                var default_test_item_view = test_views.First();
                project.ID = default_test_item_view.ProductID;
 
                var project_item_id = default_test_item_view.ItemID;
 
 
                foreach (var bp_record in test_dataS_bp)
                {
                    TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList();
                    TProduct.Model.PumpFeatTestRecord record = new PumpFeatTestRecord();
                    string[] strMeasureRecord = bp_record.MeasureRecord.Split(',');
                    for (int i = 0; i < strMeasureRecord.Count(); i++)
                    {
                        var bp_measureValue = Convert.ToDouble(strMeasureRecord[i]);
                        if (i >= points.Count)
                            break;
                        if (points[i].point == null)
                            continue;
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(points[i].point.ID, bp_measureValue));
                    }
                    if (mp_电机效率 != null)
                    {
                        if (bp_record.MotorEfficient < 1.1)
                        {
                            monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机效率.ID, bp_record.MotorEfficient*100));
                        }
                        else
                        {
                            monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机效率.ID, bp_record.MotorEfficient));
                        } 
                    }
                    if (mp_电机频率 != null)
                    {
                        monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(mp_电机频率.ID, bp_record.MotorFrequence));
                    }
                    
 
 
                    record.TestItemID = project_item_id;
 
                    record.Time = bp_record.TestTime;
                    record.CorrectPtQ = bp_record.CorrectQ;
                    record.CorrectPtH = bp_record.CorrectH;
                    record.CorrectPtE = bp_record.CorrectE;
                    record.CorrectPtP = bp_record.CorrectP;
 
                    record.TestPtQ = bp_record.TestQ;
                    record.TestPtH = bp_record.TestH;
                    record.TestPtE = bp_record.TestE;
                    record.TestPtP = bp_record.TestP;
 
                    record.Speed = 0;
                    if(point转速 != null)
                    {
                        record.Speed = Convert.ToDouble(strMeasureRecord[point转速.IndexBP]);
                    }
        
                    
                    record.MonitorRecords = monitorRecord4Ds.ToDsString();
 
                    record.RecordType = eRecordType.Import;
 
                    record.ID = bllTestRecord.Add(default_test_item_view, record);
                }
 
 
 
 
            }
 
 
 
 
 
 
 
 
 
 
 
            MessageBox.Show("转化完成");
 
 
        }
 
        class MonitorPointBundle
        {
            public TProduct.Model.MonitorPointBase point { get; set; }
            public int IndexBP { get; set; }
        }
 
        string access_file_path = @"D:\WorkData\TProduct\Client.V1.3.1\Out\Data中山公用\DB.mdb";
        private System.Data.DataSet Read(string tableName)
        {
            string connect_string = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + access_file_path + ";Jet OleDb:DataBase Password='TXSMHLY';";
 
            OleDbConnection thisConnection = new OleDbConnection(connect_string);
            //   string.Format(@"provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};DataBase Password='TXSMHLY';", access_file_path)); //连接Access数据库
            string sql = "select * from " + tableName;
            OleDbDataAdapter thisAdapter = new OleDbDataAdapter(sql, thisConnection);
            System.Data.DataSet thisDataSet = new System.Data.DataSet();
            thisAdapter.Fill(thisDataSet, "table");
            thisConnection.Close();
 
            return thisDataSet;
        }
    }
}