개정판 2c46461b
issue #000: 초기 psn sqlite db path 설정
Change-Id: I484e41af17f6a745f6cc3ea77ec2f045837ff975
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
807 | 807 |
} |
808 | 808 |
private void SavePSNData() |
809 | 809 |
{ |
810 |
DataTable pathItemsDT = new DataTable(); |
|
811 |
pathItemsDT.Columns.Add("OID", typeof(string)); |
|
812 |
pathItemsDT.Columns.Add("SequenceData_OID", typeof(string)); |
|
813 |
pathItemsDT.Columns.Add("TopologySet_OID", typeof(string)); |
|
814 |
pathItemsDT.Columns.Add("BranchTopologySet_OID", typeof(string)); |
|
815 |
pathItemsDT.Columns.Add("PipeLine_OID", typeof(string)); |
|
816 |
pathItemsDT.Columns.Add("ITEMNAME", typeof(string)); |
|
817 |
pathItemsDT.Columns.Add("ITEMTAG", typeof(string)); |
|
818 |
pathItemsDT.Columns.Add("Class", typeof(string)); |
|
819 |
pathItemsDT.Columns.Add("SubClass", typeof(string)); |
|
820 |
pathItemsDT.Columns.Add("TYPE", typeof(string)); |
|
821 |
pathItemsDT.Columns.Add("PIDNAME", typeof(string)); |
|
822 |
pathItemsDT.Columns.Add("NPD", typeof(string)); |
|
823 |
pathItemsDT.Columns.Add("PipeSystemNetwork_OID", typeof(string)); |
|
824 |
pathItemsDT.Columns.Add("ViewPipeSystemNetwork_OID", typeof(string)); |
|
825 |
pathItemsDT.Columns.Add("PipeRun_OID", typeof(string)); |
|
826 |
|
|
827 |
DataTable sequenceDataDT = new DataTable(); |
|
828 |
sequenceDataDT.Columns.Add("OID", typeof(string)); |
|
829 |
sequenceDataDT.Columns.Add("SERIALNUMBER", typeof(string)); |
|
830 |
sequenceDataDT.Columns.Add("PathItem_OID", typeof(string)); |
|
831 |
sequenceDataDT.Columns.Add("TopologySet_OID_Key", typeof(string)); |
|
832 |
|
|
833 |
DataTable pipeSystemNetworkDT = new DataTable(); |
|
834 |
pipeSystemNetworkDT.Columns.Add("OID", typeof(string)); |
|
835 |
pipeSystemNetworkDT.Columns.Add("Type", typeof(string)); |
|
836 |
pipeSystemNetworkDT.Columns.Add("OrderNumber", typeof(string)); |
|
837 |
pipeSystemNetworkDT.Columns.Add("Pipeline_OID", typeof(string)); |
|
838 |
pipeSystemNetworkDT.Columns.Add("FROM_DATA", typeof(string)); |
|
839 |
pipeSystemNetworkDT.Columns.Add("TO_DATA", typeof(string)); |
|
840 |
pipeSystemNetworkDT.Columns.Add("TopologySet_OID_Key", typeof(string)); |
|
841 |
pipeSystemNetworkDT.Columns.Add("PSNRevisionNumber", typeof(string)); |
|
842 |
pipeSystemNetworkDT.Columns.Add("PBS", typeof(string)); |
|
843 |
pipeSystemNetworkDT.Columns.Add("PIDDrawings", typeof(string)); |
|
844 |
pipeSystemNetworkDT.Columns.Add("Validity", typeof(string)); |
|
845 |
pipeSystemNetworkDT.Columns.Add("Status", typeof(string)); |
|
846 |
|
|
847 |
DataTable topologySetDT = new DataTable(); |
|
848 |
topologySetDT.Columns.Add("OID", typeof(string)); |
|
849 |
topologySetDT.Columns.Add("Type", typeof(string)); |
|
850 |
topologySetDT.Columns.Add("SubType", typeof(string)); |
|
851 |
topologySetDT.Columns.Add("HeadItemTag", typeof(string)); |
|
852 |
topologySetDT.Columns.Add("TailItemTag", typeof(string)); |
|
853 |
topologySetDT.Columns.Add("HeadItemID", typeof(string)); |
|
854 |
topologySetDT.Columns.Add("TailItemID", typeof(string)); |
|
855 |
|
|
856 |
// Set Header Info |
|
857 |
List<VentDrainInfo> VentDrainInfos = new List<VentDrainInfo>(); |
|
858 |
DataTable dt = DB.SelectVentDrainSetting(); |
|
859 |
foreach (DataRow row in dt.Rows) |
|
810 |
try |
|
860 | 811 |
{ |
861 |
string groupID = row["GROUP_ID"].ToString(); |
|
862 |
string desc = row["DESCRIPTION"].ToString(); |
|
863 |
int index = Convert.ToInt32(row["INDEX"]); |
|
864 |
string name = row["NAME"].ToString(); |
|
865 |
|
|
866 |
VentDrainInfo ventDrainInfo = VentDrainInfos.Find(x => x.UID.Equals(groupID)); |
|
867 |
if (ventDrainInfo == null) |
|
812 |
DataTable pathItemsDT = new DataTable(); |
|
813 |
pathItemsDT.Columns.Add("OID", typeof(string)); |
|
814 |
pathItemsDT.Columns.Add("SequenceData_OID", typeof(string)); |
|
815 |
pathItemsDT.Columns.Add("TopologySet_OID", typeof(string)); |
|
816 |
pathItemsDT.Columns.Add("BranchTopologySet_OID", typeof(string)); |
|
817 |
pathItemsDT.Columns.Add("PipeLine_OID", typeof(string)); |
|
818 |
pathItemsDT.Columns.Add("ITEMNAME", typeof(string)); |
|
819 |
pathItemsDT.Columns.Add("ITEMTAG", typeof(string)); |
|
820 |
pathItemsDT.Columns.Add("Class", typeof(string)); |
|
821 |
pathItemsDT.Columns.Add("SubClass", typeof(string)); |
|
822 |
pathItemsDT.Columns.Add("TYPE", typeof(string)); |
|
823 |
pathItemsDT.Columns.Add("PIDNAME", typeof(string)); |
|
824 |
pathItemsDT.Columns.Add("NPD", typeof(string)); |
|
825 |
pathItemsDT.Columns.Add("PipeSystemNetwork_OID", typeof(string)); |
|
826 |
pathItemsDT.Columns.Add("ViewPipeSystemNetwork_OID", typeof(string)); |
|
827 |
pathItemsDT.Columns.Add("PipeRun_OID", typeof(string)); |
|
828 |
|
|
829 |
DataTable sequenceDataDT = new DataTable(); |
|
830 |
sequenceDataDT.Columns.Add("OID", typeof(string)); |
|
831 |
sequenceDataDT.Columns.Add("SERIALNUMBER", typeof(string)); |
|
832 |
sequenceDataDT.Columns.Add("PathItem_OID", typeof(string)); |
|
833 |
sequenceDataDT.Columns.Add("TopologySet_OID_Key", typeof(string)); |
|
834 |
|
|
835 |
DataTable pipeSystemNetworkDT = new DataTable(); |
|
836 |
pipeSystemNetworkDT.Columns.Add("OID", typeof(string)); |
|
837 |
pipeSystemNetworkDT.Columns.Add("Type", typeof(string)); |
|
838 |
pipeSystemNetworkDT.Columns.Add("OrderNumber", typeof(string)); |
|
839 |
pipeSystemNetworkDT.Columns.Add("Pipeline_OID", typeof(string)); |
|
840 |
pipeSystemNetworkDT.Columns.Add("FROM_DATA", typeof(string)); |
|
841 |
pipeSystemNetworkDT.Columns.Add("TO_DATA", typeof(string)); |
|
842 |
pipeSystemNetworkDT.Columns.Add("TopologySet_OID_Key", typeof(string)); |
|
843 |
pipeSystemNetworkDT.Columns.Add("PSNRevisionNumber", typeof(string)); |
|
844 |
pipeSystemNetworkDT.Columns.Add("PBS", typeof(string)); |
|
845 |
pipeSystemNetworkDT.Columns.Add("PIDDrawings", typeof(string)); |
|
846 |
pipeSystemNetworkDT.Columns.Add("Validity", typeof(string)); |
|
847 |
pipeSystemNetworkDT.Columns.Add("Status", typeof(string)); |
|
848 |
|
|
849 |
DataTable topologySetDT = new DataTable(); |
|
850 |
topologySetDT.Columns.Add("OID", typeof(string)); |
|
851 |
topologySetDT.Columns.Add("Type", typeof(string)); |
|
852 |
topologySetDT.Columns.Add("SubType", typeof(string)); |
|
853 |
topologySetDT.Columns.Add("HeadItemTag", typeof(string)); |
|
854 |
topologySetDT.Columns.Add("TailItemTag", typeof(string)); |
|
855 |
topologySetDT.Columns.Add("HeadItemID", typeof(string)); |
|
856 |
topologySetDT.Columns.Add("TailItemID", typeof(string)); |
|
857 |
|
|
858 |
// Set Header Info |
|
859 |
List<VentDrainInfo> VentDrainInfos = new List<VentDrainInfo>(); |
|
860 |
DataTable dt = DB.SelectVentDrainSetting(); |
|
861 |
foreach (DataRow row in dt.Rows) |
|
868 | 862 |
{ |
869 |
ventDrainInfo = new VentDrainInfo(groupID);
|
|
870 |
ventDrainInfo.Description = desc;
|
|
871 |
VentDrainInfos.Add(ventDrainInfo);
|
|
872 |
}
|
|
863 |
string groupID = row["GROUP_ID"].ToString();
|
|
864 |
string desc = row["DESCRIPTION"].ToString();
|
|
865 |
int index = Convert.ToInt32(row["INDEX"]);
|
|
866 |
string name = row["NAME"].ToString();
|
|
873 | 867 |
|
874 |
ventDrainInfo.VentDrainItems.Add(new VentDrainItem() |
|
875 |
{ |
|
876 |
Index = index, |
|
877 |
Name = name |
|
878 |
}); |
|
879 |
} |
|
880 |
|
|
881 |
// key = 미입력 branch |
|
882 |
Dictionary<Item, Item> startBranchDic = new Dictionary<Item, Item>(); |
|
883 |
Dictionary<Item, Item> endBranchDic = new Dictionary<Item, Item>(); |
|
884 |
foreach (PSNItem PSNItem in PSNItems) |
|
885 |
{ |
|
886 |
int psnOrder = 0; |
|
887 |
int index = 0; |
|
888 |
bool bPSNStart = true; |
|
889 |
string sPSNData = string.Empty; |
|
890 |
bool bVentDrain = false; |
|
891 |
|
|
892 |
//VentDrain 검사 |
|
893 |
if (PSNItem.Groups.Count.Equals(1)) |
|
894 |
{ |
|
895 |
List<VentDrainInfo> endInfos = new List<VentDrainInfo>(); |
|
896 |
Group group = PSNItem.Groups[0]; |
|
897 |
for (int i = 0; i < group.Items.Count; i++) |
|
868 |
VentDrainInfo ventDrainInfo = VentDrainInfos.Find(x => x.UID.Equals(groupID)); |
|
869 |
if (ventDrainInfo == null) |
|
898 | 870 |
{ |
899 |
Item item = group.Items[i]; |
|
900 |
foreach (VentDrainInfo ventDrainInfo in VentDrainInfos) |
|
901 |
{ |
|
902 |
if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count) |
|
903 |
continue; |
|
904 |
if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name)) |
|
905 |
{ |
|
906 |
endInfos.Add(ventDrainInfo); |
|
907 |
continue; |
|
908 |
} |
|
909 |
|
|
910 |
if (i + 1 == group.Items.Count && group.Items.Count.Equals(ventDrainInfo.VentDrainItems.Count)) |
|
911 |
bVentDrain = true; |
|
912 |
} |
|
871 |
ventDrainInfo = new VentDrainInfo(groupID); |
|
872 |
ventDrainInfo.Description = desc; |
|
873 |
VentDrainInfos.Add(ventDrainInfo); |
|
913 | 874 |
} |
914 | 875 |
|
915 |
if (!bVentDrain) |
|
876 |
ventDrainInfo.VentDrainItems.Add(new VentDrainItem() |
|
877 |
{ |
|
878 |
Index = index, |
|
879 |
Name = name |
|
880 |
}); |
|
881 |
} |
|
882 |
|
|
883 |
// key = 미입력 branch |
|
884 |
Dictionary<Item, Item> startBranchDic = new Dictionary<Item, Item>(); |
|
885 |
Dictionary<Item, Item> endBranchDic = new Dictionary<Item, Item>(); |
|
886 |
foreach (PSNItem PSNItem in PSNItems) |
|
887 |
{ |
|
888 |
int psnOrder = 0; |
|
889 |
int index = 0; |
|
890 |
bool bPSNStart = true; |
|
891 |
string sPSNData = string.Empty; |
|
892 |
bool bVentDrain = false; |
|
893 |
|
|
894 |
//VentDrain 검사 |
|
895 |
if (PSNItem.Groups.Count.Equals(1)) |
|
916 | 896 |
{ |
917 |
endInfos = new List<VentDrainInfo>(); |
|
897 |
List<VentDrainInfo> endInfos = new List<VentDrainInfo>(); |
|
898 |
Group group = PSNItem.Groups[0]; |
|
918 | 899 |
for (int i = 0; i < group.Items.Count; i++) |
919 | 900 |
{ |
920 |
Item item = group.Items[group.Items.Count - i - 1];
|
|
901 |
Item item = group.Items[i];
|
|
921 | 902 |
foreach (VentDrainInfo ventDrainInfo in VentDrainInfos) |
922 | 903 |
{ |
923 | 904 |
if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count) |
... | ... | |
932 | 913 |
bVentDrain = true; |
933 | 914 |
} |
934 | 915 |
} |
935 |
} |
|
936 |
} |
|
937 | 916 |
|
938 |
//PSN, PathItems, SequenceData 관련 |
|
939 |
foreach (Group group in PSNItem.Groups) |
|
940 |
{ |
|
941 |
foreach (Item item in group.Items) |
|
942 |
{ |
|
943 |
if (item.BranchItems.Count == 0) |
|
917 |
if (!bVentDrain) |
|
944 | 918 |
{ |
945 |
CreatePathItemsDataRow(item.UID, item.ID2DBType); |
|
946 |
CreateSequenceDataDataRow(item.UID); |
|
947 |
index++; |
|
919 |
endInfos = new List<VentDrainInfo>(); |
|
920 |
for (int i = 0; i < group.Items.Count; i++) |
|
921 |
{ |
|
922 |
Item item = group.Items[group.Items.Count - i - 1]; |
|
923 |
foreach (VentDrainInfo ventDrainInfo in VentDrainInfos) |
|
924 |
{ |
|
925 |
if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count) |
|
926 |
continue; |
|
927 |
if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name)) |
|
928 |
{ |
|
929 |
endInfos.Add(ventDrainInfo); |
|
930 |
continue; |
|
931 |
} |
|
932 |
|
|
933 |
if (i + 1 == group.Items.Count && group.Items.Count.Equals(ventDrainInfo.VentDrainItems.Count)) |
|
934 |
bVentDrain = true; |
|
935 |
} |
|
936 |
} |
|
948 | 937 |
} |
949 |
else |
|
938 |
} |
|
939 |
|
|
940 |
//PSN, PathItems, SequenceData 관련 |
|
941 |
foreach (Group group in PSNItem.Groups) |
|
942 |
{ |
|
943 |
foreach (Item item in group.Items) |
|
950 | 944 |
{ |
951 |
CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType); |
|
952 |
CreateSequenceDataDataRow(item.UID + "_L1"); |
|
953 |
index++; |
|
954 |
for (int i = 0; i < item.BranchItems.Count; i++) |
|
945 |
if (item.BranchItems.Count == 0) |
|
955 | 946 |
{ |
956 |
CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
|
|
957 |
CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1));
|
|
947 |
CreatePathItemsDataRow(item.UID, item.ID2DBType);
|
|
948 |
CreateSequenceDataDataRow(item.UID);
|
|
958 | 949 |
index++; |
959 |
|
|
960 |
CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType); |
|
961 |
CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2)); |
|
950 |
} |
|
951 |
else |
|
952 |
{ |
|
953 |
CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType); |
|
954 |
CreateSequenceDataDataRow(item.UID + "_L1"); |
|
962 | 955 |
index++; |
963 |
|
|
964 |
if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item) |
|
965 |
startBranchDic.Add(item.BranchItems[i], item); |
|
966 |
else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item) |
|
967 |
endBranchDic.Add(item.BranchItems[i], item); |
|
956 |
for (int i = 0; i < item.BranchItems.Count; i++) |
|
957 |
{ |
|
958 |
CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]); |
|
959 |
CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1)); |
|
960 |
index++; |
|
961 |
|
|
962 |
CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType); |
|
963 |
CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2)); |
|
964 |
index++; |
|
965 |
|
|
966 |
if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item) |
|
967 |
startBranchDic.Add(item.BranchItems[i], item); |
|
968 |
else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item) |
|
969 |
endBranchDic.Add(item.BranchItems[i], item); |
|
970 |
} |
|
968 | 971 |
} |
969 |
} |
|
970 | 972 |
|
971 |
if (bPSNStart) |
|
972 |
{ |
|
973 |
CreatePipeSystemNetworkDataRow(); |
|
974 |
sPSNData = item.TopologyData; |
|
975 |
psnOrder++; |
|
976 |
bPSNStart = false; |
|
977 |
} |
|
978 |
else |
|
979 |
{ |
|
980 |
if (item.TopologyData != sPSNData) |
|
973 |
if (bPSNStart) |
|
981 | 974 |
{ |
982 | 975 |
CreatePipeSystemNetworkDataRow(); |
983 | 976 |
sPSNData = item.TopologyData; |
984 | 977 |
psnOrder++; |
978 |
bPSNStart = false; |
|
985 | 979 |
} |
986 |
} |
|
987 |
void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null) |
|
988 |
{ |
|
989 |
DataRow newRow = pathItemsDT.NewRow(); |
|
990 |
newRow["OID"] = itemOID; |
|
980 |
else |
|
981 |
{ |
|
982 |
if (item.TopologyData != sPSNData) |
|
983 |
{ |
|
984 |
CreatePipeSystemNetworkDataRow(); |
|
985 |
sPSNData = item.TopologyData; |
|
986 |
psnOrder++; |
|
987 |
} |
|
988 |
} |
|
989 |
void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null) |
|
990 |
{ |
|
991 |
DataRow newRow = pathItemsDT.NewRow(); |
|
992 |
newRow["OID"] = itemOID; |
|
991 | 993 |
|
992 |
newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index); |
|
994 |
newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
|
|
993 | 995 |
|
994 |
newRow["TopologySet_OID"] = item.Topology.FullName; |
|
996 |
newRow["TopologySet_OID"] = item.Topology.FullName;
|
|
995 | 997 |
|
996 |
newRow["BranchTopologySet_OID"] = branchTopologyName; |
|
997 |
newRow["PipeLine_OID"] = item.PSNPipeLineID; |
|
998 |
newRow["ITEMNAME"] = GetItemName(item, itemOID); |
|
999 |
newRow["ITEMTAG"] = GetItemTag(item); |
|
1000 |
newRow["Class"] = GetClass(item, itemOID); |
|
1001 |
newRow["SubClass"] = GetSubClass(item, itemOID); |
|
998 |
newRow["BranchTopologySet_OID"] = branchTopologyName;
|
|
999 |
newRow["PipeLine_OID"] = item.PSNPipeLineID;
|
|
1000 |
newRow["ITEMNAME"] = GetItemName(item, itemOID);
|
|
1001 |
newRow["ITEMTAG"] = GetItemTag(item);
|
|
1002 |
newRow["Class"] = GetClass(item, itemOID);
|
|
1003 |
newRow["SubClass"] = GetSubClass(item, itemOID);
|
|
1002 | 1004 |
|
1003 |
if (item.ItemType == ItemType.Symbol) |
|
1004 |
newRow["TYPE"] = item.ID2DBName; |
|
1005 |
else if (item.ItemType == ItemType.Line) |
|
1006 |
newRow["TYPE"] = item.ID2DBType; |
|
1007 |
newRow["PIDNAME"] = group.Document.DrawingName; |
|
1005 |
if (item.ItemType == ItemType.Symbol)
|
|
1006 |
newRow["TYPE"] = item.ID2DBName;
|
|
1007 |
else if (item.ItemType == ItemType.Line)
|
|
1008 |
newRow["TYPE"] = item.ID2DBType;
|
|
1009 |
newRow["PIDNAME"] = group.Document.DrawingName;
|
|
1008 | 1010 |
|
1009 |
// NPD |
|
1010 |
if (item.LineNumber != null) |
|
1011 |
{ |
|
1012 |
Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter"); |
|
1013 |
if (attribute != null) |
|
1014 |
newRow["NPD"] = attribute.Value; |
|
1015 |
} |
|
1016 |
else |
|
1017 |
newRow["NPD"] = null; |
|
1011 |
// NPD
|
|
1012 |
if (item.LineNumber != null)
|
|
1013 |
{
|
|
1014 |
Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
|
|
1015 |
if (attribute != null)
|
|
1016 |
newRow["NPD"] = attribute.Value;
|
|
1017 |
}
|
|
1018 |
else
|
|
1019 |
newRow["NPD"] = null;
|
|
1018 | 1020 |
|
1019 |
newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
|
1020 |
if (branchItem == null) |
|
1021 |
newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
|
1022 |
else |
|
1023 |
newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID(); |
|
1024 |
|
|
1025 |
newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty; |
|
1021 |
newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
|
1022 |
if (branchItem == null) |
|
1023 |
newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
|
1024 |
else |
|
1025 |
newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID(); |
|
1026 | 1026 |
|
1027 |
pathItemsDT.Rows.Add(newRow); |
|
1028 |
} |
|
1029 |
void CreateSequenceDataDataRow(string itemOID) |
|
1030 |
{ |
|
1031 |
DataRow newRow = sequenceDataDT.NewRow(); |
|
1032 |
newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index); |
|
1033 |
newRow["SERIALNUMBER"] = string.Format("{0}", index); |
|
1034 |
newRow["PathItem_OID"] = itemOID; |
|
1035 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
|
1027 |
newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty; |
|
1036 | 1028 |
|
1037 |
sequenceDataDT.Rows.Add(newRow); |
|
1038 |
} |
|
1039 |
void CreatePipeSystemNetworkDataRow() |
|
1040 |
{ |
|
1041 |
// VentDrain의 경우 제외 요청 |
|
1042 |
if (bVentDrain) |
|
1043 |
return; |
|
1044 |
|
|
1045 |
DataRow newRow = pipeSystemNetworkDT.NewRow(); |
|
1046 |
newRow["OID"] = PSNItem.PSN_OID(); |
|
1047 |
newRow["Type"] = PSNItem.GetPSNType(); |
|
1048 |
newRow["OrderNumber"] = psnOrder; |
|
1049 |
newRow["Pipeline_OID"] = item.PSNPipeLineID; |
|
1050 |
newRow["FROM_DATA"] = PSNItem.GetFromData(); |
|
1051 |
newRow["TO_DATA"] = PSNItem.GetToData(); |
|
1052 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
|
1053 |
newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision); |
|
1054 |
newRow["PBS"] = PSNItem.GetPBSData(); |
|
1055 |
newRow["Validity"] = PSNItem.Validity; |
|
1056 |
newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty; |
|
1057 |
|
|
1058 |
|
|
1059 |
List<string> drawingNames = new List<string>(); |
|
1060 |
foreach (Group _group in PSNItem.Groups) |
|
1029 |
pathItemsDT.Rows.Add(newRow); |
|
1030 |
} |
|
1031 |
void CreateSequenceDataDataRow(string itemOID) |
|
1061 | 1032 |
{ |
1062 |
if (!drawingNames.Contains(_group.Document.DrawingName)) |
|
1033 |
DataRow newRow = sequenceDataDT.NewRow(); |
|
1034 |
newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index); |
|
1035 |
newRow["SERIALNUMBER"] = string.Format("{0}", index); |
|
1036 |
newRow["PathItem_OID"] = itemOID; |
|
1037 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
|
1038 |
|
|
1039 |
sequenceDataDT.Rows.Add(newRow); |
|
1040 |
} |
|
1041 |
void CreatePipeSystemNetworkDataRow() |
|
1042 |
{ |
|
1043 |
// VentDrain의 경우 제외 요청 |
|
1044 |
if (bVentDrain) |
|
1045 |
return; |
|
1046 |
|
|
1047 |
DataRow newRow = pipeSystemNetworkDT.NewRow(); |
|
1048 |
newRow["OID"] = PSNItem.PSN_OID(); |
|
1049 |
newRow["Type"] = PSNItem.GetPSNType(); |
|
1050 |
newRow["OrderNumber"] = psnOrder; |
|
1051 |
newRow["Pipeline_OID"] = item.PSNPipeLineID; |
|
1052 |
newRow["FROM_DATA"] = PSNItem.GetFromData(); |
|
1053 |
newRow["TO_DATA"] = PSNItem.GetToData(); |
|
1054 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
|
1055 |
newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision); |
|
1056 |
newRow["PBS"] = PSNItem.GetPBSData(); |
|
1057 |
newRow["Validity"] = PSNItem.Validity; |
|
1058 |
newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty; |
|
1059 |
|
|
1060 |
|
|
1061 |
List<string> drawingNames = new List<string>(); |
|
1062 |
foreach (Group _group in PSNItem.Groups) |
|
1063 | 1063 |
{ |
1064 |
if (drawingNames.Count == 0) |
|
1065 |
newRow["PIDDrawings"] = _group.Document.DrawingName; |
|
1066 |
else |
|
1067 |
newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + _group.Document.DrawingName; |
|
1068 |
drawingNames.Add(_group.Document.DrawingName); |
|
1064 |
if (!drawingNames.Contains(_group.Document.DrawingName)) |
|
1065 |
{ |
|
1066 |
if (drawingNames.Count == 0) |
|
1067 |
newRow["PIDDrawings"] = _group.Document.DrawingName; |
|
1068 |
else |
|
1069 |
newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + _group.Document.DrawingName; |
|
1070 |
drawingNames.Add(_group.Document.DrawingName); |
|
1071 |
} |
|
1069 | 1072 |
} |
1073 |
pipeSystemNetworkDT.Rows.Add(newRow); |
|
1070 | 1074 |
} |
1071 |
pipeSystemNetworkDT.Rows.Add(newRow); |
|
1072 | 1075 |
} |
1073 | 1076 |
} |
1077 |
//TopologySet 관련 |
|
1078 |
foreach (Topology topology in PSNItem.Topologies) |
|
1079 |
{ |
|
1080 |
DataRow newRow = topologySetDT.NewRow(); |
|
1081 |
newRow["OID"] = topology.FullName; |
|
1082 |
newRow["Type"] = topology.FullName.Split(new char[] { '-' }).Last().StartsWith("M") ? "Main" : "Branch"; |
|
1083 |
if (bVentDrain) |
|
1084 |
newRow["SubType"] = "Vent_Drain"; |
|
1085 |
else |
|
1086 |
newRow["SubType"] = null; |
|
1087 |
newRow["HeadItemTag"] = GetItemTag(topology.Items.Last()); |
|
1088 |
newRow["TailItemTag"] = GetItemTag(topology.Items.First()); |
|
1089 |
newRow["HeadItemID"] = topology.Items.Last().UID; |
|
1090 |
newRow["TailItemID"] = topology.Items.First().UID; |
|
1091 |
topologySetDT.Rows.Add(newRow); |
|
1092 |
} |
|
1074 | 1093 |
} |
1075 |
//TopologySet 관련 |
|
1076 |
foreach (Topology topology in PSNItem.Topologies) |
|
1077 |
{ |
|
1078 |
DataRow newRow = topologySetDT.NewRow(); |
|
1079 |
newRow["OID"] = topology.FullName; |
|
1080 |
newRow["Type"] = topology.FullName.Split(new char[] { '-' }).Last().StartsWith("M") ? "Main" : "Branch"; |
|
1081 |
if (bVentDrain) |
|
1082 |
newRow["SubType"] = "Vent_Drain"; |
|
1083 |
else |
|
1084 |
newRow["SubType"] = null; |
|
1085 |
newRow["HeadItemTag"] = GetItemTag(topology.Items.Last()); |
|
1086 |
newRow["TailItemTag"] = GetItemTag(topology.Items.First()); |
|
1087 |
newRow["HeadItemID"] = topology.Items.Last().UID; |
|
1088 |
newRow["TailItemID"] = topology.Items.First().UID; |
|
1089 |
topologySetDT.Rows.Add(newRow); |
|
1090 |
} |
|
1091 |
} |
|
1092 | 1094 |
|
1093 |
foreach (var item in startBranchDic) |
|
1094 |
{ |
|
1095 |
string uid = item.Key.UID; |
|
1096 |
string topologyName = item.Value.Topology.FullName; |
|
1097 |
DataRow[] rows = pathItemsDT.Select(string.Format("OID LIKE '{0}%'", uid)); |
|
1098 |
if (rows.Length == 1) |
|
1099 |
rows.First()["BranchTopologySet_OID"] = topologyName; |
|
1100 |
else if (rows.Length > 1) |
|
1095 |
foreach (var item in startBranchDic) |
|
1101 | 1096 |
{ |
1102 |
DataRow targetRow = null; |
|
1103 |
int index = int.MaxValue; |
|
1104 |
foreach (DataRow row in rows) |
|
1097 |
string uid = item.Key.UID; |
|
1098 |
string topologyName = item.Value.Topology.FullName; |
|
1099 |
DataRow[] rows = pathItemsDT.Select(string.Format("OID LIKE '{0}%'", uid)); |
|
1100 |
if (rows.Length == 1) |
|
1101 |
rows.First()["BranchTopologySet_OID"] = topologyName; |
|
1102 |
else if (rows.Length > 1) |
|
1105 | 1103 |
{ |
1106 |
string split = row["OID"].ToString().Split(new char[] { '_' })[1]; |
|
1107 |
if (split.StartsWith("L")) |
|
1104 |
DataRow targetRow = null; |
|
1105 |
int index = int.MaxValue; |
|
1106 |
foreach (DataRow row in rows) |
|
1108 | 1107 |
{ |
1109 |
int num = Convert.ToInt32(split.Remove(0, 1));
|
|
1110 |
if (index > num)
|
|
1108 |
string split = row["OID"].ToString().Split(new char[] { '_' })[1];
|
|
1109 |
if (split.StartsWith("L"))
|
|
1111 | 1110 |
{ |
1112 |
index = num; |
|
1113 |
targetRow = row; |
|
1111 |
int num = Convert.ToInt32(split.Remove(0, 1)); |
|
1112 |
if (index > num) |
|
1113 |
{ |
|
1114 |
index = num; |
|
1115 |
targetRow = row; |
|
1116 |
} |
|
1114 | 1117 |
} |
1115 | 1118 |
} |
1116 |
} |
|
1117 | 1119 |
|
1118 |
if (targetRow != null) |
|
1119 |
targetRow["BranchTopologySet_OID"] = topologyName; |
|
1120 |
if (targetRow != null) |
|
1121 |
targetRow["BranchTopologySet_OID"] = topologyName; |
|
1122 |
} |
|
1120 | 1123 |
} |
1121 |
} |
|
1122 |
foreach (var item in endBranchDic) |
|
1123 |
{ |
|
1124 |
string uid = item.Key.UID; |
|
1125 |
string topologyName = item.Value.Topology.FullName; |
|
1126 |
DataRow[] rows = pathItemsDT.Select(string.Format("OID LIKE '{0}%'", uid)); |
|
1127 |
if (rows.Length == 1) |
|
1128 |
rows.First()["BranchTopologySet_OID"] = topologyName; |
|
1129 |
else if (rows.Length > 1) |
|
1124 |
foreach (var item in endBranchDic) |
|
1130 | 1125 |
{ |
1131 |
DataRow targetRow = null; |
|
1132 |
int index = int.MinValue; |
|
1133 |
foreach (DataRow row in rows) |
|
1126 |
string uid = item.Key.UID; |
|
1127 |
string topologyName = item.Value.Topology.FullName; |
|
1128 |
DataRow[] rows = pathItemsDT.Select(string.Format("OID LIKE '{0}%'", uid)); |
|
1129 |
if (rows.Length == 1) |
|
1130 |
rows.First()["BranchTopologySet_OID"] = topologyName; |
|
1131 |
else if (rows.Length > 1) |
|
1134 | 1132 |
{ |
1135 |
string split = row["OID"].ToString().Split(new char[] { '_' })[1]; |
|
1136 |
if (split.StartsWith("L")) |
|
1133 |
DataRow targetRow = null; |
|
1134 |
int index = int.MinValue; |
|
1135 |
foreach (DataRow row in rows) |
|
1137 | 1136 |
{ |
1138 |
int num = Convert.ToInt32(split.Remove(0, 1));
|
|
1139 |
if (index < num)
|
|
1137 |
string split = row["OID"].ToString().Split(new char[] { '_' })[1];
|
|
1138 |
if (split.StartsWith("L"))
|
|
1140 | 1139 |
{ |
1141 |
index = num; |
|
1142 |
targetRow = row; |
|
1140 |
int num = Convert.ToInt32(split.Remove(0, 1)); |
|
1141 |
if (index < num) |
|
1142 |
{ |
|
1143 |
index = num; |
|
1144 |
targetRow = row; |
|
1145 |
} |
|
1143 | 1146 |
} |
1144 | 1147 |
} |
1145 |
} |
|
1146 | 1148 |
|
1147 |
if (targetRow != null) |
|
1148 |
targetRow["BranchTopologySet_OID"] = topologyName; |
|
1149 |
if (targetRow != null) |
|
1150 |
targetRow["BranchTopologySet_OID"] = topologyName; |
|
1151 |
} |
|
1149 | 1152 |
} |
1150 |
} |
|
1151 | 1153 |
|
1152 |
PathItems = pathItemsDT; |
|
1153 |
SequenceData = sequenceDataDT; |
|
1154 |
PipeSystemNetwork = pipeSystemNetworkDT; |
|
1155 |
TopologySet = topologySetDT; |
|
1154 |
PathItems = pathItemsDT; |
|
1155 |
SequenceData = sequenceDataDT; |
|
1156 |
PipeSystemNetwork = pipeSystemNetworkDT; |
|
1157 |
TopologySet = topologySetDT; |
|
1158 |
} |
|
1159 |
catch (Exception ex) |
|
1160 |
{ |
|
1161 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
1162 |
MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
1163 |
} |
|
1156 | 1164 |
} |
1157 | 1165 |
private void UpdateSubType() |
1158 | 1166 |
{ |
내보내기 Unified diff