프로젝트

일반

사용자정보

개정판 c7db500b

IDc7db500b482e99105d730db90533221e7fb11775
상위 d327a608
하위 b244f30e, 05851873, 0169b3c7

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

dev issue #1226 : dev converter form

Change-Id: I460e2fe84c8d64a716b3fd2704154bcebe3f47b6

차이점 보기:

DTI_PID/APIDConverter/Form/APIDConverter.cs
31 31
        DataTable ID2SymbolTypeTable = null;
32 32
        private DataTable _ConverterDT = new DataTable();
33 33
        public List<Document> Documents = new List<Document>();
34
        private Dictionary<string, Document> _DicDocuments = new Dictionary<string, Document>();
34 35

  
35 36
        private void InitUsedDataTable()
36 37
        {
......
39 40
            col.Caption = "Drawing File Name";
40 41
            col = _ConverterDT.Columns.Add("colDrawingFilePath");
41 42
            col.Caption = "DrawingFilePath";
42
            col = _ConverterDT.Columns.Add("colUnit");
43
            col.Caption = "Unit";
44
            col = _ConverterDT.Columns.Add("colTemplate");
45
            col.Caption = "Template";
46
            col = _ConverterDT.Columns.Add("colDrawingNumber");
47
            col.Caption = "Drawing Number";
48
            col = _ConverterDT.Columns.Add("colDrawingName");
49
            col.Caption = "Drawing Name";
50 43
            col = _ConverterDT.Columns.Add("colStatus");
51 44
            col.Caption = "Status";
52 45
            col = _ConverterDT.Columns.Add("colUID");
......
60 53

  
61 54
            gridControlConverter.DataSource = _ConverterDT;
62 55

  
63
            gridViewConverter.Columns["colUnit"].OptionsColumn.AllowEdit = false;
64 56
            gridViewConverter.Columns["colDrawingFileName"].OptionsColumn.AllowEdit = false;
65
            gridViewConverter.Columns["colUnit"].OptionsColumn.ReadOnly = true;
66 57
            gridViewConverter.Columns["colStatus"].OptionsColumn.AllowEdit = false;
67 58
            gridViewConverter.Columns["colDrawingFilePath"].Visible = false;
68 59
            gridViewConverter.Columns["colUID"].Visible = false;
......
86 77
                foreach (var fileName in dia.FileNames)
87 78
                {
88 79
                    Document document = new Document(fileName, ID2SymbolTypeTable);
89
                    if (document.Enable)
80

  
81
                    DataRow[] rows = _ConverterDT.Select(string.Format("colDrawingFilePath = '{0}'", fileName));
82
                    if (rows.Length == 0)
90 83
                    {
91
                        Documents.Add(document);
84
                        DataRow row = _ConverterDT.NewRow();
85
                        row["colDrawingFileName"] = Path.GetFileNameWithoutExtension(fileName);
86
                        row["colDrawingFilePath"] = fileName;
87
                        if (document.Enable)
88
                            row["colStatus"] = "Ready";
89
                        else
90
                            row["colStatus"] = "Error";
91
                        row["colUID"] = "";
92

  
93
                        _ConverterDT.Rows.Add(row);
94

  
95
                        if (document.Enable)
96
                            gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
92 97
                    }
98
                    else
99
                    {
100
                        foreach (DataRow row in rows)
101
                        {
102
                            if (document.Enable)
103
                                row["colStatus"] = "Ready";
104
                            else
105
                                row["colStatus"] = "Error";
106
                           
107
                            if (document.Enable)
108
                                gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
109
                        }
110
                    }
111

  
112
                    if (!_DicDocuments.ContainsKey(fileName))
113
                        _DicDocuments.Add(fileName, null);
114

  
115
                    _DicDocuments[fileName] = document;
93 116
                }
94 117
            }
95 118
        }
......
107 130
                ID2SymbolTypeTable = Project_DB.SelectSymbolType();
108 131
            }
109 132
        }
133

  
134
        private void btnRun_Click(object sender, EventArgs e)
135
        {
136
            if (gridViewConverter.GetSelectedRows().Length == 0)
137
            {
138
                MessageBox.Show("Select Document", "APID Converter", MessageBoxButtons.OK, MessageBoxIcon.Warning);
139
                return;
140
            }
141

  
142
            DataTable tDrawing = Project_DB.SelectDrawings();
143
            Documents.Clear();
144
            foreach (int rowHandle in gridViewConverter.GetSelectedRows())
145
            {
146
                string _FilePath = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingFilePath");
147

  
148
                DataRow[] rows = tDrawing.Select(string.Format("NAME = '{0}'", Path.GetFileNameWithoutExtension(_FilePath) + ".png"));
149
                if (rows.Length != 1)
150
                    continue;
151

  
152
                Document document = _DicDocuments[_FilePath];
153
                document.UID = rows[0]["UID"].ToString();
154
                Documents.Add(document);
155
            }
156

  
157
            DialogResult = DialogResult.OK;
158
        }
159

  
160
        private void btnRefresh_Click(object sender, EventArgs e)
161
        {
162
            foreach (DataRow row in _ConverterDT.Rows)
163
            {
164
                string fileName = row["colDrawingFilePath"].ToString();
165
                Document document = new Document(fileName, ID2SymbolTypeTable);
166

  
167
                row["colDrawingNumber"] = document.DWGNAME;
168
                row["colDrawingName"] = document.DWGNAME;
169
                if (document.Enable)
170
                    row["colStatus"] = "Ready";
171
                else
172
                    row["colStatus"] = "Error";
173

  
174
                if (!_DicDocuments.ContainsKey(fileName))
175
                    _DicDocuments.Add(fileName, null);
176

  
177
                _DicDocuments[fileName] = document;
178

  
179
                if (document.Enable)
180
                    gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
181
            }
182
        }
110 183
    }
111 184
}

내보내기 Unified diff

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