개정판 23684fe1
fix opc relation
Change-Id: Ifda48a04aff9c2089a836b801f276286edd6a754
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
3045 | 3045 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
3046 | 3046 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
3047 | 3047 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
3048 |
"(select stuff((select ',' + convert(NVARCHAR(10),[index]) from [Points] where Connected = a.UID for XML PAth('')),1,1,'')) as [Index]," \
|
|
3048 |
"(select stuff((select ',' + convert(NVARCHAR(10),[index]) from [Points] where Connected = a.UID for XML PAth('')),1,1,'')) as [Count]," \
|
|
3049 | 3049 |
"UID as OPC from Components a " \ |
3050 | 3050 |
"where Symbol_UID in (select UID from Symbol where SymbolType_UID in " \ |
3051 | 3051 |
"(select UID from SymbolType where Type='Instrument OPC''s' or Type='Piping OPC''s'))" |
... | ... | |
3053 | 3053 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
3054 | 3054 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
3055 | 3055 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
3056 |
"(select stuff((select ',' + convert(NVARCHAR(10),[index]) from [Points] where Connected = a.UID for XML PAth('')),1,1,'')) as [Index]," \
|
|
3056 |
"(select stuff((select ',' + convert(NVARCHAR(10),[index]) from [Points] where Connected = a.UID for XML PAth('')),1,1,'')) as [Count]," \
|
|
3057 | 3057 |
"UID as OPC from Components a " \ |
3058 | 3058 |
"where Symbol_UID in (" + target + ")" |
3059 | 3059 |
''' |
... | ... | |
3061 | 3061 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
3062 | 3062 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
3063 | 3063 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
3064 |
"(select Count(1) from [Points] where Connected = a.UID) as [Index]," \ |
|
3064 |
"(select Count(1) from [Points] where Connected = a.UID) as [Count]," \ |
|
3065 |
"(select [Index] from [PipeRunItems] where Components_UID = a.UID) as [Index]," \ |
|
3065 | 3066 |
"UID as OPC from Components a " \ |
3066 | 3067 |
"where Symbol_UID in (select UID from Symbol where SymbolType_UID in " \ |
3067 | 3068 |
"(select UID from SymbolType where Type='Instrument OPC''s' or Type='Piping OPC''s'))" |
... | ... | |
3069 | 3070 |
sql = "select (select Name from Drawings where UID=a.Drawings_UID) as Drawing," \ |
3070 | 3071 |
"(select Value from Components where UID=a.Owner) as [Line No]," \ |
3071 | 3072 |
"(select Name from Symbol where a.Symbol_UID=UID) as Symbol," \ |
3072 |
"(select Count(1) from [Points] where Connected = a.UID) as [Index]," \ |
|
3073 |
"(select Count(1) from [Points] where Connected = a.UID) as [Count]," \ |
|
3074 |
"(select [Index] from [PipeRunItems] where Components_UID = a.UID) as [Index]," \ |
|
3073 | 3075 |
"UID as OPC from Components a " \ |
3074 | 3076 |
"where Symbol_UID in (" + target + ")" |
3075 | 3077 |
|
... | ... | |
3080 | 3082 |
opcs = [] |
3081 | 3083 |
if self.project.database.db_type == 'SQLite': |
3082 | 3084 |
for row in rows: |
3083 |
opcs.append({ "Drawing":row["Drawing"], "Line No":row["Line No"], "Symbol":row["Symbol"], "Index":row["Index"], "OPC":row["OPC"] }) |
|
3085 |
count = str(len(row["Count"].split(','))) |
|
3086 |
opcs.append({ "Drawing":row["Drawing"], "Line No":row["Line No"], "Symbol":row["Symbol"], "Count":count, "OPC":row["OPC"], "Index": row["Index"]}) |
|
3084 | 3087 |
else: |
3085 | 3088 |
opcs = rows |
3086 | 3089 |
|
DTI_PID/DTI_PID/OPCRelationDialog.py | ||
---|---|---|
61 | 61 |
self.ui.tableWidgetSource.setItem(row, 0, item) |
62 | 62 |
item = QTableWidgetItem(opc['Line No']) |
63 | 63 |
item.setFlags(Qt.ItemIsEnabled) |
64 |
item.tag = opc['Index']
|
|
64 |
item.tag = 0 if opc['Index'] == '0' else 1 # 0 : start with opc, 1 : end with opc
|
|
65 | 65 |
self.ui.tableWidgetSource.setItem(row, 1, item) |
66 | 66 |
item = QTableWidgetItem(opc['Symbol']) |
67 | 67 |
item.setFlags(Qt.ItemIsEnabled) |
... | ... | |
81 | 81 |
item.setFlags(Qt.ItemIsEnabled) |
82 | 82 |
self.ui.tableWidgetSource.setItem(row, 6, item) |
83 | 83 |
|
84 |
if opc['Index'] and opc['Index'] != 1:
|
|
84 |
if opc['Count'] and opc['Count'] != 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