364 |
364 |
EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Add(new EquipmentAirFinCoolerItem()
|
365 |
365 |
{
|
366 |
366 |
Type = row["Type"].ToString(),
|
|
367 |
TagIdentifier = row["TagIdentifier"].ToString(),
|
|
368 |
AttributeName = row["AttributeName"].ToString(),
|
367 |
369 |
Name = row["Name"].ToString()
|
368 |
370 |
});
|
369 |
371 |
}
|
... | ... | |
373 |
375 |
DataRow[] pumpRows = PipeSystemNetwork.Select("PUMP = 'PUMP'");
|
374 |
376 |
// 1, 2번
|
375 |
377 |
foreach (DataRow dataRow in pumpRows)
|
376 |
|
{
|
377 |
|
pumpTagNum++;
|
378 |
|
|
|
378 |
{
|
379 |
379 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
|
380 |
380 |
|
381 |
|
string eqTag = string.Empty;
|
|
381 |
string EGTAG = "EGTAG";
|
|
382 |
string ItemTag = "ItemTag";
|
382 |
383 |
string EGFlowDirection = string.Empty;
|
|
384 |
string Prefix = string.Empty;
|
|
385 |
Dictionary<string, string> eqkeyValuePairs = new Dictionary<string, string>();
|
|
386 |
|
383 |
387 |
PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
|
384 |
388 |
if (PSNItem.Groups.First().Items.First().Equipment != null)
|
385 |
389 |
{
|
386 |
390 |
if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
|
387 |
391 |
{
|
388 |
|
eqTag = PSNItem.Groups.First().Items.First().Equipment.ItemTag;
|
|
392 |
EquipmentAirFinCoolerItem equipmentAirFinCoolerItem = EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).First();
|
|
393 |
if (!string.IsNullOrEmpty(equipmentAirFinCoolerItem.AttributeName))
|
|
394 |
EGTAG = PSNItem.Groups.First().Items.First().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName) == null
|
|
395 |
? string.Empty : PSNItem.Groups.First().Items.First().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName).Value;
|
|
396 |
|
|
397 |
ItemTag = PSNItem.Groups.First().Items.First().Equipment.ItemTag;
|
|
398 |
Prefix = equipmentAirFinCoolerItem.TagIdentifier;
|
|
399 |
EGTAG = Prefix + "-" + EGTAG;
|
389 |
400 |
EGFlowDirection = "O";
|
390 |
401 |
}
|
391 |
402 |
}
|
... | ... | |
393 |
404 |
{
|
394 |
405 |
if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
|
395 |
406 |
{
|
396 |
|
eqTag = PSNItem.Groups.Last().Items.Last().Equipment.ItemTag;
|
|
407 |
EquipmentAirFinCoolerItem equipmentAirFinCoolerItem = EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type == "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).First();
|
|
408 |
if (!string.IsNullOrEmpty(equipmentAirFinCoolerItem.AttributeName))
|
|
409 |
EGTAG = EGTAG = PSNItem.Groups.Last().Items.Last().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName) == null
|
|
410 |
? string.Empty : PSNItem.Groups.Last().Items.Last().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName).Value;
|
|
411 |
|
|
412 |
ItemTag = PSNItem.Groups.Last().Items.Last().Equipment.ItemTag;
|
|
413 |
Prefix = equipmentAirFinCoolerItem.TagIdentifier;
|
|
414 |
EGTAG = Prefix + "-" + EGTAG;
|
397 |
415 |
EGFlowDirection = "I";
|
398 |
416 |
}
|
399 |
417 |
}
|
400 |
418 |
|
401 |
|
if(!string.IsNullOrEmpty(eqTag))
|
|
419 |
//Attribute가 세팅되어있지 않다면
|
|
420 |
if (EGTAG.Equals("EGTAG"))
|
402 |
421 |
{
|
403 |
|
foreach (DataRow dr in pathItemRows)
|
|
422 |
if (!eqkeyValuePairs.ContainsKey(ItemTag))
|
404 |
423 |
{
|
405 |
|
dr["EqpGroupTag"] = eqTag;
|
406 |
|
dr["EGFlowDirection"] = EGFlowDirection;
|
|
424 |
pumpTagNum++;
|
|
425 |
EGTAG = Prefix + string.Format("-{0}", string.Format("{0:D5}", pumpTagNum));
|
|
426 |
eqkeyValuePairs.Add(ItemTag, EGTAG);
|
|
427 |
}
|
|
428 |
else
|
|
429 |
{
|
|
430 |
EGTAG = eqkeyValuePairs[ItemTag];
|
407 |
431 |
}
|
408 |
432 |
}
|
|
433 |
|
|
434 |
foreach (DataRow dr in pathItemRows)
|
|
435 |
{
|
|
436 |
dr["EqpGroupTag"] = EGTAG;
|
|
437 |
dr["EGFlowDirection"] = EGFlowDirection;
|
|
438 |
}
|
409 |
439 |
}
|
410 |
440 |
|
411 |
441 |
// 3, 4번
|
... | ... | |
671 |
701 |
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
672 |
702 |
foreach (DataRow dataRow in airFinCoolerRows)
|
673 |
703 |
{
|
674 |
|
string[] afcTag = dataRow.Field<string>("AFC").Split(new string[] { "\\" }, StringSplitOptions.None);
|
675 |
|
if (afcTag.Length > 1)
|
676 |
|
{
|
677 |
|
string afc = string.Empty;
|
678 |
|
if(!keyValuePairs.ContainsKey(afcTag[1]))
|
679 |
|
{
|
680 |
|
afcTagNum++;
|
681 |
|
afc = "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));
|
682 |
|
keyValuePairs.Add(afcTag[1], afc);
|
683 |
|
}
|
684 |
|
else
|
685 |
|
{
|
686 |
|
afc = keyValuePairs[afcTag[1]];
|
687 |
|
}
|
688 |
|
|
689 |
|
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
|
690 |
|
foreach (DataRow dr in pathItemRows)
|
691 |
|
{
|
692 |
|
dr["EqpGroupTag"] = afc;
|
693 |
|
}
|
694 |
|
}
|
695 |
|
}
|
696 |
|
|
697 |
|
foreach (DataRow dataRow in airFinCoolerRows)
|
698 |
|
{
|
699 |
|
|
700 |
704 |
string EGFlowDirection = string.Empty;
|
701 |
|
|
|
705 |
string EGTAG = "EGTAG";
|
|
706 |
string Prefix = string.Empty;
|
|
707 |
//item.Attributes.Find(x => x.Name == valveitem.AttributeName).Value;
|
702 |
708 |
PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
|
703 |
709 |
if (PSNItem.Groups.First().Items.First().Equipment != null)
|
704 |
710 |
{
|
705 |
711 |
if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type != "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).Count() > 0)
|
706 |
712 |
{
|
|
713 |
EquipmentAirFinCoolerItem equipmentAirFinCoolerItem = EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type != "Pump" && PSNItem.Groups.First().Items.First().Equipment.Name.Contains(x.Name)).First();
|
|
714 |
if(!string.IsNullOrEmpty(equipmentAirFinCoolerItem.AttributeName))
|
|
715 |
EGTAG = PSNItem.Groups.First().Items.First().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName) == null
|
|
716 |
? string.Empty : PSNItem.Groups.First().Items.First().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName).Value;
|
|
717 |
|
|
718 |
Prefix = equipmentAirFinCoolerItem.TagIdentifier;
|
|
719 |
EGTAG = Prefix + "-" + EGTAG;
|
707 |
720 |
EGFlowDirection = "O";
|
708 |
721 |
}
|
709 |
722 |
}
|
... | ... | |
711 |
724 |
{
|
712 |
725 |
if (EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type != "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).Count() > 0)
|
713 |
726 |
{
|
|
727 |
EquipmentAirFinCoolerItem equipmentAirFinCoolerItem = EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Where(x => x.Type != "Pump" && PSNItem.Groups.Last().Items.Last().Equipment.Name.Contains(x.Name)).First();
|
|
728 |
if (!string.IsNullOrEmpty(equipmentAirFinCoolerItem.AttributeName))
|
|
729 |
EGTAG = PSNItem.Groups.Last().Items.Last().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName) == null
|
|
730 |
? string.Empty : PSNItem.Groups.Last().Items.Last().Equipment.Attributes.Find(x => x.Name == equipmentAirFinCoolerItem.AttributeName).Value;
|
|
731 |
|
|
732 |
Prefix = equipmentAirFinCoolerItem.TagIdentifier;
|
|
733 |
EGTAG = Prefix + "-" + EGTAG;
|
714 |
734 |
EGFlowDirection = "I";
|
715 |
735 |
}
|
716 |
736 |
}
|
717 |
737 |
|
|
738 |
if(!string.IsNullOrEmpty(EGFlowDirection))
|
|
739 |
{
|
|
740 |
string[] afcTag = dataRow.Field<string>("AFC").Split(new string[] { "\\" }, StringSplitOptions.None);
|
|
741 |
|
|
742 |
//Attribute가 세팅되어있지 않다면
|
|
743 |
if (EGTAG.Equals("EGTAG"))
|
|
744 |
{
|
|
745 |
if (!keyValuePairs.ContainsKey(afcTag[1]))
|
|
746 |
{
|
|
747 |
afcTagNum++;
|
|
748 |
EGTAG = Prefix + string.Format("-{0}", string.Format("{0:D5}", afcTagNum));
|
|
749 |
keyValuePairs.Add(afcTag[1], EGTAG);
|
|
750 |
}
|
|
751 |
else
|
|
752 |
{
|
|
753 |
EGTAG = keyValuePairs[afcTag[1]];
|
|
754 |
}
|
|
755 |
}
|
|
756 |
|
|
757 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
|
|
758 |
foreach (DataRow dr in pathItemRows)
|
|
759 |
{
|
|
760 |
dr["EqpGroupTag"] = EGTAG;
|
|
761 |
dr["EGFlowDirection"] = EGFlowDirection;
|
|
762 |
}
|
|
763 |
}
|
|
764 |
|
|
765 |
}
|
|
766 |
|
|
767 |
List<string> changePSN = new List<string>();
|
|
768 |
foreach (DataRow dataRow in airFinCoolerRows)
|
|
769 |
{
|
|
770 |
if (changePSN.Contains(dataRow["OID"].ToString()))
|
|
771 |
continue;
|
|
772 |
|
718 |
773 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
|
719 |
|
string AFCTag = pathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).First().Field<string>("EqpGroupTag");
|
720 |
|
List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).ToList();
|
721 |
|
//ViewPipeSystemNetwork_OID
|
722 |
|
string MainLineTag = "";
|
|
774 |
string AFCTag = string.Empty;
|
|
775 |
if (pathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).Count() > 0)
|
|
776 |
AFCTag = pathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).First().Field<string>("EqpGroupTag");
|
|
777 |
|
|
778 |
List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
|
|
779 |
|
723 |
780 |
if (dataRow["Type"].ToString() == "E2E")
|
724 |
781 |
{
|
725 |
|
MainLineTag = "M";
|
726 |
|
dataRow["AFC"] = "P3";
|
|
782 |
foreach (DataRow dr in pathItemRows)
|
|
783 |
{
|
|
784 |
dr["MainLineTag"] = "M";
|
|
785 |
}
|
|
786 |
dataRow["AFC"] = "P3";
|
727 |
787 |
}
|
728 |
788 |
else if (dataRow["Type"].ToString() == "E2B" || dataRow["Type"].ToString() == "B2E")
|
729 |
789 |
{
|
730 |
|
foreach (string viewOID in lstViewPipeSystemNetwork_OID)
|
731 |
|
{
|
732 |
|
if (viewOID == dataRow["OID"].ToString())
|
733 |
|
continue;
|
734 |
|
|
735 |
|
DataRow dr = PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewOID)).First();
|
736 |
|
if (!dr.Field<string>("AFC").Contains("P1"))
|
|
790 |
foreach (string lstoid in lstViewPipeSystemNetwork_OID)
|
|
791 |
{
|
|
792 |
DataRow[] viewPathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstoid));
|
|
793 |
List<string> lstview = viewPathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
|
|
794 |
lstview.Remove(dataRow["OID"].ToString()); // P1인 자기 자신 제거
|
|
795 |
//제거 후 다른 P2를 확인
|
|
796 |
foreach (string lstvw in lstview)
|
737 |
797 |
{
|
738 |
|
if (lstViewPipeSystemNetwork_OID.Where(x => x.Equals(viewOID)).Count() == 1)
|
|
798 |
DataRow[] pipesn = PipeSystemNetwork.Select(string.Format("OID = '{0}' AND AFC = 'P2'", lstvw));
|
|
799 |
if(pipesn.Count() > 0)
|
739 |
800 |
{
|
740 |
|
MainLineTag = "M";
|
741 |
|
dataRow["AFC"] = "P3";
|
742 |
|
}
|
743 |
|
else if(lstViewPipeSystemNetwork_OID.Where(x => x.Equals(viewOID)).Count() > 1)
|
744 |
|
{
|
745 |
|
DataRow[] viewpipeSystem = PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewOID));
|
746 |
|
foreach (DataRow row in viewpipeSystem)
|
|
801 |
List<string> lstpipe = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstvw)).Select(x=>x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
|
|
802 |
lstpipe.Remove(lstvw); //현재 자기 라인 제거
|
|
803 |
lstpipe.Remove(dataRow["OID"].ToString()); //기준 P1 제거
|
|
804 |
List<string> lstnewpipe = new List<string>();
|
|
805 |
foreach (string pipe in lstpipe)
|
747 |
806 |
{
|
748 |
|
row["AFC"] = "P4";
|
|
807 |
if (airFinCoolerRows.Where(x => x.Field<string>("OID").Equals(pipe)).Count() > 0) //P1이면 리스트에 추가
|
|
808 |
lstnewpipe.Add(pipe);
|
749 |
809 |
}
|
750 |
810 |
|
751 |
|
DataRow[] viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", viewOID));
|
752 |
|
|
753 |
|
//if(viewpathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).Count() > 0)
|
754 |
|
// AFCTag = viewpathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).First().Field<string>("EqpGroupTag");
|
755 |
|
afcTagNum++;
|
756 |
|
AFCTag = "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));
|
757 |
|
foreach (DataRow viewdr in viewpathItemRows)
|
|
811 |
if (lstnewpipe.Count() == 0)
|
758 |
812 |
{
|
759 |
|
viewdr["EqpGroupTag"] = AFCTag;
|
760 |
|
viewdr["MainLineTag"] = "M";
|
|
813 |
foreach (DataRow dr in pathItemRows)
|
|
814 |
{
|
|
815 |
dr["MainLineTag"] = "M";
|
|
816 |
}
|
|
817 |
dataRow["AFC"] = "P3";
|
|
818 |
}
|
|
819 |
else if (lstnewpipe.Count() > 0) //P2에 기준 P1 말고 다른 P1이 있다면 P2에 ML값 AGT값 지정 후 P2에 연결된 모든 P1들의 AGT값 치환
|
|
820 |
{
|
|
821 |
// P2에 ML값 AGT값 지정
|
|
822 |
DataRow[] viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstvw));
|
|
823 |
DataRow[] pipesystemRows = PipeSystemNetwork.Select(string.Format("OID = '{0}'", lstvw));
|
|
824 |
foreach (DataRow viewdr in pipesystemRows)
|
|
825 |
{
|
|
826 |
viewdr["AFC"] = "P4";
|
|
827 |
}
|
|
828 |
|
|
829 |
foreach (DataRow viewdr in viewpathItemRows)
|
|
830 |
{
|
|
831 |
viewdr["EqpGroupTag"] = AFCTag;
|
|
832 |
viewdr["MainLineTag"] = "M";
|
|
833 |
}
|
|
834 |
// 연결된 모든 P1들의 AGT값 치환
|
|
835 |
foreach (string pipe in lstnewpipe)
|
|
836 |
{
|
|
837 |
viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", pipe));
|
|
838 |
foreach (DataRow viewdr in viewpathItemRows)
|
|
839 |
{
|
|
840 |
viewdr["EqpGroupTag"] = AFCTag;
|
|
841 |
}
|
|
842 |
}
|
761 |
843 |
}
|
762 |
844 |
}
|
763 |
|
}
|
764 |
|
}
|
|
845 |
}
|
|
846 |
}
|
765 |
847 |
}
|
766 |
848 |
|
767 |
|
foreach (DataRow dr in pathItemRows)
|
768 |
|
{
|
769 |
|
dr["EqpGroupTag"] = AFCTag;// "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum)); //ATG Sequence No Rule 여쭤봐야함.
|
770 |
|
dr["MainLineTag"] = MainLineTag;
|
771 |
|
dr["EGFlowDirection"] = EGFlowDirection;
|
772 |
|
}
|
773 |
849 |
}
|
774 |
|
|
775 |
850 |
//P3을 제외한 P1
|
776 |
851 |
airFinCoolerRows = PipeSystemNetwork.Select("AFC Like 'P1%'");
|
777 |
852 |
foreach (DataRow dataRow in airFinCoolerRows)
|
778 |
853 |
{
|
779 |
|
//ML이 공란
|
780 |
|
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}' AND MainLineTag = ''", dataRow["OID"].ToString()));
|
781 |
|
|
|
854 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
|
|
855 |
|
782 |
856 |
if (pathItemRows.Count() > 0)
|
783 |
857 |
{
|
784 |
858 |
List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
|
... | ... | |
788 |
862 |
foreach (string viewOID in lstViewPipeSystemNetwork_OID)
|
789 |
863 |
{
|
790 |
864 |
if (dataRow["OID"].ToString() == viewOID)
|
|
865 |
{
|
|
866 |
lstAll.Add(viewOID);
|
791 |
867 |
continue;
|
|
868 |
}
|
792 |
869 |
|
793 |
870 |
//P3이면
|
794 |
871 |
DataRow viewPSN = null;
|
... | ... | |
798 |
875 |
if (viewPSN != null)
|
799 |
876 |
{
|
800 |
877 |
//P3의 AGT를 가져와 P1에 입력
|
801 |
|
EqpGroupTag = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", viewOID)).First().Field<string>("EqpGroupTag");
|
|
878 |
if(string.IsNullOrEmpty(EqpGroupTag))
|
|
879 |
EqpGroupTag = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", viewOID)).First().Field<string>("EqpGroupTag");
|
|
880 |
|
802 |
881 |
foreach (DataRow dr in pathItemRows)
|
803 |
882 |
{
|
|
883 |
|
804 |
884 |
dr["EqpGroupTag"] = EqpGroupTag;
|
805 |
885 |
|
806 |
886 |
//P1의 AGT와 같은 모든 AGT를 P3의 AGT로 변경하기위해
|
807 |
887 |
if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstpsn.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
|
808 |
888 |
{
|
809 |
|
lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
810 |
|
lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
|
889 |
//AND MainLineTag = ''
|
|
890 |
if (PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}' ", dr.Field<string>("ViewPipeSystemNetwork_OID"))).Count() > 0)
|
|
891 |
{
|
|
892 |
lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
|
893 |
lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
|
894 |
}
|
811 |
895 |
}
|
812 |
896 |
}
|
813 |
897 |
}
|
... | ... | |
815 |
899 |
}
|
816 |
900 |
|
817 |
901 |
while (lstpsn.Count() != 0)
|
818 |
|
{
|
819 |
|
int lstCount = lstpsn.Count;
|
820 |
|
for (int i = 0; i < lstpsn.Count(); i++) //string psn in lstpsn
|
|
902 |
{
|
|
903 |
DataRow[] rule4pathItems = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstpsn[0]));
|
|
904 |
foreach (DataRow dr in rule4pathItems)
|
821 |
905 |
{
|
822 |
|
|
823 |
|
DataRow[] rule4pathItems = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstpsn[i]));
|
824 |
|
foreach (DataRow dr in rule4pathItems)
|
|
906 |
if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstAll.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
|
825 |
907 |
{
|
826 |
|
if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstAll.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
|
|
908 |
DataRow viewPSN = null;
|
|
909 |
|
|
910 |
if (airFinCoolerRows.Where(x => x.Field<string>("OID") == dr.Field<string>("ViewPipeSystemNetwork_OID")).Count() > 0)
|
|
911 |
viewPSN = airFinCoolerRows.Where(x => x.Field<string>("OID") == dr.Field<string>("ViewPipeSystemNetwork_OID")).First();
|
|
912 |
|
|
913 |
//DataRow[] pathItemviewRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dr.Field<string>("ViewPipeSystemNetwork_OID")));
|
|
914 |
//if (pathItemviewRows.Select(x => x.Field<string>("MainLineTag") == "M").Count() > 0)
|
|
915 |
//{
|
|
916 |
//}
|
|
917 |
if (viewPSN != null)
|
827 |
918 |
{
|
828 |
|
DataRow viewPSN = null;
|
829 |
|
//연결된 PathItem-Tee (P3인것만) 의 PathItem-Tee에 또 P3가 있다면 해당 PSN도 Tag변경 만약 P3가 아닌 모든 OID면 해당 로직 삭제 (위에로직도 변경필요)
|
830 |
|
if (PipeSystemNetwork.Select(string.Format("OID = '{0}' AND AFC = 'P3'", dr.Field<string>("ViewPipeSystemNetwork_OID"))).Count() > 0)
|
831 |
|
viewPSN = PipeSystemNetwork.Select(string.Format("OID = '{0}' AND AFC = 'P3'", dr.Field<string>("ViewPipeSystemNetwork_OID"))).First();
|
832 |
|
if(viewPSN != null)
|
833 |
|
{
|
834 |
|
lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
835 |
|
lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
836 |
|
}
|
|
919 |
lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
|
920 |
lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
|
837 |
921 |
}
|
|
922 |
}
|
838 |
923 |
|
839 |
|
if (dr["EqpGroupTag"].Equals(EqpGroupTag))
|
840 |
|
continue;
|
|
924 |
|
841 |
925 |
|
842 |
|
dr["EqpGroupTag"] = EqpGroupTag;
|
843 |
|
}
|
|
926 |
dr["EqpGroupTag"] = EqpGroupTag;
|
844 |
927 |
|
845 |
|
lstpsn.Remove(lstpsn[i]);
|
846 |
928 |
}
|
847 |
|
|
|
929 |
lstpsn.Remove(lstpsn[0]);
|
848 |
930 |
}
|
849 |
931 |
}
|
850 |
932 |
|
... | ... | |
971 |
1053 |
List<Item> valveGroupingItem = new List<Item>();
|
972 |
1054 |
int bCnt = 0;
|
973 |
1055 |
|
974 |
|
//bool bCheck = false;
|
975 |
|
if (drPathitem["PipeSystemNetwork_OID"].ToString().Contains("901"))
|
976 |
|
{
|
977 |
|
|
978 |
|
}
|
|
1056 |
|
979 |
1057 |
List<DataRow> lstitem = new List<DataRow>();
|
980 |
1058 |
foreach (DataRow dr in pathItemRows)
|
981 |
1059 |
{
|
982 |
|
//if (!string.IsNullOrEmpty(dr["GROUPTAG"].ToString()))
|
983 |
|
// break;
|
984 |
|
|
985 |
1060 |
if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString()))
|
986 |
1061 |
{
|
987 |
1062 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString()));
|
... | ... | |
991 |
1066 |
keyValuePairs.Add(bCnt, lstitem.ToList());
|
992 |
1067 |
bCnt++;
|
993 |
1068 |
lstitem.Clear();
|
994 |
|
//break;
|
995 |
1069 |
}
|
996 |
1070 |
else
|
997 |
1071 |
{
|
998 |
1072 |
if (rows.First()["SubType"].ToString() != "Bypass" && rows.First()["SubType"].ToString() != "Vent_Drain")
|
999 |
1073 |
{
|
1000 |
|
// bCheck = true;
|
1001 |
1074 |
if (lstitem.ToList().Where(x => !string.IsNullOrEmpty(x.Field<string>("GROUPTAG"))).Count() > 0)
|
1002 |
1075 |
{
|
1003 |
1076 |
lstitem.Add(dr);
|
... | ... | |
1016 |
1089 |
else
|
1017 |
1090 |
lstitem.Add(dr);
|
1018 |
1091 |
}
|
1019 |
|
|
1020 |
1092 |
}
|
1021 |
1093 |
else
|
1022 |
1094 |
lstitem.Add(dr);
|
... | ... | |
1025 |
1097 |
if (lstitem.Count > 0)
|
1026 |
1098 |
{
|
1027 |
1099 |
keyValuePairs.Add(bCnt, lstitem);
|
1028 |
|
//bCnt++;
|
1029 |
1100 |
}
|
1030 |
1101 |
|
1031 |
1102 |
if (keyValuePairs.Count() == 0)
|
... | ... | |
1039 |
1110 |
}
|
1040 |
1111 |
else
|
1041 |
1112 |
{
|
1042 |
|
if(string.IsNullOrEmpty(valvetag[1]))
|
1043 |
|
VGTag = valveitem.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
|
1044 |
|
else
|
1045 |
|
VGTag = valveitem.TagIdentifier + "-" + valvetag[1] + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
|
1046 |
|
|
1047 |
|
vgTagNum++;
|
|
1113 |
//if(string.IsNullOrEmpty(valvetag[1]))
|
|
1114 |
// VGTag = valveitem.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
|
|
1115 |
//else
|
|
1116 |
VGTag = valveitem.TagIdentifier + "-" + valvetag[1];
|
1048 |
1117 |
}
|
1049 |
1118 |
|
1050 |
1119 |
foreach (KeyValuePair<int, List<DataRow>> keyValuePair in keyValuePairs)
|
... | ... | |
1073 |
1142 |
}
|
1074 |
1143 |
}
|
1075 |
1144 |
}
|
1076 |
|
|
1077 |
|
|
1078 |
|
//ViewPipeSystemNetwork_OID
|
1079 |
|
//DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString()));
|
1080 |
1145 |
}
|
1081 |
1146 |
}
|
1082 |
1147 |
}
|
1083 |
1148 |
}
|
1084 |
|
|
1085 |
1149 |
if(valveitem.GroupType.Contains("PSV"))
|
1086 |
1150 |
{
|
1087 |
1151 |
DataRow[] psnRows = PipeSystemNetwork.Select(string.Format("OID = '{0}'", drPathitem["PipeSystemNetwork_OID"].ToString()));
|
... | ... | |
1089 |
1153 |
row["Pocket"] = "Yes";
|
1090 |
1154 |
}
|
1091 |
1155 |
}
|
1092 |
|
|
1093 |
|
|
1094 |
1156 |
}
|
1095 |
1157 |
catch (Exception ex)
|
1096 |
1158 |
{
|
1097 |
1159 |
MessageBox.Show(ex.Message, "ID2 ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
1098 |
1160 |
}
|
1099 |
|
//}
|
1100 |
1161 |
}
|
1101 |
1162 |
|
1102 |
1163 |
private void SetTopologyData()
|
... | ... | |
1154 |
1215 |
List<LineNumber> lineNumbers = group.Document.LineNumbers.FindAll(x => !x.IsCopy);
|
1155 |
1216 |
Random random = new Random();
|
1156 |
1217 |
int index = random.Next(lineNumbers.Count - 1);
|
1157 |
|
|
|
1218 |
|
1158 |
1219 |
// Copy
|
1159 |
1220 |
LineNumber cLineNumber = lineNumbers[index].Copy();
|
1160 |
1221 |
group.Document.LineNumbers.Add(cLineNumber);
|
... | ... | |
1205 |
1266 |
|
1206 |
1267 |
item.PSNPipeLineID = string.Join("-", pipeLineID);
|
1207 |
1268 |
item.TopologyData = string.Join("-", pipeLineID);
|
1208 |
|
|
|
1269 |
|
1209 |
1270 |
}
|
1210 |
1271 |
else
|
1211 |
1272 |
{
|