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
using System.Collections.Generic;
using System.Windows.Forms;
using TProduct.Model;
 
namespace TProduct.WinFrmUI.TValve
{
    /// <summary>
    /// 性能测试
    /// </summary>
    public partial class FeatTestViewMainPage : DocumentPage
    {
        /// <summary>
        /// 赋值
        /// </summary>
        /// <param name="project"></param>
        /// <param name="item"></param>
        /// <param name="workBench"></param>
        /// <param name="workBenchParas"></param>
        public void SetBindingData(
            TProduct.Model.ProductMainExValve valve,
            TProduct.Model.PartBase part,
            TProduct.Model.TestProjectItemView project_item)
        {
            if (project_item == null)
            {
                MessageBox.Show("还未设置project参数");
                return;
            }
            if (valve == null)
            {
                MessageBox.Show("还未设置valve参数");
                return;
            }
            if (part == null)
            {
                MessageBox.Show("还未设置part参数");
                return;
            }
 
            //this.PageTitle.Caption = "阀测试:"+ project.Name;
 
            this._currentValve = valve;
            this._currentPart = part;
 
 
            var feat_test_item = project_item;
            if (feat_test_item == null)
                return;
 
            this._testProject = new Model.TestProjectBase(project_item);
            this._featTestItem = feat_test_item;
 
            this._workBenchInfo = new BLL.WorkBenchBase().GetByID(feat_test_item.BenchID);
            if (_workBenchInfo == null)
            {
                MessageBox.Show("还未设置测试台参数");
                return;
            }
 
            var allMonitorPointList = new BLL.WorkBenchMonitorPoint().GetByBenchID(_workBenchInfo.ID);
            //
            if (!InitialCalcDialog(valve, _workBenchInfo, feat_test_item, allMonitorPointList))
            {
                return;
            }
 
 
            //从数据库中获取以前的测试数据
            var allRecords4Ds = new BLL.ValveFeatTestRecord().GetByTestItem(feat_test_item);
            this._allRecords = new List<ValveFeatTestRecordViewModel>();
            if (allRecords4Ds != null)
            {
                foreach (var r in allRecords4Ds)
                {
                    this._allRecords.Add(new ValveFeatTestRecordViewModel(r) { MonitorRecordList = new MonitorRecord4DsList(r.MonitorRecords) });
                }
            }
 
            //
            InitialJudgeItem();
 
 
            //
            InitialMonitorGrid(allMonitorPointList);
 
 
            //
            InitialTestLogCtrl();
 
 
            //
            IntialPartInfoCtrl();
 
 
 
            //
            IntialMainChart();
 
            //
            InitialJudgeResult();
 
            //
            InitialModel3d();
 
            //
            InitialDurabilityTest();
 
            if (!string.IsNullOrEmpty(_featTestItem.ProjectName))
                this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectName;
            else if (!string.IsNullOrEmpty(_featTestItem.ProjectCode))
                this.PageTitle.Caption = "泵测试:" + _featTestItem.ProjectCode;
        }
 
 
        //耐久试验
        private void InitialDurabilityTest()
        {
            if (this._featTestItem == null)
                return;
            TProduct.Model.DurabilityTestBundle bundle = this._featTestItem.DurabilityTestInfo;
            if (bundle == null || !bundle.IsHave || bundle.TotalDuration < 5)
            {
                tabPageDurabilityTest.PageVisible = false;
                return;
            }
            var durabilityTestCtrl = new TProduct.WinFrmUI.TBase.ViewDurabilityTestDetail();
            durabilityTestCtrl.Name = "ViewDurabilityTestDetail";
            durabilityTestCtrl.Dock = DockStyle.Fill;
            durabilityTestCtrl.SetBindingData(bundle);
            tabPageDurabilityTest.Controls.Add(durabilityTestCtrl);
        }
 
        //日志
        TBase.TestItemLogContentCtrl _testLogCtrl = null;
        void InitialTestLogCtrl()
        {
            if (this._featTestItem == null)
                return;
            if (_testLogCtrl == null)
            {
                _testLogCtrl = new TBase.TestItemLogContentCtrl();
                _testLogCtrl.Name = "ViewTestItemLogCtrl";
                _testLogCtrl.Dock = DockStyle.Fill;
                _testLogCtrl.OnSaveLog += (new_content) =>
                {
                    this._featTestItem.ItemLogContent = new_content;
                    new TProduct.BLL.TestProjectItem().UpdateLogContent(_featTestItem.ItemID, _featTestItem.ItemLogContent);
                    TProduct.WinFrmUI.TipFrmHelper.ShowSuccess("日志已保存");
                };
                tabPageLog.Controls.Add(_testLogCtrl);
            }
 
            _testLogCtrl.SetBindingData(this._featTestItem.ItemLogContent);
        }
 
 
    }
}