개정판 c971ebe0
issue #49: import export test
Change-Id: Ie632659810c4d8ecefcaacf32999dd8ac7972358
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
2902 | 2902 |
@author kyouho |
2903 | 2903 |
@date 2018.07.12 |
2904 | 2904 |
''' |
2905 |
|
|
2906 | 2905 |
def saveCommonCodeData(self, tableName, datas): |
2907 | 2906 |
import uuid |
2908 | 2907 |
|
... | ... | |
2912 | 2911 |
# Get a cursor object |
2913 | 2912 |
cursor = conn.cursor() |
2914 | 2913 |
|
2914 |
sql = self.project.database.to_sql('delete from {}'.format(tableName)) |
|
2915 |
cursor.execute(sql) |
|
2916 |
|
|
2915 | 2917 |
for data in datas: |
2918 |
''' |
|
2916 | 2919 |
uid, code, description, allowables = data[0], data[1], data[2], data[3] |
2917 | 2920 |
if not uid: |
2918 | 2921 |
sql = self.project.database.to_sql( |
... | ... | |
2926 | 2929 |
"update {} SET CODE=?, DESCRIPTION=?, ALLOWABLES=? WHERE UID = ?".format(tableName)) |
2927 | 2930 |
param = (data[1], data[2], data[3], data[0]) |
2928 | 2931 |
cursor.execute(sql, param) |
2932 |
''' |
|
2933 |
if data[0]: |
|
2934 |
uid = data[0] |
|
2935 |
else: |
|
2936 |
uid = str(uuid.uuid4()) |
|
2937 |
sql = self.project.database.to_sql( |
|
2938 |
"insert into {}(UID, CODE, DESCRIPTION, ALLOWABLES) values(?, ?, ?, ?)".format(tableName)) |
|
2939 |
param = (uid, data[1], data[2], data[3]) |
|
2940 |
cursor.execute(sql, param) |
|
2929 | 2941 |
|
2930 | 2942 |
conn.commit() |
2931 | 2943 |
# Catch the exception |
DTI_PID/DTI_PID/CodeTableDialog.py | ||
---|---|---|
56 | 56 |
self.ui.tableWidgetValveOperCodes.setSortingEnabled(True) |
57 | 57 |
self.ui.tableWidgetEqpTagNames.setSortingEnabled(True) |
58 | 58 |
self.ui.tableWidgetReservedWords.setSortingEnabled(True) |
59 |
self.ui.tableWidgetDictionary.setSortingEnabled(True) |
|
59 | 60 |
|
60 | 61 |
# DB Table명 기준으로 작성 |
61 | 62 |
for table in QCodeTableDialog.CODE_TABLES: |
... | ... | |
535 | 536 |
|
536 | 537 |
if tabText != "NominalDiameter": |
537 | 538 |
item = table.item(row, 1) |
539 |
if not item: return |
|
538 | 540 |
code = item.text() |
539 | 541 |
if column == 1: |
540 | 542 |
result = self.isExistCode(table, code) |
... | ... | |
862 | 864 |
rowCount = table.rowCount() |
863 | 865 |
for row in range(rowCount): |
864 | 866 |
if table.isRowHidden(row): |
865 |
uid, code, description, allowables = '-1', table.item(row, 1).text(), '', table.item(row, 0).text() |
|
867 |
continue |
|
868 |
#uid, code, description, allowables = '-1', table.item(row, 1).text(), '', table.item(row, 0).text() |
|
866 | 869 |
elif table.item(row, 0): |
867 | 870 |
uid = table.item(row, 0).text() |
868 | 871 |
code = table.item(row, 1).text() |
내보내기 Unified diff