프로젝트

일반

사용자정보

개정판 63ff8e26

ID63ff8e26ad031949ca0517fb05461907489f666a
상위 add4c093
하위 d21b35b1

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

issue #000: eq tag pump 수정

Change-Id: Ia0b59bcb9452b8e3a9d53ac09948cce53247406d

차이점 보기:

DTI_PID/ID2PSN/PSN.cs
242 242
            UpdateAccuracy();
243 243
            // ValveGrouping
244 244
            UpdateValveGrouping();
245

  
246
            DataTable dtPathItems = PathItems.Clone();
247
            DataTable dtPipeSystemNetwork = PipeSystemNetwork.DefaultView.ToTable(true, new string[] { "OID" });
248

  
249
            foreach (DataRow drpipe in dtPipeSystemNetwork.Rows)
250
            {
251
                DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", drpipe["OID"].ToString()));
252
                DataTable dtSequenceItems = SequenceData.Clone();
253
                foreach (DataRow drpath in pathItemRows)
254
                {
255
                    DataRow sequenceRows = SequenceData.Select(string.Format("PathItem_OID = '{0}'", drpath.Field<string>("OID"))).First();
256
                    
257
                    DataRow newRow = dtSequenceItems.NewRow();
258
                    foreach (DataColumn column in SequenceData.Columns)
259
                        if (dtSequenceItems.Columns[column.ColumnName] != null)
260
                            newRow[column.ColumnName] = sequenceRows[column.ColumnName];
261

  
262
                    dtSequenceItems.Rows.Add(newRow);
263
                }
264

  
265
                foreach (DataRow sqrow in dtSequenceItems.Select().OrderBy(x => Convert.ToInt32(x.Field<string>("SERIALNUMBER"))))
266
                {
267
                    DataRow newRow = dtPathItems.NewRow();
268
                    DataRow row = PathItems.Select(string.Format("OID = '{0}'", sqrow["PathItem_OID"])).First();
269
                    
270
                    foreach (DataColumn column in PathItems.Columns)
271
                        if (dtPathItems.Columns[column.ColumnName] != null)
272
                            newRow[column.ColumnName] = row[column.ColumnName];
273

  
274
                    dtPathItems.Rows.Add(newRow);
275
                }
276

  
277
                //foreach (DataRow sqrow in datasqDT.Select().OrderBy(x => Convert.ToInt32(x.Field<string>("SERIALNUMBER"))))
278
                //{
279
                //    DataRow newRow = gridDT.NewRow();
280

  
281
                    //    DataRow row = dataDT.Select(string.Format("OID = '{0}'", sqrow["PathItem_OID"])).First();
282

  
283
                    //    foreach (DataColumn column in dataDT.Columns)
284
                    //        if (gridDT.Columns[column.ColumnName] != null)
285
                    //            newRow[column.ColumnName] = row[column.ColumnName];
286

  
287
                    //    gridDT.Rows.Add(newRow);
288
                    //}
289

  
290
            }
291

  
292
            PathItems.Clear();
293
            PathItems = dtPathItems.Copy();
245 294
            // AirFinCooler 
246 295
            UpdateAirFinCooler();
247
            // PathItem 정렬
248
            //PathItemSort();
296

  
249 297
        }
250 298

  
251 299
        private void UpdateAirFinCooler()
......
276 324

  
277 325
                    DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
278 326

  
327
                    string eqTag = string.Empty;
279 328
                    string EGFlowDirection = string.Empty;
280
                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["From_Data"].ToString().Contains(x.Name)).Count() > 0)
281
                        EGFlowDirection = "O";
282
                    else if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["To_Data"].ToString().Contains(x.Name)).Count() > 0)
283
                        EGFlowDirection = "I";
284

  
329
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
330
                    if (PSNItem.Groups.First().Items.First().Equipment != null)
331
                    {
332
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
333
                        {
334
                            eqTag = PSNItem.Groups.First().Items.First().Equipment.ItemTag;
335
                            EGFlowDirection = "O";
336
                        }                        
337
                    } 
338
                    else if(PSNItem.Groups.Last().Items.Last().Equipment != null)
339
                    {
340
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
341
                        {
342
                            eqTag = PSNItem.Groups.Last().Items.Last().Equipment.ItemTag;
343
                            EGFlowDirection = "I";
344
                        }
345
                    }
285 346

  
286
                    foreach (DataRow dr in pathItemRows)
347
                    if(!string.IsNullOrEmpty(eqTag))
287 348
                    {
288
                        dr["EqpGroupTag"] = "PUMP" + string.Format("-{0}", string.Format("{0:D3}", pumpTagNum));                       
289
                        dr["EGFlowDirection"] = EGFlowDirection;
349
                        foreach (DataRow dr in pathItemRows)
350
                        {
351
                            dr["EqpGroupTag"] = eqTag;
352
                            dr["EGFlowDirection"] = EGFlowDirection;
353
                        }
290 354
                    }
291 355
                }
292 356

  
......
295 359
                {
296 360

  
297 361
                    DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
298

  
362
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
299 363
                    string EGFlowDirection = string.Empty;
300
                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["From_Data"].ToString().Contains(x.Name)).Count() > 0)
301
                        EGFlowDirection = "O";
302
                    else if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["To_Data"].ToString().Contains(x.Name)).Count() > 0)
303
                        EGFlowDirection = "I";
364

  
365
                    if (PSNItem.Groups.First().Items.First().Equipment != null)
366
                    {
367
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
368
                        {
369
                            EGFlowDirection = "O";
370
                        }
371
                    }
372
                    else if (PSNItem.Groups.Last().Items.Last().Equipment != null)
373
                    {
374
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
375
                        {
376
                            EGFlowDirection = "I";
377
                        }
378
                    }
379

  
304 380

  
305 381
                    List<string> lstViewPipeSystemNetwork_OID = new List<string>();
306 382

  
......
311 387
                            string viewEGFlowDirection = string.Empty;
312 388
                            if (PipeSystemNetwork.Select(string.Format("OID = '{0}'", dr.Field<string>("ViewPipeSystemNetwork_OID"))).Count() > 0)
313 389
                            {
314
                                DataRow data = PipeSystemNetwork.Select(string.Format("OID = '{0}'", dr.Field<string>("ViewPipeSystemNetwork_OID"))).First();
315
                                if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && data["From_Data"].ToString().Contains(x.Name)).Count() > 0)
316
                                    viewEGFlowDirection = "O";
317
                                else if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && data["To_Data"].ToString().Contains(x.Name)).Count() > 0)
318
                                    viewEGFlowDirection = "I";
390
                                PSNItem viewPSNItem = PSNItems.Find(x => x.PSN_OID() == dr.Field<string>("ViewPipeSystemNetwork_OID"));                               
391

  
392
                                if (viewPSNItem.Groups.First().Items.First().Equipment != null)
393
                                {
394
                                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && viewPSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
395
                                    {
396
                                        viewEGFlowDirection = "O";
397
                                    }
398
                                }
399
                                else if (viewPSNItem.Groups.Last().Items.Last().Equipment != null)
400
                                {
401
                                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && viewPSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
402
                                    {
403
                                        viewEGFlowDirection = "I";
404
                                    }
405
                                }
319 406

  
320 407
                                if (EGFlowDirection.Equals(viewEGFlowDirection) && !lstViewPipeSystemNetwork_OID.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
321 408
                                    lstViewPipeSystemNetwork_OID.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
......
354 441
                    {              
355 442
                        string EqpGroupTag = string.Empty;                       
356 443

  
357
                        if (lstViewPipeSystemNetwork_OID.Contains(pathItemRows.First().Field<string>("ViewPipeSystemNetwork_OID")))
358
                        {
444
                        if((EGFlowDirection == "O" && lstViewPipeSystemNetwork_OID.Contains(pathItemRows.Last().Field<string>("ViewPipeSystemNetwork_OID"))) ||
445
                            (EGFlowDirection == "I" && lstViewPipeSystemNetwork_OID.Contains(pathItemRows.First().Field<string>("ViewPipeSystemNetwork_OID"))))
446
                        { 
359 447
                            DataRow[] viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", pathItemRows.First().Field<string>("ViewPipeSystemNetwork_OID")));
360 448

  
361 449
                            foreach (DataRow row in viewpathItemRows)
......
380 468
                            {
381 469
                                foreach (DataRow dr in pathItemRows)
382 470
                                {
471
                                    if (selectViewOID == dr["OID"].ToString())
472
                                    {
473
                                        dr["EGTConnectedPoint"] = "1";
474
                                        bCheck = true;
475
                                    }
476

  
383 477
                                    if (!bCheck)
384 478
                                    {
385 479
                                        dr["EqpGroupTag"] = string.Empty;
386 480
                                        dr["MainLineTag"] = string.Empty;
387
                                        dr["EGTConnectedPoint"] = "0";                                        
481
                                        dr["EGTConnectedPoint"] = "0";
482
                                        dr["EGFlowDirection"] = string.Empty;
388 483
                                    }
389 484
                                    else
390 485
                                    {
391 486
                                        dr["MainLineTag"] = "M";
392 487
                                    }
393

  
394
                                    if (selectViewOID == dr["OID"].ToString())
395
                                    {
396
                                        dr["EGTConnectedPoint"] = "1";
397
                                        bCheck = true;
398
                                    }
488
                                    
399 489
                                }
400 490

  
401 491
                            }
......
405 495
                                {
406 496
                                    if (bCheck)
407 497
                                    {
498
                                        
408 499
                                        dr["EqpGroupTag"] = string.Empty;
409 500
                                        dr["MainLineTag"] = string.Empty;
410 501
                                        dr["EGTConnectedPoint"] = "0";
502
                                        dr["EGFlowDirection"] = string.Empty;
411 503
                                    }
412 504
                                    else
413 505
                                    {
......
441 533
                    bool bCheck = false;
442 534
                    string EqpGroupTag = string.Empty;
443 535

  
444
                    string EGFlowDirection = string.Empty;
445
                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["From_Data"].ToString().Contains(x.Name)).Count() > 0)
446
                        EGFlowDirection = "I";
447
                    else if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dataRow["To_Data"].ToString().Contains(x.Name)).Count() > 0)
448
                        EGFlowDirection = "O";
536
                    string EGFlowDirection = string.Empty;                   
449 537

  
450
                    List<string> lstViewPipeSystemNetwork_OID = new List<string>();
538
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow.Field<string>("OID"));
451 539

  
540
                    if (PSNItem.Groups.First().Items.First().Equipment != null)
541
                    {
542
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
543
                        {
544
                            EGFlowDirection = "O";
545
                        }
546
                    }
547
                    else if (PSNItem.Groups.Last().Items.Last().Equipment != null)
548
                    {
549
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
550
                        {
551
                            EGFlowDirection = "I";
552
                        }
553
                    }
554

  
555
                    List<string> lstViewPipeSystemNetwork_OID = new List<string>();
556
                    List<string> lstEqTagRows = new List<string>();
452 557
                    if (EGFlowDirection.Equals("I"))
453 558
                    {
454 559
                        foreach (DataRow dr in pathItemRows)
455
                        {
456
                            if (!string.IsNullOrEmpty(dr.Field<string>("MainLineTag")) && dr.Field<string>("MainLineTag").Equals("M"))
560
                        {                            
561
                            if (!string.IsNullOrEmpty(dr.Field<string>("MainLineTag")) && dr.Field<string>("MainLineTag").Equals("M") && !string.IsNullOrEmpty(dr.Field<string>("EqpGroupTag")))
562
                            {
457 563
                                bCheck = true;
458

  
459
                            if (!string.IsNullOrEmpty(dr.Field<string>("EqpGroupTag")))
460 564
                                EqpGroupTag = dr.Field<string>("EqpGroupTag");
565
                                if(!lstEqTagRows.Contains(EqpGroupTag))
566
                                    lstEqTagRows.Add(EqpGroupTag);
461 567

  
462
                            if (bCheck && !string.IsNullOrEmpty(EqpGroupTag))
463
                                break;
464
                        }
568
                                if(dataRow["OID"].ToString() != dr.Field<string>("ViewPipeSystemNetwork_OID"))
569
                                {
570
                                    PSNItem viewPSNItem = PSNItems.Find(x => x.PSN_OID() == dr.Field<string>("ViewPipeSystemNetwork_OID"));
571
                                    if (viewPSNItem.Groups.Last().Items.Last().Equipment == null)
572
                                        continue;
465 573

  
466
                        foreach (DataRow dr in pathItemRows)
467
                        {
468
                            if (!string.IsNullOrEmpty(dr.Field<string>("EqpGroupTag")) && EqpGroupTag.Equals(dr.Field<string>("EqpGroupTag")) &&
469
                                !dataRow["OID"].ToString().Equals(dr.Field<string>("ViewPipeSystemNetwork_OID")))
470
                            {
471
                                lstViewPipeSystemNetwork_OID.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
574
                                    if (!lstEqTagRows.Contains(viewPSNItem.Groups.Last().Items.Last().Equipment.ItemTag))
575
                                        lstEqTagRows.Add(viewPSNItem.Groups.Last().Items.Last().Equipment.ItemTag);
576
                                }
577
                                
472 578
                            }
579

  
473 580
                        }
474
                        
475
                        if (bCheck && lstViewPipeSystemNetwork_OID.Count() > 0)
581
                        if(bCheck)
476 582
                        {
477
                            foreach (string viewPipesystem in lstViewPipeSystemNetwork_OID)
583
                            foreach (DataRow row in pumpRows)
478 584
                            {
479
                                if (PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewPipesystem)).Count() == 0)
585
                                if (row.Field<string>("OID").Equals(dataRow["OID"].ToString()))
480 586
                                    continue;
481 587

  
482
                                DataRow dr = PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewPipesystem)).First();
588
                                PSNItem viewPSNItem = PSNItems.Find(x => x.PSN_OID() == row["OID"].ToString());
483 589

  
484
                                if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && dr["From_Data"].ToString().Contains(x.Name)).Count() > 0) 
590
                                if (viewPSNItem.Groups.First().Items.First().Equipment == null)
591
                                    continue;
592
                                
593
                                if (lstEqTagRows.Contains(viewPSNItem.Groups.First().Items.First().Equipment.ItemTag) && !lstViewPipeSystemNetwork_OID.Contains(row.Field<string>("OID")))
594
                                    lstViewPipeSystemNetwork_OID.Add(row.Field<string>("OID"));
595
                            }
596

  
597
                                
598

  
599
                            if (lstViewPipeSystemNetwork_OID.Count() > 0)
600
                            {
601
                                foreach (string viewPipesystem in lstViewPipeSystemNetwork_OID)
485 602
                                {
486
                                    string selectViewOID = string.Empty;
487 603
                                    DataRow[] viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", viewPipesystem));
488 604
                                    foreach (DataRow viewdr in viewpathItemRows)
489 605
                                    {
......
491 607
                                            viewdr["EqpGroupTag"] = EqpGroupTag;
492 608
                                    }
493 609
                                }
494

  
495
                              
496 610
                            }
497
                        }
498
                    }
499
                   
611
                        }                        
612
                    }                   
500 613
                }
501 614
                
502 615
                foreach (DataRow dataRow in airFinCoolerRows)
503 616
                {
504 617
                    afcTagNum++;
505
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
506 618
                    string EGFlowDirection = string.Empty;
507
                    if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => dataRow["From_Data"].ToString().Contains(x.Name)).Count() > 0)
508
                        EGFlowDirection = "O";
509
                    else if(EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => dataRow["To_Data"].ToString().Contains(x.Name)).Count() > 0)
510
                        EGFlowDirection = "I";
619

  
620
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
621
                    if (PSNItem.Groups.First().Items.First().Equipment != null)
622
                    {
623
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
624
                        {
625
                            EGFlowDirection = "O";
626
                        }
627
                    }
628
                    else if (PSNItem.Groups.Last().Items.Last().Equipment != null)
629
                    {
630
                        if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
631
                        {
632
                            EGFlowDirection = "I";
633
                        }
634
                    }
511 635

  
512 636
                    DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
513 637
                    List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();

내보내기 Unified diff

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