개정판 abc4250b
opc relation support sqlite, mssql both
Change-Id: Ie61fea8f7677440aa520c86192637c03acbf9418
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
3040 | 3040 |
# Get a cursor object |
3041 | 3041 |
cursor = conn.cursor() |
3042 | 3042 |
|
3043 |
''' |
|
3043 | 3044 |
if target == "ALL" or target == '': |
3044 | 3045 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
3045 | 3046 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
... | ... | |
3055 | 3056 |
"(select stuff((select ',' + convert(NVARCHAR(10),[index]) from [Points] where Connected = a.UID for XML PAth('')),1,1,'')) as [Index]," \ |
3056 | 3057 |
"UID as OPC from Components a " \ |
3057 | 3058 |
"where Symbol_UID in (" + target + ")" |
3059 |
''' |
|
3060 |
if target == "ALL" or target == '': |
|
3061 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
|
3062 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
|
3063 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
|
3064 |
"(select Count(1) from [Points] where Connected = a.UID) as [Index]," \ |
|
3065 |
"UID as OPC from Components a " \ |
|
3066 |
"where Symbol_UID in (select UID from Symbol where SymbolType_UID in " \ |
|
3067 |
"(select UID from SymbolType where Type='Instrument OPC''s' or Type='Piping OPC''s'))" |
|
3068 |
else: |
|
3069 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
|
3070 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
|
3071 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
|
3072 |
"(select Count(1) from [Points] where Connected = a.UID) as [Index]," \ |
|
3073 |
"UID as OPC from Components a " \ |
|
3074 |
"where Symbol_UID in (" + target + ")" |
|
3058 | 3075 |
|
3059 | 3076 |
cursor.execute(sql) |
3060 |
return cursor.fetchall() |
|
3077 |
|
|
3078 |
rows = cursor.fetchall() |
|
3079 |
|
|
3080 |
opcs = [] |
|
3081 |
if self.project.database.db_type == 'SQLite': |
|
3082 |
for row in rows: |
|
3083 |
opcs.append({ "Drawing":row["Drawing"], "Line No":row["Line No"], "Symbol":row["Symbol"], "Index":row["Index"], "OPC":row["OPC"] }) |
|
3084 |
else: |
|
3085 |
opcs = rows |
|
3086 |
|
|
3087 |
return opcs |
|
3061 | 3088 |
# Catch the exception |
3062 | 3089 |
except Exception as ex: |
3063 | 3090 |
from App import App |
DTI_PID/DTI_PID/OPCRelationDialog.py | ||
---|---|---|
81 | 81 |
item.setFlags(Qt.ItemIsEnabled) |
82 | 82 |
self.ui.tableWidgetSource.setItem(row, 6, item) |
83 | 83 |
|
84 |
if opc['Index'] and len(opc['Index'].split(',')) != 1:
|
|
84 |
if opc['Index'] and opc['Index'] != 1:
|
|
85 | 85 |
item.setText('Error, Please Check From OPC in Draiwng') |
86 | 86 |
item.setBackground(Qt.red) |
87 | 87 |
self.error = True |
내보내기 Unified diff