ningshuxia
2025-03-31 d321346f204a69b1929cc39098a5d88f44509e7b
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
using DevExpress.Utils.Extensions;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.Basic
{
    public partial class PumpCurveMgrPage : DocumentPage
    {
        public PumpCurveMgrPage()
        {
            InitializeComponent();
            this.PageTitle.Caption = "泵曲线";
            this.gridViewCurvePoints.SetNormalView();
            this.pumpCurveMappingListCtrl1.FocusedChangedEvent += PumpCurveMappingListCtrl1_FocusedChangedEvent;
            this.curveExpressChart1.OnCurveCoordinateParasChanged += CurveExpressChart1_OnCurveCoordinateParasChanged;
        }
 
 
        private string _belongType;
        private Model.Equipment _product = null;
        private Model.PumpCurveExMapping _pumpCurveExMapping = null;
 
        /// <summary>
        /// 初始化数据
        /// </summary>
        public override void InitialDataSource()
        {
            _pumpCurveExMapping = null;
            this.pumpCurveMappingListCtrl1.SetBindingData();
        }
 
 
        //曲线变换列表
        private void PumpCurveMappingListCtrl1_FocusedChangedEvent(string objectType, object obj)
        {
            _belongType = objectType;
            _product = null;
            _pumpCurveExMapping = null;
            if (string.IsNullOrEmpty(objectType) || obj == null)
            {
 
                this.tabPane1.Pages.ForEach(x => x.PageVisible = false);
            }
 
            var isProduct = _belongType == IStation.ObjectType.Equipment;
            this.tabNavigationPageCurveView.PageVisible = !isProduct;
            this.tabNavigationPageCurveEdit.PageVisible = !isProduct;
 
            this.tabNavigationPageOnePoint.PageVisible = isProduct;
            this.tabNavigationPageExcel.PageVisible = isProduct;
            this.tabNavigationPageCurveExpress.PageVisible = isProduct;
            this.tabNavigationPagePicture.PageVisible = isProduct;
 
            if (objectType == IStation.ObjectType.Equipment)
            {
                this.tabPane1.SelectedPage = this.tabNavigationPageOnePoint;
                this.ribbonControl1.SelectedPage = this.ribbonPageOnePoint;
                _product = obj as Model.Equipment;
 
            }
            else if (objectType == IStation.ObjectType.PumpCurveExMapping)
            {
                this.tabPane1.SelectedPage = this.tabNavigationPageCurveView;
                this.ribbonControl1.SelectedPage = this.ribbonPageCurveMgr;
                _pumpCurveExMapping = obj as Model.PumpCurveExMapping;
                this.curveExpressChart1.InitialChartData();
                SetBindingData(_pumpCurveExMapping);
            }
            else if (objectType == IStation.ObjectType.PumpSpeedCurve)
            {
                this.tabPane1.SelectedPage = this.tabNavigationPageCurveView;
                this.ribbonControl1.SelectedPage = this.ribbonPageCurveMgr;
                var speedCurve = obj as Model.PumpSpeedCurve;
                this.curveExpressChart1.InitialChartData();
                SetBindingData(speedCurve);
            }
        }
 
 
 
        #region 曲线
 
        //绑定数据
        private void SetBindingData(Model.PumpCurve pumpCurve)
        {
            if (pumpCurve == null || pumpCurve.CurveInfo == null)
                return;
            if (pumpCurve.CurveInfo.CurveQH == null)
                return;
 
            List<Model.CurvePoint> qhPoints, qePoints = null, qpPoints = null;
            var curveInfo = pumpCurve.CurveInfo;
            if (curveInfo.CurveQH.DefinePoints != null)
                qhPoints = curveInfo.CurveQH.DefinePoints;
            else
                qhPoints = curveInfo.CurveQH.GetFitPoints(12);
 
            if (curveInfo.CurveQE != null)
                if (curveInfo.CurveQE.DefinePoints != null)
                    qePoints = curveInfo.CurveQE.DefinePoints;
                else
                    qePoints = curveInfo.CurveQE?.GetFitPoints(12);
 
            if (curveInfo.CurveQP != null)
                if (curveInfo.CurveQP?.DefinePoints != null)
                    qpPoints = curveInfo.CurveQP.DefinePoints;
                else
                    qpPoints = curveInfo.CurveQP?.GetFitPoints(12);
 
            #region 曲线
 
            /* var fre = Convert.ToDouble(this.barTrackBarHZ.EditValue);
             SetFrequence(pumpCurve.CurveInfo, fre);*/
            this.curveExpressChart1.SetBindingData(curveInfo.CurveQH,
                                                        curveInfo.CurveQE,
                                                        curveInfo.CurveQP,
                                                        qhPoints,
                                                        qePoints,
                                                        qpPoints,
                                                        pumpCurve.CoordParas);
 
 
            #endregion
 
            #region 曲线编辑
            Model.eCurveFitType
               qhFitType = curveInfo.CurveQH.FitType,
               qeFitType = Model.eCurveFitType.CubicCurve,
               qpFitType = Model.eCurveFitType.CubicCurve;
 
            if (curveInfo.CurveQE != null)
                qeFitType = curveInfo.CurveQE.FitType;
 
            if (curveInfo.CurveQP != null)
                qpFitType = curveInfo.CurveQP.FitType;
 
            this.curveExpressEditCtrl1.SetBindingData(qhPoints, qePoints, qpPoints, qhFitType, qeFitType, qpFitType);
            this.curveExpressEditCtrl1.Enabled = true;
            #endregion
        }
 
        //绑定数据
        private void SetBindingData(Model.PumpSpeedCurve pumpSpeedCurve)
        {
            if (pumpSpeedCurve == null || pumpSpeedCurve.CurveInfo == null)
                return;
            if (pumpSpeedCurve.CurveInfo.CurveQH == null)
                return;
 
            List<Model.CurvePoint> qhPoints, qePoints = null, qpPoints = null;
            var curveInfo = pumpSpeedCurve.CurveInfo;
            if (curveInfo.CurveQH.DefinePoints != null)
                qhPoints = curveInfo.CurveQH.DefinePoints;
            else
                qhPoints = curveInfo.CurveQH.GetFitPoints(12);
 
            if (curveInfo.CurveQE != null)
                if (curveInfo.CurveQE.DefinePoints != null)
                    qePoints = curveInfo.CurveQE.DefinePoints;
                else
                    qePoints = curveInfo.CurveQE?.GetFitPoints(12);
 
            if (curveInfo.CurveQP != null)
                if (curveInfo.CurveQP?.DefinePoints != null)
                    qpPoints = curveInfo.CurveQP.DefinePoints;
                else
                    qpPoints = curveInfo.CurveQP?.GetFitPoints(12);
 
            #region 曲线
 
            this.curveExpressChart1.SetBindingData(curveInfo.CurveQH,
                                                        curveInfo.CurveQE,
                                                        curveInfo.CurveQP,
                                                        qhPoints,
                                                        qePoints,
                                                        qpPoints,
                                                        pumpSpeedCurve.CoordParas);
 
 
            #endregion
 
            #region 曲线编辑
            Model.eCurveFitType
               qhFitType = curveInfo.CurveQH.FitType,
               qeFitType = Model.eCurveFitType.CubicCurve,
               qpFitType = Model.eCurveFitType.CubicCurve;
 
            if (curveInfo.CurveQE != null)
                qeFitType = curveInfo.CurveQE.FitType;
 
            if (curveInfo.CurveQP != null)
                qpFitType = curveInfo.CurveQP.FitType;
 
            this.curveExpressEditCtrl1.SetBindingData(qhPoints, qePoints, qpPoints, qhFitType, qeFitType, qpFitType);
            this.curveExpressEditCtrl1.Enabled = true;
            #endregion
        }
 
 
        //坐标变换修改
        private void CurveExpressChart1_OnCurveCoordinateParasChanged(Model.CurveCoordinateParas obj)
        {
            _pumpCurveExMapping.CoordParas = obj;
            if (!new BLL.PumpCurve().Update(_pumpCurveExMapping))
            {
                XtraMessageBox.Show("修改失败!");
                return;
            }
            XtraMessageBox.Show("修改成功!");
        }
 
 
        //修改泵曲线信息
        private void barBtnEditPumpCurveInfo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            WaitFrmHelper.ShowWaitForm();
            var dlg = new EditPumpCurveInfoDlg();
            dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
            dlg.SetBindingData(_pumpCurveExMapping);
            dlg.ReloadDataEvent += (rhs) =>
            {
                rhs.UpdateTime = DateTime.Now;
                var result = new BLL.PumpCurve().Update(rhs);
                if (result)
                {
                    _pumpCurveExMapping.Reset(rhs);
                    SetBindingData(_pumpCurveExMapping);
                }
                return result;
            };
            dlg.ShowDialog();
        }
 
        //修改泵曲线名称
        private void barBtnEditPumpCurveOtherName_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            WaitFrmHelper.ShowWaitForm();
            var dlg = new EditOtherNameDlg();
            dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
            dlg.SetBindingData(_pumpCurveExMapping.OtherName);
            dlg.ReloadDataEvent += (rhs) =>
            {
                var mapping = new BLL.PumpCurveMapping().GetByID(_pumpCurveExMapping.MappingID);
                mapping.OtherName = rhs;
                var result = new BLL.PumpCurveMapping().Update(mapping);
                if (result)
                {
                    _pumpCurveExMapping.Reset(mapping);
                    this.pumpCurveMappingListCtrl1.UpdateOtherName(rhs);
                }
                return result;
            };
            dlg.ShowDialog();
        }
 
        //设置工作曲线
        private void barBtnSetWorkPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            var result = new BLL.PumpCurveMapping().UpdateWorkCurve(_pumpCurveExMapping.MappingID);
            if (result)
            {
                _pumpCurveExMapping.IsWorking = true;
                this.pumpCurveMappingListCtrl1.UpdateWorkingCurve();
            }
        }
 
 
 
        //复制并延长曲线
        private void barBtnCopyAndExpandCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            var dlg = new CopyAndExpandCurveDlg();
            dlg.SetBindingData(_pumpCurveExMapping);
            dlg.ReloadDataEvent += (otherName, curveExpressGroup) =>
            {
                var pumpCurve = new Model.PumpCurve(_pumpCurveExMapping);
                pumpCurve.CurveInfo = curveExpressGroup;
                pumpCurve.ID = 0;
 
                var pumpCurveId = new BLL.PumpCurve().Insert(pumpCurve);
                if (pumpCurveId < 1)
                    return false;
                pumpCurve.ID = pumpCurveId;
 
                var pumpCurveMapping = new Model.PumpCurveMapping();
                pumpCurveMapping.PumpID = _pumpCurveExMapping.PumpID;
                pumpCurveMapping.CurveID = pumpCurveId;
                pumpCurveMapping.OtherName = otherName;
                pumpCurveMapping.IsWorking = false;
 
                var pumpCurveMappingId = new BLL.PumpCurveMapping().Insert(pumpCurveMapping);
                if (pumpCurveMappingId < 1)
                    return false;
                pumpCurveMapping.ID = pumpCurveMappingId;
                this.pumpCurveMappingListCtrl1.AddPumpCurveMapping(pumpCurveMapping);
                return true;
            };
            dlg.ShowDialog();
        }
 
        //删除曲线
        private void barBtnDeleteCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            if (XtraMessageBox.Show("是否删除曲线?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                return;
            var result = new BLL.PumpCurve().DeleteByID(_pumpCurveExMapping.ID, out string msg);
            if (!result)
            {
                XtraMessageBox.Show("删除失败!");
                return;
            }
            this.pumpCurveMappingListCtrl1.DeletePumpMapping(_pumpCurveExMapping.MappingID);
        }
 
        //刷新
        private void barBtnReload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.tabPane1.SelectedPage == this.tabNavigationPageCurveEdit)
            {
                XtraMessageBox.Show("曲线编辑页面无法刷新!");
                return;
            }
            InitialDataSource();
        }
 
        //导出inp文件曲线
        private void barBtnExportCrv_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            if (_pumpCurveExMapping.CurveInfo.CurveQH == null && _pumpCurveExMapping.CurveInfo.CurveQE == null)
                return;
            ExportCurveHelper.INPFile(_pumpCurveExMapping);
        }
 
        //导出ycm文件
        private void barBtnExportYCM_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            if (_pumpCurveExMapping.CurveInfo.CurveQH == null && _pumpCurveExMapping.CurveInfo.CurveQE == null)
                return;
 
            var json = PumpCurveDtoHelper.ExportJson(_pumpCurveExMapping);
            if (string.IsNullOrEmpty(json))
            {
                XtraMessageBox.Show("无法解析!");
                return;
            }
 
            var dlg = new SaveFileDialog();
            dlg.Title = "导出 .ycm 文件";
            dlg.FileName = $"{_pumpCurveExMapping.CurveCode}.ycm";
            dlg.Filter = "ycm (*.ycm)|*.ycm";
            if (dlg.ShowDialog() != DialogResult.OK)
                return;
            var filePath = dlg.FileName;
            File.WriteAllText(filePath, json);
 
            XtraMessageBox.Show("导出成功!");
 
        }
 
        #endregion
 
 
        #region 曲线编辑
 
        //曲线编辑 设置图表坐标
        private void barBtnSetCurveEditCoord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            this.curveExpressEditCtrl1.SetCoordinateByDialog();
        }
 
        //曲线编辑 取消修改
        private void barBtnCancelCurveEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show("是否取消修改?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                return;
            SetBindingData(_pumpCurveExMapping);
        }
 
        //曲线编辑 保存
        private void barBtnSaveCurveEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_pumpCurveExMapping == null)
                return;
            if (XtraMessageBox.Show("是否保存曲线?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                return;
 
            var bol = this.curveExpressEditCtrl1.GetPoints(out List<Model.CurvePoint> pointsQH,
                                                         out List<Model.CurvePoint> pointsQE,
                                                         out List<Model.CurvePoint> pointsQP,
                                                         out Model.eCurveFitType fitTypeQH,
                                                         out Model.eCurveFitType fitTypeQE,
                                                         out Model.eCurveFitType fitTypeQP);
            if (!bol)
                return;
            var featCurveExpressGroup = new Model.FeatCurveExpressGroup();
            var featCurvePointGroup = new Model.FeatCurvePointGroup();
            if (pointsQH != null)
            {
                featCurveExpressGroup.CurveQH = new Model.CurveExpress(pointsQH, fitTypeQH, true);
                featCurvePointGroup.PointQH = pointsQH;
            }
            if (pointsQE != null)
            {
                featCurveExpressGroup.CurveQE = new Model.CurveExpress(pointsQE, fitTypeQE, true);
                featCurvePointGroup.PointQE = pointsQE;
            }
            if (pointsQP != null)
            {
                featCurveExpressGroup.CurveQP = new Model.CurveExpress(pointsQP, fitTypeQP, true);
                featCurvePointGroup.PointQP = pointsQP;
            }
            _pumpCurveExMapping.CurveInfo = featCurveExpressGroup;
            // _pumpCurveExMapping.PointInfo = featCurvePointGroup;
 
            var result = new BLL.PumpCurve().Update(_pumpCurveExMapping);
            if (!result)
            {
                XtraMessageBox.Show("保存失败!");
                return;
            }
            XtraMessageBox.Show("保存成功!");
        }
 
        #endregion
 
 
        //选择页变换
        private void tabPane1_SelectedPageChanged(object sender, DevExpress.XtraBars.Navigation.SelectedPageChangedEventArgs e)
        {
            if (this.tabPane1.SelectedPage == this.tabNavigationPageCurveView)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPageCurveMgr;
            }
            else if (this.tabPane1.SelectedPage == this.tabNavigationPageCurveEdit)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPageCurveEdit;
            }
            else if (this.tabPane1.SelectedPage == this.tabNavigationPageOnePoint)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPageOnePoint;
            }
            else if (this.tabPane1.SelectedPage == this.tabNavigationPageExcel)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPageExcel;
            }
            else if (this.tabPane1.SelectedPage == this.tabNavigationPageCurveExpress)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPageCurveExpress;
            }
            else if (this.tabPane1.SelectedPage == this.tabNavigationPagePicture)
            {
                this.ribbonControl1.SelectedPage = this.ribbonPagePicture;
            }
 
        }
 
 
        private void barBtnSaveByOnePoint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show($"确认导入{_product.Name}?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                return;
            var bol = this.importCurveByOnePointCtrl1.GetCurve(out string curveCode, out Model.eCurveSourceFrom eCurveSourceFrom,
             out Model.FeatCurvePointGroup featCurvePointGroup, out Model.FeatCurveExpressGroup featCurveExpressGroup);
            if (!bol)
            {
                XtraMessageBox.Show("至少录入四个点!");
                return;
            }
 
            var pumpCurve = new Model.PumpCurve();
            pumpCurve.CurveCode = curveCode;
            pumpCurve.SourceFrom = eCurveSourceFrom;
            pumpCurve.CreateMethod = Model.eCurveCreateMethod.单点生成;
            pumpCurve.CurveInfo = featCurveExpressGroup;
            //  pumpCurve.PointInfo = featCurvePointGroup;
            pumpCurve.ReliabilityStatus = Model.PumpCurve.eReliabilityStatus.Normal;
            pumpCurve.CreateTime = DateTime.Now;
            pumpCurve.ID = new BLL.PumpCurve().Insert(pumpCurve);
            if (pumpCurve.ID > 0)
            {
                var pumpCurveMapping = new Model.PumpCurveMapping();
                pumpCurveMapping.PumpID = _product.ID;
                pumpCurveMapping.CurveID = pumpCurve.ID;
                pumpCurveMapping.OtherName = pumpCurve.CurveCode;
                pumpCurveMapping.SortCode = 1;
                pumpCurveMapping.IsWorking = false;
                pumpCurveMapping.ID = new BLL.PumpCurveMapping().Insert(pumpCurveMapping);
                if (pumpCurveMapping.ID < 1)
                {
                    var result = new BLL.PumpCurve().DeleteByID(pumpCurve.ID, out string msg);
                    XtraMessageBox.Show("保存失败!");
                    return;
                }
                this.pumpCurveMappingListCtrl1.AddPumpCurveMapping(pumpCurveMapping);
            }
            XtraMessageBox.Show("保存成功!");
        }
 
        private void barBtnSaveByExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show($"确认导入{_product.Name}?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                return;
            var bol = this.importCurveByExcelCtrl1.GetCurve(out string curveCode, out Model.eCurveSourceFrom eCurveSourceFrom,
             out Model.FeatCurvePointGroup featCurvePointGroup, out Model.FeatCurveExpressGroup featCurveExpressGroup);
            if (!bol)
            {
                return;
            }
 
            var pumpCurve = new Model.PumpCurve();
            pumpCurve.CurveCode = curveCode;
            pumpCurve.SourceFrom = eCurveSourceFrom;
            pumpCurve.CreateMethod = Model.eCurveCreateMethod.Excel导入;
            pumpCurve.CurveInfo = featCurveExpressGroup;
            //  pumpCurve.PointInfo = featCurvePointGroup;
            pumpCurve.ReliabilityStatus = Model.PumpCurve.eReliabilityStatus.Normal;
            pumpCurve.CreateTime = DateTime.Now;
            pumpCurve.ID = new BLL.PumpCurve().Insert(pumpCurve);
            if (pumpCurve.ID > 0)
            {
                var pumpCurveMapping = new Model.PumpCurveMapping();
                pumpCurveMapping.PumpID = _product.ID;
                pumpCurveMapping.CurveID = pumpCurve.ID;
                pumpCurveMapping.OtherName = pumpCurve.CurveCode;
                pumpCurveMapping.SortCode = 1;
                pumpCurveMapping.IsWorking = false;
                pumpCurveMapping.ID = new BLL.PumpCurveMapping().Insert(pumpCurveMapping);
                if (pumpCurveMapping.ID < 1)
                {
                    var result = new BLL.PumpCurve().DeleteByID(pumpCurve.ID, out string msg);
                    XtraMessageBox.Show("保存失败!");
                    return;
                }
                this.pumpCurveMappingListCtrl1.AddPumpCurveMapping(pumpCurveMapping);
            }
            XtraMessageBox.Show("保存成功!");
        }
 
        private void barBtnSaveByCurveExpress_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show($"确认导入{_product.Name}?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                return;
            var bol = this.importCurveByCurveExpressCtrl1.GetCurve(out string curveCode, out Model.eCurveSourceFrom eCurveSourceFrom,
        out Model.FeatCurvePointGroup featCurvePointGroup, out Model.FeatCurveExpressGroup featCurveExpressGroup);
            if (!bol)
            {
                return;
            }
 
            var pumpCurve = new Model.PumpCurve();
            pumpCurve.CurveCode = curveCode;
            pumpCurve.SourceFrom = eCurveSourceFrom;
            pumpCurve.CreateMethod = Model.eCurveCreateMethod.曲线表达式;
            pumpCurve.CurveInfo = featCurveExpressGroup;
            // pumpCurve.PointInfo = featCurvePointGroup;
            pumpCurve.ReliabilityStatus = Model.PumpCurve.eReliabilityStatus.Normal;
            pumpCurve.CreateTime = DateTime.Now;
            pumpCurve.ID = new BLL.PumpCurve().Insert(pumpCurve);
            if (pumpCurve.ID > 0)
            {
                var pumpCurveMapping = new Model.PumpCurveMapping();
                pumpCurveMapping.PumpID = _product.ID;
                pumpCurveMapping.CurveID = pumpCurve.ID;
                pumpCurveMapping.OtherName = pumpCurve.CurveCode;
                pumpCurveMapping.SortCode = 1;
                pumpCurveMapping.IsWorking = false;
                pumpCurveMapping.ID = new BLL.PumpCurveMapping().Insert(pumpCurveMapping);
                if (pumpCurveMapping.ID < 1)
                {
                    var result = new BLL.PumpCurve().DeleteByID(pumpCurve.ID, out string msg);
                    XtraMessageBox.Show("保存失败!");
                    return;
                }
                this.pumpCurveMappingListCtrl1.AddPumpCurveMapping(pumpCurveMapping);
            }
            XtraMessageBox.Show("保存成功!");
        }
 
        private void barBtnSaveByPicture_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show($"确认导入{_product.Name}?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                return;
            var bol = this.importCurveByPictureCtrl1.GetCurve(out string curveCode, out Model.eCurveSourceFrom eCurveSourceFrom,
        out Model.FeatCurvePointGroup featCurvePointGroup, out Model.FeatCurveExpressGroup featCurveExpressGroup);
            if (!bol)
            {
                return;
            }
 
            var pumpCurve = new Model.PumpCurve();
            pumpCurve.CurveCode = curveCode;
            pumpCurve.SourceFrom = eCurveSourceFrom;
            pumpCurve.CreateMethod = Model.eCurveCreateMethod.图片拟合;
            pumpCurve.CurveInfo = featCurveExpressGroup;
            // pumpCurve.PointInfo = featCurvePointGroup;
            pumpCurve.ReliabilityStatus = Model.PumpCurve.eReliabilityStatus.Normal;
            pumpCurve.CreateTime = DateTime.Now;
            pumpCurve.ID = new BLL.PumpCurve().Insert(pumpCurve);
            if (pumpCurve.ID > 0)
            {
                var pumpCurveMapping = new Model.PumpCurveMapping();
                pumpCurveMapping.PumpID = _product.ID;
                pumpCurveMapping.CurveID = pumpCurve.ID;
                pumpCurveMapping.OtherName = pumpCurve.CurveCode;
                pumpCurveMapping.SortCode = 1;
                pumpCurveMapping.IsWorking = false;
                pumpCurveMapping.ID = new BLL.PumpCurveMapping().Insert(pumpCurveMapping);
                if (pumpCurveMapping.ID < 1)
                {
                    var result = new BLL.PumpCurve().DeleteByID(pumpCurve.ID, out string msg);
                    XtraMessageBox.Show("保存失败!");
                    return;
                }
                this.pumpCurveMappingListCtrl1.AddPumpCurveMapping(pumpCurveMapping);
            }
            XtraMessageBox.Show("保存成功!");
        }
    }
}