프로젝트

일반

사용자정보

개정판 839708c6

ID839708c689efe1597c65726f5ada9d0a02f55945
상위 45856d85
하위 defbabc8, 8187418d

이지연이(가) 약 3년 전에 추가함

issue #000: Insulation Purpose 추가, Pipeline Data 생성 로직추가

Change-Id: Ia2719fcda0974803ceace2343bc6c2dce7ba7734

차이점 보기:

DTI_PID/ID2PSN/DB.cs
26 26
        const string PSN_TOPOLOGYSET = "SPPIDTopologySet";
27 27
        //2021.11.17 추가 
28 28
        const string PSN_PIPELINE = "SPPIDPipeLine";
29
        //2021.11.26 추가
30
        const string PSN_INSULATIONPURPOSE = "SPPIDInsulationPurpose";
29 31
        /// <summary>
30 32
        ///  ID2 Project.db 데이터를 가져온다. 
31 33
        ///  DB 접속 정보 및 DBType (Sqlite, Mssql) 정보를 가져옴
......
241 243
                        }
242 244
                    }
243 245

  
246
                    matched = names.FirstOrDefault(param => param == PSN_INSULATIONPURPOSE);
247
                    if (matched == null)
248
                    {
249
                        var query = $"CREATE TABLE {PSN_INSULATIONPURPOSE} (UID NVARCHAR(50), Code NVARCHAR(255), Description NVARCHAR(255), Remarks NVARCHAR(255))";
250
                        using (var cmd = connection.GetSqlStringCommand(query))
251
                        {
252
                            cmd.ExecuteNonQuery();
253
                        }
254
                    }
255

  
244 256
                    result = true;
245 257
                }
246 258
                catch (Exception ex)
......
405 417
            return dt;
406 418
        }
407 419

  
420

  
421
        public static DataTable SelectInsulationPurpose()
422
        {
423
            DataTable dt = null;
424
            ID2Info id2Info = ID2Info.GetInstance();
425

  
426
            using (IAbstractDatabase connection = id2Info.CreateConnection())
427
            {
428
                try
429
                {
430
                    var query = "SELECT * FROM InsulationPurpose";
431
                    using (var ds = connection.ExecuteDataSet(connection.GetSqlStringCommand(query)))
432
                    {
433
                        dt = ds.Tables[0].Copy();
434
                    }
435
                }
436
                catch (Exception ex)
437
                {
438
                    Log.Write(ex.Message + "\r\n" + ex.StackTrace);
439
                }
440
            }
441

  
442
            return dt;
443
        }
444

  
445
        public static DataTable SelectPSNINSULATIONPURPOSE()
446
        {
447
            DataTable dt = null;
448
            ID2Info id2Info = ID2Info.GetInstance();
449

  
450
            using (IAbstractDatabase connection = id2Info.CreateConnection(ID2DB_Type.SQLite))
451
            {
452
                try
453
                {
454
                    var query = $"SELECT * FROM {PSN_INSULATIONPURPOSE}";
455
                    using (var ds = connection.ExecuteDataSet(connection.GetSqlStringCommand(query)))
456
                    {
457
                        dt = ds.Tables[0].Copy();
458
                    }
459
                }
460
                catch (Exception ex)
461
                {
462
                    Log.Write(ex.Message + "\r\n" + ex.StackTrace);
463
                }
464
            }
465

  
466
            return dt;
467
        }
468

  
408 469
        public static DataTable SelectNominalDiameter()
409 470
        {
410 471
            DataTable dt = null;
DTI_PID/ID2PSN/Form/PriorityForm.Designer.cs
57 57
            this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
58 58
            this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
59 59
            this.emptySpaceItem5 = new DevExpress.XtraLayout.EmptySpaceItem();
60
            this.xtraInsulationPurpose = new DevExpress.XtraTab.XtraTabPage();
61
            this.gridControlInsulationPurpose = new DevExpress.XtraGrid.GridControl();
62
            this.gridViewInsulationPurpose = new DevExpress.XtraGrid.Views.Grid.GridView();
60 63
            ((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).BeginInit();
61 64
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
62 65
            this.layoutControl1.SuspendLayout();
......
81 84
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit();
82 85
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
83 86
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).BeginInit();
87
            this.xtraInsulationPurpose.SuspendLayout();
88
            ((System.ComponentModel.ISupportInitialize)(this.gridControlInsulationPurpose)).BeginInit();
89
            ((System.ComponentModel.ISupportInitialize)(this.gridViewInsulationPurpose)).BeginInit();
84 90
            this.SuspendLayout();
85 91
            // 
86 92
            // ribbonControl
......
190 196
            this.xtraTabControlSetting.TabIndex = 4;
191 197
            this.xtraTabControlSetting.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
192 198
            this.xtraTabPageFluidCode,
193
            this.xtraTabPagePipingMaterialsClass});
199
            this.xtraTabPagePipingMaterialsClass,
200
            this.xtraInsulationPurpose});
194 201
            // 
195 202
            // xtraTabPageFluidCode
196 203
            // 
......
221 228
            // 
222 229
            this.xtraTabPagePipingMaterialsClass.Controls.Add(this.gridControlPipingMaterialsClass);
223 230
            this.xtraTabPagePipingMaterialsClass.Name = "xtraTabPagePipingMaterialsClass";
224
            this.xtraTabPagePipingMaterialsClass.Size = new System.Drawing.Size(542, 824);
231
            this.xtraTabPagePipingMaterialsClass.Size = new System.Drawing.Size(554, 831);
225 232
            this.xtraTabPagePipingMaterialsClass.Text = "Piping Materials Class";
226 233
            // 
227 234
            // gridControlPipingMaterialsClass
......
231 238
            this.gridControlPipingMaterialsClass.MainView = this.gridViewPipingMaterialsClass;
232 239
            this.gridControlPipingMaterialsClass.MenuManager = this.ribbonControl;
233 240
            this.gridControlPipingMaterialsClass.Name = "gridControlPipingMaterialsClass";
234
            this.gridControlPipingMaterialsClass.Size = new System.Drawing.Size(542, 824);
241
            this.gridControlPipingMaterialsClass.Size = new System.Drawing.Size(554, 831);
235 242
            this.gridControlPipingMaterialsClass.TabIndex = 0;
236 243
            this.gridControlPipingMaterialsClass.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
237 244
            this.gridViewPipingMaterialsClass});
......
393 400
            this.emptySpaceItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
394 401
            this.emptySpaceItem5.TextSize = new System.Drawing.Size(0, 0);
395 402
            // 
403
            // xtraInsulationPurpose
404
            // 
405
            this.xtraInsulationPurpose.Controls.Add(this.gridControlInsulationPurpose);
406
            this.xtraInsulationPurpose.Name = "xtraInsulationPurpose";
407
            this.xtraInsulationPurpose.Size = new System.Drawing.Size(554, 831);
408
            this.xtraInsulationPurpose.Text = "Insulation Purpose";
409
            // 
410
            // gridControlInsulationPurpose
411
            // 
412
            this.gridControlInsulationPurpose.Dock = System.Windows.Forms.DockStyle.Fill;
413
            this.gridControlInsulationPurpose.Location = new System.Drawing.Point(0, 0);
414
            this.gridControlInsulationPurpose.MainView = this.gridViewInsulationPurpose;
415
            this.gridControlInsulationPurpose.MenuManager = this.ribbonControl;
416
            this.gridControlInsulationPurpose.Name = "gridControlInsulationPurpose";
417
            this.gridControlInsulationPurpose.Size = new System.Drawing.Size(554, 831);
418
            this.gridControlInsulationPurpose.TabIndex = 1;
419
            this.gridControlInsulationPurpose.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
420
            this.gridViewInsulationPurpose});
421
            // 
422
            // gridViewInsulationPurpose
423
            // 
424
            this.gridViewInsulationPurpose.GridControl = this.gridControlInsulationPurpose;
425
            this.gridViewInsulationPurpose.Name = "gridViewInsulationPurpose";
426
            this.gridViewInsulationPurpose.OptionsView.ShowGroupPanel = false;
427
            // 
396 428
            // PriorityForm
397 429
            // 
398 430
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
......
429 461
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit();
430 462
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
431 463
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem5)).EndInit();
464
            this.xtraInsulationPurpose.ResumeLayout(false);
465
            ((System.ComponentModel.ISupportInitialize)(this.gridControlInsulationPurpose)).EndInit();
466
            ((System.ComponentModel.ISupportInitialize)(this.gridViewInsulationPurpose)).EndInit();
432 467
            this.ResumeLayout(false);
433 468
            this.PerformLayout();
434 469

  
......
464 499
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6;
465 500
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7;
466 501
        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem5;
502
        private DevExpress.XtraTab.XtraTabPage xtraInsulationPurpose;
503
        private DevExpress.XtraGrid.GridControl gridControlInsulationPurpose;
504
        private DevExpress.XtraGrid.Views.Grid.GridView gridViewInsulationPurpose;
467 505
    }
468 506
}
DTI_PID/ID2PSN/Form/PriorityForm.cs
32 32
        {
33 33
            DataTable fluidCodeDT = DB.SelectFluidCode();
34 34
            DataTable pipingMaterialDT = DB.SelectPipingMaterialsClass();
35
            DataTable insulationPurpose = DB.SelectInsulationPurpose();
36

  
35 37
            DataTable PSNFluidDT = DB.SelectPSNFluidCode();
36 38
            DataTable PSNPMCDT = DB.SelectPSNPIPINGMATLCLASS();
39
            DataTable PSNINSULATIONDT = DB.SelectPSNINSULATIONPURPOSE();
37 40

  
38 41
            RepositoryItemComboBox groundLevelCB = new RepositoryItemComboBox();
39 42
            groundLevelCB.Items.AddRange(new string[] { "AG", "UG", "AG_UG" });
......
47 50
            conditionPMC.Items.AddRange(new string[] { "Normal", "Ignore" });
48 51
            conditionPMC.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
49 52

  
53
            // InsulationPurpose
54
            DataTable InsulationViewDT = new DataTable();
55
            InsulationViewDT.Columns.Add("UID", typeof(string));
56
            InsulationViewDT.Columns.Add("Code", typeof(string));
57
            InsulationViewDT.Columns.Add("Description", typeof(string));
58
            InsulationViewDT.Columns.Add("Remarks", typeof(string));
59
            foreach (DataRow row in PSNINSULATIONDT.Rows)
60
            {
61
                string uid = row["UID"].ToString();
62
                DataRow[] rows = InsulationViewDT.Select(string.Format("UID = '{0}'", uid));
63
                if (rows.Length == 1)
64
                {
65
                    DataRow oldRow = rows.First();
66
                    DataRow newRow = InsulationViewDT.NewRow();
67
                    newRow["UID"] = row["UID"];
68
                    newRow["Code"] = row["Code"];
69
                    newRow["Description"] = row["Description"];
70
                    newRow["Remarks"] = row["Allowables"];
71
                    InsulationViewDT.Rows.Add(newRow);
72
                    InsulationViewDT.Rows.Remove(oldRow);
73
                }
74
            }
75
            foreach (DataRow row in InsulationViewDT.Rows)
76
            {
77
                DataRow newRow = InsulationViewDT.NewRow();
78
                newRow["UID"] = row["UID"];
79
                newRow["Code"] = row["Code"];
80
                newRow["Description"] = row["Description"];
81
                newRow["Remarks"] = row["Allowables"];
82
                InsulationViewDT.Rows.Add(newRow);
83
            }
84
            gridControlInsulationPurpose.DataSource = InsulationViewDT;           
85
            gridViewInsulationPurpose.Columns["UID"].OptionsColumn.AllowEdit = false;
86
            gridViewInsulationPurpose.Columns["UID"].Visible = false;
87
            gridViewInsulationPurpose.Columns["Code"].OptionsColumn.AllowEdit = false;
88
            gridViewInsulationPurpose.Columns["Description"].OptionsColumn.AllowEdit = false;
89
            gridViewInsulationPurpose.Columns["Remarks"].OptionsColumn.AllowEdit = false;
90
            gridViewInsulationPurpose.OptionsCustomization.AllowSort = false;
91
            gridViewInsulationPurpose.OptionsCustomization.AllowFilter = false;
92

  
50 93
            // FluidCode
51 94
            DataTable fluidViewDT = new DataTable();
52 95
            fluidViewDT.Columns.Add("UID", typeof(string));
......
96 139
            gridViewFluidCode.OptionsCustomization.AllowSort = false;
97 140
            gridViewFluidCode.OptionsCustomization.AllowFilter = false;
98 141

  
99

  
100 142
            // PipingMaterial
101 143
            DataTable pipingMaterialViewDT = new DataTable();
102 144
            pipingMaterialViewDT.Columns.Add("UID", typeof(string));
DTI_PID/ID2PSN/PSN.cs
1238 1238
                                    if (bVentDrain)
1239 1239
                                        return;
1240 1240

  
1241
                                    DataRow newPipelineRow = pipelineDT.NewRow();
1242
                                    newPipelineRow["OID"] = item.PSNPipeLineID; //Topology Rule Setting으로 넣은 값 (F/C, PMC, I/C, SEQ NO)
1243
                                    newPipelineRow["PipeSystem_OID"] = PSNItem.PSN_OID();
1244
                                    /* PipeSystem_OID
1245
                                      Topology Rule Setting이 F/C-PMC-SEQ NO-I/C일 때, 아래 2) + 5) + 6) 조합으로 생성
1246
                    * 도면에 있는 Pipe Line Number 기준 생성해주고, Post-processing으로 Virtual Data (20"-PG-25-031V-9A1A1)로 생성해준 데이터도 여기에 다시 생성
1247
                    */
1248
                                    newPipelineRow["FLUID"] = "";
1249
                                    newPipelineRow["PMC"] = "";
1250
                                    newPipelineRow["SEQNUMBER"] = "";
1251
                                    newPipelineRow["INSULATION"] = "";
1252
                                    newPipelineRow["FROM_DATA"] = string.Empty;
1253
                                    newPipelineRow["TO_DATA"] = string.Empty;
1254
                                    newPipelineRow["Unit"] = PSNItem.GetPBSData();
1255
                                    pipelineDT.Rows.Add(newPipelineRow);
1241
                                    LineNumber lineNumber = item.Document.LineNumbers.Find(x => x.UID == item.Owner);
1242
                                    if (lineNumber != null)
1243
                                    {
1244
                                        List<Attribute> att = lineNumber.Attributes;
1245
                                        if(att != null)
1246
                                        {
1247
                                            DataRow newPipelineRow = pipelineDT.NewRow();
1248
                                            List<string> oid = new List<string>();
1249
                                            string FluidCode = att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault() != null ? att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault().Value : string.Empty;
1250
                                            string PMC = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault().Value : string.Empty;
1251
                                            string SEQNUMBER = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault().Value : string.Empty;
1252
                                            string INSULATION = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault().Value : string.Empty;
1253
                                            //InsulationPurpose
1254
                                            if (!string.IsNullOrEmpty(FluidCode)) oid.Add(FluidCode);
1255
                                            if (!string.IsNullOrEmpty(PMC)) oid.Add(PMC);                                          
1256

  
1257
                                            string PipeSystem_OID = string.Join("-", oid);
1258

  
1259
                                            if (!string.IsNullOrEmpty(SEQNUMBER)) oid.Add(SEQNUMBER);
1260
                                            if (!string.IsNullOrEmpty(INSULATION)) oid.Add(INSULATION);
1261

  
1262
                                            string OID = string.Join("-", oid);
1263
                                           
1264
                                            newPipelineRow["OID"] = OID;
1265
                                            newPipelineRow["PipeSystem_OID"] = PipeSystem_OID;
1266
                                            newPipelineRow["FLUID"] = FluidCode;
1267
                                            newPipelineRow["PMC"] = PMC;
1268
                                            newPipelineRow["SEQNUMBER"] = SEQNUMBER;
1269
                                            newPipelineRow["INSULATION"] = INSULATION;
1270
                                            newPipelineRow["FROM_DATA"] = string.Empty;
1271
                                            newPipelineRow["TO_DATA"] = string.Empty;
1272
                                            newPipelineRow["Unit"] = PSNItem.GetPBSData();
1273
                                            pipelineDT.Rows.Add(newPipelineRow);
1274
                                        }                                        
1275
                                    }
1256 1276

  
1257 1277
                                    DataRow newRow = pipeSystemNetworkDT.NewRow();
1258 1278
                                    newRow["OID"] = PSNItem.PSN_OID();

내보내기 Unified diff

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