개정판 0aebcc1f
Feature: ID2 연계 기능 추가
Change-Id: I6ccc1b6d20d018aeaacf629da4d87a310adecf73
ID2.Manager/ID2.Manager/App.config | ||
---|---|---|
4 | 4 |
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > |
5 | 5 |
<section name="ID2.Manager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> |
6 | 6 |
</sectionGroup> |
7 |
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > |
|
8 |
<section name="ID2.Manager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
|
9 |
</sectionGroup> |
|
7 | 10 |
</configSections> |
8 | 11 |
<startup> |
9 | 12 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> |
... | ... | |
22 | 25 |
</setting> |
23 | 26 |
</ID2.Manager.Properties.Settings> |
24 | 27 |
</userSettings> |
28 |
<applicationSettings> |
|
29 |
<ID2.Manager.Properties.Settings> |
|
30 |
<setting name="ID2Port" serializeAs="String"> |
|
31 |
<value>2549</value> |
|
32 |
</setting> |
|
33 |
</ID2.Manager.Properties.Settings> |
|
34 |
</applicationSettings> |
|
25 | 35 |
</configuration> |
ID2.Manager/ID2.Manager/Classes/ID2Helper.cs | ||
---|---|---|
1 |
using Newtonsoft.Json; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Diagnostics; |
|
5 |
using System.Linq; |
|
6 |
using System.Net.Sockets; |
|
7 |
using System.Reflection; |
|
8 |
using System.Text; |
|
9 |
using System.Threading.Tasks; |
|
10 |
|
|
11 |
namespace ID2.Manager.Classes |
|
12 |
{ |
|
13 |
public static class ID2Helper |
|
14 |
{ |
|
15 |
/// <summary> |
|
16 |
/// 주어진 DrawingName의 도면을 ID2에서 엽니다. |
|
17 |
/// </summary> |
|
18 |
/// <param name="DrawingName"></param> |
|
19 |
/// <param name="uids"></param> |
|
20 |
public static void OpenPID(string DrawingName, string uids, int port) |
|
21 |
{ |
|
22 |
using (TcpClient tcpClient = new TcpClient()) |
|
23 |
{ |
|
24 |
try |
|
25 |
{ |
|
26 |
tcpClient.SendTimeout = 500; |
|
27 |
tcpClient.Connect("localhost", port); |
|
28 |
|
|
29 |
var _params = new Dictionary<string, string>() |
|
30 |
{ |
|
31 |
{ "request", "open drawing" }, |
|
32 |
{ "drawing", DrawingName }, |
|
33 |
{ "oid", uids } |
|
34 |
}; |
|
35 |
string json = JsonConvert.SerializeObject(_params, Formatting.Indented); |
|
36 |
|
|
37 |
byte[] message = Encoding.UTF8.GetBytes(json); |
|
38 |
|
|
39 |
using (NetworkStream networkStream = tcpClient.GetStream()) |
|
40 |
{ |
|
41 |
networkStream.Write(message, 0, message.Length); |
|
42 |
|
|
43 |
byte[] outbuf = new byte[1024]; |
|
44 |
int nbytes = networkStream.Read(outbuf, 0, outbuf.Length); |
|
45 |
string output = Encoding.UTF8.GetString(outbuf, 4, nbytes - 5); |
|
46 |
var result = JsonConvert.DeserializeObject<Dictionary<string, string>>(output); |
|
47 |
} |
|
48 |
} |
|
49 |
catch (Exception ex) |
|
50 |
{ |
|
51 |
throw ex; |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
} |
|
56 |
} |
ID2.Manager/ID2.Manager/ID2.Manager.csproj | ||
---|---|---|
68 | 68 |
</ItemGroup> |
69 | 69 |
<ItemGroup> |
70 | 70 |
<Compile Include="Classes\BaseWorker.cs" /> |
71 |
<Compile Include="Classes\ID2Helper.cs" /> |
|
71 | 72 |
<Compile Include="Classes\MarkusUriCreate.cs" /> |
72 | 73 |
<Compile Include="Classes\OpenProperties.cs" /> |
73 | 74 |
<Compile Include="Controls\AutoCADViewer.cs"> |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
186 | 186 |
switch (e.Column.Name) |
187 | 187 |
{ |
188 | 188 |
case "AutoCADLink": |
189 |
Controls.AutoCADViewer viewer = null; |
|
190 |
foreach (var control in this.tableLayoutPanelRight.Controls) |
|
191 | 189 |
{ |
192 |
if (control is Controls.AutoCADViewer _viewer) |
|
190 |
Controls.AutoCADViewer viewer = null; |
|
191 |
foreach (var control in this.tableLayoutPanelRight.Controls) |
|
193 | 192 |
{ |
194 |
viewer = _viewer; |
|
195 |
break; |
|
193 |
if (control is Controls.AutoCADViewer _viewer) |
|
194 |
{ |
|
195 |
viewer = _viewer; |
|
196 |
break; |
|
197 |
} |
|
196 | 198 |
} |
197 |
} |
|
198 | 199 |
|
199 |
if (viewer == null) |
|
200 |
{ |
|
201 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
|
202 |
this.tableLayoutPanelRight.Controls.Add(viewer); |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
viewer.Visible = true; |
|
200 |
if (viewer == null) |
|
201 |
{ |
|
202 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
|
203 |
this.tableLayoutPanelRight.Controls.Add(viewer); |
|
204 |
} |
|
205 |
else |
|
206 |
{ |
|
207 |
viewer.Visible = true; |
|
208 |
} |
|
209 |
|
|
210 |
if (e.Row.DataBoundItem is Documents doc) |
|
211 |
{ |
|
212 |
int d = 1; |
|
213 |
} |
|
207 | 214 |
} |
208 | 215 |
break; |
209 | 216 |
case "PDFLink": |
210 | 217 |
MessageBox.Show($"{e.Column.Name} 실행"); |
211 | 218 |
break; |
212 | 219 |
case "MarkupLink": |
213 |
if (e.Row.DataBoundItem is Documents doc) |
|
214 | 220 |
{ |
215 |
if (!string.IsNullOrWhiteSpace(doc.Place) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(doc.PersonInCharge))
|
|
221 |
if (e.Row.DataBoundItem is Documents doc)
|
|
216 | 222 |
{ |
217 |
bool result = MarkusHelper.Start(doc.Place, doc.DocumentNo, doc.PersonInCharge); |
|
223 |
if (!string.IsNullOrWhiteSpace(doc.Place) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(doc.PersonInCharge)) |
|
224 |
{ |
|
225 |
bool result = MarkusHelper.Start(doc.Place, doc.DocumentNo, doc.PersonInCharge); |
|
226 |
} |
|
218 | 227 |
} |
219 | 228 |
} |
220 |
|
|
221 |
//MessageBox.Show($"{e.Column.Name} 실행"); |
|
222 | 229 |
break; |
223 | 230 |
case "AVEVALink": |
224 | 231 |
case "AVEVAConnection": |
... | ... | |
234 | 241 |
case "FrCapturePath": |
235 | 242 |
break; |
236 | 243 |
case "ID2Connection": |
237 |
MessageBox.Show($"{e.Column.Name} 실행"); |
|
244 |
try |
|
245 |
{ |
|
246 |
if (e.Row.DataBoundItem is Documents doc) |
|
247 |
{ |
|
248 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
|
249 |
} |
|
250 |
} |
|
251 |
catch (Exception ex) |
|
252 |
{ |
|
253 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
|
254 |
} |
|
238 | 255 |
break; |
239 | 256 |
} |
240 | 257 |
} |
ID2.Manager/ID2.Manager/Properties/Settings.Designer.cs | ||
---|---|---|
12 | 12 |
|
13 | 13 |
|
14 | 14 |
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
15 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
|
15 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
|
|
16 | 16 |
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { |
17 | 17 |
|
18 | 18 |
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
... | ... | |
47 | 47 |
this["UserInfo"] = value; |
48 | 48 |
} |
49 | 49 |
} |
50 |
|
|
51 |
[global::System.Configuration.ApplicationScopedSettingAttribute()] |
|
52 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
53 |
[global::System.Configuration.DefaultSettingValueAttribute("2549")] |
|
54 |
public int ID2Port { |
|
55 |
get { |
|
56 |
return ((int)(this["ID2Port"])); |
|
57 |
} |
|
58 |
} |
|
50 | 59 |
} |
51 | 60 |
} |
ID2.Manager/ID2.Manager/Properties/Settings.settings | ||
---|---|---|
8 | 8 |
<Setting Name="UserInfo" Type="System.String" Scope="User"> |
9 | 9 |
<Value Profile="(Default)" /> |
10 | 10 |
</Setting> |
11 |
<Setting Name="ID2Port" Type="System.Int32" Scope="Application"> |
|
12 |
<Value Profile="(Default)">2549</Value> |
|
13 |
</Setting> |
|
11 | 14 |
</Settings> |
12 | 15 |
</SettingsFile> |
내보내기 Unified diff