프로젝트

일반

사용자정보

개정판 6d998bd3

ID6d998bd3ec5cd10b2d4e14f44aefca2330fb8598
상위 f9eba687
하위 7a1f9cf0

백흠경이(가) 5년 이상 전에 추가함

issue #1172: 데이터 이관 기능 개선

Change-Id: If833154a635a30ff5f4f8c98782a515d3719de57

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1976 1976
    def get_components(self, drawing):
1977 1977
        """ get components in given drawing """
1978 1978
        conn = self.project.database.connect()
1979
        conn.row_factory = sqlite3.Row
1980 1979
        with conn:
1981 1980
            try:
1982 1981
                # Get a cursor object
1983
                cursor = conn.cursor()
1982
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
1984 1983

  
1985 1984
                sql = "select a.*,b.Name,b.SymbolType_UID,b.[Type],b.OriginalPoint,b.ConnectionPoint,b.BaseSymbol,b.AdditionalSymbol,b.HasInstrumentLabel,b.Flip from Components a \
1986 1985
                join Symbol b on a.Symbol_UID=b.UID \
......
2069 2068
    def get_component_connectors(self, component):
2070 2069
        """ get connectors of given component """
2071 2070
        conn = self.project.database.connect()
2072
        conn.row_factory = sqlite3.Row
2073 2071
        with conn:
2074 2072
            try:
2075 2073
                # Get a cursor object
2076
                cursor = conn.cursor()
2074
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2077 2075

  
2078 2076
                sql = "select * from Points where Components_UID='{}' order by [Index]".format(component)
2079 2077
                cursor.execute(sql)
......
2087 2085
    def get_component_associations(self, component):
2088 2086
        """ get associations of given component """
2089 2087
        conn = self.project.database.connect()
2090
        conn.row_factory = sqlite3.Row
2091 2088
        with conn:
2092 2089
            try:
2093 2090
                # Get a cursor object
2094
                cursor = conn.cursor()
2091
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2095 2092

  
2096 2093
                sql = "select * from Associations where Components_UID='{}'".format(component)
2097 2094
                cursor.execute(sql)
......
2105 2102
    def get_component_attributes(self, component):
2106 2103
        """ get attributes of given component """
2107 2104
        conn = self.project.database.connect()
2108
        conn.row_factory = sqlite3.Row
2109 2105
        with conn:
2110 2106
            try:
2111 2107
                # Get a cursor object
2112
                cursor = conn.cursor()
2108
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2113 2109

  
2114 2110
                sql = "select * from [Attributes] a \
2115 2111
                        join SymbolAttribute b on a.SymbolAttribute_UID=b.UID where a.Components_UID='{}' order by a.Components_UID,b.Property".format(component)
......
2124 2120
    def get_pipe_runs(self, component):
2125 2121
        """ get line runs of given component """
2126 2122
        conn = self.project.database.connect()
2127
        conn.row_factory = sqlite3.Row
2128 2123
        with conn:
2129 2124
            try:
2130 2125
                # Get a cursor object
2131
                cursor = conn.cursor()
2126
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2132 2127

  
2133 2128
                sql = "select * from PipeRuns where Owner='{}' order by [Index]".format(component)
2134 2129
                cursor.execute(sql)
......
2142 2137
    def get_pipe_run_items(self, pipe_run):
2143 2138
        """ get line run items of given pipe run """
2144 2139
        conn = self.project.database.connect()
2145
        conn.row_factory = sqlite3.Row
2146 2140
        with conn:
2147 2141
            try:
2148 2142
                # Get a cursor object
2149
                cursor = conn.cursor()
2143
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2150 2144

  
2151 2145
                sql = "select * from PipeRunItems where PipeRuns_UID='{}' order by [Index]".format(pipe_run)
2152 2146
                cursor.execute(sql)
......
2818 2812
                conn.rollback()
2819 2813

  
2820 2814
                from App import App
2821
                #print(sql)
2822
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
2815
                message = 'error occured({}\\n{}) in {}:{}'.format(ex, sql, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
2823 2816
                App.mainWnd().addMessage.emit(MessageType.Error, message)
2824 2817

  
2825 2818
    '''
......
2932 2925

  
2933 2926
        import uuid
2934 2927

  
2928
        _drawings = self.getDrawings()
2929

  
2935 2930
        conn = self.project.database.connect()
2936 2931
        with conn:
2937 2932
            try:
......
2939 2934
                cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True)
2940 2935

  
2941 2936
                for drawing in drawings:
2942
                    if not drawing.UID:
2937
                    matches = [draw for draw in _drawings if draw.UID == drawing.UID]
2938
                    if not matches:
2943 2939
                        sql = self.project.database.to_sql('insert into Drawings(UID, [NAME], [DATETIME]) values(?, ?, ?)')
2944 2940
                        param = tuple([str(uuid.uuid4()), drawing.name, ''])
2945 2941
                    else:
DTI_PID/DTI_PID/DataTransferDialog.py
23 23
        self.ui.lineEditPassword.setEchoMode(QLineEdit.Password) 
24 24
        self.ui.pushButtonTestConnection.clicked.connect(self.on_test_connection_clicked)
25 25

  
26
        self.ui.treeWidgetDrawingList.setHeaderHidden(False)
27
        self.ui.treeWidgetDrawingList.header().setStretchLastSection(False)
28
        self.ui.treeWidgetDrawingList.setHeaderLabels([self.tr('Name'), self.tr('DateTime')])
29
        self.ui.treeWidgetDrawingList.header().setSectionResizeMode(0, QHeaderView.ResizeToContents)
30
        self.ui.treeWidgetDrawingList.header().setSectionResizeMode(1, QHeaderView.ResizeToContents)
26 31
        self.load_data()
27 32

  
28 33
    def load_data(self):
......
60 65
            
61 66
            self.ui.treeWidgetDrawingList.root.setText(0, self.tr('P&ID Drawings')+'({})'.format(self.ui.treeWidgetDrawingList.root.childCount()))
62 67
            self.ui.treeWidgetDrawingList.expandItem(self.ui.treeWidgetDrawingList.root)
68
            self.ui.treeWidgetDrawingList.setSortingEnabled(True)
63 69
            self.ui.treeWidgetDrawingList.root.sortChildren(0, Qt.AscendingOrder)
64 70
            self.ui.treeWidgetDrawingList.resizeColumnToContents(0)
65 71
        except Exception as ex:
DTI_PID/DTI_PID/Drawing.py
20 20
        self._datetime = datetime
21 21
        ''' set drawing uid '''
22 22
        if not uid:
23
            self.UID = None
24
            #drawings = app_doc_data.getDrawings()
25
            #drawing = [drawing for drawing in drawings if self.name == os.path.splitext(drawing.name)[0]]
26
            #self.UID = drawing[0].UID if drawing else uuid.uuid4()
27
            #self._datetime = drawing[0].datetime if drawing else None
23
            drawings = app_doc_data.getDrawings()
24
            drawing = [drawing for drawing in drawings if self.name == os.path.splitext(drawing.name)[0]]
25
            self.UID = drawing[0].UID if drawing else uuid.uuid4()
26
            self._datetime = drawing[0].datetime if drawing else None
28 27
        else:
29 28
            self.UID = uid
30 29
        self._attrs = [['Drawing No', ''], ['Rev No', ''], ['Unit', '']] # attributes
......
114 113

  
115 114
                components = app_doc_data.get_components(str(self.UID))
116 115
                for component in components:
117
                    sql = database.to_sql('insert into Components(UID,Drawings_UID,Symbol_UID,X,Y,Width,Height,Rotation,Area,Value,Owner,Connected,[Supplied By],SpecialItemTypes_UID, OriginIndex) \
118
                        values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)')
119
                    cursor.execute(sql, (component['UID'], component[1], component[2], component[3], component[4], component[5], component[6], component[7], component[8],
120
                                         component[9], component[10], component[11], component[12], component[13], component[14]))
116
                    sql = database.to_sql('insert into Components(UID,Drawings_UID,Symbol_UID,X,Y,Width,Height,Rotation,Area,Value,Owner,[From],[To],Connected,[Supplied By],SpecialItemTypes_UID, OriginIndex) \
117
                        values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)')
118
                    cursor.execute(sql, (component['UID'], component['Drawings_UID'], component['Symbol_UID'], 
119
                        component['X'], component['Y'], component['Width'], component['Height'], component['Rotation'], component['Area'],
120
                        component['Value'], component['Owner'], component['From'], component['To'], component['Connected'], 
121
                        component['Supplied By'], component['SpecialItemTypes_UID'], component['OriginIndex']))
121 122

  
122 123
                for component in components:
123 124
                    pipe_runs = app_doc_data.get_pipe_runs(component['UID'])
DTI_PID/DTI_PID/ID2.pro
1
SOURCES += MainWindow_UI.py MainWindow.py License_UI.py License.py Project_UI.py ProjectDialog.py Recognition_UI.py SymbolPropertyTableWidget.py SymbolEditor_UI.py TextItemEdit_UI.py TrainingEditor_UI.py TrainingImageList_UI.py SpecBreak_UI.py ItemDataExport_UI.py OcrResultDialog_UI.py SymbolAttrEditor_UI.py SymbolEditor_UI.py TrainingImageListDialog.py Configuration_UI.py Configuration_Area_UI.py ItemDataFormat_UI.py ItemDataExportDialog.py HMB_UI.py RecognitionDialog.py LineNoTracer.py ConnectAttr_UI.py ItemTreeWidget.py .\UI\DataTransfer_UI.py 
1
SOURCES += MainWindow_UI.py MainWindow.py License_UI.py License.py Project_UI.py ProjectDialog.py Recognition_UI.py SymbolPropertyTableWidget.py SymbolEditor_UI.py TextItemEdit_UI.py TrainingEditor_UI.py TrainingImageList_UI.py SpecBreak_UI.py ItemDataExport_UI.py OcrResultDialog_UI.py SymbolAttrEditor_UI.py SymbolEditor_UI.py TrainingImageListDialog.py Configuration_UI.py Configuration_Area_UI.py ItemDataFormat_UI.py ItemDataExportDialog.py HMB_UI.py RecognitionDialog.py LineNoTracer.py ConnectAttr_UI.py ItemTreeWidget.py .\UI\DataTransfer_UI.py DataTransferDialog.py
2 2
TRANSLATIONS = translate/ko_kr.ts translate/ja_jp.ts
DTI_PID/DTI_PID/MainWindow.py
1279 1279
        for item in selected:
1280 1280
            item.setVisible(isChecked)
1281 1281

  
1282

  
1283 1282
    '''
1284 1283
        @brief  create a symbol
1285 1284
        @history    2018.05.02  Jeongwoo    Change return value of QSymbolEditorDialog (Single variable → Tuple)
DTI_PID/DTI_PID/MainWindow_UI.py
642 642
        self.actionSpecialItemTypes.setToolTip(_translate("MainWindow", "Special Item Types"))
643 643
        self.actionDataTransfer.setText(_translate("MainWindow", "DataTransfer"))
644 644
        self.actionDataTransfer.setToolTip(_translate("MainWindow", "Data Transfer"))
645
        self.actionDataTransfer.setShortcut(_translate("MainWindow", "Ctrl+T, Ctrl+D"))
645 646
        self.actionOPCRelation.setText(_translate("MainWindow", "OPCRelation"))
646 647
        self.actionOPCRelation.setToolTip(_translate("MainWindow", "OPC Relation"))
647 648
        self.actionHelp.setText(_translate("MainWindow", "Help"))
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql
3462 3462
    Area                 TEXT,
3463 3463
    Value                TEXT,
3464 3464
    Owner                TEXT,
3465
	[From] 				[varchar](37) NULL,
3466
	[To] 				[varchar](37) NULL,
3465 3467
    Connected            TEXT,
3466 3468
    [Supplied By]        TEXT,
3467 3469
    SpecialItemTypes_UID VARCHAR (37) REFERENCES SpecialItemTypes (UID),
3468
    OriginIndex          INTEGER      NOT NULL
3469
                                      DEFAULT (0) 
3470
	[Freeze] [int] NULL,
3471
    OriginIndex          INTEGER      NOT NULL DEFAULT (0) 
3470 3472
);
3471 3473

  
3472 3474

  
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
694 694
            sql = 'insert into TitleBlockValues({}) values({})'.format(','.join(cols), ','.join(values))
695 695
            if params: res.append((sql, tuple(params)))
696 696

  
697
        return res
697
        return res 
698 698

  
699 699
'''
700 700
    @brief      The class transfer pyqtSignal Event. Cause Subclass of QGraphicsRectItem can't use pyqtSignal
DTI_PID/DTI_PID/UI/DataTransfer.ui
54 54
           <height>0</height>
55 55
          </size>
56 56
         </property>
57
         <property name="sortingEnabled">
58
          <bool>true</bool>
59
         </property>
57 60
         <attribute name="headerVisible">
58 61
          <bool>false</bool>
59 62
         </attribute>
DTI_PID/DTI_PID/UI/DataTransfer_UI.py
80 80
        _translate = QtCore.QCoreApplication.translate
81 81
        DataTransferDialog.setWindowTitle(_translate("DataTransferDialog", "Data Transfer"))
82 82
        self.groupBox.setTitle(_translate("DataTransferDialog", "Drawings"))
83
        self.treeWidgetDrawingList.setSortingEnabled(True)
83 84
        self.groupBox_2.setTitle(_translate("DataTransferDialog", "MSSQL"))
84 85
        self.label.setText(_translate("DataTransferDialog", "Server"))
85 86
        self.label_2.setText(_translate("DataTransferDialog", "User"))
DTI_PID/DTI_PID/UI/MainWindow.ui
1078 1078
   <property name="toolTip">
1079 1079
    <string>Data Transfer</string>
1080 1080
   </property>
1081
   <property name="shortcut">
1082
    <string>Ctrl+T, Ctrl+D</string>
1083
   </property>
1081 1084
  </action>
1082 1085
  <action name="actionOPCRelation">
1083 1086
   <property name="text">
DTI_PID/DTI_PID/americano.qss
466 466
    background-color: #323232;
467 467
    border: 1px solid #b1b1b1;
468 468
    border-radius: 1px;
469
    width: 7px;
470
    height: 7px;
471
    margin: 0px 5px 0 5px;
469
}
470

  
471
QTreeView::indicator:unchecked
472
{
473
    background-color: lightgray;
472 474
}
DTI_PID/DTI_PID/translate/ja_jp.ts
402 402
        <translation type="unfinished"></translation>
403 403
    </message>
404 404
    <message>
405
        <location filename="../UI/DataTransfer_UI.py" line="83"/>
405
        <location filename="../UI/DataTransfer_UI.py" line="84"/>
406 406
        <source>MSSQL</source>
407 407
        <translation type="unfinished"></translation>
408 408
    </message>
409 409
    <message>
410
        <location filename="../UI/DataTransfer_UI.py" line="84"/>
410
        <location filename="../UI/DataTransfer_UI.py" line="85"/>
411 411
        <source>Server</source>
412 412
        <translation type="unfinished"></translation>
413 413
    </message>
414 414
    <message>
415
        <location filename="../UI/DataTransfer_UI.py" line="85"/>
415
        <location filename="../UI/DataTransfer_UI.py" line="86"/>
416 416
        <source>User</source>
417 417
        <translation type="unfinished"></translation>
418 418
    </message>
419 419
    <message>
420
        <location filename="../UI/DataTransfer_UI.py" line="86"/>
420
        <location filename="../UI/DataTransfer_UI.py" line="87"/>
421 421
        <source>Password</source>
422 422
        <translation type="unfinished"></translation>
423 423
    </message>
424 424
    <message>
425
        <location filename="../UI/DataTransfer_UI.py" line="87"/>
425
        <location filename="../UI/DataTransfer_UI.py" line="88"/>
426 426
        <source>Test Connection</source>
427 427
        <translation type="unfinished"></translation>
428 428
    </message>
......
1284 1284
        <translation type="unfinished"></translation>
1285 1285
    </message>
1286 1286
    <message>
1287
        <location filename="../MainWindow.py" line="1162"/>
1287
        <location filename="../MainWindow.py" line="1163"/>
1288 1288
        <source>Reading file...</source>
1289 1289
        <translation type="unfinished"></translation>
1290 1290
    </message>
......
1396 1396
    </message>
1397 1397
</context>
1398 1398
<context>
1399
    <name>QDataTransferDialog</name>
1400
    <message>
1401
        <location filename="../DataTransferDialog.py" line="28"/>
1402
        <source>Name</source>
1403
        <translation type="unfinished"></translation>
1404
    </message>
1405
    <message>
1406
        <location filename="../DataTransferDialog.py" line="28"/>
1407
        <source>DateTime</source>
1408
        <translation type="unfinished"></translation>
1409
    </message>
1410
    <message>
1411
        <location filename="../DataTransferDialog.py" line="66"/>
1412
        <source>P&amp;ID Drawings</source>
1413
        <translation type="unfinished"></translation>
1414
    </message>
1415
    <message>
1416
        <location filename="../DataTransferDialog.py" line="90"/>
1417
        <source>Information</source>
1418
        <translation type="unfinished"></translation>
1419
    </message>
1420
    <message>
1421
        <location filename="../DataTransferDialog.py" line="90"/>
1422
        <source>Test connection is success</source>
1423
        <translation type="unfinished"></translation>
1424
    </message>
1425
    <message>
1426
        <location filename="../DataTransferDialog.py" line="94"/>
1427
        <source>Error</source>
1428
        <translation type="unfinished"></translation>
1429
    </message>
1430
</context>
1431
<context>
1399 1432
    <name>QItemDataExportDialog</name>
1400 1433
    <message>
1401 1434
        <location filename="../ItemDataExportDialog.py" line="172"/>
DTI_PID/DTI_PID/translate/ko_kr.ts
468 468
        <translation type="unfinished">도면</translation>
469 469
    </message>
470 470
    <message>
471
        <location filename="../UI/DataTransfer_UI.py" line="83"/>
471
        <location filename="../UI/DataTransfer_UI.py" line="84"/>
472 472
        <source>MSSQL</source>
473 473
        <translation type="unfinished"></translation>
474 474
    </message>
475 475
    <message>
476
        <location filename="../UI/DataTransfer_UI.py" line="84"/>
476
        <location filename="../UI/DataTransfer_UI.py" line="85"/>
477 477
        <source>Server</source>
478 478
        <translation type="unfinished">서버</translation>
479 479
    </message>
480 480
    <message>
481
        <location filename="../UI/DataTransfer_UI.py" line="85"/>
481
        <location filename="../UI/DataTransfer_UI.py" line="86"/>
482 482
        <source>User</source>
483 483
        <translation type="unfinished">사용자</translation>
484 484
    </message>
485 485
    <message>
486
        <location filename="../UI/DataTransfer_UI.py" line="86"/>
486
        <location filename="../UI/DataTransfer_UI.py" line="87"/>
487 487
        <source>Password</source>
488 488
        <translation type="unfinished">암호</translation>
489 489
    </message>
490 490
    <message>
491
        <location filename="../UI/DataTransfer_UI.py" line="87"/>
491
        <location filename="../UI/DataTransfer_UI.py" line="88"/>
492 492
        <source>Test Connection</source>
493 493
        <translation type="unfinished">연결 확인</translation>
494 494
    </message>
......
1112 1112
        <translation type="unfinished">취소</translation>
1113 1113
    </message>
1114 1114
    <message>
1115
        <location filename="../MainWindow.py" line="1162"/>
1115
        <location filename="../MainWindow.py" line="1163"/>
1116 1116
        <source>Reading file...</source>
1117 1117
        <translation type="unfinished">파일을 읽는 중...</translation>
1118 1118
    </message>
......
1229 1229
    <message>
1230 1230
        <location filename="../MainWindow_UI.py" line="583"/>
1231 1231
        <source>Inconsistency</source>
1232
        <translation type="unfinished"></translation>
1232
        <translation type="unfinished">불일치</translation>
1233 1233
    </message>
1234 1234
    <message>
1235 1235
        <location filename="../MainWindow_UI.py" line="586"/>
......
1344 1344
    <message>
1345 1345
        <location filename="../MainWindow_UI.py" line="634"/>
1346 1346
        <source>Inconsistency (6)</source>
1347
        <translation type="unfinished"></translation>
1347
        <translation type="unfinished">불일치(6)</translation>
1348 1348
    </message>
1349 1349
    <message>
1350 1350
        <location filename="../MainWindow_UI.py" line="635"/>
......
1520 1520
    </message>
1521 1521
</context>
1522 1522
<context>
1523
    <name>QDataTransferDialog</name>
1524
    <message>
1525
        <location filename="../DataTransferDialog.py" line="28"/>
1526
        <source>Name</source>
1527
        <translation type="unfinished">이름</translation>
1528
    </message>
1529
    <message>
1530
        <location filename="../DataTransferDialog.py" line="28"/>
1531
        <source>DateTime</source>
1532
        <translation type="unfinished">날짜</translation>
1533
    </message>
1534
    <message>
1535
        <location filename="../DataTransferDialog.py" line="66"/>
1536
        <source>P&amp;ID Drawings</source>
1537
        <translation type="unfinished">P&amp;ID 도면</translation>
1538
    </message>
1539
    <message>
1540
        <location filename="../DataTransferDialog.py" line="90"/>
1541
        <source>Information</source>
1542
        <translation type="unfinished">알림</translation>
1543
    </message>
1544
    <message>
1545
        <location filename="../DataTransferDialog.py" line="90"/>
1546
        <source>Test connection is success</source>
1547
        <translation type="unfinished">연결 성공</translation>
1548
    </message>
1549
    <message>
1550
        <location filename="../DataTransferDialog.py" line="94"/>
1551
        <source>Error</source>
1552
        <translation type="unfinished">에러</translation>
1553
    </message>
1554
</context>
1555
<context>
1523 1556
    <name>QItemDataExportDialog</name>
1524 1557
    <message>
1525 1558
        <location filename="../ItemDataExportDialog.py" line="158"/>
......
1682 1715
    <message>
1683 1716
        <location filename="../SymbolPropertyTableWidget.py" line="34"/>
1684 1717
        <source>Name</source>
1685
        <translation type="unfinished"></translation>
1718
        <translation type="unfinished">이름</translation>
1686 1719
    </message>
1687 1720
    <message>
1688 1721
        <location filename="../SymbolPropertyTableWidget.py" line="34"/>
1689 1722
        <source>Value</source>
1690
        <translation type="unfinished"></translation>
1723
        <translation type="unfinished"></translation>
1691 1724
    </message>
1692 1725
</context>
1693 1726
<context>

내보내기 Unified diff

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