프로젝트

일반

사용자정보

개정판 e88aae98

IDe88aae982bfae2eb97922def2322b9922314cab9
상위 7c7bcd10
하위 aea96e14, ad0194f0

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

dev issue #1134 : SPPID Attribute 목록들을 사용자에게 보여주고 선택가능하게 수정.

Change-Id: Ic7d15ede6c81932abb6575f85668ab134225e610

차이점 보기:

DTI_PID/SPPIDConverter/ConverterForm.cs
32 32
        private DataTable _ConverterDT = new DataTable();
33 33
        private DataTable _SPPIDSymbolPathDT = new DataTable();
34 34
        private DataTable _SPPIDUnitDT = new DataTable();
35
        private DataTable _SPPIDAttributeDT = new DataTable();
35 36
        private RepositoryItemComboBox templateComboBox;
36 37

  
37 38

  
......
371 372
                if (!string.IsNullOrEmpty(TemplatePath))
372 373
                    templateComboBox.Items.AddRange(Directory.GetFiles(TemplatePath, "*.pid").ToList().Select(filePath => Path.GetFileName(filePath)).ToList());
373 374

  
375
                if (_SPPIDUnitDT != null)
376
                {
377
                    _SPPIDUnitDT.Dispose();
378
                    _SPPIDUnitDT = null;
379
                }
380
                if (_SPPIDAttributeDT != null)
381
                {
382
                    _SPPIDAttributeDT.Dispose();
383
                    _SPPIDAttributeDT = null;
384
                }
385

  
374 386
                _SPPIDUnitDT = SPPID_DB.GetUnitTree();
387
                _SPPIDAttributeDT = SPPID_DB.GetSPPIDAttribute();
388
                if (_SPPIDAttributeDT != null)
389
                {
390
                    _SPPIDAttributeDT.Columns["DISPLAYNAME"].ColumnName = "DISPLAY NAME";
391
                }
375 392

  
376 393
                layoutControlGroupAutoConverter.Enabled = true;
377 394
            }
......
521 538
                return;
522 539
            }
523 540

  
524
            MappingForm form = new MappingForm(_ID2SymbolDT,_SPPIDSymbolPathDT, _ID2LineDT, _ID2LinePropertyDT, _ID2AttributeDT);
541
            MappingForm form = new MappingForm(_ID2SymbolDT,_SPPIDSymbolPathDT, _ID2LineDT, _ID2LinePropertyDT, _ID2AttributeDT, _SPPIDAttributeDT);
525 542
            form.ShowDialog();
526 543
            InitMapping();
527 544
        }
DTI_PID/SPPIDConverter/DB/Project_DB.cs
500 500
            return dt;
501 501
        }
502 502

  
503

  
504

  
505 503
        public static bool InsertSymbolMapping(List<Tuple<string, string, string, bool>> datas)
506 504
        {
507 505
            Project_Info projectInfo = Project_Info.GetInstance();
DTI_PID/SPPIDConverter/DB/SPPID_DB.cs
299 299
            return TemplatePath;
300 300
        }
301 301

  
302
        public static List<string> GetSPPIDAttribute()
302
        public static DataTable GetSPPIDAttribute()
303 303
        {
304 304
            List<string> attributes = new List<string>();
305 305
            SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance();
306
            DataTable dt = null;
306 307
            try
307 308
            {
308 309
                if (dbInfo.DBType == "ORACLE")
......
315 316
                        conn.Open();
316 317
                        if (conn.State == System.Data.ConnectionState.Open)
317 318
                        {
318
                            using (OracleCommand cmd = new OracleCommand())
319
                            string sQuery = string.Format(CultureInfo.CurrentCulture,
320
                                @"SELECT DISTINCT(ATTR.displayname), ATTR.name FROM {0}.itemattributions ATTR
321
                                ORDER BY ATTR.displayname ASC", dbInfo.PlantPIDDic);
322
                            using (OracleCommand cmd = new OracleCommand(sQuery, conn))
323
                            using (OracleDataAdapter adapter = new OracleDataAdapter())
319 324
                            {
320
                                cmd.Connection = conn;
321

  
322
                                // 정리 필요
323
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPMENT");
324
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
325
                                {
326
                                    DataTable dt = reader.GetSchemaTable();
327
                                    foreach (DataRow row in dt.Rows)
328
                                        attributes.Add(row["ColumnName"].ToString());
329
                                }
330

  
331
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_NOZZLE");
332
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
333
                                {
334
                                    DataTable dt = reader.GetSchemaTable();
335
                                    foreach (DataRow row in dt.Rows)
336
                                        attributes.Add(row["ColumnName"].ToString());
337
                                }
338

  
339
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPINGCOMP");
340
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
341
                                {
342
                                    DataTable dt = reader.GetSchemaTable();
343
                                    foreach (DataRow row in dt.Rows)
344
                                        attributes.Add(row["ColumnName"].ToString());
345
                                }
346

  
347
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPERUN");
348
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
349
                                {
350

  
351
                                    DataTable dt = reader.GetSchemaTable();
352
                                    foreach (DataRow row in dt.Rows)
353
                                        attributes.Add(row["ColumnName"].ToString());
354
                                }
355

  
356
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INSTRUMENT");
357
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
358
                                {
359
                                    DataTable dt = reader.GetSchemaTable();
360
                                    foreach (DataRow row in dt.Rows)
361
                                        attributes.Add(row["ColumnName"].ToString());
362
                                }
363

  
364
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INLINECOMP");
365
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
366
                                {
367
                                    DataTable dt = reader.GetSchemaTable();
368
                                    foreach (DataRow row in dt.Rows)
369
                                        attributes.Add(row["ColumnName"].ToString());
370
                                }
371

  
372
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_VESSEL");
373
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
374
                                {
375
                                    DataTable dt = reader.GetSchemaTable();
376
                                    foreach (DataRow row in dt.Rows)
377
                                        attributes.Add(row["ColumnName"].ToString());
378
                                }
379

  
380
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EXCHANGER");
381
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
382
                                {
383
                                    DataTable dt = reader.GetSchemaTable();
384
                                    foreach (DataRow row in dt.Rows)
385
                                        attributes.Add(row["ColumnName"].ToString());
386
                                }
387

  
388
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_MECHANICAL");
389
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
390
                                {
391
                                    DataTable dt = reader.GetSchemaTable();
392
                                    foreach (DataRow row in dt.Rows)
393
                                        attributes.Add(row["ColumnName"].ToString());
394
                                }
395

  
396
                                cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPCOMPONENT");
397
                                using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
398
                                {
399
                                    DataTable dt = reader.GetSchemaTable();
400
                                    foreach (DataRow row in dt.Rows)
401
                                        attributes.Add(row["ColumnName"].ToString());
402
                                }
403

  
325
                                adapter.SelectCommand = cmd;
326
                                dt = new DataTable();
327
                                adapter.Fill(dt);
404 328
                            }
405 329
                        }
406 330
                    }
......
415 339
                System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
416 340
            }
417 341

  
418

  
419

  
420
            return attributes.Distinct().ToList();
342
            return dt;
421 343
        }
422 344
    }
423 345
}
DTI_PID/SPPIDConverter/Form/MappingForm.cs
55 55
        DataTable lineDT;
56 56
        DataTable linePropertyDT;
57 57
        DataTable attributeDT;
58
        DataTable SPPIDAttributeDT;
58 59

  
59 60
        ButtonEdit currentButtonEdit;
60
        public MappingForm(DataTable symbolDT, DataTable SPPIDSymbolPathDT, DataTable lineDT, DataTable linePropertyDT, DataTable attributeDT)
61
        public MappingForm(DataTable symbolDT, DataTable SPPIDSymbolPathDT, DataTable lineDT, DataTable linePropertyDT, DataTable attributeDT, DataTable SPPIDAttributeDT)
61 62
        {
62 63
            InitializeComponent();
63 64
            this.symbolDT = symbolDT;
......
65 66
            this.lineDT = lineDT;
66 67
            this.linePropertyDT = linePropertyDT;
67 68
            this.attributeDT = attributeDT;
69
            this.SPPIDAttributeDT = SPPIDAttributeDT;
68 70

  
69 71
            checkComboBoxTextLocation.EditValueChanging += TextEdit1_EditValueChanging;
70 72
            checkComboBoxTextLocation.Properties.SeparatorChar = ',';
......
154 156
                if (DBNull.Value.Equals(item["LEADERLINE"]))
155 157
                    item["LEADERLINE"] = false;
156 158
            }
157
                
159

  
160
            RepositoryItemLookUpEdit lookUpEdit = new RepositoryItemLookUpEdit();
161
            lookUpEdit.BeginInit();
162
            lookUpEdit.DataSource = SPPIDAttributeDT;
163
            lookUpEdit.DisplayMember = "DISPLAY NAME";
164
            lookUpEdit.ValueMember = "NAME";
165
            lookUpEdit.NullText = "";
166
            lookUpEdit.BestFitMode = BestFitMode.BestFitResizePopup;
167
            lookUpEdit.BestFit();
168
            lookUpEdit.KeyUp += lookUpEdit_KeyUp;
169
            lookUpEdit.EndInit();
170

  
158 171
            checkedComboEdit.EditValueChanging += TextEdit1_EditValueChanging;
159 172
            checkedComboEdit.SeparatorChar = ',';
160 173
            checkedComboEdit.SetFlags(typeof(Model.Location));
161 174
            checkedComboEdit.SelectAllItemVisible = false;
162 175
            removeCombinedFlags(checkedComboEdit);
163 176

  
177
            gridControlAttribute.RepositoryItems.Add(lookUpEdit);
164 178
            gridControlAttribute.RepositoryItems.Add(checkedComboEdit);
179
            gridViewAttribute.Columns["SPPID_ATTRIBUTE"].ColumnEdit = lookUpEdit;
165 180
            gridViewAttribute.Columns["LOCATION"].ColumnEdit = checkedComboEdit;
166 181
            gridControlAttribute.RepositoryItems.Add(clearButton);
167 182
            gridViewAttribute.ExpandAllGroups();
......
175 190
            gridViewLineNumber.Columns["Type"].GroupIndex = 0;
176 191
            gridViewLineNumber.ExpandAllGroups();
177 192

  
193
            gridControlLineNumber.RepositoryItems.Add(lookUpEdit);
194
            gridViewLineNumber.Columns["SPPID_ATTRIBUTE"].ColumnEdit = lookUpEdit;
178 195

  
179 196
            // Common
180 197
            gridViewSymbol.Columns["Clear"].ColumnEdit = clearButton;
......
185 202
            gridViewAttribute.Columns["Clear"].MaxWidth = 16;
186 203
        }
187 204

  
205
        private void lookUpEdit_KeyUp(object sender, KeyEventArgs e)
206
        {
207
            LookUpEdit edit = sender as LookUpEdit;
208
            if (e.KeyCode == Keys.Delete)
209
            {
210
                edit.ClosePopup();
211
                edit.EditValue = null;
212
            }
213
            e.Handled = true;
214
        }
215

  
188 216
        private void TextEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
189 217
        {
190 218
            Model.Location location = (Model.Location)e.NewValue;
......
352 380
                symbolDatas.Add(new Tuple<string, string, string, bool>(_uid, _name, _SPPIDSymbolPath, false));
353 381
            }
354 382

  
355

  
356 383
            foreach (DataRow row in linePropertyDT.Rows)
357 384
            {
358 385
                string _uid = row["UID"].ToString();

내보내기 Unified diff

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