개정판 b7a29053
dev issue #498 : OPC Attribute 처리
Change-Id: I275fe7dac7a400aed746dfa1d1a4d28d0ae8ff68
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
3462 | 3462 |
} |
3463 | 3463 |
} |
3464 | 3464 |
_Attribute.set_Value(item.VALUE); |
3465 |
// OPC 일경우 Attribute 저장 |
|
3466 |
if (targetItem.GetType() == typeof(Symbol)) |
|
3467 |
{ |
|
3468 |
Symbol symbol = targetItem as Symbol; |
|
3469 |
if (symbol.TYPE == "Piping OPC's" || symbol.TYPE == "Instrument OPC's") |
|
3470 |
symbol.SPPID.Attributes.Add(new string[] { mapping.SPPIDATTRIBUTENAME, item.VALUE }); |
|
3471 |
} |
|
3465 | 3472 |
} |
3466 |
|
|
3467 | 3473 |
} |
3468 | 3474 |
} |
3469 | 3475 |
_LMModelItem.Commit(); |
DTI_PID/SPPIDConverter/BaseModel/SPPID/SPPIDSymbolInfo.cs | ||
---|---|---|
17 | 17 |
public bool IsCorrectionX { get; set; } |
18 | 18 |
public bool IsCorrectionY { get; set; } |
19 | 19 |
|
20 |
private List<string[]> _Attributes = new List<string[]>(); |
|
21 |
|
|
20 | 22 |
public List<Symbol> CorrectionX_GroupSymbols { get; set; } |
21 | 23 |
public List<Symbol> CorrectionY_GroupSymbols { get; set; } |
22 | 24 |
|
... | ... | |
27 | 29 |
public double SPPID_Min_Y { get; set; } |
28 | 30 |
public double SPPID_Max_X { get; set; } |
29 | 31 |
public double SPPID_Max_Y { get; set; } |
32 |
public List<string[]> Attributes { get => _Attributes; set => _Attributes = value; } |
|
30 | 33 |
} |
31 | 34 |
} |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
143 | 143 |
string fromOPCModelId = fromOPCInfoRow["SPPID_OPC_MODELITEM_ID"].ToString(); |
144 | 144 |
string toOPCModelId = toOPCInfoRow["SPPID_OPC_MODELITEM_ID"].ToString(); |
145 | 145 |
string toDrawingName = toDrawing[0]["DRAWINGNAME"].ToString(); |
146 |
AutoModeling_OPC opc = new AutoModeling_OPC(dApplication, application, fromOPCModelId, toOPCModelId, toDrawingName); |
|
146 |
List<string[]> toOPCAttributes = JsonConvert.DeserializeObject<List<string[]>>(toOPCInfoRow["ATTRIBUTYES"].ToString()); |
|
147 |
AutoModeling_OPC opc = new AutoModeling_OPC(dApplication, application, fromOPCModelId, toOPCModelId, toDrawingName, toOPCAttributes); |
|
147 | 148 |
if (opc.Run()) |
148 | 149 |
{ |
149 | 150 |
fromOPCInfoRow["PAIRED"] = true; |
DTI_PID/SPPIDConverter/DB/Project_DB.cs | ||
---|---|---|
226 | 226 |
} |
227 | 227 |
if (dt.Select(string.Format("NAME = '{0}'", SPPID_OPC_INFO)).Length == 0) |
228 | 228 |
{ |
229 |
cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_OPC_UID TEXT PRIMARY KEY, SPPID_OPC_MODELITEM_ID TEXT, ID2_DRAWING_UID, PAIRED BOOL)", SPPID_OPC_INFO); |
|
229 |
cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_OPC_UID TEXT PRIMARY KEY, SPPID_OPC_MODELITEM_ID TEXT, ID2_DRAWING_UID TEXT, ATTRIBUTES TEXT, PAIRED BOOL)", SPPID_OPC_INFO);
|
|
230 | 230 |
cmd.ExecuteNonQuery(); |
231 | 231 |
} |
232 | 232 |
} |
... | ... | |
823 | 823 |
{ |
824 | 824 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
825 | 825 |
{ |
826 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (ID2_OPC_UID, SPPID_OPC_MODELITEM_ID, ID2_DRAWING_UID, PAIRED) VALUES (@ID2_OPC_UID, @SPPID_OPC_MODELITEM_ID, @ID2_DRAWING_UID, @PAIRED)", SPPID_OPC_INFO);
|
|
826 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (ID2_OPC_UID, SPPID_OPC_MODELITEM_ID, ID2_DRAWING_UID, ATTRIBUTES, PAIRED) VALUES (@ID2_OPC_UID, @SPPID_OPC_MODELITEM_ID, @ID2_DRAWING_UID, @ATTRIBUTES, @PAIRED)", SPPID_OPC_INFO);
|
|
827 | 827 |
cmd.Parameters.AddWithValue("@ID2_OPC_UID", item.UID); |
828 | 828 |
cmd.Parameters.AddWithValue("@SPPID_OPC_MODELITEM_ID", item.SPPID.ModelItemID); |
829 | 829 |
cmd.Parameters.AddWithValue("@ID2_DRAWING_UID", document.UID); |
830 |
cmd.Parameters.AddWithValue("@ATTRIBUTES", JsonConvert.SerializeObject(item.SPPID.Attributes)); |
|
830 | 831 |
cmd.Parameters.AddWithValue("@PAIRED", false); |
831 | 832 |
cmd.ExecuteNonQuery(); |
832 | 833 |
} |
DTI_PID/SPPIDConverter/OPC/AutoModeling_OPC.cs | ||
---|---|---|
33 | 33 |
string fromOPCModelId; |
34 | 34 |
string toOPCModelId; |
35 | 35 |
string toDrawingName; |
36 |
List<string[]> toOPCAttributes; |
|
36 | 37 |
|
37 |
public AutoModeling_OPC(dynamic application, Ingr.RAD2D.Application radApp, string fromOPCModelId, string toOPCModelId, string toDrawingName) |
|
38 |
public AutoModeling_OPC(dynamic application, Ingr.RAD2D.Application radApp, string fromOPCModelId, string toOPCModelId, string toDrawingName, List<string[]> toOPCAttributes)
|
|
38 | 39 |
{ |
39 | 40 |
this.application = application; |
40 | 41 |
this.radApp = radApp; |
41 | 42 |
this.fromOPCModelId = fromOPCModelId; |
42 | 43 |
this.toOPCModelId = toOPCModelId; |
43 | 44 |
this.toDrawingName = toDrawingName; |
45 |
this.toOPCAttributes = toOPCAttributes; |
|
44 | 46 |
} |
45 | 47 |
|
46 | 48 |
public bool Run() |
... | ... | |
106 | 108 |
} |
107 | 109 |
|
108 | 110 |
if (newOPC != null) |
111 |
{ |
|
109 | 112 |
result = true; |
113 |
foreach (var attribute in toOPCAttributes) |
|
114 |
{ |
|
115 |
LMAAttribute _attribute = newOPC.Attributes[attribute[0]]; |
|
116 |
if (_attribute != null) |
|
117 |
_attribute.set_Value(attribute[1]); |
|
118 |
} |
|
119 |
newOPC.Commit(); |
|
120 |
} |
|
110 | 121 |
|
111 | 122 |
ReleaseCOMObjects(newOPC); |
112 | 123 |
newOPC = null; |
내보내기 Unified diff