프로젝트

일반

사용자정보

개정판 18e758c8

ID18e758c882c37affea176f059f0fb2d69cf17cf1
상위 c3fff180
하위 c4ae884a, db9873a2

함의성이(가) 5년 이상 전에 추가함

issue #000: fix saving valve data into db

Change-Id: Ibb207c4cbb3207e4b977bab6ad4b7591557dd2b7

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2633 2633
            # Get a cursor object
2634 2634
            cursor = conn.cursor()
2635 2635

  
2636
            sql = 'select a.UID,a.ITEM_NO,a.PNID_NO,c.Attribute,b.Value from VALVE_DATA_LIST a left join Attributes b on a.uid=b.Components_UID ' \
2636
            sql = 'select a.UID,a.ITEM_NO,a.PNID_NO,a.MainSize,a.SubSize,c.Attribute,b.Value from VALVE_DATA_LIST a left join Attributes b on a.uid=b.Components_UID ' \
2637 2637
                  'left join SymbolAttribute c on b.SymbolAttribute_UID=c.UID'
2638 2638
            if docName is not None:
2639 2639
                sql += " where PNID_NO = '{}'".format(docName)
......
2643 2643
            for row in rows:
2644 2644
                matches = [res for res in result if res['UID'] == row[0]]
2645 2645
                if matches:
2646
                    matches[0][row[3]] = row[4]
2646
                    matches[0][row[5]] = row[6]
2647 2647
                else:
2648
                    data = {'UID':row[0], 'ITEM_NO':row[1], 'PNID_NO':row[2], 'SIZE':'', 'Sub Size':'', 'Main Size':''}
2649
                    data[row[3]] = row[4]
2648
                    data = {'UID':row[0], 'ITEM_NO':row[1], 'PNID_NO':row[2], 'MainSize':row[3], 'SubSize':row[4]}
2649
                    data[row[5]] = row[6]
2650 2650
                    result.append(data)
2651 2651

  
2652 2652
        # Catch the exception
DTI_PID/DTI_PID/Commands/SaveWorkCommand.py
31 31
        from EngineeringSpecBreakItem import QEngineeringSpecBreakItem
32 32
        from EngineeringVendorItem import QEngineeringVendorItem
33 33
        from SymbolSvgItem import SymbolSvgItem 
34
        from EngineeringReducerItem import QEngineeringReducerItem
34 35

  
35 36
        try:
36 37
            appDocData = AppDocData.instance()
......
44 45
                        if item.area == titleBlockProp[0]:
45 46
                            titleBlockItems.append(item)
46 47

  
47
            dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or\
48
            dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or type(item) is QEngineeringReducerItem or\
48 49
            type(item) is QEngineeringNoteItem or type(item) is SymbolSvgItem or type(item) is QEngineeringLineNoTextItem or type(item) is QEngineeringVendorItem] + titleBlockItems
49 50
            appDocData.saveToDatabase(dbItems)
50 51

  
DTI_PID/DTI_PID/ItemDataFormatDialog.py
418 418
            configs.append(Config(dbListOrderName[index], str(index), value))
419 419
            
420 420
            docData.saveConfigs(configs)
421
            docData.configTable = None
421 422

  
422 423
        reply = QMessageBox.information(self, self.tr('INFO'), self.tr('Save Success!.'), QMessageBox.Ok, QMessageBox.Cancel)
423 424
        if reply == QMessageBox.Ok:
DTI_PID/DTI_PID/MainWindow.py
47 47
from EngineeringErrorItem import QEngineeringErrorItem
48 48
from EngineeringVendorItem import QEngineeringVendorItem
49 49
from EngineeringEndBreakItem import QEngineeringEndBreakItem
50
from EngineeringReducerItem import QEngineeringReducerItem
50 51
from AppDocData import *
51 52
import SymbolTreeWidget, SymbolPropertyTableWidget
52 53
import SymbolEditorDialog
......
572 573
                        if item.area == titleBlockProp[0]:
573 574
                            titleBlockItems.append(item)
574 575

  
575
            dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or\
576
            dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or type(item) is QEngineeringReducerItem or\
576 577
            type(item) is QEngineeringNoteItem or type(item) is SymbolSvgItem or type(item) is QEngineeringLineNoTextItem or type(item) is QEngineeringVendorItem] + titleBlockItems
577 578
            appDocData.saveToDatabase(dbItems)
578 579
        except Exception as ex:
DTI_PID/DTI_PID/Shapes/EngineeringReducerItem.py
161 161
        res = []
162 162
        appDocData = AppDocData.instance()
163 163

  
164
        cols = ['UID', 'ITEM_NO', 'MainSize', 'SubSize', 'PNID_NO']
164
        cols = ['UID', 'ITEM_NO', 'PNID_NO', 'MainSize', 'SubSize']
165 165
        values = ['?','?','?', '?', '?']
166
        main_size = self.prop('MainSize')
167
        sub_size = self.prop('SubSize')
168
        param = [str(self.uid), self.name, main_size if main_size else '', sub_size if sub_size else '', appDocData.activeDrawing.name]
166
        main_size = self.prop('Main Size')
167
        sub_size = self.prop('Sub Size')
168
        param = [str(self.uid), self.name, appDocData.activeDrawing.name, main_size if main_size else '', sub_size if sub_size else '']
169 169
        sql = 'insert or replace into VALVE_DATA_LIST({}) values({})'.format(','.join(cols), ','.join(values))
170 170
        res.append((sql, tuple(param)))
171 171

  

내보내기 Unified diff

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