프로젝트

일반

사용자정보

개정판 a5616391

IDa5616391098ab9b4091160b4fc99c4f4c9ab7b5c
상위 95931055
하위 419055fa

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

issue #000:

Change-Id: I069ba0117f834ab19bb871bb0c528cabdae52662

차이점 보기:

DTI_PID/ID2PSN/Form/MainForm.cs
197 197
                psn.SetPSNData();
198 198
                currentPSN = psn;
199 199

  
200
                
200 201
                SetDataTableByCurrentPSN();
201 202

  
203
                //gridViewPSN.RefreshData();
204

  
202 205
                splashScreenManager1.CloseWaitForm();
203 206

  
204 207
                MessageBox.Show("Generate PSN was successful.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
......
497 500

  
498 501
          //  currentPSN = DB.GetDBPSN();
499 502

  
500
            SetPathItem(currentPSN.PathItems);
503
           // SetPathItem(currentPSN.PathItems);
501 504
        }
502 505

  
503 506
        private void gridViewPSN_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
DTI_PID/ID2PSN/Form/TransformKeywordsSettingForm.cs
277 277
        private void TreeList_BeforeCheckNode(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
278 278
        {
279 279
            DevExpress.XtraEditors.TreeListLookUpEdit treeListLookUpEdit = sender as DevExpress.XtraEditors.TreeListLookUpEdit;
280
            if (treeListLookUpEdit.Properties.TreeList.FocusedNode == null)
281
                return;
282

  
280 283
            if (treeListLookUpEdit.Properties.TreeList.FocusedNode.Level == 0)
281 284
                e.Cancel = true;
282 285
        }
DTI_PID/ID2PSN/PSN.cs
231 231
            UpdateSubType();
232 232
            // Update Error
233 233
            UpdateErrorForPSN();
234
            // Update Keyword
235
            //UpdateKeywordForPSN();
236
         
234 237
            // 확도 계산
235 238
            UpdateAccuracy();          
236 239
        }
......
1055 1058
                // key = 미입력 branch
1056 1059
                Dictionary<Item, Item> startBranchDic = new Dictionary<Item, Item>();
1057 1060
                Dictionary<Item, Item> endBranchDic = new Dictionary<Item, Item>();
1058
                List<Group> lstventdrainGroup = new List<Group>();
1059 1061

  
1060 1062
                foreach (PSNItem PSNItem in PSNItems)
1061 1063
                {
......
1072 1074
                        {
1073 1075
                            List<VentDrainInfo> endInfos = new List<VentDrainInfo>();
1074 1076
                            Group group = PSNItem.Groups[0];
1075
                            for (int i = 0; i < group.Items.Count; i++)
1077
                            List<Item> items = group.Items.FindAll(x => x.Name != "PSN_Nozzle");
1078
                            for (int i = 0; i < items.Count; i++)
1076 1079
                            {
1077
                                Item item = group.Items[i];
1080
                                Item item = items[i];                               
1081

  
1078 1082
                                foreach (VentDrainInfo ventDrainInfo in VentDrainInfos)
1079 1083
                                {
1080
                                    if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count)
1084
                                    if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != items.Count)
1081 1085
                                        continue;
1082 1086
                                    if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name))
1083 1087
                                    {
......
1085 1089
                                        continue;
1086 1090
                                    }
1087 1091

  
1088
                                    if (i + 1 == group.Items.Count && group.Items.Count.Equals(ventDrainInfo.VentDrainItems.Count))
1092
                                    if (i + 1 == items.Count && items.Count.Equals(ventDrainInfo.VentDrainItems.Count))
1089 1093
                                    {
1090 1094
                                        bVentDrain = true;
1091
                                       
1092
                                        if (!lstventdrainGroup.Contains(group))
1093
                                            lstventdrainGroup.Add(group);
1094 1095
                                    }
1095 1096
                                }
1096 1097
                            }
......
1098 1099
                            if (!bVentDrain)
1099 1100
                            {
1100 1101
                                endInfos = new List<VentDrainInfo>();
1101
                                for (int i = 0; i < group.Items.Count; i++)
1102
                                for (int i = 0; i < items.Count; i++)
1102 1103
                                {
1103
                                    Item item = group.Items[group.Items.Count - i - 1];
1104
                                    Item item = items[items.Count - i - 1];
1105
                                   
1104 1106
                                    foreach (VentDrainInfo ventDrainInfo in VentDrainInfos)
1105 1107
                                    {
1106
                                        if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count)
1108
                                        if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != items.Count)
1107 1109
                                            continue;
1108 1110
                                        if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name))
1109 1111
                                        {
......
1111 1113
                                            continue;
1112 1114
                                        }
1113 1115

  
1114
                                        if (i + 1 == group.Items.Count && group.Items.Count.Equals(ventDrainInfo.VentDrainItems.Count))
1116
                                        if (i + 1 == items.Count && items.Count.Equals(ventDrainInfo.VentDrainItems.Count))
1115 1117
                                        {
1116 1118
                                            bVentDrain = true;
1117
                                           
1118
                                            if (!lstventdrainGroup.Contains(group))
1119
                                                lstventdrainGroup.Add(group);
1120 1119
                                        }
1121 1120
                                    }
1122 1121
                                }
1123 1122
                            }
1124 1123
                        }
1125

  
1126
                        //foreach (KeywordInfo keywordInfo in KeywordInfos)
1127
                        //    keywordInfo.KeywordItems = keywordInfo.KeywordItems.OrderBy(x => x.Index).ToList();
1128

  
1129
                        if (!bVentDrain)
1130
                        {
1131
                            try
1132
                            {
1133
                                //try
1134
                                //{ 
1135
                                //PSN, PathItems, SequenceData 관련
1136
                                foreach (Group group in PSNItem.Groups)
1124
                                                                       
1125
                        try
1126
                        {                            
1127
                            //PSN, PathItems, SequenceData 관련
1128
                            foreach (Group group in PSNItem.Groups)
1129
                            {                                
1130
                                foreach (Item item in group.Items)
1137 1131
                                {
1138

  
1139

  
1140
                                    foreach (Item item in group.Items)
1132
                                    string PathitemUID = string.Empty;
1133
                                    if (item.BranchItems.Count == 0)
1141 1134
                                    {
1142
                                        if (item.BranchItems.Count == 0)
1143
                                        {
1144
                                            CreatePathItemsDataRow(item.UID, item.ID2DBType);
1145
                                            CreateSequenceDataDataRow(item.UID);
1146
                                            index++;
1147
                                        }
1148
                                        else
1135
                                        PathitemUID = item.UID;
1136
                                        CreatePathItemsDataRow(PathitemUID, item.ID2DBType);
1137
                                        CreateSequenceDataDataRow(PathitemUID);
1138
                                        index++;
1139
                                    }
1140
                                    else
1141
                                    {
1142
                                        PathitemUID = item.UID + "_L1";
1143
                                        CreatePathItemsDataRow(PathitemUID, item.ID2DBType);
1144
                                        CreateSequenceDataDataRow(PathitemUID);
1145
                                        index++;
1146
                                        for (int i = 0; i < item.BranchItems.Count; i++)
1149 1147
                                        {
1150
                                            CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType);
1151
                                            CreateSequenceDataDataRow(item.UID + "_L1");
1148
                                            CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
1149
                                            CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1));
1152 1150
                                            index++;
1153
                                            for (int i = 0; i < item.BranchItems.Count; i++)
1154
                                            {
1155
                                                CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
1156
                                                CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1));
1157
                                                index++;
1158 1151
                                                
1159
                                                CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType);
1160
                                                CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2));
1161
                                                index++;
1162

  
1163
                                                if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item)
1164
                                                    startBranchDic.Add(item.BranchItems[i], item);
1165
                                                else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item)
1166
                                                    endBranchDic.Add(item.BranchItems[i], item);
1167
                                            }
1168
                                        }
1152
                                            CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType);
1153
                                            CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2));
1154
                                            index++;
1169 1155

  
1170
                                        if (bPSNStart)
1156
                                            if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item)
1157
                                                startBranchDic.Add(item.BranchItems[i], item);
1158
                                            else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item)
1159
                                                endBranchDic.Add(item.BranchItems[i], item);
1160
                                        }
1161
                                    }
1162
                                    if (bPSNStart)
1163
                                    {
1164
                                        CreatePipeSystemNetworkDataRow();
1165
                                        sPSNData = item.TopologyData;
1166
                                        psnOrder++;
1167
                                        bPSNStart = false;
1168
                                    }
1169
                                    else
1170
                                    {
1171
                                        if (item.TopologyData != sPSNData)
1171 1172
                                        {
1172 1173
                                            CreatePipeSystemNetworkDataRow();
1173 1174
                                            sPSNData = item.TopologyData;
1174 1175
                                            psnOrder++;
1175
                                            bPSNStart = false;
1176 1176
                                        }
1177
                                        else
1177
                                    }
1178
                                    void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null)
1179
                                    {
1180
                                        DataRow newRow = pathItemsDT.NewRow();
1181

  
1182
                                        if (itemType == "Nozzles")
1178 1183
                                        {
1179
                                            if (item.TopologyData != sPSNData)
1180
                                            {
1181
                                                CreatePipeSystemNetworkDataRow();
1182
                                                sPSNData = item.TopologyData;
1183
                                                psnOrder++;
1184
                                            }
1184
                                            newRow["Equipment_OID"] = item.Equipment.UID;
1185 1185
                                        }
1186
                                        void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null)
1187
                                        {
1188
                                            DataRow newRow = pathItemsDT.NewRow();
1189

  
1190
                                            if (itemType == "Nozzles")
1191
                                            {
1192
                                                newRow["Equipment_OID"] = item.Equipment.UID;
1193
                                            }
1194 1186

  
1195
                                            newRow["OID"] = itemOID;
1196

  
1197
                                            newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1198

  
1199
                                            newRow["TopologySet_OID"] = item.Topology.FullName;
1200

  
1201
                                            newRow["BranchTopologySet_OID"] = branchTopologyName;
1202
                                            newRow["PipeLine_OID"] = item.PSNPipeLineID;
1203
                                            newRow["ITEMNAME"] = GetItemName(item, itemOID);
1204
                                            newRow["ITEMTAG"] = GetItemTag(item);
1205
                                            newRow["Class"] = GetClass(item, itemOID);
1206
                                            string subClass = GetSubClass(item, itemOID);
1207
                                           
1208
                                            newRow["SubClass"] = subClass;
1209

  
1210
                                            if (item.ItemType == ItemType.Symbol)
1211
                                                newRow["TYPE"] = item.ID2DBName;
1212
                                            else if (item.ItemType == ItemType.Line)
1213
                                                newRow["TYPE"] = item.ID2DBType;
1214
                                            newRow["PIDNAME"] = group.Document.DrawingName;
1215

  
1216
                                            // NPD
1217
                                            if (item.LineNumber != null)
1218
                                            {
1219
                                                Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
1220
                                                if (attribute != null)
1221
                                                    newRow["NPD"] = attribute.Value;
1222
                                            }
1223
                                            else
1224
                                                newRow["NPD"] = null;
1187
                                        newRow["OID"] = itemOID;
1188
                                        newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1189
                                        newRow["TopologySet_OID"] = item.Topology.FullName;
1190
                                        newRow["BranchTopologySet_OID"] = branchTopologyName;
1191
                                        newRow["PipeLine_OID"] = item.PSNPipeLineID;
1192
                                        newRow["ITEMNAME"] = GetItemName(item, itemOID);
1193
                                        newRow["ITEMTAG"] = GetItemTag(item);
1194
                                        newRow["Class"] = GetClass(item, itemOID);
1195
                                        string subClass = GetSubClass(item, itemOID);                                           
1196
                                        newRow["SubClass"] = subClass;
1197

  
1198
                                        if (item.ItemType == ItemType.Symbol)
1199
                                            newRow["TYPE"] = item.ID2DBName;
1200
                                        else if (item.ItemType == ItemType.Line)
1201
                                            newRow["TYPE"] = item.ID2DBType;
1202
                                        newRow["PIDNAME"] = group.Document.DrawingName;
1203

  
1204
                                        // NPD
1205
                                        if (item.LineNumber != null)
1206
                                        {
1207
                                            Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
1208
                                            if (attribute != null)
1209
                                                newRow["NPD"] = attribute.Value;
1210
                                        }
1211
                                        else
1212
                                            newRow["NPD"] = null;
1225 1213

  
1226 1214

  
1227
                                            newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1228
                                            if (branchItem == null)
1229
                                                newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1230
                                            else
1231
                                                newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID();
1215
                                        newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1216
                                        if (branchItem == null)
1217
                                            newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1218
                                        else
1219
                                            newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID();
1232 1220

  
1233
                                            newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
1221
                                        newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
1234 1222

  
1235
                                            pathItemsDT.Rows.Add(newRow);
1236
                                        }
1237
                                        void UpdatePathItemsDataRow(string itemOID, string Type, string Text)
1223
                                        pathItemsDT.Rows.Add(newRow);
1224
                                    }
1225
                                    void UpdatePathItemsDataRow(string itemOID, string Type, string Text)
1226
                                    {
1227
                                        if (pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault() != null)
1238 1228
                                        {
1239
                                            if (pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault() != null)
1240
                                            {
1241
                                                //pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["TYPE"] = Type;
1242
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMTAG"] = Text;
1243
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["DESCRIPTION"] = Text;
1244
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMNAME"] = "PipingComp";
1245
                                            }
1229
                                            //pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["TYPE"] = Type;
1230
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMTAG"] = Text;
1231
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["DESCRIPTION"] = Text;
1232
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMNAME"] = "PipingComp";
1246 1233
                                        }
1247
                                        void UpdatePathItemsKeywordDataRow(string itemOID, string Text)
1234
                                    }
1235
                                    void UpdatePathItemsKeywordDataRow(string itemOID, string Text, string Type)
1236
                                    {
1237
                                        if (pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault() != null)
1248 1238
                                        {
1249
                                            if (pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault() != null)
1250
                                            {
1251
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["TYPE"] = "End";
1252
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMTAG"] = Text;
1253
                                                pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["DESCRIPTION"] = Text;
1254
                                            }
1239
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["CLASS"] = Type;
1240
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["TYPE"] = "End";
1241
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["ITEMTAG"] = Text;
1242
                                            pathItemsDT.Select(string.Format("OID = '{0}'", itemOID)).FirstOrDefault()["DESCRIPTION"] = Text;
1255 1243
                                        }
1256
                                        void CreateSequenceDataDataRow(string itemOID)
1257
                                        {
1258
                                            DataRow newRow = sequenceDataDT.NewRow();
1259
                                            newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1260
                                            newRow["SERIALNUMBER"] = string.Format("{0}", index);
1261
                                            newRow["PathItem_OID"] = itemOID;
1262
                                            newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1244
                                    }
1245
                                    void CreateSequenceDataDataRow(string itemOID)
1246
                                    {
1247
                                        DataRow newRow = sequenceDataDT.NewRow();
1248
                                        newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1249
                                        newRow["SERIALNUMBER"] = string.Format("{0}", index);
1250
                                        newRow["PathItem_OID"] = itemOID;
1251
                                        newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1263 1252

  
1264
                                            sequenceDataDT.Rows.Add(newRow);
1265
                                        }
1266
                                        void CreatePipeSystemNetworkDataRow()
1253
                                        sequenceDataDT.Rows.Add(newRow);
1254
                                    }
1255
                                    void CreatePipeSystemNetworkDataRow()
1256
                                    {                                       
1257
                                        LineNumber lineNumber = item.Document.LineNumbers.Find(x => x.UID == item.Owner);
1258
                                        if (lineNumber != null)
1267 1259
                                        {
1268
                                            // VentDrain의 경우 제외 요청
1269
                                            if (bVentDrain)
1270
                                                return;
1271

  
1272
                                            LineNumber lineNumber = item.Document.LineNumbers.Find(x => x.UID == item.Owner);
1273
                                            if (lineNumber != null)
1260
                                            List<Attribute> att = lineNumber.Attributes;
1261
                                            if (att != null)
1274 1262
                                            {
1275
                                                List<Attribute> att = lineNumber.Attributes;
1276
                                                if (att != null)
1277
                                                {
1263
                                                List<string> oid = new List<string>();
1264
                                                string FluidCode = att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault() != null ? att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault().Value : string.Empty;
1265
                                                string PMC = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault().Value : string.Empty;
1266
                                                string SEQNUMBER = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault().Value : string.Empty;
1267
                                                string INSULATION = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault().Value : string.Empty;
1268
                                                //InsulationPurpose
1269
                                                if (!string.IsNullOrEmpty(FluidCode)) oid.Add(FluidCode);
1270
                                                if (!string.IsNullOrEmpty(PMC)) oid.Add(PMC);
1271

  
1272
                                                string PipeSystem_OID = string.Join("-", oid);
1273

  
1274
                                                if (!string.IsNullOrEmpty(SEQNUMBER)) oid.Add(SEQNUMBER);
1275
                                                if (!string.IsNullOrEmpty(INSULATION)) oid.Add(INSULATION);
1278 1276

  
1279
                                                    List<string> oid = new List<string>();
1280
                                                    string FluidCode = att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault() != null ? att.Where(x => x.Name.ToUpper().Equals("FLUIDCODE")).FirstOrDefault().Value : string.Empty;
1281
                                                    string PMC = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("PIPINGMATERIALSCLASS")).FirstOrDefault().Value : string.Empty;
1282
                                                    string SEQNUMBER = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("TAG SEQ NO")).FirstOrDefault().Value : string.Empty;
1283
                                                    string INSULATION = lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault() != null ? lineNumber.Attributes.Where(x => x.Name.ToUpper().Equals("INSULATIONPURPOSE")).FirstOrDefault().Value : string.Empty;
1284
                                                    //InsulationPurpose
1285
                                                    if (!string.IsNullOrEmpty(FluidCode)) oid.Add(FluidCode);
1286
                                                    if (!string.IsNullOrEmpty(PMC)) oid.Add(PMC);
1287

  
1288
                                                    string PipeSystem_OID = string.Join("-", oid);
1289

  
1290
                                                    if (!string.IsNullOrEmpty(SEQNUMBER)) oid.Add(SEQNUMBER);
1291
                                                    if (!string.IsNullOrEmpty(INSULATION)) oid.Add(INSULATION);
1292

  
1293
                                                    string OID = string.Join("-", oid);
1294

  
1295
                                                    if (pipelineDT.Select(string.Format("OID = '{0}'", OID)).Count() == 0)
1296
                                                    {
1297
                                                        DataRow newPipelineRow = pipelineDT.NewRow();
1298
                                                        newPipelineRow["OID"] = OID;
1299
                                                        newPipelineRow["PipeSystem_OID"] = PipeSystem_OID;
1300
                                                        newPipelineRow["FLUID"] = FluidCode;
1301
                                                        newPipelineRow["PMC"] = PMC;
1302
                                                        newPipelineRow["SEQNUMBER"] = SEQNUMBER;
1303
                                                        newPipelineRow["INSULATION"] = INSULATION;
1304
                                                        newPipelineRow["FROM_DATA"] = string.Empty;
1305
                                                        newPipelineRow["TO_DATA"] = string.Empty;
1306
                                                        newPipelineRow["Unit"] = PSNItem.GetPBSData();
1307
                                                        pipelineDT.Rows.Add(newPipelineRow);
1308
                                                    }
1277
                                                string OID = string.Join("-", oid);
1278

  
1279
                                                if (pipelineDT.Select(string.Format("OID = '{0}'", OID)).Count() == 0)
1280
                                                {
1281
                                                    DataRow newPipelineRow = pipelineDT.NewRow();
1282
                                                    newPipelineRow["OID"] = OID;
1283
                                                    newPipelineRow["PipeSystem_OID"] = PipeSystem_OID;
1284
                                                    newPipelineRow["FLUID"] = FluidCode;
1285
                                                    newPipelineRow["PMC"] = PMC;
1286
                                                    newPipelineRow["SEQNUMBER"] = SEQNUMBER;
1287
                                                    newPipelineRow["INSULATION"] = INSULATION;
1288
                                                    newPipelineRow["FROM_DATA"] = string.Empty;
1289
                                                    newPipelineRow["TO_DATA"] = string.Empty;
1290
                                                    newPipelineRow["Unit"] = PSNItem.GetPBSData();
1291
                                                    pipelineDT.Rows.Add(newPipelineRow);
1309 1292
                                                }
1310 1293
                                            }
1294
                                        }
1311 1295

  
1312
                                            DataRow newRow = pipeSystemNetworkDT.NewRow();
1313
                                            newRow["OID"] = PSNItem.PSN_OID();
1314

  
1315
                                            newRow["OrderNumber"] = psnOrder;
1316
                                            newRow["Pipeline_OID"] = item.PSNPipeLineID;
1317
                                            PSNItem.KeywordInfos = KeywordInfos;
1318
                                            PSNItem.Nozzle = Nozzle;
1296
                                        DataRow newRow = pipeSystemNetworkDT.NewRow();
1297
                                        newRow["OID"] = PSNItem.PSN_OID();
1298
                                            
1299
                                        newRow["OrderNumber"] = psnOrder;
1300
                                        newRow["Pipeline_OID"] = item.PSNPipeLineID;
1301
                                        PSNItem.KeywordInfos = KeywordInfos;
1302
                                        PSNItem.Nozzle = Nozzle;
1303
                                        
1304
                                        string FromType = string.Empty;
1305
                                        Item From_item = new Item();
1306
                                        string FROM_DATA = PSNItem.GetFromData(ref FromType, ref From_item);
1307
                                        newRow["FROM_DATA"] = FROM_DATA;
1308

  
1309
                                        if (PSNItem.IsKeyword)
1310
                                        {                                           
1311
                                            PSNItem.StartType = PSNType.Equipment;
1312
                                            UpdatePathItemsKeywordDataRow(From_item.UID, FROM_DATA, FromType);
1313
                                        }
1314
                                        else if (FROM_DATA == "ENDOFHEADER")
1315
                                        {
1316
                                            UpdatePathItemsDataRow(From_item.UID, From_item.ID2DBName, FROM_DATA);
1317
                                        }
1319 1318

  
1320
                                            string FROM_DATA = PSNItem.GetFromData();
1321
                                            newRow["FROM_DATA"] = FROM_DATA;
1322
                                            Item From_item = group.Items.First();
1319
                                        string ToType = string.Empty;
1320
                                        Item To_item = new Item();
1323 1321

  
1324
                                            if (PSNItem.IsKeyword)
1325
                                            {
1326
                                                PSNItem.StartType = PSNType.Equipment;
1327
                                                UpdatePathItemsKeywordDataRow(From_item.UID, FROM_DATA);
1328
                                            }
1329
                                            else if (FROM_DATA == "ENDOFHEADER")
1330
                                            {
1322
                                        string TO_DATA = PSNItem.GetToData(ref ToType, ref To_item);
1323
                                        newRow["TO_DATA"] = TO_DATA;
1331 1324

  
1332
                                                UpdatePathItemsDataRow(From_item.UID, From_item.ID2DBName, FROM_DATA);
1333
                                            }
1325
                                        if (PSNItem.IsKeyword)
1326
                                        {
1327
                                            PSNItem.EndType = PSNType.Equipment;                                            
1328
                                            UpdatePathItemsKeywordDataRow(To_item.UID, TO_DATA, ToType);
1329
                                        }
1330
                                        else if (TO_DATA == "ENDOFHEADER")
1331
                                        {
1332
                                            UpdatePathItemsDataRow(To_item.UID, To_item.ID2DBName, TO_DATA);
1333
                                        }
1334 1334

  
1335
                                            string TO_DATA = PSNItem.GetToData();
1336
                                            newRow["TO_DATA"] = TO_DATA;
1337
                                            Item To_item = group.Items.Last();
1338
                                            if (PSNItem.IsKeyword)
1339
                                            {
1340
                                                PSNItem.EndType = PSNType.Equipment;
1341
                                                UpdatePathItemsKeywordDataRow(To_item.UID, TO_DATA);
1342
                                            }
1343
                                            else if (TO_DATA == "ENDOFHEADER")
1344
                                            {
1345
                                                UpdatePathItemsDataRow(To_item.UID, To_item.ID2DBName, TO_DATA);
1346
                                            }
1335
                                        // VentDrain의 경우 제외 요청
1336
                                        //if (bVentDrain)
1337
                                        //    return;
1347 1338

  
1348
                                            newRow["Type"] = PSNItem.GetPSNType();
1339
                                        newRow["Type"] = PSNItem.GetPSNType();
1349 1340

  
1350
                                            newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1351
                                            newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision);
1341
                                        newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1342
                                        newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision);
1352 1343

  
1353
                                            newRow["IsValid"] = PSNItem.IsValid;
1354
                                            newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty;
1355
                                            newRow["PBS"] = PSNItem.GetPBSData();
1344
                                        newRow["IsValid"] = PSNItem.IsValid;
1345
                                        newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty;
1346
                                        newRow["PBS"] = PSNItem.GetPBSData();
1356 1347

  
1357
                                            List<string> drawingNames = new List<string>();
1358
                                            foreach (Group _group in PSNItem.Groups)
1348
                                        List<string> drawingNames = new List<string>();
1349
                                        foreach (Group _group in PSNItem.Groups)
1350
                                        {
1351
                                            if (!drawingNames.Contains(_group.Document.DrawingName))
1359 1352
                                            {
1360
                                                if (!drawingNames.Contains(_group.Document.DrawingName))
1361
                                                {
1362
                                                    if (drawingNames.Count == 0)
1363
                                                        newRow["Drawings"] = _group.Document.DrawingName;
1364
                                                    else
1365
                                                        newRow["Drawings"] = newRow["Drawings"] + ", " + _group.Document.DrawingName;
1366
                                                    drawingNames.Add(_group.Document.DrawingName);
1367
                                                }
1353
                                                if (drawingNames.Count == 0)
1354
                                                    newRow["Drawings"] = _group.Document.DrawingName;
1355
                                                else
1356
                                                    newRow["Drawings"] = newRow["Drawings"] + ", " + _group.Document.DrawingName;
1357
                                                drawingNames.Add(_group.Document.DrawingName);
1368 1358
                                            }
1369
                                            newRow["IncludingVirtualData"] = "No";
1370
                                            newRow["PSNAccuracy"] = "100";
1371
                                            pipeSystemNetworkDT.Rows.Add(newRow);
1372

  
1373 1359
                                        }
1374

  
1360
                                        newRow["IncludingVirtualData"] = "No";
1361
                                        newRow["PSNAccuracy"] = "100";
1362
                                        pipeSystemNetworkDT.Rows.Add(newRow);
1375 1363
                                    }
1376 1364
                                }
1377 1365
                            }
1378
                            catch (Exception ex)
1379
                            {
1380
                                Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1381
                                MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1382
                            }
1366
                        }
1367
                        catch (Exception ex)
1368
                        {
1369
                            Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1370
                            MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1371
                        }
1383 1372

  
1384
                            //TopologySet 관련
1385
                            foreach (Topology topology in PSNItem.Topologies)
1386
                            {
1387
                                DataRow newRow = topologySetDT.NewRow();
1388
                                newRow["OID"] = topology.FullName;
1389
                                newRow["Type"] = topology.FullName.Split(new char[] { '-' }).Last().StartsWith("M") ? "Main" : "Branch";
1390
                                if (bVentDrain)
1391
                                    newRow["SubType"] = "Vent_Drain";
1392
                                else
1393
                                    newRow["SubType"] = null;
1394
                                newRow["HeadItemTag"] = GetItemTag(topology.Items.Last());
1395
                                newRow["TailItemTag"] = GetItemTag(topology.Items.First());
1396
                                newRow["HeadItemSPID"] = topology.Items.Last().UID;
1397
                                newRow["TailItemSPID"] = topology.Items.First().UID;
1398
                                topologySetDT.Rows.Add(newRow);
1399
                            }
1373
                        //TopologySet 관련
1374
                        foreach (Topology topology in PSNItem.Topologies)
1375
                        {
1376
                            DataRow newRow = topologySetDT.NewRow();
1377
                            newRow["OID"] = topology.FullName;
1378
                            newRow["Type"] = topology.FullName.Split(new char[] { '-' }).Last().StartsWith("M") ? "Main" : "Branch";
1379
                            if (bVentDrain)
1380
                                newRow["SubType"] = "Vent_Drain";
1381
                            else
1382
                                newRow["SubType"] = null;
1383
                            newRow["HeadItemTag"] = GetItemTag(topology.Items.Last());
1384
                            newRow["TailItemTag"] = GetItemTag(topology.Items.First());
1385
                            newRow["HeadItemSPID"] = topology.Items.Last().UID;
1386
                            newRow["TailItemSPID"] = topology.Items.First().UID;
1387
                            topologySetDT.Rows.Add(newRow);
1400 1388
                        }
1389
                        
1401 1390
                    }
1402 1391
                    catch(Exception ee)
1403 1392
                    {
......
1689 1678

  
1690 1679
        }
1691 1680

  
1681
        private void UpdateKeywordForPSN()
1682
        {
1683
            #region Keyword Info
1684
            KeywordInfo KeywordInfos = new KeywordInfo();
1685
            DataTable dtKeyword = DB.SelectKeywordsSetting();
1686
            foreach (DataRow row in dtKeyword.Rows)
1687
            {
1688
                int index = Convert.ToInt32(row["INDEX"]);
1689
                string name = row["NAME"].ToString();
1690
                string keyword = row["KEYWORD"].ToString();
1691

  
1692
                //KeywordInfo keywordInfo = new KeywordInfo();   
1693
                KeywordInfos.KeywordItems.Add(new KeywordItem()
1694
                {
1695
                    Index = index,
1696
                    Name = name,
1697
                    Keyword = keyword
1698
                });
1699
            }
1700
            #endregion
1701

  
1702
            foreach (KeywordItem keyitem in KeywordInfos.KeywordItems)
1703
            {
1704
                DataRow[] keywordRows = PipeSystemNetwork.Select(string.Format(" From_Data = '{0}' OR To_Data = '{0}'", keyitem.Name));
1705
                foreach (DataRow dataRow in keywordRows)
1706
                {                    
1707
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
1708
                    bool change = false;            
1709

  
1710
                    if(dataRow.Field<string>("From_Data") == keyitem.Name)
1711
                    {                        
1712
                        change = true;
1713
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
1714
                                               
1715
                        if(pathItemRows.First().Field<string>("Type").Equals(keyitem.Name))
1716
                        {
1717
                            DataRow dr = pathItemRows.First();
1718
                            //dr["CLASS"] = ""; //Type
1719
                            dr["TYPE"] = "End";
1720
                            dr["ITEMTAG"] = keyitem.Keyword;
1721
                            dr["DESCRIPTION"] = keyitem.Keyword;
1722
                        }
1723
                           
1724
                    }
1725

  
1726
                    if (dataRow.Field<string>("To_Data") == keyitem.Name)
1727
                    {
1728
                        change = true;
1729
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
1730

  
1731
                        if (pathItemRows.Last().Field<string>("Type").Equals(keyitem.Name))
1732
                        {
1733
                            DataRow dr = pathItemRows.Last();
1734
                            //dr["CLASS"] = ""; //Type
1735
                            dr["TYPE"] = "End";
1736
                            dr["ITEMTAG"] = keyitem.Keyword;
1737
                            dr["DESCRIPTION"] = keyitem.Keyword;
1738
                            //dr.Field<string>("Type")
1739
                        }
1740

  
1741
                    }                   
1742
                }
1743
            }          
1744
        }
1745

  
1692 1746
        private void UpdateErrorForPSN()
1693 1747
        {
1694 1748
            DataRow[] errorRows = PipeSystemNetwork.Select(string.Format(" Type = '{0}'", ErrorType.Error));
......
2007 2061
        }
2008 2062
        public bool IsBypass { get; set; }
2009 2063

  
2010
        public string GetFromData()
2064
        public string GetFromData(ref string Type, ref Item item)
2011 2065
        {
2012 2066
            string result = string.Empty;
2013 2067
            if (IsKeyword)
......
2018 2072
                    result = "ENDOFHEADER";
2019 2073
                else if (StartType == PSNType.Branch)
2020 2074
                {
2021
                    Item item = Groups.First().Items.First();
2075
                    item = Groups.First().Items.First();
2022 2076
                    if (item.Relations.First().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
2023 2077
                        result = item.Relations.First().Item.LineNumber.Name;
2024 2078
                    else
......
2040 2094
                else
2041 2095
                {
2042 2096
                    IsValid = "Error";
2043
                    Item item = Groups.First().Items.First();
2097
                    item = Groups.First().Items.First();
2044 2098
                    if (item.ItemType == ItemType.Symbol)
2045 2099
                    {
2046

  
2100
                        
2047 2101
                        string keyword = string.Empty;
2048
                        keyword = GetFromKeywordData();
2102
                        keyword = GetFromKeywordData(ref Type, item);
2049 2103

  
2050 2104
                        if (string.IsNullOrEmpty(keyword))
2051 2105
                        {
......
2081 2135
            return result;
2082 2136
        }
2083 2137

  
2084
        public string GetFromKeywordData()
2138
        public string GetFromKeywordData(ref string Type, Item item)
2085 2139
        {
2086 2140
            string result = string.Empty;
2087 2141
           
2088
            Item item = Groups.First().Items.First();
2089

  
2090 2142
            foreach(KeywordItem keyitem in KeywordInfos.KeywordItems)
2091 2143
            {
2092 2144
                if(keyitem.Name.Equals(item.Name))
2145
                {
2093 2146
                    result = keyitem.Keyword;
2147
                    Type = item.ID2DBType;
2148
                    //break;
2149
                }
2094 2150
            }
2095 2151
          
2096 2152
            return result;
2097 2153
        }
2098 2154

  
2099
        public string GetToKeywordData()
2155
        public string GetToKeywordData(ref string Type, Item item)
2100 2156
        {
2101 2157
            string result = string.Empty;
2102 2158

  
2103
            Item item = Groups.Last().Items.Last();
2104 2159
            foreach (KeywordItem keyitem in KeywordInfos.KeywordItems)
2105 2160
            {
2106 2161
                if (keyitem.Name.Equals(item.Name))
2162
                {
2107 2163
                    result = keyitem.Keyword;
2164
                    Type = item.ID2DBType;
2165
                   // break;
2166
                }
2108 2167
            }
2109 2168
            return result;
2110 2169
        }
2111 2170

  
2112
        public string GetToData()
2171
        public string GetToData(ref string ToType, ref Item item)
2113 2172
        {
2114 2173
            string result = string.Empty;
2115 2174
          
......
2121 2180
                    result = "ENDOFHEADER";
2122 2181
                else if (EndType == PSNType.Branch)
2123 2182
                {
2124
                    Item item = Groups.Last().Items.Last();
2183
                    item = Groups.Last().Items.Last();
2125 2184
                    if (item.Relations.Last().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
2126 2185
                        result = item.Relations.Last().Item.LineNumber.Name;
2127 2186
                    else
......
2143 2202
                else
2144 2203
                {
2145 2204
                    IsValid = "Error";
2146
                    Item item = Groups.Last().Items.Last();
2205
                    item = Groups.Last().Items.Last();
2147 2206
                    if (item.ItemType == ItemType.Symbol)
2148 2207
                    {
2149 2208
                        string keyword = string.Empty;
2150
                        keyword = GetToKeywordData();
2209
                        keyword = GetToKeywordData(ref ToType, item);
2151 2210

  
2152 2211
                        if (string.IsNullOrEmpty(keyword))
2153 2212
                        {

내보내기 Unified diff

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