프로젝트

일반

사용자정보

개정판 64e17792

ID64e17792badfc9d56a388e17484291e0c89fecc4
상위 217af533
하위 9c68ce79

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

issue #49: custom code table function testing and grouping remain

Change-Id: I6a7576cacc49d41cb5b2bb2a2ba8df0e966bf763

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2371 2371
        @date       2018.07.10
2372 2372
    '''
2373 2373

  
2374
    def getCodeTable(self, property, forCheckLineNumber=False, symbol_attribute_uid=None, custom_table_uid=None):
2374
    def getCodeTable(self, property, forCheckLineNumber=False, symbol_attribute_uid=None, custom_table_uid=None, custom=False):
2375 2375
        result = []
2376 2376
        conn = self.project.database.connect()
2377 2377
        with conn:
......
2394 2394
                    rows = cursor.fetchall()
2395 2395
                    if property.upper() in [name[0].upper() for name in rows]:
2396 2396
                    """
2397
                    if not symbol_attribute_uid and not custom_table_uid:
2397
                    if not symbol_attribute_uid and not custom_table_uid and not custom:
2398 2398
                        sql = 'select uid, code, description, Allowables from [{}] order by code DESC'.format(property)
2399 2399
                    elif symbol_attribute_uid and not custom_table_uid:
2400 2400
                        sql = "select uid, code, description, Allowables from [{}] where SymbolAttribute_UID='{}' order by code DESC".format(property, symbol_attribute_uid)
2401 2401
                    elif not symbol_attribute_uid and custom_table_uid:
2402 2402
                        sql = "select uid, code, description, Allowables from [{}] where Table_UID='{}' order by code DESC".format(property, custom_table_uid)
2403
                    elif custom:
2404
                        sql = "select uid, code, description, Allowables from CustomCodes \
2405
                                    where table_uid = (select uid from CustomTables where upper(name) like upper('{}'))".format(property)
2403 2406
                    cursor.execute(sql)
2404 2407
                    rows = cursor.fetchall()
2405 2408
                    for row in rows:
DTI_PID/DTI_PID/CodeTables.py
10 10
    """ This is code table class """
11 11

  
12 12
    TABLES = {}
13
    DEFAULTS = ['NOMINALDIAMETER', 'FLUIDCODE', 'PIPINGMATERIALSCLASS', 'UNITNUMBER', 'INSULATIONPURPOSE', 'PNIDNUMBER', \
14
                    'VALVEOPERCODES', 'RESERVEDWORDS', 'DICTIONARY', 'EQPTAGNAMES']
13 15

  
14 16
    def __init__(self, name, values):
15 17
        self.name = name
......
66 68
        from NominalPipeSize import NominalPipeSizeTable
67 69

  
68 70
        _table_name = table_name.upper().replace(' ', '')
69
        if symbol_attribute_uid is None and _table_name == 'NOMINALDIAMETER':
71
        if symbol_attribute_uid is None and custom_table_uid is None and _table_name == 'NOMINALDIAMETER':
72
            # nominaldiameter
70 73
            return NominalPipeSizeTable.instance()
71
        elif symbol_attribute_uid is None and custom_table_uid is None and _table_name not in CodeTable.TABLES:
74

  
75
        elif symbol_attribute_uid is None and custom_table_uid is None and _table_name not in CodeTable.TABLES and \
76
                    _table_name in CodeTable.DEFAULTS:
77
            # default code tables
72 78
            appDocData = AppDocData.instance()
73 79
            values = appDocData.getCodeTable(_table_name, False)
74 80
            CodeTable.TABLES[_table_name] = CodeTable(_table_name, values)
81

  
75 82
        elif _table_name == 'SYMBOLATTRIBUTECODETABLE' and symbol_attribute_uid:
83
            # symbol attribute code tables
76 84
            if symbol_attribute_uid in CodeTable.TABLES:
77 85
                return CodeTable.TABLES[symbol_attribute_uid]
78 86
            else:
......
80 88
                values = appDocData.getCodeTable(_table_name, False, symbol_attribute_uid=symbol_attribute_uid)
81 89
                CodeTable.TABLES[symbol_attribute_uid] = CodeTable(symbol_attribute_uid, values)
82 90
                return CodeTable.TABLES[symbol_attribute_uid]
91

  
83 92
        elif _table_name == 'CUSTOMCODES' and custom_table_uid:
93
            # custom code table setting
84 94
            if custom_table_uid in CodeTable.TABLES:
85 95
                return CodeTable.TABLES[custom_table_uid]
86 96
            else:
......
89 99
                CodeTable.TABLES[custom_table_uid] = CodeTable(custom_table_uid, values)
90 100
                return CodeTable.TABLES[custom_table_uid]
91 101

  
102
        elif _table_name not in CodeTable.TABLES:
103
            # custom code table using
104
            appDocData = AppDocData.instance()
105
            values = appDocData.getCodeTable(_table_name, False, custom=True)
106
            CodeTable.TABLES[_table_name] = CodeTable(custom_table_uid, values)
107
            return CodeTable.TABLES[_table_name]
108

  
92 109
        return CodeTable.TABLES[_table_name]
93 110

  
94 111
    @staticmethod

내보내기 Unified diff

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