프로젝트

일반

사용자정보

개정판 bd86dd48

IDbd86dd48e66164347aa66a1d0db05057153b1f94
상위 030ee6a2
하위 9bb7a028

이지연이(가) 2년 이상 전에 추가함

issue #000: Setting Secondary 조건 수정, Header Rule 로직 수정, tieinpoint 로직 수정

Change-Id: I84ad7e4f5784ca7a0886e8900f2526f8d034e81a

차이점 보기:

DTI_PID/ID2PSN/DB.cs
893 893
            return dt;
894 894
        }
895 895

  
896
        public static DataTable SelectTieInSymbolAttribute()
897
        {
898
            DataTable dt = null;
899
            ID2Info id2Info = ID2Info.GetInstance();
900

  
901
            using (IAbstractDatabase connection = id2Info.CreateConnection())
902
            {
903
                try
904
                {
905
                    // var query = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;";
906
                    var query = string.Empty;
907
                    if (id2Info.ID2DBType == ID2DB_Type.MSSQL)
908
                        query = "SELECT DISTINCT Attribute FROM SymbolAttribute WHERE SymbolType_UID IN(SELECT SymbolType_UID FROM Symbol WHERE CONVERT(varchar(Max), isnull([Name], '')) = 'TIEINPOINT');";
909
                    else
910
                        query = "SELECT DISTINCT Attribute FROM SymbolAttribute WHERE SymbolType_UID IN(SELECT SymbolType_UID FROM Symbol WHERE ifnull([Name], '') = 'TIEINPOINT');";
911

  
912
                    using (var ds = connection.ExecuteDataSet(connection.GetSqlStringCommand(query)))
913
                    {
914
                        dt = ds.Tables[0].Copy();
915
                    }
916
                }
917
                catch (Exception ex)
918
                {
919
                    Log.Write(ex.Message + "\r\n" + ex.StackTrace);
920
                }
921
            }
922

  
923
            return dt;
924
        }
925

  
896 926
        public static DataTable SelectSymbolName()
897 927
        {
898 928
            DataTable dt = null;
DTI_PID/ID2PSN/Document.cs
127 127
        private LineNumber GetLineNumber(XElement element)
128 128
        {
129 129
            LineNumber lineNumber = new LineNumber();
130
            lineNumber.UID = element.Element("UID").Value;
130
            lineNumber.UID = element.Element("UID").Value;           
131 131
            lineNumber.Name = element.Element("TEXT").Value;
132 132
            lineNumber.Attributes = GetAttributes(element);
133 133
            return lineNumber;
......
183 183
            List<Attribute> result = new List<Attribute>();
184 184
            foreach (XElement item in element.Elements("ATTRIBUTE"))
185 185
            {
186
               
186 187
                result.Add(new Attribute()
187 188
                {
188 189
                    UID = item.Attribute("UID").Value,
......
406 407
                    HeaderInfos.Add(headerInfo);
407 408
                }
408 409

  
410

  
409 411
                headerInfo.HeaderItems.Add(new HeaderItem()
410 412
                {
411 413
                    Index = index,
412 414
                    Name = name
413 415
                });
414 416
            }
417

  
418

  
415 419
            foreach (HeaderInfo headerInfo in HeaderInfos)
416
                headerInfo.HeaderItems = headerInfo.HeaderItems.OrderBy(x => x.Index).ToList();
420
                headerInfo.HeaderItems = headerInfo.HeaderItems.OrderByDescending(x => x.Index).ToList();
417 421

  
418 422
            foreach (Group group in Groups)
419 423
            {
420
                List<HeaderInfo> endInfos = new List<HeaderInfo>();
421
                bool bFind = false;
422
                for (int i = 0; i < group.Items.Count; i++)
424
                foreach (HeaderInfo header in HeaderInfos)
423 425
                {
424
                    Item item = group.Items[i];
425
                    foreach (HeaderInfo header in HeaderInfos)
426
                    if (group.Items.Count < header.HeaderItems.Count)
426 427
                    {
427
                        if (endInfos.Contains(header))
428
                            continue;
429

  
430
                        if (!header.HeaderItems[i].Name.Equals(item.Name))
431
                        {
432
                            endInfos.Add(header);
433
                            continue;
434
                        }
428
                        continue;
429
                    }
435 430

  
436
                        if (header.HeaderItems.Count.Equals(i + 1))
431
                    bool found = true;
432
                    for (int i = 0; i < header.HeaderItems.Count; i++)
433
                    {
434
                        if (!header.HeaderItems[header.HeaderItems.Count - 1 - i].Name.Equals(group.Items[i].Name))
437 435
                        {
438
                            for (int j = 0; j < i + 1; j++)
439
                                group.Items[j].SubItemType = SubItemType.Header;
440
                            bFind = true;
436
                            found = false;
441 437
                            break;
442 438
                        }
443 439
                    }
444

  
445
                    if (bFind || endInfos.Count.Equals(HeaderInfos.Count))
446
                        break;
447
                }
448

  
449
                endInfos = new List<HeaderInfo>();
450
                bFind = false;
451
                for (int i = 0; i < group.Items.Count; i++)
452
                {
453
                    Item item = group.Items[group.Items.Count - i - 1];
454
                    foreach (HeaderInfo header in HeaderInfos)
440
                    if (found)
455 441
                    {
456
                        if (endInfos.Contains(header))
457
                            continue;
442
                        found = false;
443
                        List<Item> branches = new List<Item>();
444
                        //for (int i = 0; i < header.HeaderItems.Count; i++)
445
                        //{
446
                        //    if (group.Items[i].ItemType == ItemType.Line)
447
                        //    {
448
                                foreach(var _line in group.Items.Where(x=>x.ItemType == ItemType.Line))
449
                                {
450
                                    branches = Groups.Where(w => w != group).SelectMany(s => s.Items).Where(w => w.ItemType == ItemType.Line).Where(w => w.Relations[0].Item == _line || w.Relations[1].Item == _line).ToList();
451
                                    if (branches.Count > 0)
452
                                    {
453
                                        found = true;
454
                                        break;
455
                                    }
456

  
457
                                    if (found)
458
                                        break;
459
                                }                                
460
                        //    }
461
                        //}
458 462

  
459
                        if (!header.HeaderItems[i].Name.Equals(item.Name))
463
                        if (found)
460 464
                        {
461
                            endInfos.Add(header);
462
                            continue;
465
                            for (int i = 0; i < header.HeaderItems.Count; i++)
466
                            {
467
                                group.Items[i].SubItemType = SubItemType.Header;
468
                            }
463 469
                        }
470
                    }
464 471

  
465
                        if (header.HeaderItems.Count.Equals(i + 1))
472
                    found = true;
473
                    for (int i = 0; i < header.HeaderItems.Count; i++)
474
                    {
475
                        if (!header.HeaderItems[i].Name.Equals(group.Items[group.Items.Count - header.HeaderItems.Count + i].Name))
466 476
                        {
467
                            for (int j = 0; j < i + 1; j++)
468
                                group.Items[group.Items.Count - j - 1].SubItemType = SubItemType.Header;
469
                            bFind = true;
477
                            found = false;
470 478
                            break;
471 479
                        }
472 480
                    }
481
                    if (found)
482
                    {
483
                        found = false;
484
                        List<Item> branches = new List<Item>();
485
                        //for (int i = 0; i < header.HeaderItems.Count; i++)
486
                        //{
487
                        //    if (group.Items[group.Items.Count - 1 - i].ItemType == ItemType.Line)
488
                        //    {
489

  
490
                                foreach (var _line in group.Items.Where(x => x.ItemType == ItemType.Line))
491
                                {
492
                                    branches = Groups.Where(w => w != group).SelectMany(s => s.Items).Where(w => w.ItemType == ItemType.Line).Where(w => w.Relations[0].Item == _line || w.Relations[1].Item == _line).ToList();
493
                                    if (branches.Count > 0)
494
                                    {
495
                                        found = true;
496
                                        break;
497
                                    }
498

  
499
                                    if (found)
500
                                        break;
501
                                }                                
502
                        //    }
503
                        //}
473 504

  
474
                    if (bFind || endInfos.Count.Equals(HeaderInfos.Count))
475
                        break;
505
                        if (found)
506
                        {
507
                            for (int i = 0; i < header.HeaderItems.Count; i++)
508
                            {
509
                                group.Items[group.Items.Count - 1 - i].SubItemType = SubItemType.Header;
510
                            }
511
                        }
512
                    }
476 513
                }
477 514
            }
515

  
478 516
            #endregion
479 517

  
518
            //#region HeaderSetting
519
            //List<HeaderInfo> HeaderInfos = new List<HeaderInfo>();
520
            //DataTable dt = DB.SelectHeaderSetting();
521
            //foreach (DataRow row in dt.Rows)
522
            //{
523
            //    string groupID = row["GROUP_ID"].ToString();
524
            //    string desc = row["DESCRIPTION"].ToString();
525
            //    int index = Convert.ToInt32(row["INDEX"]);
526
            //    string name = row["NAME"].ToString();
527

  
528
            //    HeaderInfo headerInfo = HeaderInfos.Find(x => x.UID.Equals(groupID));
529
            //    if (headerInfo == null)
530
            //    {
531
            //        headerInfo = new HeaderInfo(groupID);
532
            //        headerInfo.Description = desc;
533
            //        HeaderInfos.Add(headerInfo);
534
            //    }
535

  
536
            //    headerInfo.HeaderItems.Add(new HeaderItem()
537
            //    {
538
            //        Index = index,
539
            //        Name = name
540
            //    });
541
            //}
542
            //foreach (HeaderInfo headerInfo in HeaderInfos)
543
            //    headerInfo.HeaderItems = headerInfo.HeaderItems.OrderBy(x => x.Index).ToList();
544

  
545
            //foreach (Group group in Groups)
546
            //{
547
            //    List<HeaderInfo> endInfos = new List<HeaderInfo>();
548
            //    bool bFind = false;
549
            //    for (int i = 0; i < group.Items.Count; i++)
550
            //    {
551
            //        Item item = group.Items[i];
552
            //        foreach (HeaderInfo header in HeaderInfos)
553
            //        {
554
            //            if (endInfos.Contains(header))
555
            //                continue;
556

  
557
            //            if (!header.HeaderItems[i].Name.Equals(item.Name))
558
            //            {
559
            //                endInfos.Add(header);
560
            //                continue;
561
            //            }
562

  
563
            //            if (header.HeaderItems.Count.Equals(i + 1))
564
            //            {
565
            //                for (int j = 0; j < i + 1; j++)
566
            //                    group.Items[j].SubItemType = SubItemType.Header;
567
            //                bFind = true;
568
            //                break;
569
            //            }
570
            //        }
571

  
572
            //        if (bFind || endInfos.Count.Equals(HeaderInfos.Count))
573
            //            break;
574
            //    }
575

  
576
            //    endInfos = new List<HeaderInfo>();
577
            //    bFind = false;
578
            //    for (int i = 0; i < group.Items.Count; i++)
579
            //    {
580
            //        Item item = group.Items[group.Items.Count - i - 1];
581
            //        foreach (HeaderInfo header in HeaderInfos)
582
            //        {
583
            //            if (endInfos.Contains(header))
584
            //                continue;
585

  
586
            //            if (!header.HeaderItems[i].Name.Equals(item.Name))
587
            //            {
588
            //                endInfos.Add(header);
589
            //                continue;
590
            //            }
591

  
592
            //            if (header.HeaderItems.Count.Equals(i + 1))
593
            //            {
594
            //                for (int j = 0; j < i + 1; j++)
595
            //                    group.Items[group.Items.Count - j - 1].SubItemType = SubItemType.Header;
596
            //                bFind = true;
597
            //                break;
598
            //            }
599
            //        }
600

  
601
            //        if (bFind || endInfos.Count.Equals(HeaderInfos.Count))
602
            //            break;
603
            //    }
604
            //}
605
            //#endregion
606

  
480 607
            //#region KeywordSetting
481 608
            ////List<KeywordInfo> KeywordInfos = new List<KeywordInfo>();
482 609
            //DataTable dtKeyword = DB.SelectKeywordsSetting();
DTI_PID/ID2PSN/Form/EquipmentNoPocketSetting.cs
204 204

  
205 205
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
206 206

  
207
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
207
                if (bLine)
208 208
                {
209 209
                    bLine = false;
210 210
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/Form/EquipmentSetting.cs
365 365

  
366 366
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
367 367

  
368
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
368
                //if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
369
                if(bLine)
369 370
                {
370 371
                    bLine = false;
371 372
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/Form/HeaderSettingForm.Designer.cs
94 94
            this.ribbonControl.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.False;
95 95
            this.ribbonControl.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages;
96 96
            this.ribbonControl.ShowToolbarCustomizeItem = false;
97
            this.ribbonControl.Size = new System.Drawing.Size(920, 32);
97
            this.ribbonControl.Size = new System.Drawing.Size(944, 32);
98 98
            this.ribbonControl.Toolbar.ShowCustomizeItem = false;
99 99
            // 
100 100
            // layoutControl1
......
110 110
            this.layoutControl1.Location = new System.Drawing.Point(0, 32);
111 111
            this.layoutControl1.Name = "layoutControl1";
112 112
            this.layoutControl1.Root = this.Root;
113
            this.layoutControl1.Size = new System.Drawing.Size(920, 631);
113
            this.layoutControl1.Size = new System.Drawing.Size(944, 643);
114 114
            this.layoutControl1.TabIndex = 1;
115 115
            this.layoutControl1.Text = "layoutControl1";
116 116
            // 
......
120 120
            this.labelControlToolTip.ImageAlignToText = DevExpress.XtraEditors.ImageAlignToText.RightCenter;
121 121
            this.labelControlToolTip.ImageOptions.Alignment = System.Drawing.ContentAlignment.MiddleLeft;
122 122
            this.labelControlToolTip.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("labelControlToolTip.ImageOptions.Image")));
123
            this.labelControlToolTip.Location = new System.Drawing.Point(838, 12);
123
            this.labelControlToolTip.Location = new System.Drawing.Point(862, 12);
124 124
            this.labelControlToolTip.Name = "labelControlToolTip";
125 125
            this.labelControlToolTip.Size = new System.Drawing.Size(70, 16);
126 126
            this.labelControlToolTip.StyleController = this.layoutControl1;
......
129 129
            // 
130 130
            // btnAddType
131 131
            // 
132
            this.btnAddType.Location = new System.Drawing.Point(360, 63);
132
            this.btnAddType.Location = new System.Drawing.Point(369, 63);
133 133
            this.btnAddType.Name = "btnAddType";
134
            this.btnAddType.Size = new System.Drawing.Size(79, 22);
134
            this.btnAddType.Size = new System.Drawing.Size(82, 22);
135 135
            this.btnAddType.StyleController = this.layoutControl1;
136 136
            this.btnAddType.TabIndex = 0;
137 137
            this.btnAddType.Text = "Add Type";
......
139 139
            // 
140 140
            // gridControlSymbol
141 141
            // 
142
            this.gridControlSymbol.Location = new System.Drawing.Point(479, 89);
142
            this.gridControlSymbol.Location = new System.Drawing.Point(491, 89);
143 143
            this.gridControlSymbol.MainView = this.gridViewSymbol;
144 144
            this.gridControlSymbol.MenuManager = this.ribbonControl;
145 145
            this.gridControlSymbol.Name = "gridControlSymbol";
146
            this.gridControlSymbol.Size = new System.Drawing.Size(417, 478);
146
            this.gridControlSymbol.Size = new System.Drawing.Size(429, 490);
147 147
            this.gridControlSymbol.TabIndex = 4;
148 148
            this.gridControlSymbol.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
149 149
            this.gridViewSymbol});
......
160 160
            this.gridControlType.MainView = this.gridViewType;
161 161
            this.gridControlType.MenuManager = this.ribbonControl;
162 162
            this.gridControlType.Name = "gridControlType";
163
            this.gridControlType.Size = new System.Drawing.Size(415, 478);
163
            this.gridControlType.Size = new System.Drawing.Size(427, 490);
164 164
            this.gridControlType.TabIndex = 3;
165 165
            this.gridControlType.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
166 166
            this.gridViewType});
......
176 176
            // btnClose
177 177
            // 
178 178
            this.btnClose.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.ImageOptions.Image")));
179
            this.btnClose.Location = new System.Drawing.Point(838, 583);
179
            this.btnClose.Location = new System.Drawing.Point(862, 595);
180 180
            this.btnClose.Name = "btnClose";
181 181
            this.btnClose.Size = new System.Drawing.Size(70, 36);
182 182
            this.btnClose.StyleController = this.layoutControl1;
......
187 187
            // btnSave
188 188
            // 
189 189
            this.btnSave.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.ImageOptions.Image")));
190
            this.btnSave.Location = new System.Drawing.Point(746, 583);
190
            this.btnSave.Location = new System.Drawing.Point(770, 595);
191 191
            this.btnSave.Name = "btnSave";
192 192
            this.btnSave.Size = new System.Drawing.Size(68, 36);
193 193
            this.btnSave.StyleController = this.layoutControl1;
......
197 197
            // 
198 198
            // btnAddSymbol
199 199
            // 
200
            this.btnAddSymbol.Location = new System.Drawing.Point(805, 63);
200
            this.btnAddSymbol.Location = new System.Drawing.Point(826, 63);
201 201
            this.btnAddSymbol.Name = "btnAddSymbol";
202
            this.btnAddSymbol.Size = new System.Drawing.Size(91, 22);
202
            this.btnAddSymbol.Size = new System.Drawing.Size(94, 22);
203 203
            this.btnAddSymbol.StyleController = this.layoutControl1;
204 204
            this.btnAddSymbol.TabIndex = 2;
205 205
            this.btnAddSymbol.Text = " Add Symbol";
......
220 220
            this.layoutControlItem7,
221 221
            this.emptySpaceItem5});
222 222
            this.Root.Name = "Root";
223
            this.Root.Size = new System.Drawing.Size(920, 631);
223
            this.Root.Size = new System.Drawing.Size(944, 643);
224 224
            this.Root.TextVisible = false;
225 225
            // 
226 226
            // splitterItem1
227 227
            // 
228 228
            this.splitterItem1.AllowHotTrack = true;
229
            this.splitterItem1.Location = new System.Drawing.Point(443, 20);
229
            this.splitterItem1.Location = new System.Drawing.Point(455, 20);
230 230
            this.splitterItem1.Name = "splitterItem1";
231
            this.splitterItem1.Size = new System.Drawing.Size(12, 551);
231
            this.splitterItem1.Size = new System.Drawing.Size(12, 563);
232 232
            // 
233 233
            // emptySpaceItem3
234 234
            // 
235 235
            this.emptySpaceItem3.AllowHotTrack = false;
236
            this.emptySpaceItem3.Location = new System.Drawing.Point(0, 571);
236
            this.emptySpaceItem3.Location = new System.Drawing.Point(0, 583);
237 237
            this.emptySpaceItem3.Name = "emptySpaceItem3";
238
            this.emptySpaceItem3.Size = new System.Drawing.Size(734, 40);
238
            this.emptySpaceItem3.Size = new System.Drawing.Size(758, 40);
239 239
            this.emptySpaceItem3.TextSize = new System.Drawing.Size(0, 0);
240 240
            // 
241 241
            // layoutControlItem4
242 242
            // 
243 243
            this.layoutControlItem4.Control = this.btnSave;
244
            this.layoutControlItem4.Location = new System.Drawing.Point(734, 571);
244
            this.layoutControlItem4.Location = new System.Drawing.Point(758, 583);
245 245
            this.layoutControlItem4.MaxSize = new System.Drawing.Size(72, 40);
246 246
            this.layoutControlItem4.MinSize = new System.Drawing.Size(72, 40);
247 247
            this.layoutControlItem4.Name = "layoutControlItem4";
......
253 253
            // layoutControlItem5
254 254
            // 
255 255
            this.layoutControlItem5.Control = this.btnClose;
256
            this.layoutControlItem5.Location = new System.Drawing.Point(826, 571);
256
            this.layoutControlItem5.Location = new System.Drawing.Point(850, 583);
257 257
            this.layoutControlItem5.MaxSize = new System.Drawing.Size(74, 40);
258 258
            this.layoutControlItem5.MinSize = new System.Drawing.Size(74, 40);
259 259
            this.layoutControlItem5.Name = "layoutControlItem5";
......
265 265
            // emptySpaceItem2
266 266
            // 
267 267
            this.emptySpaceItem2.AllowHotTrack = false;
268
            this.emptySpaceItem2.Location = new System.Drawing.Point(806, 571);
268
            this.emptySpaceItem2.Location = new System.Drawing.Point(830, 583);
269 269
            this.emptySpaceItem2.MaxSize = new System.Drawing.Size(20, 40);
270 270
            this.emptySpaceItem2.MinSize = new System.Drawing.Size(20, 40);
271 271
            this.emptySpaceItem2.Name = "emptySpaceItem2";
......
281 281
            this.emptySpaceItem4});
282 282
            this.layoutControlGroup1.Location = new System.Drawing.Point(0, 20);
283 283
            this.layoutControlGroup1.Name = "layoutControlGroup1";
284
            this.layoutControlGroup1.Size = new System.Drawing.Size(443, 551);
284
            this.layoutControlGroup1.Size = new System.Drawing.Size(455, 563);
285 285
            this.layoutControlGroup1.Text = "Header Type";
286 286
            // 
287 287
            // layoutControlItem2
......
289 289
            this.layoutControlItem2.Control = this.gridControlType;
290 290
            this.layoutControlItem2.Location = new System.Drawing.Point(0, 26);
291 291
            this.layoutControlItem2.Name = "layoutControlItem2";
292
            this.layoutControlItem2.Size = new System.Drawing.Size(419, 482);
292
            this.layoutControlItem2.Size = new System.Drawing.Size(431, 494);
293 293
            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
294 294
            this.layoutControlItem2.TextVisible = false;
295 295
            // 
296 296
            // layoutControlItem1
297 297
            // 
298 298
            this.layoutControlItem1.Control = this.btnAddType;
299
            this.layoutControlItem1.Location = new System.Drawing.Point(336, 0);
299
            this.layoutControlItem1.Location = new System.Drawing.Point(345, 0);
300 300
            this.layoutControlItem1.Name = "layoutControlItem1";
301
            this.layoutControlItem1.Size = new System.Drawing.Size(83, 26);
301
            this.layoutControlItem1.Size = new System.Drawing.Size(86, 26);
302 302
            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
303 303
            this.layoutControlItem1.TextVisible = false;
304 304
            // 
......
307 307
            this.emptySpaceItem4.AllowHotTrack = false;
308 308
            this.emptySpaceItem4.Location = new System.Drawing.Point(0, 0);
309 309
            this.emptySpaceItem4.Name = "emptySpaceItem4";
310
            this.emptySpaceItem4.Size = new System.Drawing.Size(336, 26);
310
            this.emptySpaceItem4.Size = new System.Drawing.Size(345, 26);
311 311
            this.emptySpaceItem4.TextSize = new System.Drawing.Size(0, 0);
312 312
            // 
313 313
            // layoutControlGroup2
......
316 316
            this.layoutControlItem6,
317 317
            this.layoutControlItem3,
318 318
            this.emptySpaceItem1});
319
            this.layoutControlGroup2.Location = new System.Drawing.Point(455, 20);
319
            this.layoutControlGroup2.Location = new System.Drawing.Point(467, 20);
320 320
            this.layoutControlGroup2.Name = "layoutControlGroup2";
321
            this.layoutControlGroup2.Size = new System.Drawing.Size(445, 551);
321
            this.layoutControlGroup2.Size = new System.Drawing.Size(457, 563);
322 322
            this.layoutControlGroup2.Text = "Type Items";
323 323
            // 
324 324
            // layoutControlItem6
......
326 326
            this.layoutControlItem6.Control = this.gridControlSymbol;
327 327
            this.layoutControlItem6.Location = new System.Drawing.Point(0, 26);
328 328
            this.layoutControlItem6.Name = "layoutControlItem6";
329
            this.layoutControlItem6.Size = new System.Drawing.Size(421, 482);
329
            this.layoutControlItem6.Size = new System.Drawing.Size(433, 494);
330 330
            this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0);
331 331
            this.layoutControlItem6.TextVisible = false;
332 332
            // 
333 333
            // layoutControlItem3
334 334
            // 
335 335
            this.layoutControlItem3.Control = this.btnAddSymbol;
336
            this.layoutControlItem3.Location = new System.Drawing.Point(326, 0);
336
            this.layoutControlItem3.Location = new System.Drawing.Point(335, 0);
337 337
            this.layoutControlItem3.Name = "layoutControlItem3";
338
            this.layoutControlItem3.Size = new System.Drawing.Size(95, 26);
338
            this.layoutControlItem3.Size = new System.Drawing.Size(98, 26);
339 339
            this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
340 340
            this.layoutControlItem3.TextVisible = false;
341 341
            // 
......
344 344
            this.emptySpaceItem1.AllowHotTrack = false;
345 345
            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 0);
346 346
            this.emptySpaceItem1.Name = "emptySpaceItem1";
347
            this.emptySpaceItem1.Size = new System.Drawing.Size(326, 26);
347
            this.emptySpaceItem1.Size = new System.Drawing.Size(335, 26);
348 348
            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
349 349
            // 
350 350
            // layoutControlItem7
351 351
            // 
352 352
            this.layoutControlItem7.Control = this.labelControlToolTip;
353
            this.layoutControlItem7.Location = new System.Drawing.Point(826, 0);
353
            this.layoutControlItem7.Location = new System.Drawing.Point(850, 0);
354 354
            this.layoutControlItem7.MaxSize = new System.Drawing.Size(74, 20);
355 355
            this.layoutControlItem7.MinSize = new System.Drawing.Size(74, 20);
356 356
            this.layoutControlItem7.Name = "layoutControlItem7";
......
364 364
            this.emptySpaceItem5.AllowHotTrack = false;
365 365
            this.emptySpaceItem5.Location = new System.Drawing.Point(0, 0);
366 366
            this.emptySpaceItem5.Name = "emptySpaceItem5";
367
            this.emptySpaceItem5.Size = new System.Drawing.Size(826, 20);
367
            this.emptySpaceItem5.Size = new System.Drawing.Size(850, 20);
368 368
            this.emptySpaceItem5.TextSize = new System.Drawing.Size(0, 0);
369 369
            // 
370 370
            // HeaderSettingForm
371 371
            // 
372 372
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
373 373
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
374
            this.ClientSize = new System.Drawing.Size(920, 663);
374
            this.ClientSize = new System.Drawing.Size(944, 675);
375 375
            this.Controls.Add(this.layoutControl1);
376 376
            this.Controls.Add(this.ribbonControl);
377 377
            this.Name = "HeaderSettingForm";
DTI_PID/ID2PSN/Form/HeaderSettingForm.cs
255 255

  
256 256
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
257 257

  
258
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
258
                if (bLine)
259 259
                {
260 260
                    bLine = false;
261
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
262
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 30000, parentId, "Secondary", 1, resizedImage);
261
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, null);
262
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 30000, parentId, "Secondary", 1, null);
263 263
                }
264 264
            }
265 265
        }
......
341 341
        private void TreeList_BeforeCheckNode(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
342 342
        {
343 343
            DevExpress.XtraEditors.TreeListLookUpEdit treeListLookUpEdit = sender as DevExpress.XtraEditors.TreeListLookUpEdit;
344
            if (treeListLookUpEdit.Properties.TreeList.FocusedNode.Level == 0)
344
            if (treeListLookUpEdit.Properties.TreeList.FocusedNode != null && treeListLookUpEdit.Properties.TreeList.FocusedNode.Level == 0)
345 345
                e.Cancel = true;
346 346
        }
347 347
        private void btnSave_Click(object sender, EventArgs e)
DTI_PID/ID2PSN/Form/MainForm.Designer.cs
58 58
            this.btnValveGroupItemsSetting = new DevExpress.XtraEditors.SimpleButton();
59 59
            this.btnEquipment = new DevExpress.XtraEditors.SimpleButton();
60 60
            this.btnHistory = new DevExpress.XtraEditors.SimpleButton();
61
            this.MultiwaySetting = new DevExpress.XtraEditors.SimpleButton();
61 62
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
62 63
            this.layoutControlGroupMain = new DevExpress.XtraLayout.LayoutControlGroup();
63 64
            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
......
70 71
            this.layoutControlItem16 = new DevExpress.XtraLayout.LayoutControlItem();
71 72
            this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
72 73
            this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
74
            this.layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem();
73 75
            this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup();
74 76
            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
75 77
            this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
......
85 87
            this.toolStripMenuItemPathItems = new System.Windows.Forms.ToolStripMenuItem();
86 88
            this.splashScreenManager1 = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::ID2PSN.WaitForm), true, true);
87 89
            this.sqLiteCommandBuilder1 = new System.Data.SQLite.SQLiteCommandBuilder();
88
            this.MultiwaySetting = new DevExpress.XtraEditors.SimpleButton();
89
            this.layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem();
90 90
            ((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).BeginInit();
91 91
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
92 92
            this.layoutControl1.SuspendLayout();
......
113 113
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).BeginInit();
114 114
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
115 115
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
116
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).BeginInit();
116 117
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit();
117 118
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
118 119
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
......
125 126
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).BeginInit();
126 127
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).BeginInit();
127 128
            this.contextMenuPSN.SuspendLayout();
128
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).BeginInit();
129 129
            this.SuspendLayout();
130 130
            // 
131 131
            // ribbonControl
......
421 421
            this.btnHistory.Text = "View Revision History";
422 422
            this.btnHistory.Click += new System.EventHandler(this.btnHistory_Click);
423 423
            // 
424
            // MultiwaySetting
425
            // 
426
            this.MultiwaySetting.Enabled = false;
427
            this.MultiwaySetting.Location = new System.Drawing.Point(24, 251);
428
            this.MultiwaySetting.Name = "MultiwaySetting";
429
            this.MultiwaySetting.Size = new System.Drawing.Size(233, 22);
430
            this.MultiwaySetting.StyleController = this.layoutControl1;
431
            this.MultiwaySetting.TabIndex = 27;
432
            this.MultiwaySetting.Text = "Tie-In Setting";
433
            this.MultiwaySetting.Click += new System.EventHandler(this.MultiwaySetting_Click);
434
            // 
424 435
            // Root
425 436
            // 
426 437
            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
......
545 556
            this.layoutControlItem8.TextSize = new System.Drawing.Size(0, 0);
546 557
            this.layoutControlItem8.TextVisible = false;
547 558
            // 
559
            // layoutControlItem10
560
            // 
561
            this.layoutControlItem10.Control = this.MultiwaySetting;
562
            this.layoutControlItem10.Location = new System.Drawing.Point(0, 208);
563
            this.layoutControlItem10.Name = "layoutControlItem10";
564
            this.layoutControlItem10.Size = new System.Drawing.Size(237, 26);
565
            this.layoutControlItem10.TextSize = new System.Drawing.Size(0, 0);
566
            this.layoutControlItem10.TextVisible = false;
567
            // 
548 568
            // layoutControlGroup2
549 569
            // 
550 570
            this.layoutControlGroup2.GroupStyle = DevExpress.Utils.GroupStyle.Card;
......
673 693
            this.sqLiteCommandBuilder1.DataAdapter = null;
674 694
            this.sqLiteCommandBuilder1.QuoteSuffix = "]";
675 695
            // 
676
            // MultiwaySetting
677
            // 
678
            this.MultiwaySetting.Location = new System.Drawing.Point(24, 251);
679
            this.MultiwaySetting.Name = "MultiwaySetting";
680
            this.MultiwaySetting.Size = new System.Drawing.Size(233, 22);
681
            this.MultiwaySetting.StyleController = this.layoutControl1;
682
            this.MultiwaySetting.TabIndex = 27;
683
            this.MultiwaySetting.Text = "Tie-In Setting";
684
            this.MultiwaySetting.Click += new System.EventHandler(this.MultiwaySetting_Click);
685
            // 
686
            // layoutControlItem10
687
            // 
688
            this.layoutControlItem10.Control = this.MultiwaySetting;
689
            this.layoutControlItem10.Location = new System.Drawing.Point(0, 208);
690
            this.layoutControlItem10.Name = "layoutControlItem10";
691
            this.layoutControlItem10.Size = new System.Drawing.Size(237, 26);
692
            this.layoutControlItem10.TextSize = new System.Drawing.Size(0, 0);
693
            this.layoutControlItem10.TextVisible = false;
694
            // 
695 696
            // MainForm
696 697
            // 
697 698
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
......
730 731
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).EndInit();
731 732
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
732 733
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
734
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).EndInit();
733 735
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit();
734 736
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
735 737
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
......
742 744
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).EndInit();
743 745
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).EndInit();
744 746
            this.contextMenuPSN.ResumeLayout(false);
745
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem10)).EndInit();
746 747
            this.ResumeLayout(false);
747 748
            this.PerformLayout();
748 749

  
DTI_PID/ID2PSN/Form/MainForm.cs
194 194
                PSN psn = new PSN(documents, revisionNumber);
195 195
                if (Settings.Default.UseEquipTag)
196 196
                    psn.EquipTagNoAttributeName = Settings.Default.EquipTagAttribute;
197
                if (Settings.Default.UseTieIn)
198
                    psn.TieInPointAttributeName = Settings.Default.TieInAttribute;
197 199
                psn.SetPSNData(splashScreenManager1);
198 200
                currentPSN = psn;
199 201

  
DTI_PID/ID2PSN/Form/MultiwaySetting.cs
218 218

  
219 219
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
220 220

  
221
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
221
                if (bLine)
222 222
                {
223 223
                    bLine = false;
224 224
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/Form/TieInSetting.cs
32 32

  
33 33
            comboBoxTieIn.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
34 34
            string equipTag = Properties.Settings.Default.TieInAttribute;
35
            DataTable dt = DB.SelectSymbolAttribute();
35
            DataTable dt = DB.SelectTieInSymbolAttribute();
36 36
            foreach (DataRow row in dt.Rows)
37 37
            {
38 38
                string value = row["Attribute"].ToString();
......
50 50
        {
51 51
            try
52 52
            {
53
                if (checkTieIn.Checked)
54
                {
53
                //if (checkTieIn.Checked)
54
                //{
55 55
                    Properties.Settings.Default.TieInAttribute = comboBoxTieIn.SelectedItem.ToString();                   
56
                }
56
                //}
57 57
                Properties.Settings.Default.UseTieIn = checkTieIn.Checked;
58 58
                Properties.Settings.Default.Save();
59 59
                MessageBox.Show("Save was successful", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
DTI_PID/ID2PSN/Form/TopologyRuleForm.cs
60 60
                        newRow["Name"] = rows[0].Field<string>("DisplayName");
61 61
                        dt.Rows.Add(newRow);
62 62
                    }
63
                    else
64
                    {
65
                        rows = attrDT.Select(string.Format("Name = '{0}'", uid));
66
                        if (rows.Length == 1)
67
                        {
68
                            DataRow newRow = dt.NewRow();
69
                            newRow["Name"] = rows[0].Field<string>("DisplayName");
70
                            dt.Rows.Add(newRow);
71
                        }
72
                    }
73

  
63 74
                }
64 75
            }
65 76
        }
DTI_PID/ID2PSN/Form/TransformKeywordsSettingForm.cs
212 212

  
213 213
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
214 214

  
215
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
215
                if (bLine)
216 216
                {
217 217
                    bLine = false;
218 218
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/Form/ValveGroupingSetting.cs
270 270

  
271 271
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
272 272

  
273
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
273
                if (bLine)
274 274
                {
275 275
                    bLine = false;
276 276
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/Form/VentDrainSettingForm.cs
255 255

  
256 256
                dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
257 257

  
258
                if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
258
                if (bLine)
259 259
                {
260 260
                    bLine = false;
261 261
                    dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
DTI_PID/ID2PSN/PSN.cs
36 36
        private double DrawingHeight = double.NaN;
37 37
        public int Revision;
38 38
        public string EquipTagNoAttributeName = string.Empty;
39
        public string TieInPointAttributeName = string.Empty;
39 40
        public DataTable PathItems { get; set; }
40 41
        public DataTable SequenceData { get; set; }
41 42
        public DataTable PipeSystemNetwork { get; set; }
......
52 53
        public string Rule5 = "Line Disconnected";
53 54

  
54 55
        int tieInPointIndex = 1;
55

  
56
        int tieInPointSymbolIndex = 1;
56 57
        List<Document> Documents;
57 58
        List<Group> groups = new List<Group>();
58 59
        List<PSNItem> PSNItems = new List<PSNItem>();
......
1501 1502

  
1502 1503
                                    }
1503 1504

  
1504
                                 
1505
                                    //    //if (item.Document.MissingLineNumber1)
1506
                                    //    //    item.MissingLineNumber1 = true;
1507
                                    //    //else if (item.Document.MissingLineNumber2)
1508
                                    //    //    item.MissingLineNumber2 = true;
1509
                                    //}
1510 1505
                                }
1506
                                else
1507
                                {
1508

  
1509
                                }
1510

  
1511 1511
                            }
1512 1512
                        }
1513 1513
                        
......
1553 1553
                foreach (Group group in groups.FindAll(x => x.Items.Last().SubItemType == SubItemType.OPC))
1554 1554
                {
1555 1555
                    Item opcItem = group.Items.Last();
1556
                    DataRow[] fromRows = opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID));
1557
                    if (fromRows.Length.Equals(1))
1556
                    if(opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID)) != null)
1558 1557
                    {
1559
                        DataRow opcRow = fromRows.First();
1560
                        string toDrawing = opcRow["ToDrawing"].ToString();
1561
                        string toOPCUID = opcRow["ToOPCUID"].ToString();
1562

  
1563
                        Document toDocument = Documents.Find(x => x.DrawingName == toDrawing);
1564
                        if (toDocument != null)
1558
                        DataRow[] fromRows = opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID));
1559
                        if (fromRows.Length.Equals(1))
1565 1560
                        {
1566
                            Group toGroup = toDocument.Groups.Find(x => x.Items.Find(y => y.UID == toOPCUID) != null);
1567
                            DataRow[] toRows = opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID));
1568
                            //1대1 매칭이 아닐때 걸림 (2개 이상일 때) 2021.11.07 
1569
                            if (toRows.Length > 1)
1561
                            DataRow opcRow = fromRows.First();
1562
                            string toDrawing = opcRow["ToDrawing"].ToString();
1563
                            string toOPCUID = opcRow["ToOPCUID"].ToString();
1564

  
1565
                            Document toDocument = Documents.Find(x => x.DrawingName == toDrawing);
1566
                            if (toDocument != null)
1570 1567
                            {
1571
                                //throw new Exception("OPC error(multi connect)");
1572
                                MessageBox.Show("OPC error(multi connect)", "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1573
                                return;
1568
                                Group toGroup = toDocument.Groups.Find(x => x.Items.Find(y => y.UID == toOPCUID) != null);
1569

  
1570
                                if (toGroup != null && opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID)) != null)
1571
                                {
1572
                                    DataRow[] toRows = opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID));
1573
                                    //1대1 매칭이 아닐때 걸림 (2개 이상일 때) 2021.11.07 
1574
                                    if (toRows.Length > 1)
1575
                                    {
1576
                                        //throw new Exception("OPC error(multi connect)");
1577
                                        MessageBox.Show("OPC error(multi connect)", "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1578
                                        return;
1579
                                    }
1580
                                    group.EndGroup = toGroup;
1581
                                    toGroup.StartGroup = group;
1582
                                }
1583

  
1574 1584
                            }
1575
                            group.EndGroup = toGroup;
1576
                            toGroup.StartGroup = group;
1577 1585
                        }
1578
                    }
1586
                    }                    
1579 1587
                }
1580 1588
            }
1581 1589
            catch (Exception ex)
......
1718 1726
                    else if (item.SubItemType == SubItemType.OPC)
1719 1727
                        type = PSNType.OPC;
1720 1728
                }
1729
                else
1730
                {
1731

  
1732
                }
1721 1733

  
1722 1734
                return type;
1723 1735
            }
......
1795 1807
                                            PSNItem.Topologies.Add(topology);
1796 1808
                                    }
1797 1809
                                }
1810
                                if (topology == null)
1811
                                {
1798 1812

  
1813
                                }
1799 1814
                                item.Topology = topology;
1800 1815
                                topology.Items.Add(item);
1801 1816
                            }
1802 1817
                        }
1803 1818
                    }
1819
                    
1804 1820
                }
1805 1821
                #endregion
1806 1822

  
......
2038 2054

  
2039 2055
        private void SaveNozzleAndEquipment()
2040 2056
        {
2057
            Dictionary<string, int> globalNozzleCount = new Dictionary<string, int>();
2058

  
2041 2059
            List<Item> nozzles = new List<Item>();
2042 2060
            List<Equipment> equipments = new List<Equipment>();
2043 2061
            foreach (Document document in Documents)
......
2046 2064
                equipments.AddRange(document.Equipments);
2047 2065
            }
2048 2066

  
2067
            DataTable equipDT = new DataTable();
2068
            equipDT.Columns.Add("OID", typeof(string));
2069
            equipDT.Columns.Add("ITEMTAG", typeof(string));
2070
            equipDT.Columns.Add("XCOORDS", typeof(string));
2071
            equipDT.Columns.Add("YCOORDS", typeof(string));
2072

  
2073
            foreach (Equipment equipment in equipments)
2074
            {
2075
                DataRow row = equipDT.NewRow();
2076
                row["OID"] = equipment.UID;
2077
                if (!string.IsNullOrEmpty(EquipTagNoAttributeName))
2078
                {
2079
                    Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName);
2080
                    if (attribute != null && attribute.Value != "None")
2081
                        equipment.ItemTag = attribute.Value;
2082
                    else
2083
                    {
2084
                        equipment.ItemTag = equipment.Name;
2085
                    }
2086
                }
2087
                else
2088
                    equipment.ItemTag = equipment.Name;
2089

  
2090
                if (!string.IsNullOrEmpty(equipment.ItemTag))
2091
                {
2092
                    if (!globalNozzleCount.ContainsKey(equipment.ItemTag))
2093
                    {
2094
                        globalNozzleCount[equipment.ItemTag] = 0;
2095
                    }
2096
                }
2097

  
2098
                row["ITEMTAG"] = equipment.ItemTag;
2099
                List<double> xList = equipment.POINT.Select(x => x[0]).ToList();
2100
                row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth;
2101

  
2102
                List<double> yList = equipment.POINT.Select(x => x[1]).ToList();
2103
                row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight;
2104

  
2105
                equipDT.Rows.Add(row);
2106
            }
2049 2107

  
2050 2108
            DataTable nozzleDT = new DataTable();
2051 2109
            nozzleDT.Columns.Add("OID", typeof(string));
......
2069 2127
                {
2070 2128
                    Equipment equipment = equipments.Find(x => x.UID == relation.UID);
2071 2129
                    equipment.Nozzles.Add(item);
2072
                    row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", equipment.Nozzles.Count + 100));
2130
                    //row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", equipment.Nozzles.Count + 100));
2131

  
2132
                    int nozzleCount = equipment.Nozzles.Count;
2133
                    if (globalNozzleCount.ContainsKey(equipment.ItemTag))
2134
                    {
2135
                        nozzleCount = globalNozzleCount[equipment.ItemTag];
2136
                    }
2137
                    row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", nozzleCount + 100));
2138
                    if (globalNozzleCount.ContainsKey(equipment.ItemTag))
2139
                    {
2140
                        globalNozzleCount[equipment.ItemTag] += 1;
2141
                    }
2142

  
2073 2143
                    row["Equipment_OID"] = equipment.UID;
2074 2144
                    item.Equipment = equipment;
2075 2145
                }
......
2097 2167
                nozzleDT.Rows.Add(row);
2098 2168
            }
2099 2169

  
2100
            DataTable equipDT = new DataTable();
2101
            equipDT.Columns.Add("OID", typeof(string));
2102
            equipDT.Columns.Add("ITEMTAG", typeof(string));
2103
            equipDT.Columns.Add("XCOORDS", typeof(string));
2104
            equipDT.Columns.Add("YCOORDS", typeof(string));
2105

  
2106
            foreach (Equipment equipment in equipments)
2107
            {
2108
                DataRow row = equipDT.NewRow();
2109
                row["OID"] = equipment.UID;
2110
                if (!string.IsNullOrEmpty(EquipTagNoAttributeName))
2111
                {
2112
                    Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName);
2113
                    if (attribute != null)
2114
                        equipment.ItemTag = attribute.Value;
2115
                }
2116
                else
2117
                    equipment.ItemTag = equipment.Name;
2118

  
2119
                row["ITEMTAG"] = equipment.ItemTag;
2120
                List<double> xList = equipment.POINT.Select(x => x[0]).ToList();
2121
                row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth;
2122

  
2123
                List<double> yList = equipment.POINT.Select(x => x[1]).ToList();
2124
                row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight;
2125

  
2126
                equipDT.Rows.Add(row);
2127
            }
2170
            //DataTable equipDT = new DataTable();
2171
            //equipDT.Columns.Add("OID", typeof(string));
2172
            //equipDT.Columns.Add("ITEMTAG", typeof(string));
2173
            //equipDT.Columns.Add("XCOORDS", typeof(string));
2174
            //equipDT.Columns.Add("YCOORDS", typeof(string));
2175

  
2176
            //foreach (Equipment equipment in equipments)
2177
            //{
2178
            //    DataRow row = equipDT.NewRow();
2179
            //    row["OID"] = equipment.UID;
2180
            //    if (!string.IsNullOrEmpty(EquipTagNoAttributeName))
2181
            //    {
2182
            //        Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName);
2183
            //        if (attribute != null)
2184
            //            equipment.ItemTag = attribute.Value;
2185
            //    }
2186
            //    else
2187
            //        equipment.ItemTag = equipment.Name;
2188

  
2189
            //    row["ITEMTAG"] = equipment.ItemTag;
2190
            //    List<double> xList = equipment.POINT.Select(x => x[0]).ToList();
2191
            //    row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth;
2192

  
2193
            //    List<double> yList = equipment.POINT.Select(x => x[1]).ToList();
2194
            //    row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight;
2195

  
2196
            //    equipDT.Rows.Add(row);
2197
            //}
2128 2198

  
2129 2199
            Equipment = equipDT;
2130 2200
            Nozzle = nozzleDT;
......
2475 2545
                                            newRow["Equipment_OID"] = item.Equipment != null ? item.Equipment.UID : "";
2476 2546
                                        }
2477 2547

  
2548
                                        //string topologyFullName = 
2549

  
2478 2550
                                        newRow["OID"] = itemOID;
2479 2551
                                        newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
2480 2552
                                        newRow["TopologySet_OID"] = item.Topology.FullName;
2481 2553
                                        newRow["BranchTopologySet_OID"] = branchTopologyName;
2482 2554
                                        newRow["PipeLine_OID"] = item.PSNPipeLineID;
2483
                                        newRow["ITEMNAME"] = GetItemName(item, itemOID);
2484
                                        newRow["ITEMTAG"] = GetItemTag(item);
2485
                                        newRow["Class"] = GetClass(item, itemOID);
2486
                                        string subClass = GetSubClass(item, itemOID);
2487
                                        newRow["SubClass"] = subClass;
2488

  
2489
                                        if (item.ItemType == ItemType.Symbol)
2490
                                            newRow["TYPE"] = item.ID2DBName;
2491
                                        else if (item.ItemType == ItemType.Line)
2492
                                            newRow["TYPE"] = item.ID2DBType;
2555

  
2556
                                        if (item.ItemType != ID2PSN.ItemType.Line && item.ID2DBName.ToUpper().Equals("TIEINPOINT"))
2557
                                        {
2558
                                            
2559
                                            newRow["ITEMNAME"] = "PipingComp";
2560
                                            if (!string.IsNullOrEmpty(TieInPointAttributeName))
2561
                                                newRow["ITEMTAG"] = string.Format("TIEINPOINT_{0:D3}V", tieInPointSymbolIndex);
2562
                                            else
2563
                                                newRow["ITEMTAG"] = item.Attributes.Find(x => x.Name == TieInPointAttributeName).Value;
2564
                                                    
2565
                                            newRow["Class"] = "In-Line Fitting";
2566
                                            newRow["SubClass"] = "";
2567
                                            newRow["TYPE"] = "End";
2568
                                            tieInPointSymbolIndex++;
2569
                                        }
2570
                                        else
2571
                                        {
2572
                                            newRow["ITEMNAME"] = GetItemName(item, itemOID);
2573
                                            newRow["ITEMTAG"] = GetItemTag(item);
2574
                                            newRow["Class"] = GetClass(item, itemOID);
2575
                                            string subClass = GetSubClass(item, itemOID);
2576
                                            newRow["SubClass"] = subClass;
2577

  
2578
                                            if (item.ItemType == ItemType.Symbol)
2579
                                                newRow["TYPE"] = item.ID2DBName;
2580
                                            else if (item.ItemType == ItemType.Line)
2581
                                                newRow["TYPE"] = item.ID2DBType;
2582
                                        }
2583
                                       
2584
                                        
2585
                                       
2493 2586
                                        newRow["PIDNAME"] = group.Document.DrawingName;
2494 2587

  
2495 2588
                                        // NPD
......
2999 3092

  
3000 3093
                                List<Relation> relations = new List<Relation>();
3001 3094

  
3002
                                if (firstItem.Relations.FindAll(x => x.Item == null).Count() != 0)
3003
                                    relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
3095
                                if (firstItem.Relations.FindAll(x => x.Item == null).Count() != 0 && firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID) != null )
3096
                                    relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID));
3004 3097

  
3005
                                if (lastItem.Relations.FindAll(x => x.Item == null).Count() != 0)
3006
                                    relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
3098
                                if (lastItem.Relations.FindAll(x => x.Item == null).Count() != 0 && lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID) != null)
3099
                                    relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID));
3007 3100

  
3008 3101
                                if (relations.Count > 0)
3009 3102
                                    rows.First()["SubType"] = "OtherSystem";
......
3259 3352
                    bool bCheck = false;
3260 3353
                    if (!PSNItem.EnableType(PSNItem.StartType))
3261 3354
                    {
3262
                        change = true;
3263
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
3264
                        int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First());
3265

  
3266
                        Item item = PSNItem.Groups.First().Items.First();
3267
                        try
3268
                        {
3269
                            string FROM_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
3355
                        //if(!PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])).First().Field<string>("ItemTag").Contains("TIEINPOINT"))
3356
                        //{
3357
                            change = true;
3358
                            DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
3359
                            int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First());
3270 3360

  
3271
                            foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
3361
                            Item item = PSNItem.Groups.First().Items.First();
3362
                            try
3272 3363
                            {
3273
                                loopRow["FROM_DATA"] = FROM_DATA;
3274
                                if (item.ItemType == ItemType.Line)
3364
                                string FROM_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
3365

  
3366
                                foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
3275 3367
                                {
3276
                                    if (loopRow.Field<string>("OrderNumber") == "0")
3368
                                    loopRow["FROM_DATA"] = FROM_DATA;
3369
                                    if (item.ItemType == ItemType.Line)
3277 3370
                                    {
3278
                                        string status = loopRow.Field<string>("Status");
3279
                                        //string isvali
3280
                                        if (string.IsNullOrEmpty(status))
3281
                                            status = "Line Disconnected";
3282
                                        else if (!status.Contains("Line Disconnected"))
3283
                                            status += ", Line Disconnected";
3284
                                        loopRow["Status"] = status;
3285
                                        if (!string.IsNullOrEmpty(status))
3286
                                            loopRow["IsValid"] = "Error";
3371
                                        if (loopRow.Field<string>("OrderNumber") == "0")
3372
                                        {
3373
                                            string status = loopRow.Field<string>("Status");
3374
                                            //string isvali
3375
                                            if (string.IsNullOrEmpty(status))
3376
                                                status = "Line Disconnected";
3377
                                            else if (!status.Contains("Line Disconnected"))
3378
                                                status += ", Line Disconnected";
3379
                                            loopRow["Status"] = status;
3380
                                            if (!string.IsNullOrEmpty(status))
3381
                                                loopRow["IsValid"] = "Error";
3382
                                        }
3287 3383
                                    }
3288 3384
                                }
3289
                            }
3290 3385

  
3291
                            tieInPointIndex++;
3386
                                tieInPointIndex++;
3292 3387

  
3293
                            if (item.ItemType == ItemType.Line)
3294
                            {
3295
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);                                
3388
                                if (item.ItemType == ItemType.Line)
3389
                                {
3390
                                    PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
3391
                                }
3392
                                else
3393
                                {
3394
                                    PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex);
3395
                                    PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
3396

  
3397
                                    bCheck = true;
3398
                                }
3399

  
3400
                                PSNItem.StartType = PSNType.Equipment;
3296 3401
                            }
3297
                            else
3402
                            catch (Exception ex)
3298 3403
                            {
3299
                                PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex);
3300
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
3301

  
3302
                                bCheck = true;
3404
                                MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
3405
                                return;
3303 3406
                            }
3304

  
3305
                            PSNItem.StartType = PSNType.Equipment;
3306
                        }
3307
                        catch (Exception ex)
3308
                        {
3309
                            MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
3310
                            return;
3311
                        }
3407
                        //}                       
3312 3408
                    }
3313 3409

  
3314 3410
                    if (!PSNItem.EnableType(PSNItem.EndType))
3315
                    {                        
3316
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
3317
                        //int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1;
3318
                        DataRow dr = pathItemRows.Last();
3319
                        if (change)
3320
                        {
3321
                            if(bCheck)
3322
                                dr = pathItemRows[pathItemRows.Count() - 3];
3323
                            else
3411
                    {
3412
                        //if (!PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])).Last().Field<string>("ItemTag").Contains("TIEINPOINT"))
3413
                        //{
3414
                            DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
3415
                            //int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1;
3416
                            DataRow dr = pathItemRows.Last();
3417
                            if (change)
3324 3418
                            {
3325
                                dr = pathItemRows[pathItemRows.Count() - 2];
3419
                                if (bCheck)
3420
                                    dr = pathItemRows[pathItemRows.Count() - 3];
3421
                                else
3422
                                {
3423
                                    dr = pathItemRows[pathItemRows.Count() - 2];
3424
                                }
3326 3425
                            }
3327
                        }
3328

  
3329
                        change = true;
3330
                        int insertIndex = PathItems.Rows.IndexOf(dr) + 1;
3331 3426

  
3332
                        Item item = PSNItem.Groups.Last().Items.Last();
3333
                        try
3334
                        {
3335
                            string TO_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
3427
                            change = true;
3428
                            int insertIndex = PathItems.Rows.IndexOf(dr) + 1;
3336 3429

  
3337
                            
3338
                            foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
3430
                            Item item = PSNItem.Groups.Last().Items.Last();
3431
                            try
3339 3432
                            {
3340
                                loopRow["TO_DATA"] = TO_DATA;
3341
                                if (item.ItemType == ItemType.Line)
3433
                                string TO_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
3434

  
3435

  
3436
                                foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
3342 3437
                                {
3343
                                    if (loopRow.Field<string>("OrderNumber") == Convert.ToString(PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())).Count() - 1))
3438
                                    loopRow["TO_DATA"] = TO_DATA;
3439
                                    if (item.ItemType == ItemType.Line)
3344 3440
                                    {
3345
                                        string status = loopRow.Field<string>("Status");
3346
                                        if (string.IsNullOrEmpty(status))
3347
                                            status = "Line Disconnected";
3348
                                        else if (!status.Contains("Line Disconnected"))
3349
                                            status += ", Line Disconnected";
3350
                                        loopRow["Status"] = status;
3351
                                        if (!string.IsNullOrEmpty(status))
3352
                                            loopRow["IsValid"] = "Error";
3441
                                        if (loopRow.Field<string>("OrderNumber") == Convert.ToString(PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())).Count() - 1))
3442
                                        {
3443
                                            string status = loopRow.Field<string>("Status");
3444
                                            if (string.IsNullOrEmpty(status))
3445
                                                status = "Line Disconnected";
3446
                                            else if (!status.Contains("Line Disconnected"))
3447
                                                status += ", Line Disconnected";
3448
                                            loopRow["Status"] = status;
3449
                                            if (!string.IsNullOrEmpty(status))
3450
                                                loopRow["IsValid"] = "Error";
3451
                                        }
3353 3452
                                    }
3453

  
3354 3454
                                }
3355 3455

  
3356
                            }                            
3456
                                tieInPointIndex++;
3357 3457

  
3358
                            tieInPointIndex++;
3458
                                if (item.ItemType == ItemType.Line)
3459
                                {
3460
                                    PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex);
3461
                                }
3462
                                else
3463
                                {
3464
                                    PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex);
3465
                                    PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Last()), insertIndex);
3359 3466

  
3360
                            if (item.ItemType == ItemType.Line)
3361
                            {
3362
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex);
3467
                                }
3468

  
3469
                                PSNItem.EndType = PSNType.Equipment;
3363 3470
                            }
3364
                            else
3471
                            catch (Exception ex)
3365 3472
                            {
3366
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex);
3367
                                if(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Count() > 0)
3368
                                    PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Last()), insertIndex);
3369
                               
3473
                                MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
3474
                                return;
3370 3475
                            }
3371

  
3372
                            PSNItem.EndType = PSNType.Equipment;
3373
                        }
3374
                        catch (Exception ex)
3375
                        {
3376
                            MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
3377
                            return;
3378
                        }
3476
                        //}      
3379 3477
                    }
3380 3478

  
3381 3479
                    dataRow["Type"] = PSNItem.GetPSNType();
......
3449 3547
                        newRow["OID"] = Guid.NewGuid().ToString();
3450 3548
                        newRow["SequenceData_OID"] = itemRow["SequenceData_OID"];
3451 3549
                        newRow["TopologySet_OID"] = itemRow["TopologySet_OID"];
3452
                        newRow["BranchTopologySet_OID"] = itemRow["BranchTopologySet_OID"];
3550
                        newRow["BranchTopologySet_OID"] = "";
3453 3551
                        newRow["PipeLine_OID"] = itemRow["PipeLine_OID"];
3454
                        newRow["ITEMNAME"] = itemRow["ITEMNAME"];
3455
                        newRow["ITEMTAG"] = itemRow["ITEMTAG"];
3456
                        newRow["Class"] = itemRow["Class"];
3457
                        newRow["SubClass"] = itemRow["SubClass"];
3458
                        newRow["TYPE"] = itemRow["TYPE"];
3552
                        newRow["ITEMNAME"] = "PipeRun";
3553
                        newRow["ITEMTAG"] = itemRow["PipeRun_OID"];
3554
                        newRow["Class"] = "Piping";
3555
                        newRow["SubClass"] = "";
3556
                        newRow["TYPE"] = "Secondary";
3459 3557
                        newRow["PIDNAME"] = itemRow["PIDNAME"];
3460 3558
                        newRow["NPD"] = itemRow["NPD"];
3461 3559
                        newRow["PipeSystemNetwork_OID"] = itemRow["PipeSystemNetwork_OID"];

내보내기 Unified diff

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