프로젝트

일반

사용자정보

개정판 7b262903

ID7b262903ca6c488f75712f550a2b732fda101c6a
상위 9a441e35
하위 ee2cdc95, fa0b96b3

gaqhf 이(가) 약 5년 전에 추가함

dev issue #498 : opc List 확인

Change-Id: I3d9069f22e315b6f24df017a208d3707b550c2de

차이점 보기:

DTI_PID/SPPIDConverter/ConverterDocking.cs
309 309
            }
310 310

  
311 311
            List<OPC_Info> _OPC_Infos = new List<OPC_Info>();
312
            DevExpress.Spreadsheet.Workbook workbook = new DevExpress.Spreadsheet.Workbook();
313
            workbook.BeginUpdate();
312 314

  
315
            workbook.Worksheets[0][0, 0].Value = "OPC ModelItemID";
316
            workbook.Worksheets[0][0, 1].Value = "Tag Value";
317
            workbook.Worksheets[0][0, 2].Value = "Pair Drawing Name";
318
            workbook.Worksheets[0][0, 3].Value = "Match RepID";
319

  
320
            int rowIndex = 1;
313 321
            foreach (var current in CurrentDrawing)
314 322
            {
323
                // 여기 로그
315 324
                LMOPC currentOPC = dataSource.GetOPC(current.Item1.ModelItemID);
316 325
                string fileName = current.Item1.get_FileName();
317 326
                string tag = current.Item2;
......
325 334
                    }
326 335
                }
327 336

  
328
                if (findOPCs.Count == 1)
337
                workbook.Worksheets[0][rowIndex, 0].Value = current.Item1.ModelItemID.ToString();
338
                workbook.Worksheets[0][rowIndex, 1].Value = string.IsNullOrEmpty(tag) ? "Tag is null" : tag;
339

  
340
                if (findOPCs.Count >= 1 && !string.IsNullOrEmpty(tag))
329 341
                {
330
                    LMRepresentation currentPairRepresentation = currentOPC.pairedWithOPCObject.Representations.Nth[1];
331
                    LMRepresentation findPairRepresentation = findOPCs[0].pairedWithOPCObject.Representations.Nth[1];
332
                    if (currentPairRepresentation == null || findPairRepresentation == null)
333
                        continue;
334
                    else if (currentPairRepresentation.get_ItemStatus() == "Active" && currentPairRepresentation.get_InStockpile() == "True" &&
335
                        findPairRepresentation.get_ItemStatus() == "Active" && findPairRepresentation.get_InStockpile() == "True")
342
                    List<OPC_Info> tempInfos = new List<OPC_Info>();
343
                    foreach (var findOPC in findOPCs)
336 344
                    {
337
                        string currentGraphicOID = currentOPC.Representations.Nth[1].get_GraphicOID().ToString();
338
                        LMRepresentation findRepresentation = findOPCs[0].Representations.Nth[1];
339
                        string findGraphicOID = findRepresentation.get_GraphicOID().ToString();
340
                        LMDrawing findDrawing = findRepresentation.DrawingObject;
341
                        string findDrawingPath = settingValue + findDrawing.get_Path();
342

  
343
                        _OPC_Infos.Add(new OPC_Info()
345
                        LMRepresentation currentPairRepresentation = currentOPC.pairedWithOPCObject.Representations.Nth[1];
346
                        LMRepresentation findPairRepresentation = findOPC.pairedWithOPCObject.Representations.Nth[1];
347
                        if (currentPairRepresentation == null || findPairRepresentation == null)
348
                            continue;
349
                        else if (currentPairRepresentation.get_ItemStatus() == "Active" && currentPairRepresentation.get_InStockpile() == "True" &&
350
                            findPairRepresentation.get_ItemStatus() == "Active" && findPairRepresentation.get_InStockpile() == "True")
344 351
                        {
345
                            CurrentGraphicOID = currentGraphicOID,
346
                            TagValue = tag,
347
                            FindGraphicOID = findGraphicOID,
348
                            FindDrawingPath = findDrawingPath,
349
                            FindDrawingName = Path.GetFileNameWithoutExtension(findDrawingPath),
350
                            CurrentRepID = currentOPC.Representations.Nth[1].Id,
351
                            FindRepID = findRepresentation.Id
352
                        });
353

  
354
                        ReleaseCOMObjects(findDrawing);
355
                        ReleaseCOMObjects(findRepresentation);
356

  
357
                        //application.ActiveSelectSet.Add(application.ActiveDocument.ActiveSheet.DrawingObjects[currentOPC.Representations.Nth[1].get_GraphicOID().ToString()]);
352
                            string currentGraphicOID = currentOPC.Representations.Nth[1].get_GraphicOID().ToString();
353
                            LMRepresentation findRepresentation = findOPC.Representations.Nth[1];
354
                            string findGraphicOID = findRepresentation.get_GraphicOID().ToString();
355
                            LMDrawing findDrawing = findRepresentation.DrawingObject;
356
                            string findDrawingPath = settingValue + findDrawing.get_Path();
357

  
358
                            tempInfos.Add(new OPC_Info()
359
                            {
360
                                CurrentGraphicOID = currentGraphicOID,
361
                                TagValue = tag,
362
                                FindGraphicOID = findGraphicOID,
363
                                FindDrawingPath = findDrawingPath,
364
                                FindDrawingName = Path.GetFileNameWithoutExtension(findDrawingPath),
365
                                CurrentRepID = currentOPC.Representations.Nth[1].Id,
366
                                FindRepID = findRepresentation.Id
367
                            });
368

  
369
                            ReleaseCOMObjects(findDrawing);
370
                            ReleaseCOMObjects(findRepresentation);
371
                        }
358 372
                    }
359
                }
360 373

  
374
                    if (tempInfos.Count == 1)
375
                    {
376
                        _OPC_Infos.Add(tempInfos[0]);
377
                        workbook.Worksheets[0][rowIndex, 2].Value = tempInfos[0].FindDrawingName;
378
                        workbook.Worksheets[0][rowIndex, 3].Value = tempInfos[0].FindRepID;
379
                    }
380
                    else
381
                    {
382
                        foreach (var tempInfo in tempInfos)
383
                        {
384
                            workbook.Worksheets[0][rowIndex, 2].Value = tempInfo.FindDrawingName;
385
                            workbook.Worksheets[0][rowIndex, 3].Value = tempInfo.FindRepID;
386
                            if (tempInfos.IndexOf(tempInfo) != tempInfos.Count - 1)
387
                                rowIndex++;
388
                        }
389
                    }   
390
                }
391
                rowIndex++;
361 392
                foreach (var item in findOPCs)
362 393
                    ReleaseCOMObjects(item);
363 394
                ReleaseCOMObjects(currentOPC);
......
371 402
                    LMSymbol removeSymbol = dataSource.GetSymbol(item.CurrentRepID);
372 403
                    LMOPC removeOPC = dataSource.GetOPC(removeSymbol.ModelItemID);
373 404

  
374
                    
375

  
376 405
                    LMRepresentation findRep = dataSource.GetRepresentation(item.FindRepID);
377 406
                    LMOPC findOPC = dataSource.GetOPC(findRep.ModelItemID);
378 407
                    LMOPC pairOPC = findOPC.pairedWithOPCObject;
......
424 453
                application.ActiveDocument.Save();
425 454
            }
426 455

  
456
            workbook.EndUpdate();
457
            workbook.Worksheets[0].Columns.AutoFit(0, 3);
458
            SaveFileDialog save = new SaveFileDialog();
459
            save.Filter = "excel file (*.xlsx)|*.xlsx";
460
            if (save.ShowDialog() == DialogResult.OK)
461
            {
462
                workbook.SaveDocument(save.FileName, DevExpress.Spreadsheet.DocumentFormat.Xlsx);
463
            }
464
            workbook.Dispose();
427 465

  
428 466
            foreach (var item in CurrentDrawing)
429 467
                ReleaseCOMObjects(item);

내보내기 Unified diff

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