tx
2025-04-10 2538101febc78f525945da72c7cdcb2589f9e6ea
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
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TProduct.Common;
using TProduct.Model; 
 
namespace TProduct.WinFrmUI.TValve
{
    /// <summary>
    /// 性能测试
    /// </summary>
    public partial class FeatTestViewMainPage
    {
        private void barBtn清空测试数据_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this._allRecords == null || this._allRecords.Count() == 0)
                return;
            DialogResult result1 = MessageBox.Show("请问是否清空测试数据", "询问",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Warning);
            if (result1 != DialogResult.Yes)
            {
                return;
            }
 
            DialogResult result2 = MessageBox.Show("请问是否清空测试数据,删除后, 数据无法恢复,请再次确认", "询问",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Warning);
            if (result2 != DialogResult.Yes)
            {
                return;
            }
            new TProduct.BLL.ValveFeatTestRecord().ClearAllRecord(this._testItem);
            this._allRecords.Clear();
            _monitorGridCtrl.ClearData( );
            _chartMainCtrl.EmptyRecordPoint( );
        }
 
        private void barBtn导出测试数据_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this._allRecords == null || this._allRecords.Count() == 0)
                return;
            this._monitorGridCtrl.ExportExcel();
        }
 
        private void barBtn测试台参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this._workBench.LinkType == eLinkType.ShunZhou)
            {
                TProduct.WinFrmUI.Data4Factory.ViewWorkBench4ShunDlg frm = new TProduct.WinFrmUI.Data4Factory.ViewWorkBench4ShunDlg();
                frm.SetBindingData(this._workBench);
                frm.Show();
            }
        }
 
        private void barBtn仪表参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TProduct.WinFrmUI.Data4Factory.ListWorkBenchMonitorPointDlg frm = new TProduct.WinFrmUI.Data4Factory.ListWorkBenchMonitorPointDlg();
            frm.SetBindingData(this._workBench);
            frm.Show();
        }
 
        private void barBtn设备参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
 
        }
 
        private void barBtn编写日志_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (this._testItem == null)
            //    return;
            //TProduct.WinFrmUI.TBase.EditTestItemLogDlg frm = new TBase.EditTestItemLogDlg();
            //frm.SetTestItem(this._testItem);
            //if(frm.ShowDialog(this) == DialogResult.OK)
            //{
            //    _testLogCtrl.SetBindingData(this._testItem.LogContent);
            //}
        }
 
        private void barBtn导出测试报告_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SetTestReportInfoDlg dlg = new SetTestReportInfoDlg();
            dlg.SetBindingData(this._testProject);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                TProduct.DataFile.ValveReport.TestReportFile5 file_helepr= new TProduct.DataFile.ValveReport.TestReportFile5();
                file_helepr.SetBindingData(this._currentValve, this._currentPart, this._testProject);
                if (file_helepr.Create(dlg.GetFilePah(), (info, type) => {
                    MessageBox.Show(info);
                }) == null)
                {
                    MessageBox.Show("生成成功");
                }
            }
        }
 
        private void barBtn添加测试数据_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            NewFeatTestRecord();
        }
 
        private void barBtn编辑测试数据_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var record_id = this._monitorGridCtrl.GetFocusRowRecordID();
            if (record_id <= 0)
                return;
            var record = this._allRecords.Find(x => x.ID == record_id);
            EditFeatTestRecord(record);
        }
 
        //List<TProduct.Model.TestJudgeItemResultViewModel> _testJudgeResults = null;
 
        private void barBtn合格性判定_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (this._allRecords == null || this._allRecords.Count() < 4)
            //{
            //    MessageBox.Show("点数量过少,暂时无法判断");
            //    return;
            //}
            
 
            //TProduct.Common.PumpTestJudgeHelper helper = new TProduct.Common.PumpTestJudgeHelper();
            //helper.SetRatedParas(this._ratedParas);
            //helper.SetStandard(this._testStandard, this._testGrade, this._testJudgeItems);
            //var isOk =  helper.JudgeQH(this._allRecords, out _testJudgeResults);
            //SaveJudgeResult(isOk);
 
 
            //ResultJudgeForm frm = new ResultJudgeForm();
            //frm.SetRatedParas(this._ratedParas);
            //frm.SetRecordPoints(this._allRecords);
            //frm.SetBindingData(this._testStandard, this._testGrade, this._testJudgeItems, _testJudgeResults);
            //frm.OnSaveResult += (isOk2,new_testJudgeResults ) =>
            //{
            //    SaveJudgeResult(isOk2);
            //    this._testJudgeResults = new_testJudgeResults;
            //};
            //frm.OnSaveGrade += (standard_id, grade_id, judgeItemList) =>
            //{
            //    this._testStandard = TestStandardHelper.Instance.GetStandard(standard_id);
            //    this._testGrade = TestStandardHelper.Instance.GetGrade(standard_id, grade_id);
            //    this._testJudgeItems = judgeItemList;
 
            //    this._testItem.TestStandardID = this._testStandard.ID;
            //    this._testItem.TestGradeID = this._testGrade.ID;
 
            //    new BLL.TestItem().Update(this._testItem);
 
            //    if(OnRefreshTestItem != null)
            //    {
            //        OnRefreshTestItem(this._testItem);
            //    }
            //};
            //frm.Show();
        }
     
        private void SaveJudgeResult(bool isOk)
        {
            if (this._testItem.JudgeResult == eTestJudgeResult.合格)
            {
                if (!isOk)
                {
                    this._testItem.JudgeResult = eTestJudgeResult.不合格;
                    this._testProject.JudgeResult = eTestJudgeResult.不合格;
                    new BLL.TestProjectItem().UpdateJudgeResult(this._testItem.ItemID, (int)this._testItem.JudgeResult);
                    new BLL.TestProject().UpdateJudgeResult(this._testProject.ID, (int)this._testProject.JudgeResult);
                }
            }
            else if (this._testItem.JudgeResult == eTestJudgeResult.不合格)
            {
                if (isOk)
                {
                    this._testItem.JudgeResult = eTestJudgeResult.合格;
                    this._testProject.JudgeResult = eTestJudgeResult.合格;
                    new BLL.TestProjectItem().UpdateJudgeResult(this._testItem.ItemID, (int)this._testItem.JudgeResult);
                    new BLL.TestProject().UpdateJudgeResult(this._testProject.ID, (int)this._testProject.JudgeResult);
                }
            }
            else
            {
                if (isOk)
                {
                    this._testItem.JudgeResult = eTestJudgeResult.合格;
                    this._testProject.JudgeResult = eTestJudgeResult.合格;
                    new BLL.TestProjectItem().UpdateJudgeResult(this._testItem.ItemID, (int)this._testItem.JudgeResult);
                    new BLL.TestProject().UpdateJudgeResult(this._testProject.ID, (int)this._testProject.JudgeResult);
                }
                else
                {
                    this._testItem.JudgeResult = eTestJudgeResult.不合格;
                    this._testProject.JudgeResult = eTestJudgeResult.不合格;
                    new BLL.TestProjectItem().UpdateJudgeResult(this._testItem.ItemID, (int)this._testItem.JudgeResult);
                    new BLL.TestProject().UpdateJudgeResult(this._testProject.ID, (int)this._testProject.JudgeResult);
                }
            }
        }
 
 
 
 
    }
}