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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
 
namespace TProduct.WinFrmUI.TPump
{
    public partial class TestInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public TestInfoCtrl()
        {
            InitializeComponent();
        }
        TProduct.Model.TestProjectBase _projectTest = null;
        List<Model.TestProjectItemView> _items = null;
        public void SetBindingData(TProduct.Model.TestProjectBase project,
            List<Model.TestProjectItemView> items)
        {
            if (project == null || items == null)
                return;
            _items = items;
 
            _projectTest = project;
            textEdit测试编号.Text = project.Code;
            textEdit测试名称.Text = project.Name;
            TextEditReportFileNO.Text = project.ReportFileNO;
 
            textEdit测试编号.Tag = string.IsNullOrEmpty(project.Code) ? "" : project.Code;
            textEdit测试名称.Tag = string.IsNullOrEmpty(project.Name) ? "" : project.Name;
            TextEditReportFileNO.Tag = string.IsNullOrEmpty(project.ReportFileNO) ? "" : project.ReportFileNO;
 
            var feat = items.Find(x => x.TestType == Model.eTestType.FeatTest);
            if (feat != null)
            {
                textEditFeatTestLog.Tag = string.IsNullOrEmpty(feat.ItemLogContent) ? "" : project.Name;
                textEditFeatTestLog.Text = feat.ItemLogContent;
            }
 
            if (_projectTest.ProjectParas != null)
            {
                imageComboProjectNature.EditValue =
                   (int)_projectTest.ProjectParas.TestNature;
 
                spinEditInspectionNumber.Value = _projectTest.ProjectParas.InspectionNumber;
            }
        }
        public Action<Model.TestProjectItemView> OnSaveItem = null;
        public Action<Model.TestProjectBase> OnSaveProject = null;
 
        private void bbi修改参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (OnSaveItem == null)
                return;
            if (textEditFeatTestLog.Tag.ToString() != textEditFeatTestLog.Text)
            {
                var feat = _items.Find(x => x.TestType == Model.eTestType.FeatTest);
                if (feat != null)
                {
                    feat.ItemLogContent = textEditFeatTestLog.Text;
                    textEditFeatTestLog.Tag = textEditFeatTestLog.Text;
                    OnSaveItem(feat);
                }
            }
            bool isChange = false;
            if (textEdit测试编号.Tag.ToString() != textEdit测试编号.Text)
            {
                isChange = true;
                _projectTest.Code = textEdit测试编号.Text;
                textEdit测试编号.Tag = textEdit测试编号.Text;
            }
            if (TextEditReportFileNO.Tag.ToString() != TextEditReportFileNO.Text)
            {
                isChange = true;
                _projectTest.ReportFileNO = TextEditReportFileNO.Text;
                TextEditReportFileNO.Tag = TextEditReportFileNO.Text;
            }
            if (textEdit测试名称.Tag.ToString() != textEdit测试名称.Text)
            {
                isChange = true;
                _projectTest.Name = textEdit测试名称.Text;
                textEdit测试名称.Tag = textEdit测试名称.Text;
            }
 
            if (_projectTest.ProjectParas != null)
            {
                var nnn = (Model.eTestProjectNature)Convert.ToInt32(imageComboProjectNature.EditValue);
                var iii = Convert.ToInt32(spinEditInspectionNumber.Value);
                if (_projectTest.ProjectParas.TestNature != nnn)
                {
                    isChange = true;
                    _projectTest.ProjectParas.TestNature = nnn;
                }
                if (_projectTest.ProjectParas.InspectionNumber != iii)
                {
                    isChange = true;
                    _projectTest.ProjectParas.InspectionNumber = iii;
                }
            }
 
 
            if (isChange && OnSaveProject != null)
            {
                OnSaveProject.Invoke(_projectTest);
            }
 
            MessageBox.Show("已保存信息");
        }
    }
}