프로젝트

일반

사용자정보

개정판 98aa8635

ID98aa86356dc7a11bf0d2c8042eae89cfa2525f43
상위 b0a1351a
하위 ab245b6d

gaqhf 이(가) 약 5년 전에 추가함

dev issue #000 : add aveva message form

Change-Id: I6170fb3ac2a371b34047b65e8bb989a5d7eeb192

차이점 보기:

DTI_PID/APIDConverter/AVEVA.PID.CustomizationUtility_ACAD2018_x64.csproj
166 166
  </ItemGroup>
167 167
  <ItemGroup>
168 168
    <Compile Include="AvevaInfo.cs" />
169
    <Compile Include="Form\MessageForm.cs">
170
      <SubType>Form</SubType>
171
    </Compile>
172
    <Compile Include="Form\MessageForm.Designer.cs">
173
      <DependentUpon>MessageForm.cs</DependentUpon>
174
    </Compile>
169 175
    <Compile Include="Model\PlantItem\Note.cs" />
170 176
    <Compile Include="Model\PlantItem\Text.cs" />
171 177
    <Compile Include="Utils\AvevaThread.cs" />
......
250 256
    <EmbeddedResource Include="Form\APIDConverter.resx">
251 257
      <DependentUpon>APIDConverter.cs</DependentUpon>
252 258
    </EmbeddedResource>
259
    <EmbeddedResource Include="Form\MessageForm.resx">
260
      <DependentUpon>MessageForm.cs</DependentUpon>
261
    </EmbeddedResource>
253 262
    <EmbeddedResource Include="Form\ProjectForm.resx">
254 263
      <DependentUpon>ProjectForm.cs</DependentUpon>
255 264
    </EmbeddedResource>
DTI_PID/APIDConverter/Form/APIDConverter.cs
26 26
            InitializeComponent();
27 27
            InitUsedDataTable();
28 28
            InitGridControl();
29

  
30
            layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
29 31
        }
30 32

  
31 33
        DataTable ID2SymbolTypeTable = null;
......
103 105
            if (dia.ShowDialog() == DialogResult.OK)
104 106
            {
105 107
                DataTable drawingTable = Project_DB.SelectDrawingTable();
108
                List<Model.Document> validationFailDocs = new List<Model.Document>();
109
                DataTable symbolMappingTable = Project_DB.GetSymbolMappingTable();
110
                DataTable lineMappingTable = Project_DB.GetLineMappingTable();
111
                DataTable opcMappingTable = Project_DB.GetOPCMappingTable();
106 112

  
107 113
                foreach (var fileName in dia.FileNames)
108 114
                {
109 115
                    Document document = new Document(fileName, ID2SymbolTypeTable);
110

  
116
                    if (!document.SetAvevaInfo(symbolMappingTable, lineMappingTable, opcMappingTable))
117
                    {
118
                        validationFailDocs.Add(document);
119
                        document.Enable = false;
120
                    }
121
                        
111 122
                    DataRow[] rows = _ConverterDT.Select(string.Format("colDrawingFilePath = '{0}'", fileName));
112 123
                    if (rows.Length == 0)
113 124
                    {
......
143 154
                        }
144 155
                    }
145 156

  
157
                    // validation check
146 158
                    if (!_DicDocuments.ContainsKey(fileName))
147 159
                        _DicDocuments.Add(fileName, null);
148 160

  
149 161
                    _DicDocuments[fileName] = document;
150 162
                }
163

  
164
                symbolMappingTable.Dispose();
165
                lineMappingTable.Dispose();
166
                opcMappingTable.Dispose();
167

  
168
                if (validationFailDocs.Count > 0)
169
                {
170
                    MessageForm messageForm = new MessageForm(validationFailDocs);
171
                    messageForm.ShowDialog();
172
                }
151 173
            }
152 174
        }
153 175

  
......
193 215
                MessageBox.Show("Select Document", "APID Converter", MessageBoxButtons.OK, MessageBoxIcon.Warning);
194 216
                return;
195 217
            }
196

  
218
            List<Model.Document> validationFailDocs = new List<Model.Document>();
197 219
            DataTable symbolMappingTable = Project_DB.GetSymbolMappingTable();
198 220
            DataTable lineMappingTable = Project_DB.GetLineMappingTable();
199 221
            DataTable opcMappingTable = Project_DB.GetOPCMappingTable();
......
220 242
                // validation check
221 243
                if (document.SetAvevaInfo(symbolMappingTable, lineMappingTable, opcMappingTable))
222 244
                    Documents.Add(document);
245
                else
246
                    validationFailDocs.Add(document);
223 247
            }
224 248

  
225 249
            symbolMappingTable.Dispose();
226 250
            lineMappingTable.Dispose();
227 251
            opcMappingTable.Dispose();
228 252

  
229
            if (Documents.Count > 0)
253
            if (validationFailDocs.Count > 0)
254
            {
255
                MessageForm messageForm = new MessageForm(validationFailDocs);
256
                messageForm.ShowDialog();
257
            }
258
            else if (Documents.Count > 0)
230 259
            {
231 260
                DialogResult = DialogResult.OK;
232 261
            }
DTI_PID/APIDConverter/Form/MappingForm.cs
552 552
                    string dirPath = "";
553 553
                    GetNodeLoopText(e.Node, ref dirPath);
554 554
                    string resultPath = imagePath + dirPath;
555
                    Directory.CreateDirectory(resultPath);
556

  
555 557
                    string[] fileNames = Directory.GetFiles(resultPath, "*.png", SearchOption.TopDirectoryOnly);
556 558
                    galleryControlAvevaSymbols.Gallery.Groups[0].Caption = e.Node.GetDisplayText("Name");
557 559

  
DTI_PID/APIDConverter/Form/MessageForm.Designer.cs
1
namespace AVEVA.PID.CustomizationUtility
2
{
3
    partial class MessageForm
4
    {
5
        /// <summary>
6
        /// Required designer variable.
7
        /// </summary>
8
        private System.ComponentModel.IContainer components = null;
9

  
10
        /// <summary>
11
        /// Clean up any resources being used.
12
        /// </summary>
13
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
        protected override void Dispose(bool disposing)
15
        {
16
            if (disposing && (components != null))
17
            {
18
                components.Dispose();
19
            }
20
            base.Dispose(disposing);
21
        }
22

  
23
        #region Windows Form Designer generated code
24

  
25
        /// <summary>
26
        /// Required method for Designer support - do not modify
27
        /// the contents of this method with the code editor.
28
        /// </summary>
29
        private void InitializeComponent()
30
        {
31
            this.ribbonControl = new DevExpress.XtraBars.Ribbon.RibbonControl();
32
            this.ribbonPage2 = new DevExpress.XtraBars.Ribbon.RibbonPage();
33
            this.tabPane = new DevExpress.XtraBars.Navigation.TabPane();
34
            ((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).BeginInit();
35
            ((System.ComponentModel.ISupportInitialize)(this.tabPane)).BeginInit();
36
            this.SuspendLayout();
37
            // 
38
            // ribbonControl
39
            // 
40
            this.ribbonControl.ExpandCollapseItem.Id = 0;
41
            this.ribbonControl.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
42
            this.ribbonControl.ExpandCollapseItem});
43
            this.ribbonControl.Location = new System.Drawing.Point(0, 0);
44
            this.ribbonControl.MaxItemId = 1;
45
            this.ribbonControl.Name = "ribbonControl";
46
            this.ribbonControl.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.False;
47
            this.ribbonControl.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.False;
48
            this.ribbonControl.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages;
49
            this.ribbonControl.ShowToolbarCustomizeItem = false;
50
            this.ribbonControl.Size = new System.Drawing.Size(762, 32);
51
            this.ribbonControl.Toolbar.ShowCustomizeItem = false;
52
            // 
53
            // ribbonPage2
54
            // 
55
            this.ribbonPage2.Name = "ribbonPage2";
56
            this.ribbonPage2.Text = "ribbonPage2";
57
            // 
58
            // tabPane
59
            // 
60
            this.tabPane.Dock = System.Windows.Forms.DockStyle.Fill;
61
            this.tabPane.Location = new System.Drawing.Point(0, 32);
62
            this.tabPane.Name = "tabPane";
63
            this.tabPane.RegularSize = new System.Drawing.Size(762, 488);
64
            this.tabPane.SelectedPage = null;
65
            this.tabPane.Size = new System.Drawing.Size(762, 488);
66
            this.tabPane.TabIndex = 2;
67
            this.tabPane.Text = "tabPane1";
68
            // 
69
            // MessageForm
70
            // 
71
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
72
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73
            this.ClientSize = new System.Drawing.Size(762, 520);
74
            this.Controls.Add(this.tabPane);
75
            this.Controls.Add(this.ribbonControl);
76
            this.Name = "MessageForm";
77
            this.Ribbon = this.ribbonControl;
78
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
79
            this.Text = "Message";
80
            ((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).EndInit();
81
            ((System.ComponentModel.ISupportInitialize)(this.tabPane)).EndInit();
82
            this.ResumeLayout(false);
83
            this.PerformLayout();
84

  
85
        }
86

  
87
        #endregion
88
        private DevExpress.XtraBars.Ribbon.RibbonControl ribbonControl;
89
        private DevExpress.XtraBars.Ribbon.RibbonPage ribbonPage2;
90
        private DevExpress.XtraBars.Navigation.TabPane tabPane;
91
    }
92
}
DTI_PID/APIDConverter/Form/MessageForm.cs
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10
using DevExpress.XtraBars.Navigation;
11

  
12
namespace AVEVA.PID.CustomizationUtility
13
{
14
    public partial class MessageForm : DevExpress.XtraBars.Ribbon.RibbonForm
15
    {
16
        public MessageForm(List<Model.Document> documents)
17
        {
18
            InitializeComponent();
19
            foreach (var item in documents)
20
            {
21
                if (!item.Validation || !item.MappingValidation)
22
                {
23
                    var page = tabPane.AddPage(item.DWGNAME, Guid.NewGuid().ToString());
24

  
25
                    DevExpress.XtraEditors.MemoEdit memoEdit = new DevExpress.XtraEditors.MemoEdit();
26
                    memoEdit.Text = item.ValidationMessage;
27
                    memoEdit.Select(0, 0);
28
                    memoEdit.Dock = DockStyle.Fill;
29
                    page.Controls.Add(memoEdit);
30
                }
31
            }
32
            
33
        }
34
    }
35
}
DTI_PID/APIDConverter/Form/MessageForm.resx
1
<?xml version="1.0" encoding="utf-8"?>
2
<root>
3
  <!-- 
4
    Microsoft ResX Schema 
5
    
6
    Version 2.0
7
    
8
    The primary goals of this format is to allow a simple XML format 
9
    that is mostly human readable. The generation and parsing of the 
10
    various data types are done through the TypeConverter classes 
11
    associated with the data types.
12
    
13
    Example:
14
    
15
    ... ado.net/XML headers & schema ...
16
    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
    <resheader name="version">2.0</resheader>
18
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
    </data>
25
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
        <comment>This is a comment</comment>
28
    </data>
29
                
30
    There are any number of "resheader" rows that contain simple 
31
    name/value pairs.
32
    
33
    Each data row contains a name, and value. The row also contains a 
34
    type or mimetype. Type corresponds to a .NET class that support 
35
    text/value conversion through the TypeConverter architecture. 
36
    Classes that don't support this are serialized and stored with the 
37
    mimetype set.
38
    
39
    The mimetype is used for serialized objects, and tells the 
40
    ResXResourceReader how to depersist the object. This is currently not 
41
    extensible. For a given mimetype the value must be set accordingly:
42
    
43
    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
    that the ResXResourceWriter will generate, however the reader can 
45
    read any of the formats listed below.
46
    
47
    mimetype: application/x-microsoft.net.object.binary.base64
48
    value   : The object must be serialized with 
49
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
            : and then encoded with base64 encoding.
51
    
52
    mimetype: application/x-microsoft.net.object.soap.base64
53
    value   : The object must be serialized with 
54
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
            : and then encoded with base64 encoding.
56

  
57
    mimetype: application/x-microsoft.net.object.bytearray.base64
58
    value   : The object must be serialized into a byte array 
59
            : using a System.ComponentModel.TypeConverter
60
            : and then encoded with base64 encoding.
61
    -->
62
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
    <xsd:element name="root" msdata:IsDataSet="true">
65
      <xsd:complexType>
66
        <xsd:choice maxOccurs="unbounded">
67
          <xsd:element name="metadata">
68
            <xsd:complexType>
69
              <xsd:sequence>
70
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
              </xsd:sequence>
72
              <xsd:attribute name="name" use="required" type="xsd:string" />
73
              <xsd:attribute name="type" type="xsd:string" />
74
              <xsd:attribute name="mimetype" type="xsd:string" />
75
              <xsd:attribute ref="xml:space" />
76
            </xsd:complexType>
77
          </xsd:element>
78
          <xsd:element name="assembly">
79
            <xsd:complexType>
80
              <xsd:attribute name="alias" type="xsd:string" />
81
              <xsd:attribute name="name" type="xsd:string" />
82
            </xsd:complexType>
83
          </xsd:element>
84
          <xsd:element name="data">
85
            <xsd:complexType>
86
              <xsd:sequence>
87
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
              </xsd:sequence>
90
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
              <xsd:attribute ref="xml:space" />
94
            </xsd:complexType>
95
          </xsd:element>
96
          <xsd:element name="resheader">
97
            <xsd:complexType>
98
              <xsd:sequence>
99
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
              </xsd:sequence>
101
              <xsd:attribute name="name" type="xsd:string" use="required" />
102
            </xsd:complexType>
103
          </xsd:element>
104
        </xsd:choice>
105
      </xsd:complexType>
106
    </xsd:element>
107
  </xsd:schema>
108
  <resheader name="resmimetype">
109
    <value>text/microsoft-resx</value>
110
  </resheader>
111
  <resheader name="version">
112
    <value>2.0</value>
113
  </resheader>
114
  <resheader name="reader">
115
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
  </resheader>
117
  <resheader name="writer">
118
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
  </resheader>
120
</root>
DTI_PID/APIDConverter/Model/PlantItem/Document.cs
673 673
                    item.Aveva.End_Y = Math.Round(item.Aveva.End_Y);
674 674
                }
675 675
                else
676
                {
677
                    validationStringBuilder.AppendLine(string.Format("Need Mapping Line : {0}", item.TYPE));
676 678
                    result = false;
679
                }
677 680
            }
678 681
            foreach (var item in SYMBOLS)
679 682
            {
......
694 697
                    item.Aveva.Name = split[split.Length - 1];
695 698
                }
696 699
                else
700
                {
701
                    validationStringBuilder.AppendLine(string.Format("Need Mapping Symbol : {0}", item.NAME));
697 702
                    result = false;
703
                }
698 704
            }
699 705
            foreach (var item in OPCs)
700 706
            {
......
738 744
                        }
739 745
                    }
740 746
                    else
747
                    {
748
                        validationStringBuilder.AppendLine(string.Format("Check OPC's Connector : {0}", item.UID));
741 749
                        result = false;
750
                    }
742 751
                }
743 752
                else
753
                {
754
                    validationStringBuilder.AppendLine(string.Format("Need Mapping Symbol : {0}", item.NAME));
744 755
                    result = false;
756
                }
745 757
            }
746 758
            foreach (var item in LINENUMBERS)
747 759
            {
......
826 838
                item.Aveva.Angle = item.ANGLE;
827 839
            }
828 840

  
841
            if (!result)
842
                ValidationMessage = validationStringBuilder.ToString();
843

  
829 844
            return result;
830 845
        }
831 846

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)